@lokascript/framework 2.3.1 → 2.4.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/api/index.js +29 -516
- package/dist/api/index.js.map +1 -1
- package/dist/core/index.js +20 -128
- package/dist/core/index.js.map +1 -1
- package/dist/core/pattern-matching/index.js +19 -12
- package/dist/core/pattern-matching/index.js.map +1 -1
- package/dist/core/tokenization/index.js.map +1 -1
- package/dist/core/types.d.ts +7 -354
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +21 -129
- package/dist/core/types.js.map +1 -1
- package/dist/generation/diagnostics.d.ts +5 -115
- package/dist/generation/diagnostics.d.ts.map +1 -1
- package/dist/generation/index.js +20 -77
- package/dist/generation/index.js.map +1 -1
- package/dist/index.cjs +189 -1458
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +108 -1347
- package/dist/index.js.map +1 -1
- package/dist/interfaces/value-extractor.d.ts +20 -0
- package/dist/interfaces/value-extractor.d.ts.map +1 -1
- package/dist/ir/explicit-parser.d.ts +2 -83
- package/dist/ir/explicit-parser.d.ts.map +1 -1
- package/dist/ir/explicit-renderer.d.ts +2 -31
- package/dist/ir/explicit-renderer.d.ts.map +1 -1
- package/dist/ir/index.js +89 -1260
- package/dist/ir/index.js.map +1 -1
- package/dist/ir/protocol-json.d.ts +2 -70
- package/dist/ir/protocol-json.d.ts.map +1 -1
- package/dist/ir/references.d.ts +2 -16
- package/dist/ir/references.d.ts.map +1 -1
- package/dist/ir/types.d.ts +2 -148
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/parsing/index.js +19 -12
- package/dist/parsing/index.js.map +1 -1
- package/dist/schema/command-schema.d.ts +3 -92
- package/dist/schema/command-schema.d.ts.map +1 -1
- package/dist/schema/index.js +3 -20
- package/dist/schema/index.js.map +1 -1
- package/dist/testing/index.js +1066 -712
- package/dist/testing/index.js.map +1 -1
- package/package.json +6 -2
- package/src/core/types.ts +71 -600
- package/src/generation/diagnostics.ts +12 -233
- package/src/interfaces/value-extractor.ts +32 -0
- package/src/ir/explicit-parser.ts +12 -792
- package/src/ir/explicit-renderer.ts +2 -195
- package/src/ir/from-interchange.test.ts +91 -4
- package/src/ir/from-interchange.ts +59 -0
- package/src/ir/protocol-json.test.ts +16 -7
- package/src/ir/protocol-json.ts +9 -748
- package/src/ir/references.ts +2 -30
- package/src/ir/types.ts +18 -190
- package/src/schema/command-schema.ts +3 -134
|
@@ -1,95 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Command Schema Types
|
|
3
|
-
*
|
|
4
|
-
* Defines the structure of DSL commands for pattern generation.
|
|
5
|
-
* These schemas are language-neutral and describe the semantic structure
|
|
6
|
-
* of commands rather than their surface syntax.
|
|
2
|
+
* Command Schema Types — re-exported from @lokascript/intent
|
|
7
3
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Command schema - defines a DSL command's structure.
|
|
11
|
-
*/
|
|
12
|
-
export interface CommandSchema {
|
|
13
|
-
/** The action type (command name) */
|
|
14
|
-
readonly action: ActionType;
|
|
15
|
-
/** Human-readable description */
|
|
16
|
-
readonly description: string;
|
|
17
|
-
/** Roles this command accepts */
|
|
18
|
-
readonly roles: RoleSpec[];
|
|
19
|
-
/** The primary role (what the command acts on) */
|
|
20
|
-
readonly primaryRole: SemanticRole;
|
|
21
|
-
/** Category for grouping (DSL-specific) */
|
|
22
|
-
readonly category: string;
|
|
23
|
-
/** Whether this command typically has a body (like event handlers, blocks) */
|
|
24
|
-
readonly hasBody?: boolean;
|
|
25
|
-
/** Notes about special handling or usage */
|
|
26
|
-
readonly notes?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Role specification - defines a semantic role in a command.
|
|
30
|
-
*/
|
|
31
|
-
export interface RoleSpec {
|
|
32
|
-
/** The semantic role */
|
|
33
|
-
readonly role: SemanticRole;
|
|
34
|
-
/** Description of what this role represents */
|
|
35
|
-
readonly description: string;
|
|
36
|
-
/** Whether this role is required */
|
|
37
|
-
readonly required: boolean;
|
|
38
|
-
/** Expected value types */
|
|
39
|
-
readonly expectedTypes: Array<ExpectedType>;
|
|
40
|
-
/** Default value if not provided */
|
|
41
|
-
readonly default?: SemanticValue;
|
|
42
|
-
/** Position hint for SVO languages (higher = earlier) */
|
|
43
|
-
readonly svoPosition?: number;
|
|
44
|
-
/** Position hint for SOV languages (higher = earlier) */
|
|
45
|
-
readonly sovPosition?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Override the default role marker for this command.
|
|
48
|
-
* Maps language code to the marker to use (e.g., { en: 'from', ja: 'から' }).
|
|
49
|
-
* If not specified, uses the language profile's default roleMarker.
|
|
50
|
-
*/
|
|
51
|
-
readonly markerOverride?: Record<string, string>;
|
|
52
|
-
/**
|
|
53
|
-
* Override the rendering marker separately from parsing.
|
|
54
|
-
* Used when the parsing grammar differs from rendered output.
|
|
55
|
-
* Maps language code to the rendering marker.
|
|
56
|
-
*/
|
|
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';
|
|
66
|
-
/**
|
|
67
|
-
* When true, this role captures all remaining tokens until the next
|
|
68
|
-
* recognized marker keyword or end of input, joining their values
|
|
69
|
-
* with spaces into a single ExpressionValue.
|
|
70
|
-
*
|
|
71
|
-
* Only meaningful for the last role in a sequence or a role followed
|
|
72
|
-
* by a marked role. Default: false.
|
|
73
|
-
*/
|
|
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'>;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Helper to create a command schema with sensible defaults.
|
|
87
|
-
* Provides defaults for description, category, and primaryRole.
|
|
88
|
-
*/
|
|
89
|
-
export declare function defineCommand(schema: Partial<CommandSchema> & Pick<CommandSchema, 'action' | 'roles'>): CommandSchema;
|
|
90
|
-
/**
|
|
91
|
-
* Helper to create a role spec with sensible defaults.
|
|
92
|
-
* Provides default for description.
|
|
93
|
-
*/
|
|
94
|
-
export declare function defineRole(role: Partial<RoleSpec> & Pick<RoleSpec, 'role' | 'required' | 'expectedTypes'>): RoleSpec;
|
|
4
|
+
export type { CommandSchema, RoleSpec } from '@lokascript/intent';
|
|
5
|
+
export { defineCommand, defineRole, getRoleSpec } from '@lokascript/intent';
|
|
95
6
|
//# sourceMappingURL=command-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-schema.d.ts","sourceRoot":"","sources":["../../src/schema/command-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command-schema.d.ts","sourceRoot":"","sources":["../../src/schema/command-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/schema/index.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
// src/schema/command-schema.ts
|
|
2
|
-
|
|
3
|
-
return {
|
|
4
|
-
description: schema.description || `${schema.action} command`,
|
|
5
|
-
category: schema.category || "general",
|
|
6
|
-
primaryRole: schema.primaryRole || schema.roles[0]?.role || "patient",
|
|
7
|
-
...schema,
|
|
8
|
-
action: schema.action,
|
|
9
|
-
roles: schema.roles
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function defineRole(role) {
|
|
13
|
-
return {
|
|
14
|
-
description: role.description || `${role.role} role`,
|
|
15
|
-
...role,
|
|
16
|
-
role: role.role,
|
|
17
|
-
required: role.required,
|
|
18
|
-
expectedTypes: role.expectedTypes
|
|
19
|
-
};
|
|
20
|
-
}
|
|
2
|
+
import { defineCommand, defineRole, getRoleSpec } from "@lokascript/intent";
|
|
21
3
|
export {
|
|
22
4
|
defineCommand,
|
|
23
|
-
defineRole
|
|
5
|
+
defineRole,
|
|
6
|
+
getRoleSpec
|
|
24
7
|
};
|
|
25
8
|
//# sourceMappingURL=index.js.map
|
package/dist/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/command-schema.ts"],"sourcesContent":["/**\n * Command Schema Types
|
|
1
|
+
{"version":3,"sources":["../../src/schema/command-schema.ts"],"sourcesContent":["/**\n * Command Schema Types — re-exported from @lokascript/intent\n */\n\nexport type { CommandSchema, RoleSpec } from '@lokascript/intent';\nexport { defineCommand, defineRole, getRoleSpec } from '@lokascript/intent';\n"],"mappings":";AAKA,SAAS,eAAe,YAAY,mBAAmB;","names":[]}
|