browser-debugger-cli 0.6.4 → 0.6.5
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/commands/__tests__/machineReadableHelp.contract.test.d.ts +12 -0
- package/dist/commands/__tests__/machineReadableHelp.contract.test.d.ts.map +1 -0
- package/dist/commands/__tests__/machineReadableHelp.contract.test.js +102 -0
- package/dist/commands/__tests__/machineReadableHelp.contract.test.js.map +1 -0
- package/dist/commands/cdp.js +8 -4
- package/dist/commands/cdp.js.map +1 -1
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +22 -2
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/dom/a11y.d.ts.map +1 -1
- package/dist/commands/dom/a11y.js +51 -15
- package/dist/commands/dom/a11y.js.map +1 -1
- package/dist/commands/dom/evalHelpers.d.ts +1 -1
- package/dist/commands/dom/evalHelpers.d.ts.map +1 -1
- package/dist/commands/dom/evalHelpers.js +3 -2
- package/dist/commands/dom/evalHelpers.js.map +1 -1
- package/dist/commands/dom/formFillHelpers.d.ts.map +1 -1
- package/dist/commands/dom/formFillHelpers.js +30 -2
- package/dist/commands/dom/formFillHelpers.js.map +1 -1
- package/dist/commands/dom/index.d.ts.map +1 -1
- package/dist/commands/dom/index.js +85 -13
- package/dist/commands/dom/index.js.map +1 -1
- package/dist/commands/dom/reactEventHelpers.d.ts +1 -1
- package/dist/commands/dom/reactEventHelpers.d.ts.map +1 -1
- package/dist/commands/dom/reactEventHelpers.js +3 -3
- package/dist/commands/machineReadableHelp.d.ts +48 -0
- package/dist/commands/machineReadableHelp.d.ts.map +1 -1
- package/dist/commands/machineReadableHelp.js +80 -0
- package/dist/commands/machineReadableHelp.js.map +1 -1
- package/dist/commands/network.d.ts.map +1 -1
- package/dist/commands/network.js +28 -2
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/peek.js +2 -2
- package/dist/commands/peek.js.map +1 -1
- package/dist/commands/shared/CommandRunner.d.ts +2 -0
- package/dist/commands/shared/CommandRunner.d.ts.map +1 -1
- package/dist/commands/shared/CommandRunner.js +3 -0
- package/dist/commands/shared/CommandRunner.js.map +1 -1
- package/dist/commands/shared/validation.d.ts +2 -0
- package/dist/commands/shared/validation.d.ts.map +1 -1
- package/dist/commands/shared/validation.js +5 -2
- package/dist/commands/shared/validation.js.map +1 -1
- package/dist/commands/stop.d.ts.map +1 -1
- package/dist/commands/stop.js +2 -1
- package/dist/commands/stop.js.map +1 -1
- package/dist/commands/tail.d.ts.map +1 -1
- package/dist/commands/tail.js +6 -0
- package/dist/commands/tail.js.map +1 -1
- package/dist/connection/cdp.js +9 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -1
- package/dist/constants.js.map +1 -1
- package/dist/daemon/patternDefinitions.d.ts +47 -0
- package/dist/daemon/patternDefinitions.d.ts.map +1 -0
- package/dist/daemon/patternDefinitions.js +71 -0
- package/dist/daemon/patternDefinitions.js.map +1 -0
- package/dist/daemon/patternDetector.d.ts +60 -0
- package/dist/daemon/patternDetector.d.ts.map +1 -0
- package/dist/daemon/patternDetector.js +74 -0
- package/dist/daemon/patternDetector.js.map +1 -0
- package/dist/daemon/worker/__tests__/PatternDetector.unit.test.d.ts +11 -0
- package/dist/daemon/worker/__tests__/PatternDetector.unit.test.d.ts.map +1 -0
- package/dist/daemon/worker/__tests__/PatternDetector.unit.test.js +136 -0
- package/dist/daemon/worker/__tests__/PatternDetector.unit.test.js.map +1 -0
- package/dist/daemon/worker/commandRegistry.d.ts.map +1 -1
- package/dist/daemon/worker/commandRegistry.js +13 -2
- package/dist/daemon/worker/commandRegistry.js.map +1 -1
- package/dist/ipc/protocol/commands.d.ts +2 -0
- package/dist/ipc/protocol/commands.d.ts.map +1 -1
- package/dist/ipc/protocol/commands.js.map +1 -1
- package/dist/session/cleanup.d.ts.map +1 -1
- package/dist/session/cleanup.js +2 -0
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/queryCache.d.ts +35 -0
- package/dist/session/queryCache.d.ts.map +1 -0
- package/dist/session/queryCache.js +83 -0
- package/dist/session/queryCache.js.map +1 -0
- package/dist/telemetry/a11y.d.ts +8 -5
- package/dist/telemetry/a11y.d.ts.map +1 -1
- package/dist/telemetry/a11y.js +34 -19
- package/dist/telemetry/a11y.js.map +1 -1
- package/dist/ui/errors/CommandError.d.ts +5 -1
- package/dist/ui/errors/CommandError.d.ts.map +1 -1
- package/dist/ui/errors/CommandError.js.map +1 -1
- package/dist/ui/formatters/__tests__/preview.unit.test.d.ts +13 -0
- package/dist/ui/formatters/__tests__/preview.unit.test.d.ts.map +1 -0
- package/dist/ui/formatters/__tests__/preview.unit.test.js +180 -0
- package/dist/ui/formatters/__tests__/preview.unit.test.js.map +1 -0
- package/dist/ui/formatters/dom.d.ts.map +1 -1
- package/dist/ui/formatters/dom.js +5 -2
- package/dist/ui/formatters/dom.js.map +1 -1
- package/dist/ui/formatters/helpFormatters.d.ts +41 -0
- package/dist/ui/formatters/helpFormatters.d.ts.map +1 -0
- package/dist/ui/formatters/helpFormatters.js +80 -0
- package/dist/ui/formatters/helpFormatters.js.map +1 -0
- package/dist/ui/formatters/preview.d.ts.map +1 -1
- package/dist/ui/formatters/preview.js +67 -19
- package/dist/ui/formatters/preview.js.map +1 -1
- package/dist/ui/formatters/sessionFormatters.d.ts +58 -0
- package/dist/ui/formatters/sessionFormatters.d.ts.map +1 -0
- package/dist/ui/formatters/sessionFormatters.js +116 -0
- package/dist/ui/formatters/sessionFormatters.js.map +1 -0
- package/dist/ui/messages/commands.d.ts +9 -0
- package/dist/ui/messages/commands.d.ts.map +1 -1
- package/dist/ui/messages/commands.js +11 -1
- package/dist/ui/messages/commands.js.map +1 -1
- package/dist/ui/messages/errors.d.ts +53 -0
- package/dist/ui/messages/errors.d.ts.map +1 -1
- package/dist/ui/messages/errors.js +59 -0
- package/dist/ui/messages/errors.js.map +1 -1
- package/dist/ui/messages/hints.d.ts +33 -0
- package/dist/ui/messages/hints.d.ts.map +1 -0
- package/dist/ui/messages/hints.js +37 -0
- package/dist/ui/messages/hints.js.map +1 -0
- package/dist/ui/messages/session.d.ts +11 -1
- package/dist/ui/messages/session.d.ts.map +1 -1
- package/dist/ui/messages/session.js +14 -21
- package/dist/ui/messages/session.js.map +1 -1
- package/dist/utils/decisionTrees.d.ts +54 -0
- package/dist/utils/decisionTrees.d.ts.map +1 -0
- package/dist/utils/decisionTrees.js +171 -0
- package/dist/utils/decisionTrees.js.map +1 -0
- package/dist/utils/taskMappings.d.ts +47 -0
- package/dist/utils/taskMappings.d.ts.map +1 -0
- package/dist/utils/taskMappings.js +118 -0
- package/dist/utils/taskMappings.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-related formatting helpers for landing page sections.
|
|
3
|
+
*
|
|
4
|
+
* Provides well-structured, TSDoc'd helpers for building each section
|
|
5
|
+
* of the landing page, organized by priority (high-level commands first).
|
|
6
|
+
*/
|
|
7
|
+
import { section } from '../../ui/formatting.js';
|
|
8
|
+
/**
|
|
9
|
+
* Builds the common tasks section showing task-to-command mappings.
|
|
10
|
+
*
|
|
11
|
+
* Provides agents with clear intent-to-command examples.
|
|
12
|
+
*
|
|
13
|
+
* @returns Formatted common tasks section
|
|
14
|
+
*/
|
|
15
|
+
export function buildCommonTasksSection() {
|
|
16
|
+
return section('Common Tasks:', [
|
|
17
|
+
'Screenshot bdg dom screenshot output.png',
|
|
18
|
+
'Fill forms bdg dom fill "#email" "test@test.com"',
|
|
19
|
+
'Click button bdg dom click "button.submit"',
|
|
20
|
+
'Query DOM bdg dom query "article h2"',
|
|
21
|
+
'Get cookies bdg network getCookies',
|
|
22
|
+
'Export HAR bdg network har output.har',
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds the domain commands section with expanded command coverage.
|
|
27
|
+
*
|
|
28
|
+
* Shows all 12+ high-level commands organized by domain (DOM, Network, Console).
|
|
29
|
+
* Previously showed only 2 commands, now provides comprehensive coverage.
|
|
30
|
+
*
|
|
31
|
+
* @returns Formatted domain commands section
|
|
32
|
+
*/
|
|
33
|
+
export function buildDomainCommandsSection() {
|
|
34
|
+
return section('Domain Commands:', [
|
|
35
|
+
'DOM:',
|
|
36
|
+
' bdg dom query <selector> Query elements (returns JSON)',
|
|
37
|
+
' bdg dom get <selector|index> Get element details',
|
|
38
|
+
' bdg dom eval <javascript> Execute JavaScript in page context',
|
|
39
|
+
' bdg dom screenshot [path] Capture full page screenshot',
|
|
40
|
+
' bdg dom fill <selector> <value> Fill form input',
|
|
41
|
+
' bdg dom click <selector> Click element',
|
|
42
|
+
' bdg dom a11y [selector] Accessibility tree',
|
|
43
|
+
'',
|
|
44
|
+
'Network:',
|
|
45
|
+
' bdg network har [path] Export HTTP Archive (HAR)',
|
|
46
|
+
' bdg network getCookies List all cookies',
|
|
47
|
+
' bdg network headers <id> HTTP headers for request',
|
|
48
|
+
'',
|
|
49
|
+
'Console:',
|
|
50
|
+
' bdg console [options] Query console logs',
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Builds the live monitoring section.
|
|
55
|
+
*
|
|
56
|
+
* Shows commands for real-time data inspection during active sessions.
|
|
57
|
+
*
|
|
58
|
+
* @returns Formatted live monitoring section
|
|
59
|
+
*/
|
|
60
|
+
export function buildLiveMonitoringSection() {
|
|
61
|
+
return section('Live Monitoring:', [
|
|
62
|
+
'bdg peek Preview collected data (last 10 items)',
|
|
63
|
+
'bdg peek --follow Live updates every second',
|
|
64
|
+
'bdg tail Continuous monitoring (like tail -f)',
|
|
65
|
+
'bdg details network <id> Full request/response details',
|
|
66
|
+
'bdg details console <id> Full console message details',
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Builds the session management section.
|
|
71
|
+
*
|
|
72
|
+
* Shows commands for controlling the daemon and session lifecycle.
|
|
73
|
+
*
|
|
74
|
+
* @returns Formatted session management section
|
|
75
|
+
*/
|
|
76
|
+
export function buildSessionManagementSection() {
|
|
77
|
+
return section('Session Management:', [
|
|
78
|
+
'bdg status Check session state',
|
|
79
|
+
'bdg status --verbose Include Chrome diagnostics',
|
|
80
|
+
'bdg stop End session & save output',
|
|
81
|
+
'bdg cleanup Clean stale sessions',
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Builds the CDP access section positioned as advanced fallback.
|
|
86
|
+
*
|
|
87
|
+
* Provides raw CDP protocol access for advanced use cases not covered
|
|
88
|
+
* by high-level commands. Intentionally positioned after domain commands
|
|
89
|
+
* to guide agents toward wrapper commands first.
|
|
90
|
+
*
|
|
91
|
+
* @returns Formatted CDP section
|
|
92
|
+
*/
|
|
93
|
+
export function buildCdpSection() {
|
|
94
|
+
return section('Advanced: Raw CDP Access (53 domains, 300+ methods):', [
|
|
95
|
+
'bdg cdp --list List all domains',
|
|
96
|
+
'bdg cdp Network --list List Network methods (39 methods)',
|
|
97
|
+
'bdg cdp --search cookie Search methods by keyword',
|
|
98
|
+
'bdg cdp Runtime.evaluate --params \'{"expression":"document.title"}\'',
|
|
99
|
+
'',
|
|
100
|
+
'Use high-level commands above when possible for better efficiency.',
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Builds the discovery section for AI agents.
|
|
105
|
+
*
|
|
106
|
+
* Points agents to machine-readable schemas and documentation resources.
|
|
107
|
+
*
|
|
108
|
+
* @returns Formatted discovery section
|
|
109
|
+
*/
|
|
110
|
+
export function buildDiscoverySection() {
|
|
111
|
+
return section('Discovery (for AI agents):', [
|
|
112
|
+
'bdg --help --json Machine-readable schema (commands, options, exit codes)',
|
|
113
|
+
'.claude/skills/bdg/ Claude skill with 15+ recipes & patterns',
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=sessionFormatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionFormatters.js","sour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BAAqB;IACnC,OAAO,OAAO,CAAC,4BAA4B,EAAE;QAC3C,oFAAoF;QACpF,qEAAqE;KACtE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -73,6 +73,15 @@ export declare function sessionStillActiveError(pid: number): string;
|
|
|
73
73
|
/**
|
|
74
74
|
* Generate help message when no URL is provided to start command.
|
|
75
75
|
*
|
|
76
|
+
* Displays comprehensive guidance optimized for agent discovery:
|
|
77
|
+
* - Agent-specific resources (machine-readable schema, CDP discovery)
|
|
78
|
+
* - Complete task workflow examples
|
|
79
|
+
* - URL format guidance
|
|
80
|
+
* - Session management commands
|
|
81
|
+
*
|
|
82
|
+
* Organized to prioritize agent needs (discovery first) while maintaining
|
|
83
|
+
* human readability with clear task-oriented examples.
|
|
84
|
+
*
|
|
76
85
|
* @returns Multi-line help message with examples
|
|
77
86
|
* */
|
|
78
87
|
export declare function startCommandHelpMessage(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5D;AACD;;;;;KAKK;AACL,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;;;;;;KAaK;AACL,wBAAgB,uBAAuB,IAAI,MAAM,CAehD"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* User-facing messages for command-specific operations like stopping sessions,
|
|
5
5
|
* cleaning up stale files, and validating command arguments.
|
|
6
6
|
*/
|
|
7
|
+
import { buildAgentDiscoveryHelp, buildCommonTaskExamples, buildUrlExamples, buildSessionManagementReminder, } from '../../ui/formatters/helpFormatters.js';
|
|
7
8
|
import { joinLines } from '../../ui/formatting.js';
|
|
8
9
|
/**
|
|
9
10
|
* Generate Chrome killed message.
|
|
@@ -94,9 +95,18 @@ export function sessionStillActiveError(pid) {
|
|
|
94
95
|
/**
|
|
95
96
|
* Generate help message when no URL is provided to start command.
|
|
96
97
|
*
|
|
98
|
+
* Displays comprehensive guidance optimized for agent discovery:
|
|
99
|
+
* - Agent-specific resources (machine-readable schema, CDP discovery)
|
|
100
|
+
* - Complete task workflow examples
|
|
101
|
+
* - URL format guidance
|
|
102
|
+
* - Session management commands
|
|
103
|
+
*
|
|
104
|
+
* Organized to prioritize agent needs (discovery first) while maintaining
|
|
105
|
+
* human readability with clear task-oriented examples.
|
|
106
|
+
*
|
|
97
107
|
* @returns Multi-line help message with examples
|
|
98
108
|
* */
|
|
99
109
|
export function startCommandHelpMessage() {
|
|
100
|
-
return joinLines('',
|
|
110
|
+
return joinLines('', buildAgentDiscoveryHelp(), '', buildCommonTaskExamples(), '', buildUrlExamples(), '', buildSessionManagementReminder(), '', 'Not sure which command? Start a session to see all available commands:', ' bdg <url>', '');
|
|
101
111
|
}
|
|
102
112
|
//# sourceMappingURL=commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/ui/messages/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,GAAG,CAAC,CAAC,CAAC,sBAAsB,GAAG,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,KAAa;IACzD,OAAO,cAAc,KAAK,2BAA2B,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,YAAY,OAAO,EAAE,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,0BAA0B,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B;IAC1C,OAAO,gCAAgC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,4DAA4D,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,OAAO,4BAA4B,GAAG,eAAe,CAAC;AACxD,CAAC;AACD;;;;;KAKK;AACL,MAAM,UAAU,0BAA0B,CAAC,GAAW;IACpD,OAAO,SAAS,CACd,oBAAoB,GAAG,oBAAoB,EAC3C,2BAA2B,EAC3B,+DAA+D,CAChE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;A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AC,GAAW;IACpD,OAAO,SAAS,CACd,oBAAoB,GAAG,oBAAoB,EAC3C,2BAA2B,EAC3B,+DAA+D,CAChE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,OAAO,gCAAgC,GAAG,GAAG,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;;;KAaK;AACL,MAAM,UAAU,uBAAuB;IACrC,OAAO,SAAS,CACd,EAAE,EACF,uBAAuB,EAAE,EACzB,EAAE,EACF,uBAAuB,EAAE,EACzB,EAAE,EACF,gBAAgB,EAAE,EAClB,EAAE,EACF,8BAA8B,EAAE,EAChC,EAAE,EACF,wEAAwE,EACxE,aAAa,EACb,EAAE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -81,4 +81,57 @@ export declare function unknownError(): string;
|
|
|
81
81
|
* @returns Formatted error message
|
|
82
82
|
*/
|
|
83
83
|
export declare function invalidResponseError(reason: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Generate session not active error with state-aware suggestion.
|
|
86
|
+
*
|
|
87
|
+
* Provides context-appropriate guidance based on what operation was attempted.
|
|
88
|
+
*
|
|
89
|
+
* @param operation - Operation that was attempted (e.g., "peek", "dom query")
|
|
90
|
+
* @returns Formatted error message with suggestions
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* throw new CommandError(
|
|
95
|
+
* sessionNotActiveError('peek'),
|
|
96
|
+
* {},
|
|
97
|
+
* EXIT_CODES.RESOURCE_NOT_FOUND
|
|
98
|
+
* );
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function sessionNotActiveError(operation: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* Generate element not found error with CDP fallback.
|
|
104
|
+
*
|
|
105
|
+
* Provides guidance for when high-level DOM commands fail to find elements,
|
|
106
|
+
* including CDP alternatives for complex queries.
|
|
107
|
+
*
|
|
108
|
+
* @param selector - CSS selector that failed
|
|
109
|
+
* @returns Formatted error message with fallback suggestions
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* throw new CommandError(
|
|
114
|
+
* elementNotFoundError('#missing-element'),
|
|
115
|
+
* { cdpAlternative: 'Use Runtime.evaluate for complex queries' },
|
|
116
|
+
* EXIT_CODES.RESOURCE_NOT_FOUND
|
|
117
|
+
* );
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function elementNotFoundError(selector: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* Generate command requires session error.
|
|
123
|
+
*
|
|
124
|
+
* Generic error for commands that require an active session but one is not found.
|
|
125
|
+
* Provides clear guidance on starting a session.
|
|
126
|
+
*
|
|
127
|
+
* @param commandName - Name of command that was attempted
|
|
128
|
+
* @returns Formatted error message
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const error = commandRequiresSessionError('dom query');
|
|
133
|
+
* console.error(error);
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare function commandRequiresSessionError(commandName: string): string;
|
|
84
137
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAcR;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yDAAyD;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sCAAsC;IACtC,SAAS,CAAC,EAAE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AED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY7D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAUvE"}
|
|
@@ -82,4 +82,63 @@ export function unknownError() {
|
|
|
82
82
|
export function invalidResponseError(reason) {
|
|
83
83
|
return `[bdg] Invalid response from daemon: ${reason}`;
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Generate session not active error with state-aware suggestion.
|
|
87
|
+
*
|
|
88
|
+
* Provides context-appropriate guidance based on what operation was attempted.
|
|
89
|
+
*
|
|
90
|
+
* @param operation - Operation that was attempted (e.g., "peek", "dom query")
|
|
91
|
+
* @returns Formatted error message with suggestions
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* throw new CommandError(
|
|
96
|
+
* sessionNotActiveError('peek'),
|
|
97
|
+
* {},
|
|
98
|
+
* EXIT_CODES.RESOURCE_NOT_FOUND
|
|
99
|
+
* );
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export function sessionNotActiveError(operation) {
|
|
103
|
+
return joinLines(`Error: Cannot ${operation} - no active session`, '', 'Start a session first:', ' bdg <url>', '', 'Example:', ' bdg https://example.com', ` bdg ${operation}`);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Generate element not found error with CDP fallback.
|
|
107
|
+
*
|
|
108
|
+
* Provides guidance for when high-level DOM commands fail to find elements,
|
|
109
|
+
* including CDP alternatives for complex queries.
|
|
110
|
+
*
|
|
111
|
+
* @param selector - CSS selector that failed
|
|
112
|
+
* @returns Formatted error message with fallback suggestions
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* throw new CommandError(
|
|
117
|
+
* elementNotFoundError('#missing-element'),
|
|
118
|
+
* { cdpAlternative: 'Use Runtime.evaluate for complex queries' },
|
|
119
|
+
* EXIT_CODES.RESOURCE_NOT_FOUND
|
|
120
|
+
* );
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export function elementNotFoundError(selector) {
|
|
124
|
+
return joinLines(`Error: Element not found: ${selector}`, '', 'Suggestions:', ' - Check the selector syntax', ' - Wait for the element to load (page might still be loading)', ' - Use bdg peek to see if page loaded correctly', '', 'Advanced: Use CDP for complex queries:', ` bdg cdp Runtime.evaluate --params '{"expression":"document.querySelector('${selector}')"}'`);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Generate command requires session error.
|
|
128
|
+
*
|
|
129
|
+
* Generic error for commands that require an active session but one is not found.
|
|
130
|
+
* Provides clear guidance on starting a session.
|
|
131
|
+
*
|
|
132
|
+
* @param commandName - Name of command that was attempted
|
|
133
|
+
* @returns Formatted error message
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const error = commandRequiresSessionError('dom query');
|
|
138
|
+
* console.error(error);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export function commandRequiresSessionError(commandName) {
|
|
142
|
+
return joinLines(`Error: '${commandName}' requires an active session`, '', 'Start a session:', ' bdg <url>', '', 'Check session status:', ' bdg status');
|
|
143
|
+
}
|
|
85
144
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/ui/messages/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,0BAA0B,CACxC,GAAW,EACX,QAAgB,EAChB,SAAkB;IAElB,OA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,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,SAAS,CACd,iBAAiB,SAAS,sBAAsB,EAChD,EAAE,EACF,wBAAwB,EACxB,aAAa,EACb,EAAE,EACF,UAAU,EACV,2BAA2B,EAC3B,SAAS,SAAS,EAAE,CACrB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,OAAO,SAAS,CACd,6BAA6B,QAAQ,EAAE,EACvC,EAAE,EACF,cAAc,EACd,+BAA+B,EAC/B,gEAAgE,EAChE,kDAAkD,EAClD,EAAE,EACF,wCAAwC,EACxC,+EAA+E,QAAQ,OAAO,CAC/F,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAAC,WAAmB;IAC7D,OAAO,SAAS,CACd,WAAW,WAAW,8BAA8B,EACpD,EAAE,EACF,kBAAkB,EAClB,aAAa,EACb,EAAE,EACF,uBAAuB,EACvB,cAAc,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime hint message generators.
|
|
3
|
+
*
|
|
4
|
+
* Provides formatted hint messages that guide agents toward more
|
|
5
|
+
* efficient command patterns during active sessions.
|
|
6
|
+
*/
|
|
7
|
+
import type { PatternDefinition } from '../../daemon/patternDefinitions.js';
|
|
8
|
+
/**
|
|
9
|
+
* Generate runtime pattern hint message.
|
|
10
|
+
*
|
|
11
|
+
* Creates a formatted hint suggesting a more efficient command alternative.
|
|
12
|
+
*
|
|
13
|
+
* @param pattern - Detected pattern with alternative suggestion
|
|
14
|
+
* @returns Formatted hint message
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const hint = generatePatternHint(pattern);
|
|
19
|
+
* console.error(hint);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function generatePatternHint(pattern: PatternDefinition): string;
|
|
23
|
+
/**
|
|
24
|
+
* Generate hint for multiple Runtime.evaluate calls.
|
|
25
|
+
*
|
|
26
|
+
* Specialized hint for the common pattern of multiple evaluate calls
|
|
27
|
+
* that could be consolidated.
|
|
28
|
+
*
|
|
29
|
+
* @param count - Number of Runtime.evaluate calls detected
|
|
30
|
+
* @returns Formatted hint message
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateMultipleEvaluateHint(count: number): string;
|
|
33
|
+
//# sourceMappingURL=hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/hints.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAMtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQlE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime hint message generators.
|
|
3
|
+
*
|
|
4
|
+
* Provides formatted hint messages that guide agents toward more
|
|
5
|
+
* efficient command patterns during active sessions.
|
|
6
|
+
*/
|
|
7
|
+
import { joinLines } from '../../ui/formatting.js';
|
|
8
|
+
/**
|
|
9
|
+
* Generate runtime pattern hint message.
|
|
10
|
+
*
|
|
11
|
+
* Creates a formatted hint suggesting a more efficient command alternative.
|
|
12
|
+
*
|
|
13
|
+
* @param pattern - Detected pattern with alternative suggestion
|
|
14
|
+
* @returns Formatted hint message
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const hint = generatePatternHint(pattern);
|
|
19
|
+
* console.error(hint);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function generatePatternHint(pattern) {
|
|
23
|
+
return joinLines('', `Hint: Consider using '${pattern.alternative}' instead of ${pattern.cdpMethods.join(' or ')}`, '');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generate hint for multiple Runtime.evaluate calls.
|
|
27
|
+
*
|
|
28
|
+
* Specialized hint for the common pattern of multiple evaluate calls
|
|
29
|
+
* that could be consolidated.
|
|
30
|
+
*
|
|
31
|
+
* @param count - Number of Runtime.evaluate calls detected
|
|
32
|
+
* @returns Formatted hint message
|
|
33
|
+
*/
|
|
34
|
+
export function generateMultipleEvaluateHint(count) {
|
|
35
|
+
return joinLines('', `Hint: Detected ${count} Runtime.evaluate calls`, ` Consider using 'bdg dom eval' for JavaScript execution`, ` Or 'bdg dom query' for DOM queries`, '');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=hints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.js","sourceRoot":"","sources":["../../../src/ui/messages/hints.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA0B;IAC5D,OAAO,SAAS,CACd,EAAE,EACF,yBAAyB,OAAO,CAAC,WAAW,gBAAgB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAC7F,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,OAAO,SAAS,CACd,EAAE,EACF,kBAAkB,KAAK,yBAAyB,EAChD,2DAA2D,EAC3D,uCAAuC,EACvC,EAAE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -14,7 +14,17 @@ export interface LandingPageOptions {
|
|
|
14
14
|
/**
|
|
15
15
|
* Generate the landing page display for session start.
|
|
16
16
|
*
|
|
17
|
-
* Shows a clean, organized overview of available commands grouped by
|
|
17
|
+
* Shows a clean, organized overview of available commands grouped by priority.
|
|
18
|
+
* High-level commands are presented first to guide agents toward token-efficient
|
|
19
|
+
* wrappers before falling back to verbose CDP commands.
|
|
20
|
+
*
|
|
21
|
+
* Section order optimized for agent discoverability:
|
|
22
|
+
* 1. Common tasks with token savings estimates
|
|
23
|
+
* 2. Comprehensive domain command coverage (12+ commands)
|
|
24
|
+
* 3. Live monitoring capabilities
|
|
25
|
+
* 4. Session management
|
|
26
|
+
* 5. Advanced CDP access (positioned as fallback)
|
|
27
|
+
* 6. Discovery resources for agents
|
|
18
28
|
*
|
|
19
29
|
* @param options - Landing page options
|
|
20
30
|
* @returns Formatted landing page string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAsB/D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -4,11 +4,22 @@
|
|
|
4
4
|
* Centralized location for all session UI text including landing pages,
|
|
5
5
|
* status displays, and session management messages.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { buildCommonTasksSection, buildDomainCommandsSection, buildLiveMonitoringSection, buildSessionManagementSection, buildCdpSection, buildDiscoverySection, } from '../../ui/formatters/sessionFormatters.js';
|
|
8
|
+
import { joinLines } from '../../ui/formatting.js';
|
|
8
9
|
/**
|
|
9
10
|
* Generate the landing page display for session start.
|
|
10
11
|
*
|
|
11
|
-
* Shows a clean, organized overview of available commands grouped by
|
|
12
|
+
* Shows a clean, organized overview of available commands grouped by priority.
|
|
13
|
+
* High-level commands are presented first to guide agents toward token-efficient
|
|
14
|
+
* wrappers before falling back to verbose CDP commands.
|
|
15
|
+
*
|
|
16
|
+
* Section order optimized for agent discoverability:
|
|
17
|
+
* 1. Common tasks with token savings estimates
|
|
18
|
+
* 2. Comprehensive domain command coverage (12+ commands)
|
|
19
|
+
* 3. Live monitoring capabilities
|
|
20
|
+
* 4. Session management
|
|
21
|
+
* 5. Advanced CDP access (positioned as fallback)
|
|
22
|
+
* 6. Discovery resources for agents
|
|
12
23
|
*
|
|
13
24
|
* @param options - Landing page options
|
|
14
25
|
* @returns Formatted landing page string
|
|
@@ -23,25 +34,7 @@ import { section, joinLines } from '../../ui/formatting.js';
|
|
|
23
34
|
*/
|
|
24
35
|
export function landingPage(options) {
|
|
25
36
|
const { url } = options;
|
|
26
|
-
return joinLines('', '
|
|
27
|
-
'bdg cdp --list List all domains',
|
|
28
|
-
'bdg cdp Network --list List Network methods',
|
|
29
|
-
'bdg cdp --search cookie Search methods',
|
|
30
|
-
'bdg cdp runtime.evaluate --params \'{"expression":"document.title"}\'',
|
|
31
|
-
]), '', section('Live Monitoring:', [
|
|
32
|
-
'bdg peek Preview collected data (last 10 items)',
|
|
33
|
-
'bdg tail Continuous monitoring (live updates)',
|
|
34
|
-
'bdg details <type> <id> Full request/console details',
|
|
35
|
-
]), '', section('Domain Wrappers:', [
|
|
36
|
-
'bdg dom query <selector> Query DOM elements',
|
|
37
|
-
'bdg dom eval <js> Execute JavaScript',
|
|
38
|
-
]), '', section('Session:', [
|
|
39
|
-
'bdg status Check session state',
|
|
40
|
-
'bdg stop End session & save output',
|
|
41
|
-
]), '', section('Discovery (for AI agents):', [
|
|
42
|
-
'bdg --help --json Machine-readable schema (commands, options, exit codes)',
|
|
43
|
-
'.claude/skills/bdg/ Claude skill with 15+ recipes & patterns',
|
|
44
|
-
]), '');
|
|
37
|
+
return joinLines('', 'Session Started', '', `Target: ${url}`, '', buildCommonTasksSection(), '', buildDomainCommandsSection(), '', buildLiveMonitoringSection(), '', buildSessionManagementSection(), '', buildCdpSection(), '', buildDiscoverySection(), '');
|
|
45
38
|
}
|
|
46
39
|
/**
|
|
47
40
|
* Generate "session stopped" success message.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/ui/messages/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/ui/messages/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,eAAe,EACf,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAExB,OAAO,SAAS,CACd,EAAE,EACF,iBAAiB,EACjB,EAAE,EACF,WAAW,GAAG,EAAE,EAChB,EAAE,EACF,uBAAuB,EAAE,EACzB,EAAE,EACF,0BAA0B,EAAE,EAC5B,EAAE,EACF,0BAA0B,EAAE,EAC5B,EAAE,EACF,6BAA6B,EAAE,EAC/B,EAAE,EACF,eAAe,EAAE,EACjB,EAAE,EACF,qBAAqB,EAAE,EACvB,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,OAAO,qCAAqC,UAAU,EAAE,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,8BAA8B;IACvC,UAAU,EAAE,yBAAyB;IACrC,MAAM,EAAE,wBAAwB;IAChC,kBAAkB,EAAE,oBAAoB;CAChC,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,wBAAwB,MAAM,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision tree definitions for intent-based command discovery.
|
|
3
|
+
*
|
|
4
|
+
* Provides structured guidance trees that help agents navigate
|
|
5
|
+
* from high-level intents to specific commands through question-based flow.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Decision tree node representing a question and actions.
|
|
9
|
+
*/
|
|
10
|
+
export interface DecisionTreeNode {
|
|
11
|
+
/** Question to determine next action */
|
|
12
|
+
question: string;
|
|
13
|
+
/** Command to execute if answer is yes */
|
|
14
|
+
yesCommand: string;
|
|
15
|
+
/** Next action if answer is no (command name or "next" to continue) */
|
|
16
|
+
noAction: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Complete decision tree for a specific intent domain.
|
|
20
|
+
*/
|
|
21
|
+
export interface DecisionTree {
|
|
22
|
+
/** High-level intent this tree addresses */
|
|
23
|
+
intent: string;
|
|
24
|
+
/** Ordered sequence of decision nodes */
|
|
25
|
+
steps: DecisionTreeNode[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Decision tree registry mapping intent domains to guidance flows.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DECISION_TREES: Record<string, DecisionTree>;
|
|
31
|
+
/**
|
|
32
|
+
* Get decision tree by domain key.
|
|
33
|
+
*
|
|
34
|
+
* @param treeKey - Decision tree identifier
|
|
35
|
+
* @returns Decision tree if found, undefined otherwise
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDecisionTree(treeKey: string): DecisionTree | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Get all decision trees.
|
|
40
|
+
*
|
|
41
|
+
* @returns Complete decision tree registry
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAllDecisionTrees(): Record<string, DecisionTree>;
|
|
44
|
+
/**
|
|
45
|
+
* Search decision trees by intent keyword.
|
|
46
|
+
*
|
|
47
|
+
* @param keyword - Search term (case-insensitive)
|
|
48
|
+
* @returns Matching decision trees with keys
|
|
49
|
+
*/
|
|
50
|
+
export declare function searchDecisionTrees(keyword: string): Array<{
|
|
51
|
+
key: string;
|
|
52
|
+
tree: DecisionTree;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=decisionTrees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decisionTrees.d.ts","sourceRoot":"","sources":["../../src/utils/decisionTrees.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAuIvD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CAK/F"}
|