auwgent-yaml-lite 0.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.
@@ -0,0 +1,90 @@
1
+ /**
2
+ * AUWGENT YAML-Lite — Public API
3
+ *
4
+ * Main entry point for the parser library.
5
+ */
6
+ export type { Token, TokenType, Position, ASTNode, ScalarNode, MappingNode, MappingEntry, SequenceNode, RefNode, EmptyNode, ParseResult, ParseError, IRValue, IRObject, IRArray, IRRef, IRResult, IRError, ParserEvent, ParserEventType, ParserMiddleware, ParserOptions, IntentSchema, StreamingParser, } from './types';
7
+ export { Tokenizer, tokenize } from './tokenizer';
8
+ export { Parser, parse, createParser } from './parser';
9
+ export { IRBuilder, buildIR } from './ir-builder';
10
+ import type { ParserOptions, IRValue, IRResult, ParseResult } from './types';
11
+ /**
12
+ * Parse YAML-Lite string and convert to JSON-compatible value.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const json = parseToJSON(`
17
+ * intent:
18
+ * type: tool_call
19
+ * name: search
20
+ * args:
21
+ * query: hello
22
+ * `);
23
+ * // { intent: { type: 'tool_call', name: 'search', args: { query: 'hello' } } }
24
+ * ```
25
+ */
26
+ export declare function parseToJSON(input: string, options?: ParserOptions): IRValue;
27
+ /**
28
+ * Parse YAML-Lite with full result including AST, IR, and diagnostics.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const result = parseWithDiagnostics(input);
33
+ * if (result.ir.unresolvedRefs.length > 0) {
34
+ * console.warn('Unresolved refs:', result.ir.unresolvedRefs);
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function parseWithDiagnostics(input: string, options?: ParserOptions): {
39
+ parse: ParseResult;
40
+ ir: IRResult;
41
+ };
42
+ /**
43
+ * Create a streaming parser with JSON output.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const stream = createStreamingParser();
48
+ * stream.write('intent:\n');
49
+ * stream.write(' type: tool_call\n');
50
+ *
51
+ * const partial = stream.peek(); // Get current state
52
+ * const final = stream.end(); // Get final result
53
+ * ```
54
+ */
55
+ export declare function createStreamingParser(options?: ParserOptions): {
56
+ write: (chunk: string) => void;
57
+ peek: () => IRValue;
58
+ end: () => IRValue;
59
+ onIntentReady: (handler: (intentType: string) => void) => void;
60
+ };
61
+ /**
62
+ * Validate YAML-Lite input without full parsing.
63
+ * Returns true if valid, or array of errors if invalid.
64
+ */
65
+ export declare function validate(input: string, options?: ParserOptions): true | ParseError[];
66
+ /**
67
+ * Extract clean YAML from LLM output that may contain conversational noise.
68
+ *
69
+ * Handles common LLM behaviors:
70
+ * - Preambles: "Sure!", "Okay, here's the YAML:", "Here you go:"
71
+ * - Code fences: ```yaml ... ``` or ``` ... ```
72
+ * - Trailing text: "Let me know if you need anything else!"
73
+ * - Mixed content before/after the YAML block
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const dirty = `Sure! Here's your UI:
78
+ * \`\`\`yaml
79
+ * type: Card
80
+ * title: Hello
81
+ * \`\`\`
82
+ * Let me know if you need changes!`;
83
+ *
84
+ * const clean = extractYAML(dirty);
85
+ * // "type: Card\ntitle: Hello"
86
+ * ```
87
+ */
88
+ export declare function extractYAML(input: string): string;
89
+ import type { ParseError } from './types';
90
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAER,KAAK,EACL,SAAS,EACT,QAAQ,EAGR,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EAGV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EAGP,WAAW,EACX,eAAe,EACf,gBAAgB,EAGhB,aAAa,EACb,YAAY,EACZ,eAAe,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,QAAQ,EA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