@dotit/core 1.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +229 -0
  3. package/dist/aliases.d.ts +1 -0
  4. package/dist/aliases.js +8 -0
  5. package/dist/ask.d.ts +7 -0
  6. package/dist/ask.js +55 -0
  7. package/dist/browser.d.ts +12 -0
  8. package/dist/browser.js +32 -0
  9. package/dist/diff.d.ts +17 -0
  10. package/dist/diff.js +179 -0
  11. package/dist/document-css.d.ts +1 -0
  12. package/dist/document-css.js +290 -0
  13. package/dist/executor.d.ts +40 -0
  14. package/dist/executor.js +501 -0
  15. package/dist/history.d.ts +10 -0
  16. package/dist/history.js +297 -0
  17. package/dist/html-to-it.d.ts +1 -0
  18. package/dist/html-to-it.js +288 -0
  19. package/dist/index-builder.d.ts +62 -0
  20. package/dist/index-builder.js +228 -0
  21. package/dist/index.d.ts +39 -0
  22. package/dist/index.js +94 -0
  23. package/dist/language-registry.d.ts +39 -0
  24. package/dist/language-registry.js +530 -0
  25. package/dist/markdown.d.ts +1 -0
  26. package/dist/markdown.js +123 -0
  27. package/dist/merge.d.ts +6 -0
  28. package/dist/merge.js +255 -0
  29. package/dist/parser.d.ts +29 -0
  30. package/dist/parser.js +1562 -0
  31. package/dist/query.d.ts +32 -0
  32. package/dist/query.js +293 -0
  33. package/dist/renderer.d.ts +16 -0
  34. package/dist/renderer.js +1286 -0
  35. package/dist/schema.d.ts +47 -0
  36. package/dist/schema.js +574 -0
  37. package/dist/source.d.ts +3 -0
  38. package/dist/source.js +223 -0
  39. package/dist/theme.d.ts +49 -0
  40. package/dist/theme.js +113 -0
  41. package/dist/themes/corporate.json +86 -0
  42. package/dist/themes/dark.json +64 -0
  43. package/dist/themes/editorial.json +54 -0
  44. package/dist/themes/legal.json +57 -0
  45. package/dist/themes/minimal.json +50 -0
  46. package/dist/themes/print.json +54 -0
  47. package/dist/themes/technical.json +59 -0
  48. package/dist/themes/warm.json +53 -0
  49. package/dist/trust.d.ts +66 -0
  50. package/dist/trust.js +200 -0
  51. package/dist/types.d.ts +234 -0
  52. package/dist/types.js +19 -0
  53. package/dist/utils.d.ts +2 -0
  54. package/dist/utils.js +13 -0
  55. package/dist/validate.d.ts +13 -0
  56. package/dist/validate.js +711 -0
  57. package/dist/workflow.d.ts +18 -0
  58. package/dist/workflow.js +160 -0
  59. package/package.json +51 -0
@@ -0,0 +1,234 @@
1
+ export interface IntentBlock {
2
+ id: string;
3
+ type: BlockType;
4
+ keywordAlias?: string;
5
+ content: string;
6
+ originalContent?: string;
7
+ properties?: Record<string, string | number>;
8
+ inline?: InlineNode[];
9
+ children?: IntentBlock[];
10
+ table?: {
11
+ headers?: string[];
12
+ rows: string[][];
13
+ headersKeyword?: string;
14
+ rowKeyword?: string;
15
+ };
16
+ }
17
+ export declare const INTERNAL_BLOCK_TYPES: readonly ["list-item", "step-item", "body-text", "divider", "table", "extension"];
18
+ export declare const KEYWORDS: string[];
19
+ export type BlockType = "title" | "summary" | "section" | "sub" | "divider" | "text" | "info" | "columns" | "row" | "table" | "extension" | "task" | "done" | "ask" | "quote" | "cite" | "image" | "link" | "ref" | "embed" | "code" | "input" | "output" | "list-item" | "step-item" | "body-text" | "step" | "decision" | "trigger" | "loop" | "checkpoint" | "audit" | "error" | "import" | "export" | "progress" | "context" | "tool" | "prompt" | "memory" | "result" | "handoff" | "wait" | "parallel" | "retry" | "gate" | "call" | "signal" | "policy" | "track" | "approve" | "sign" | "freeze" | "revision" | "history" | "meta" | "font" | "page" | "break" | "byline" | "epigraph" | "caption" | "footnote" | "toc" | "dedication" | "header" | "footer" | "watermark" | "style" | "def" | "metric" | "amendment" | "figure" | "signline" | "contact" | "deadline" | "assert" | "secret" | "agent" | "model" | "custom";
20
+ export type InlineNode = {
21
+ type: "text";
22
+ value: string;
23
+ } | {
24
+ type: "bold";
25
+ value: string;
26
+ } | {
27
+ type: "italic";
28
+ value: string;
29
+ } | {
30
+ type: "strike";
31
+ value: string;
32
+ } | {
33
+ type: "inline-quote";
34
+ value: string;
35
+ } | {
36
+ type: "highlight";
37
+ value: string;
38
+ } | {
39
+ type: "code";
40
+ value: string;
41
+ } | {
42
+ type: "inline-note";
43
+ value: string;
44
+ } | {
45
+ type: "date";
46
+ value: string;
47
+ iso: string;
48
+ } | {
49
+ type: "mention";
50
+ value: string;
51
+ } | {
52
+ type: "tag";
53
+ value: string;
54
+ } | {
55
+ type: "label";
56
+ value: string;
57
+ } | {
58
+ type: "link";
59
+ value: string;
60
+ href: string;
61
+ } | {
62
+ type: "footnote-ref";
63
+ value: string;
64
+ } | {
65
+ type: "styled";
66
+ value: string;
67
+ props: Record<string, string>;
68
+ };
69
+ export interface IntentExtension {
70
+ keywords?: string[];
71
+ parseBlock?: (args: {
72
+ keyword: string;
73
+ content: string;
74
+ properties?: Record<string, string | number>;
75
+ line: number;
76
+ column: number;
77
+ parseInline: (text: string) => {
78
+ content: string;
79
+ inline: InlineNode[];
80
+ };
81
+ }) => IntentBlock | null | undefined;
82
+ parseInline?: (args: {
83
+ text: string;
84
+ defaultParseInline: (text: string) => {
85
+ content: string;
86
+ inline: InlineNode[];
87
+ };
88
+ }) => {
89
+ content: string;
90
+ inline: InlineNode[];
91
+ } | null | undefined;
92
+ validate?: (document: IntentDocument) => Diagnostic[];
93
+ }
94
+ export interface ParseOptions {
95
+ extensions?: IntentExtension[];
96
+ includeHistorySection?: boolean;
97
+ }
98
+ export interface Diagnostic {
99
+ severity: "error" | "warning";
100
+ message: string;
101
+ line: number;
102
+ column: number;
103
+ code: "UNTERMINATED_CODE_BLOCK" | "UNEXPECTED_END" | "INVALID_PROPERTY_SEGMENT" | "HEADERS_WITHOUT_ROWS" | "ROW_WITHOUT_HEADERS" | "UNKNOWN_EXTENSION_KEYWORD" | "EXTENSION_VALIDATION" | "REF_MISSING_TARGET" | "REF_MISSING_REL" | "DEF_MISSING_MEANING" | "DEF_DUPLICATE_TERM" | "METRIC_MISSING_VALUE" | "METRIC_INVALID_TREND" | "AMENDMENT_WITHOUT_FREEZE" | "AMENDMENT_MISSING_REF" | "AMENDMENT_MISSING_NOW" | "FIGURE_MISSING_SRC" | "FIGURE_MISSING_CAPTION" | "CONTACT_NO_REACH" | "DEADLINE_MISSING_DATE" | "DEADLINE_PAST" | "LEGACY_HISTORY_BOUNDARY" | "HISTORY_WITHOUT_FREEZE" | "DEPRECATED_KEYWORD" | "CITE_MISSING_TITLE" | "INPUT_MISSING_NAME" | "OUTPUT_MISSING_NAME" | "TOOL_MISSING_API" | "PROMPT_MISSING_CONTENT" | "ASSERT_MISSING_CONDITION" | "SECRET_MISSING_NAME" | "DEPRECATED_PROPERTY";
104
+ }
105
+ export type AgenticStatus = "pending" | "running" | "blocked" | "failed" | "skipped" | "cancelled" | "done" | "approved" | "rejected" | "waiting";
106
+ export interface VariableRef {
107
+ $ref: string;
108
+ }
109
+ export interface IntentDocumentMetadata {
110
+ title?: string;
111
+ summary?: string;
112
+ language?: "ltr" | "rtl";
113
+ agent?: string;
114
+ model?: string;
115
+ context?: Record<string, string>;
116
+ version?: string;
117
+ tracking?: {
118
+ version: string;
119
+ by: string;
120
+ active: boolean;
121
+ };
122
+ signatures?: Array<{
123
+ signer: string;
124
+ role?: string;
125
+ at: string;
126
+ hash: string;
127
+ valid?: boolean;
128
+ }>;
129
+ freeze?: {
130
+ at: string;
131
+ hash: string;
132
+ status: "locked";
133
+ };
134
+ meta?: Record<string, string>;
135
+ }
136
+ export interface PrintLayout {
137
+ page?: IntentBlock;
138
+ header?: IntentBlock;
139
+ footer?: IntentBlock;
140
+ watermark?: IntentBlock;
141
+ breaks: IntentBlock[];
142
+ }
143
+ export interface IntentDocument {
144
+ version?: string;
145
+ blocks: IntentBlock[];
146
+ metadata?: IntentDocumentMetadata;
147
+ diagnostics?: Diagnostic[];
148
+ history?: HistorySection;
149
+ }
150
+ export interface HistorySection {
151
+ registry: RegistryEntry[];
152
+ revisions: RevisionEntry[];
153
+ raw: string;
154
+ }
155
+ export interface RegistryEntry {
156
+ id: string;
157
+ blockType: string;
158
+ section: string;
159
+ fingerprint: string;
160
+ dead?: boolean;
161
+ }
162
+ export interface RevisionEntry {
163
+ version: string;
164
+ at: string;
165
+ by: string;
166
+ change: "added" | "removed" | "modified" | "moved";
167
+ id: string;
168
+ block: string;
169
+ section?: string;
170
+ was?: string;
171
+ now?: string;
172
+ wasSection?: string;
173
+ nowSection?: string;
174
+ }
175
+ export interface QueryClause {
176
+ field: string;
177
+ operator: "=" | "!=" | "<" | ">" | "<=" | ">=" | "contains" | "startsWith" | "exists";
178
+ value?: string | number | boolean;
179
+ }
180
+ export interface QuerySort {
181
+ field: string;
182
+ direction: "asc" | "desc";
183
+ }
184
+ export interface QueryOptions {
185
+ where?: QueryClause[];
186
+ sort?: QuerySort[];
187
+ limit?: number;
188
+ offset?: number;
189
+ }
190
+ export interface QueryResult {
191
+ blocks: IntentBlock[];
192
+ total: number;
193
+ matched: number;
194
+ }
195
+ export interface PropertySchema {
196
+ type: "string" | "number" | "boolean" | "date" | "enum" | "url" | "email";
197
+ required?: boolean;
198
+ default?: string | number | boolean;
199
+ enumValues?: string[];
200
+ pattern?: string;
201
+ min?: number;
202
+ max?: number;
203
+ format?: "iso-date" | "iso-datetime" | "time" | "url" | "email";
204
+ }
205
+ export interface BlockSchema {
206
+ type: BlockType;
207
+ content?: {
208
+ required?: boolean;
209
+ minLength?: number;
210
+ maxLength?: number;
211
+ pattern?: string;
212
+ };
213
+ properties?: Record<string, PropertySchema>;
214
+ allowUnknownProperties?: boolean;
215
+ }
216
+ export interface DocumentSchema {
217
+ name: string;
218
+ description?: string;
219
+ requiredBlocks?: BlockType[];
220
+ blockSchemas?: Record<string, BlockSchema>;
221
+ allowUnknownBlocks?: boolean;
222
+ }
223
+ export interface ValidationError {
224
+ blockId: string;
225
+ blockType: string;
226
+ field: string;
227
+ message: string;
228
+ severity: "error" | "warning";
229
+ }
230
+ export interface ValidationResult {
231
+ valid: boolean;
232
+ errors: ValidationError[];
233
+ warnings: ValidationError[];
234
+ }
package/dist/types.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KEYWORDS = exports.INTERNAL_BLOCK_TYPES = void 0;
4
+ const language_registry_1 = require("./language-registry");
5
+ exports.INTERNAL_BLOCK_TYPES = [
6
+ "list-item",
7
+ "step-item",
8
+ "body-text",
9
+ "divider",
10
+ "table",
11
+ "extension",
12
+ ];
13
+ exports.KEYWORDS = [
14
+ ...language_registry_1.CANONICAL_KEYWORDS,
15
+ ...Object.keys(language_registry_1.ALIAS_MAP),
16
+ ...language_registry_1.EXTENSION_KEYWORDS,
17
+ ...Object.keys(language_registry_1.EXTENSION_LEGACY_ALIASES),
18
+ ...language_registry_1.COMPAT_KEYWORDS,
19
+ ];
@@ -0,0 +1,2 @@
1
+ import { IntentBlock } from "./types";
2
+ export declare function flattenBlocks(blocks: IntentBlock[]): IntentBlock[];
package/dist/utils.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flattenBlocks = flattenBlocks;
4
+ function flattenBlocks(blocks) {
5
+ const result = [];
6
+ for (const block of blocks) {
7
+ result.push(block);
8
+ if (block.children) {
9
+ result.push(...flattenBlocks(block.children));
10
+ }
11
+ }
12
+ return result;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IntentDocument } from "./types";
2
+ export interface SemanticIssue {
3
+ blockId: string;
4
+ blockType: string;
5
+ type: "error" | "warning" | "info";
6
+ code: string;
7
+ message: string;
8
+ }
9
+ export interface SemanticValidationResult {
10
+ valid: boolean;
11
+ issues: SemanticIssue[];
12
+ }
13
+ export declare function validateDocumentSemantic(doc: IntentDocument): SemanticValidationResult;