deepclause-sdk 0.0.89 → 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.
- package/README.md +417 -948
- package/dist/agent.d.ts +18 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +74 -21
- package/dist/agent.js.map +1 -1
- package/dist/cli/config.d.ts +323 -176
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +146 -188
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +61 -425
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/login.d.ts +29 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/login.js +184 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/readline.d.ts +6 -0
- package/dist/cli/readline.d.ts.map +1 -0
- package/dist/cli/readline.js +15 -0
- package/dist/cli/readline.js.map +1 -0
- package/dist/cli/repl-bin.d.ts +9 -0
- package/dist/cli/repl-bin.d.ts.map +1 -0
- package/dist/cli/repl-bin.js +16 -0
- package/dist/cli/repl-bin.js.map +1 -0
- package/dist/cli/repl.d.ts +191 -0
- package/dist/cli/repl.d.ts.map +1 -0
- package/dist/cli/repl.js +1232 -0
- package/dist/cli/repl.js.map +1 -0
- package/dist/cli/run.d.ts +17 -18
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +196 -183
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/set-backend.d.ts +53 -0
- package/dist/cli/set-backend.d.ts.map +1 -0
- package/dist/cli/set-backend.js +259 -0
- package/dist/cli/set-backend.js.map +1 -0
- package/dist/cli/visualize.d.ts +38 -0
- package/dist/cli/visualize.d.ts.map +1 -0
- package/dist/cli/visualize.js +125 -0
- package/dist/cli/visualize.js.map +1 -0
- package/dist/compiler.d.ts +5 -52
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +4 -768
- package/dist/compiler.js.map +1 -1
- package/dist/index.d.ts +27 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/prolog/bridge.d.ts +3 -1
- package/dist/prolog/bridge.d.ts.map +1 -1
- package/dist/prolog/bridge.js +8 -1
- package/dist/prolog/bridge.js.map +1 -1
- package/dist/prolog-src/deepclause_analysis.pl +10 -2
- package/dist/prolog-src/deepclause_mi.pl +2245 -41
- package/dist/repl/agent.d.ts +72 -0
- package/dist/repl/agent.d.ts.map +1 -0
- package/dist/repl/agent.js +366 -0
- package/dist/repl/agent.js.map +1 -0
- package/dist/repl/auth.d.ts +45 -0
- package/dist/repl/auth.d.ts.map +1 -0
- package/dist/repl/auth.js +116 -0
- package/dist/repl/auth.js.map +1 -0
- package/dist/repl/backend.d.ts +290 -0
- package/dist/repl/backend.d.ts.map +1 -0
- package/dist/repl/backend.js +370 -0
- package/dist/repl/backend.js.map +1 -0
- package/dist/repl/compaction.d.ts +122 -0
- package/dist/repl/compaction.d.ts.map +1 -0
- package/dist/repl/compaction.js +318 -0
- package/dist/repl/compaction.js.map +1 -0
- package/dist/repl/export.d.ts +30 -0
- package/dist/repl/export.d.ts.map +1 -0
- package/dist/repl/export.js +23 -0
- package/dist/repl/export.js.map +1 -0
- package/dist/repl/frames.d.ts +21 -0
- package/dist/repl/frames.d.ts.map +1 -0
- package/dist/repl/frames.js +79 -0
- package/dist/repl/frames.js.map +1 -0
- package/dist/repl/harness-tools.d.ts +74 -0
- package/dist/repl/harness-tools.d.ts.map +1 -0
- package/dist/repl/harness-tools.js +121 -0
- package/dist/repl/harness-tools.js.map +1 -0
- package/dist/repl/highlight.d.ts +30 -0
- package/dist/repl/highlight.d.ts.map +1 -0
- package/dist/repl/highlight.js +285 -0
- package/dist/repl/highlight.js.map +1 -0
- package/dist/repl/history.d.ts +234 -0
- package/dist/repl/history.d.ts.map +1 -0
- package/dist/repl/history.js +661 -0
- package/dist/repl/history.js.map +1 -0
- package/dist/repl/index.d.ts +120 -0
- package/dist/repl/index.d.ts.map +1 -0
- package/dist/repl/index.js +107 -0
- package/dist/repl/index.js.map +1 -0
- package/dist/repl/judge.d.ts +51 -0
- package/dist/repl/judge.d.ts.map +1 -0
- package/dist/repl/judge.js +58 -0
- package/dist/repl/judge.js.map +1 -0
- package/dist/repl/markdown.d.ts +25 -0
- package/dist/repl/markdown.d.ts.map +1 -0
- package/dist/repl/markdown.js +103 -0
- package/dist/repl/markdown.js.map +1 -0
- package/dist/repl/picker.d.ts +34 -0
- package/dist/repl/picker.d.ts.map +1 -0
- package/dist/repl/picker.js +81 -0
- package/dist/repl/picker.js.map +1 -0
- package/dist/repl/project-context.d.ts +16 -0
- package/dist/repl/project-context.d.ts.map +1 -0
- package/dist/repl/project-context.js +23 -0
- package/dist/repl/project-context.js.map +1 -0
- package/dist/repl/render.d.ts +160 -0
- package/dist/repl/render.d.ts.map +1 -0
- package/dist/repl/render.js +715 -0
- package/dist/repl/render.js.map +1 -0
- package/dist/repl/session.d.ts +356 -0
- package/dist/repl/session.d.ts.map +1 -0
- package/dist/repl/session.js +1275 -0
- package/dist/repl/session.js.map +1 -0
- package/dist/repl/status.d.ts +100 -0
- package/dist/repl/status.d.ts.map +1 -0
- package/dist/repl/status.js +218 -0
- package/dist/repl/status.js.map +1 -0
- package/dist/repl/tools.d.ts +53 -0
- package/dist/repl/tools.d.ts.map +1 -0
- package/dist/repl/tools.js +307 -0
- package/dist/repl/tools.js.map +1 -0
- package/dist/repl/toolset.d.ts +32 -0
- package/dist/repl/toolset.d.ts.map +1 -0
- package/dist/repl/toolset.js +82 -0
- package/dist/repl/toolset.js.map +1 -0
- package/dist/repl/tui/editor.d.ts +17 -0
- package/dist/repl/tui/editor.d.ts.map +1 -0
- package/dist/repl/tui/editor.js +39 -0
- package/dist/repl/tui/editor.js.map +1 -0
- package/dist/repl/tui/status-bar.d.ts +26 -0
- package/dist/repl/tui/status-bar.d.ts.map +1 -0
- package/dist/repl/tui/status-bar.js +47 -0
- package/dist/repl/tui/status-bar.js.map +1 -0
- package/dist/repl/tui/theme.d.ts +30 -0
- package/dist/repl/tui/theme.d.ts.map +1 -0
- package/dist/repl/tui/theme.js +81 -0
- package/dist/repl/tui/theme.js.map +1 -0
- package/dist/repl/tui/transcript.d.ts +39 -0
- package/dist/repl/tui/transcript.d.ts.map +1 -0
- package/dist/repl/tui/transcript.js +123 -0
- package/dist/repl/tui/transcript.js.map +1 -0
- package/dist/runner.d.ts +132 -13
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +434 -277
- package/dist/runner.js.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +0 -32
- package/dist/sdk.js.map +1 -1
- package/dist/system/assets/docs/AGENT_PROMPT.md +1373 -0
- package/dist/system/assets/docs/DML_AUTHORING.md +195 -0
- package/dist/system/assets/docs/DML_REFERENCE.md +312 -72
- package/dist/system/assets/docs/HARNESS_EXAMPLES.md +172 -0
- package/dist/system/assets/docs/HARNESS_PATTERNS.md +562 -0
- package/dist/system/assets/docs/META_PROMPT.md +68 -0
- package/dist/system/assets/docs/PROLOG_SNIPPETS.md +117 -0
- package/dist/system/assets/index.d.ts +9 -17
- package/dist/system/assets/index.d.ts.map +1 -1
- package/dist/system/assets/index.js +26 -85
- package/dist/system/assets/index.js.map +1 -1
- package/dist/system/runtime/agentvm-manager.d.ts +9 -2
- package/dist/system/runtime/agentvm-manager.d.ts.map +1 -1
- package/dist/system/runtime/agentvm-manager.js +70 -44
- package/dist/system/runtime/agentvm-manager.js.map +1 -1
- package/dist/system/runtime/media.d.ts +23 -0
- package/dist/system/runtime/media.d.ts.map +1 -0
- package/dist/system/runtime/media.js +55 -0
- package/dist/system/runtime/media.js.map +1 -0
- package/dist/system/runtime/shell-limits.d.ts +21 -0
- package/dist/system/runtime/shell-limits.d.ts.map +1 -0
- package/dist/system/runtime/shell-limits.js +39 -0
- package/dist/system/runtime/shell-limits.js.map +1 -0
- package/dist/system/runtime/shell-manager.d.ts +8 -3
- package/dist/system/runtime/shell-manager.d.ts.map +1 -1
- package/dist/system/runtime/shell-manager.js +56 -39
- package/dist/system/runtime/shell-manager.js.map +1 -1
- package/dist/system/runtime/shell-tool-events.js +5 -0
- package/dist/system/runtime/shell-tool-events.js.map +1 -1
- package/dist/system/runtime/token-usage.d.ts +2 -0
- package/dist/system/runtime/token-usage.d.ts.map +1 -1
- package/dist/system/runtime/token-usage.js +7 -0
- package/dist/system/runtime/token-usage.js.map +1 -1
- package/dist/tools.d.ts +3 -21
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +14 -168
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +80 -118
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +19 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +338 -0
- package/dist/validate.js.map +1 -0
- package/dist/visualize/index.d.ts +52 -0
- package/dist/visualize/index.d.ts.map +1 -0
- package/dist/visualize/index.js +189 -0
- package/dist/visualize/index.js.map +1 -0
- package/package.json +17 -15
- package/src/prolog-src/deepclause_analysis.pl +10 -2
- package/src/prolog-src/deepclause_mi.pl +2245 -41
- package/dist/cli/commands.d.ts +0 -42
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -246
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/compile.d.ts +0 -99
- package/dist/cli/compile.d.ts.map +0 -1
- package/dist/cli/compile.js +0 -363
- package/dist/cli/compile.js.map +0 -1
- package/dist/cli/default-skills.d.ts +0 -10
- package/dist/cli/default-skills.d.ts.map +0 -1
- package/dist/cli/default-skills.js +0 -206
- package/dist/cli/default-skills.js.map +0 -1
- package/dist/cli/interactive.d.ts +0 -2
- package/dist/cli/interactive.d.ts.map +0 -1
- package/dist/cli/interactive.js +0 -20
- package/dist/cli/interactive.js.map +0 -1
- package/dist/cli/mcp.d.ts +0 -56
- package/dist/cli/mcp.d.ts.map +0 -1
- package/dist/cli/mcp.js +0 -138
- package/dist/cli/mcp.js.map +0 -1
- package/dist/cli/prompt.d.ts +0 -2
- package/dist/cli/prompt.d.ts.map +0 -1
- package/dist/cli/prompt.js +0 -2
- package/dist/cli/prompt.js.map +0 -1
- package/dist/cli/search.d.ts +0 -19
- package/dist/cli/search.d.ts.map +0 -1
- package/dist/cli/search.js +0 -189
- package/dist/cli/search.js.map +0 -1
- package/dist/cli/tool-args.d.ts +0 -2
- package/dist/cli/tool-args.d.ts.map +0 -1
- package/dist/cli/tool-args.js +0 -39
- package/dist/cli/tool-args.js.map +0 -1
- package/dist/cli/tools.d.ts +0 -36
- package/dist/cli/tools.d.ts.map +0 -1
- package/dist/cli/tools.js +0 -229
- package/dist/cli/tools.js.map +0 -1
- package/dist/cli/tui/index.d.ts +0 -22
- package/dist/cli/tui/index.d.ts.map +0 -1
- package/dist/cli/tui/index.js +0 -29
- package/dist/cli/tui/index.js.map +0 -1
- package/dist/cli/tui.d.ts +0 -167
- package/dist/cli/tui.d.ts.map +0 -1
- package/dist/cli/tui.js +0 -5228
- package/dist/cli/tui.js.map +0 -1
- package/dist/compiler_prompt.d.ts +0 -20
- package/dist/compiler_prompt.d.ts.map +0 -1
- package/dist/compiler_prompt.js +0 -870
- package/dist/compiler_prompt.js.map +0 -1
- package/dist/deepclause-cli.skill +0 -0
- package/dist/prolog-src/deepclause_mi.pl.bak +0 -570
- package/dist/system/assets/docs/CONDUCTOR_PROMPT.md +0 -105
- package/dist/system/assets/docs/DML_COMPILER_PROMPT.md +0 -700
- package/dist/system/assets/docs/TUI.md +0 -150
- package/dist/system/assets/recipes/deepclause-coding-workflow/SKILL.md +0 -100
- package/dist/system/assets/skills/conductor.dml +0 -76
- package/dist/system/assets/skills/deep-planner.dml +0 -412
- package/dist/system/assets/skills/plan.dml +0 -429
- package/dist/system/assets/skills/security-planner.dml +0 -337
- package/dist/system/assets/skills/skill-creator.dml +0 -187
- package/dist/system/runtime/catalog-recipes.d.ts +0 -24
- package/dist/system/runtime/catalog-recipes.d.ts.map +0 -1
- package/dist/system/runtime/catalog-recipes.js +0 -273
- package/dist/system/runtime/catalog-recipes.js.map +0 -1
- package/dist/system/runtime/catalog-skills.d.ts +0 -50
- package/dist/system/runtime/catalog-skills.d.ts.map +0 -1
- package/dist/system/runtime/catalog-skills.js +0 -152
- package/dist/system/runtime/catalog-skills.js.map +0 -1
- package/dist/system/runtime/conductor.d.ts +0 -105
- package/dist/system/runtime/conductor.d.ts.map +0 -1
- package/dist/system/runtime/conductor.js +0 -732
- package/dist/system/runtime/conductor.js.map +0 -1
- package/dist/system/runtime/console-capture.d.ts +0 -9
- package/dist/system/runtime/console-capture.d.ts.map +0 -1
- package/dist/system/runtime/console-capture.js +0 -67
- package/dist/system/runtime/console-capture.js.map +0 -1
- package/dist/system/runtime/dml-executor.d.ts +0 -52
- package/dist/system/runtime/dml-executor.d.ts.map +0 -1
- package/dist/system/runtime/dml-executor.js +0 -203
- package/dist/system/runtime/dml-executor.js.map +0 -1
- package/dist/system/runtime/runtime-tools.d.ts +0 -31
- package/dist/system/runtime/runtime-tools.d.ts.map +0 -1
- package/dist/system/runtime/runtime-tools.js +0 -312
- package/dist/system/runtime/runtime-tools.js.map +0 -1
- package/dist/system/runtime/skill-creator.d.ts +0 -38
- package/dist/system/runtime/skill-creator.d.ts.map +0 -1
- package/dist/system/runtime/skill-creator.js +0 -763
- package/dist/system/runtime/skill-creator.js.map +0 -1
- package/src/prolog-src/deepclause_mi.pl.bak +0 -570
package/dist/tools.js
CHANGED
|
@@ -1,189 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool management utilities
|
|
2
|
+
* Tool management utilities.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export const BUILTIN_COMPILE_TOOLS = [
|
|
8
|
-
{
|
|
9
|
-
name: 'vm_exec',
|
|
10
|
-
description: 'Execute a shell command using the active workspace shell backend. With --sandbox, this runs inside AgentVM.',
|
|
11
|
-
provider: 'agentvm',
|
|
12
|
-
schema: {
|
|
13
|
-
type: 'object',
|
|
14
|
-
properties: {
|
|
15
|
-
command: { type: 'string', description: 'Shell command to execute (e.g., "python3 script.py", "echo hello", "ls -la")' }
|
|
16
|
-
},
|
|
17
|
-
required: ['command']
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: 'web_search',
|
|
22
|
-
description: 'Search the web. Uses Brave Search API if BRAVE_API_KEY is set, otherwise falls back to Bing (no key required).',
|
|
23
|
-
provider: 'brave',
|
|
24
|
-
schema: {
|
|
25
|
-
type: 'object',
|
|
26
|
-
properties: {
|
|
27
|
-
query: { type: 'string', description: 'Search query' },
|
|
28
|
-
count: { type: 'number', description: 'Number of results (default: 10, max: 20)' },
|
|
29
|
-
freshness: { type: 'string', description: 'Filter by freshness: pd (past day), pw (past week), pm (past month), py (past year)' }
|
|
30
|
-
},
|
|
31
|
-
required: ['query']
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'news_search',
|
|
36
|
-
description: 'Search for recent news articles. Uses Brave Search API if BRAVE_API_KEY is set, otherwise falls back to Bing (no key required).',
|
|
37
|
-
provider: 'brave',
|
|
38
|
-
schema: {
|
|
39
|
-
type: 'object',
|
|
40
|
-
properties: {
|
|
41
|
-
query: { type: 'string', description: 'Search query' },
|
|
42
|
-
count: { type: 'number', description: 'Number of results (default: 10, max: 20)' },
|
|
43
|
-
freshness: { type: 'string', description: 'Filter by freshness: pd (past day), pw (past week), pm (past month)' }
|
|
44
|
-
},
|
|
45
|
-
required: ['query']
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
/**
|
|
50
|
-
* Get all built-in tools for compilation
|
|
51
|
-
*/
|
|
52
|
-
export function getBuiltInCompileTools() {
|
|
53
|
-
return [...BUILTIN_COMPILE_TOOLS];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Check if a tool is allowed by the current policy
|
|
5
|
+
* Check if a tool is allowed by the current policy.
|
|
57
6
|
*/
|
|
58
7
|
export function checkToolPolicy(toolName, policy) {
|
|
59
|
-
//
|
|
8
|
+
// ask_user is the human-in-the-loop channel, not a capability. It only
|
|
9
|
+
// relays a question and is exempt from the capability whitelist/blacklist.
|
|
10
|
+
if (toolName === 'ask_user') {
|
|
11
|
+
return { allowed: true };
|
|
12
|
+
}
|
|
60
13
|
if (!policy) {
|
|
61
14
|
return { allowed: true };
|
|
62
15
|
}
|
|
63
|
-
const matches = policy.tools.some(pattern => matchToolPattern(pattern, toolName));
|
|
16
|
+
const matches = policy.tools.some((pattern) => matchToolPattern(pattern, toolName));
|
|
64
17
|
if (policy.mode === 'whitelist') {
|
|
65
18
|
if (matches) {
|
|
66
19
|
return { allowed: true };
|
|
67
20
|
}
|
|
68
|
-
return {
|
|
69
|
-
allowed: false,
|
|
70
|
-
reason: `Tool '${toolName}' is not in the whitelist`
|
|
71
|
-
};
|
|
21
|
+
return { allowed: false, reason: `Tool '${toolName}' is not in the whitelist` };
|
|
72
22
|
}
|
|
73
|
-
// Blacklist mode
|
|
74
23
|
if (matches) {
|
|
75
|
-
return {
|
|
76
|
-
allowed: false,
|
|
77
|
-
reason: `Tool '${toolName}' is blocked by blacklist`
|
|
78
|
-
};
|
|
24
|
+
return { allowed: false, reason: `Tool '${toolName}' is blocked by blacklist` };
|
|
79
25
|
}
|
|
80
26
|
return { allowed: true };
|
|
81
27
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Match a tool name against a pattern (supports wildcards)
|
|
84
|
-
*/
|
|
28
|
+
/** Match a tool name against a pattern (supports `*` wildcards). */
|
|
85
29
|
function matchToolPattern(pattern, toolName) {
|
|
86
|
-
// Convert glob pattern to regex
|
|
87
30
|
const regexPattern = pattern
|
|
88
|
-
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
89
|
-
.replace(/\*/g, '.*');
|
|
90
|
-
|
|
91
|
-
return regex.test(toolName);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Extract tool name from a Prolog term
|
|
95
|
-
* e.g., "web_search(query)" -> "web_search"
|
|
96
|
-
*/
|
|
97
|
-
export function extractToolName(term) {
|
|
98
|
-
const match = term.match(/^([a-z_][a-z0-9_]*)/i);
|
|
99
|
-
return match ? match[1] : term;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Parse tool arguments from a Prolog term
|
|
103
|
-
* e.g., "web_search(\"query\", 10)" -> ["query", 10]
|
|
104
|
-
*/
|
|
105
|
-
export function parseToolArgs(term) {
|
|
106
|
-
// Find the content between parentheses
|
|
107
|
-
const match = term.match(/\((.+)\)$/s);
|
|
108
|
-
if (!match) {
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
const argsStr = match[1];
|
|
112
|
-
const args = [];
|
|
113
|
-
// Simple parsing (doesn't handle all edge cases)
|
|
114
|
-
let current = '';
|
|
115
|
-
let depth = 0;
|
|
116
|
-
let inString = false;
|
|
117
|
-
let stringChar = '';
|
|
118
|
-
for (let i = 0; i < argsStr.length; i++) {
|
|
119
|
-
const char = argsStr[i];
|
|
120
|
-
const prevChar = i > 0 ? argsStr[i - 1] : '';
|
|
121
|
-
if (!inString) {
|
|
122
|
-
if (char === '"' || char === "'") {
|
|
123
|
-
inString = true;
|
|
124
|
-
stringChar = char;
|
|
125
|
-
current += char;
|
|
126
|
-
}
|
|
127
|
-
else if (char === '(' || char === '[' || char === '{') {
|
|
128
|
-
depth++;
|
|
129
|
-
current += char;
|
|
130
|
-
}
|
|
131
|
-
else if (char === ')' || char === ']' || char === '}') {
|
|
132
|
-
depth--;
|
|
133
|
-
current += char;
|
|
134
|
-
}
|
|
135
|
-
else if (char === ',' && depth === 0) {
|
|
136
|
-
args.push(parseValue(current.trim()));
|
|
137
|
-
current = '';
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
current += char;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
current += char;
|
|
145
|
-
if (char === stringChar && prevChar !== '\\') {
|
|
146
|
-
inString = false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (current.trim()) {
|
|
151
|
-
args.push(parseValue(current.trim()));
|
|
152
|
-
}
|
|
153
|
-
return args;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Parse a single value from Prolog term string
|
|
157
|
-
*/
|
|
158
|
-
function parseValue(str) {
|
|
159
|
-
// String literal
|
|
160
|
-
if ((str.startsWith('"') && str.endsWith('"')) ||
|
|
161
|
-
(str.startsWith("'") && str.endsWith("'"))) {
|
|
162
|
-
return str.slice(1, -1)
|
|
163
|
-
.replace(/\\"/g, '"')
|
|
164
|
-
.replace(/\\'/g, "'")
|
|
165
|
-
.replace(/\\\\/g, '\\');
|
|
166
|
-
}
|
|
167
|
-
// Number
|
|
168
|
-
const num = Number(str);
|
|
169
|
-
if (!isNaN(num)) {
|
|
170
|
-
return num;
|
|
171
|
-
}
|
|
172
|
-
// Boolean
|
|
173
|
-
if (str === 'true')
|
|
174
|
-
return true;
|
|
175
|
-
if (str === 'false')
|
|
176
|
-
return false;
|
|
177
|
-
// List
|
|
178
|
-
if (str.startsWith('[') && str.endsWith(']')) {
|
|
179
|
-
// Recursively parse list items
|
|
180
|
-
const inner = str.slice(1, -1);
|
|
181
|
-
if (!inner.trim())
|
|
182
|
-
return [];
|
|
183
|
-
// For simplicity, just return the string for now
|
|
184
|
-
return str;
|
|
185
|
-
}
|
|
186
|
-
// Atom or variable
|
|
187
|
-
return str;
|
|
31
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
32
|
+
.replace(/\*/g, '.*');
|
|
33
|
+
return new RegExp(`^${regexPattern}$`).test(toolName);
|
|
188
34
|
}
|
|
189
35
|
//# sourceMappingURL=tools.js.map
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names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AG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -28,8 +28,6 @@ export interface CreateOptions {
|
|
|
28
28
|
debug?: boolean;
|
|
29
29
|
/** Provider-specific options passed to the AI SDK (e.g. Google thinkingConfig, OpenAI reasoningEffort) */
|
|
30
30
|
providerOptions?: Record<string, Record<string, any>>;
|
|
31
|
-
/** Optional memory compaction settings for task()/prompt() execution */
|
|
32
|
-
compaction?: CompactionOptions;
|
|
33
31
|
/** Reasoning effort type (auto-resolved from model database) */
|
|
34
32
|
reasoningType?: import('./system/config/model-database.js').ReasoningType;
|
|
35
33
|
/** Reasoning budget map for token-based reasoning control */
|
|
@@ -45,9 +43,23 @@ export interface CreateOptions {
|
|
|
45
43
|
/** Name of the default judgment backend. Defaults to the first registered backend. */
|
|
46
44
|
defaultJudge?: string;
|
|
47
45
|
}
|
|
46
|
+
/** A workspace-relative media reference (never the bytes). */
|
|
47
|
+
export interface MediaRef {
|
|
48
|
+
path: string;
|
|
49
|
+
mimeType: string;
|
|
50
|
+
}
|
|
51
|
+
/** Resolved media bytes attached to a backend message (base64). */
|
|
52
|
+
export interface LLMBackendMedia {
|
|
53
|
+
mimeType: string;
|
|
54
|
+
data: string;
|
|
55
|
+
}
|
|
48
56
|
export interface LLMBackendMessage {
|
|
49
57
|
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
50
58
|
content: string;
|
|
59
|
+
/** Resolved media bytes to send with this message. */
|
|
60
|
+
media?: LLMBackendMedia[];
|
|
61
|
+
/** Reference-only media carried through to conversation memory. */
|
|
62
|
+
mediaRefs?: MediaRef[];
|
|
51
63
|
toolCalls?: LLMBackendToolCall[];
|
|
52
64
|
toolCallId?: string;
|
|
53
65
|
toolName?: string;
|
|
@@ -72,56 +84,25 @@ export interface LLMBackendRequest {
|
|
|
72
84
|
signal?: AbortSignal;
|
|
73
85
|
/** Receives model text as it becomes available. Backends may emit one final chunk. */
|
|
74
86
|
onText?: (chunk: string) => void;
|
|
87
|
+
/** Receives reasoning/thinking text as it becomes available (display only). */
|
|
88
|
+
onReasoning?: (chunk: string) => void;
|
|
75
89
|
}
|
|
76
90
|
export interface LLMBackendResponse {
|
|
77
91
|
text: string;
|
|
78
92
|
toolCalls?: LLMBackendToolCall[];
|
|
79
93
|
usage?: LLMUsage;
|
|
80
94
|
finishReason?: 'stop' | 'length' | 'tool_use' | 'error' | 'aborted';
|
|
95
|
+
/** Accumulated reasoning/thinking text (display only; not written to DML memory). */
|
|
96
|
+
reasoning?: string;
|
|
81
97
|
/** Opaque host-native assistant message to replay on a subsequent backend call. */
|
|
82
98
|
providerData?: unknown;
|
|
83
99
|
}
|
|
84
100
|
export interface LLMBackend {
|
|
85
101
|
complete(request: LLMBackendRequest): Promise<LLMBackendResponse>;
|
|
86
102
|
}
|
|
87
|
-
export type CompactorSourceType = 'inline' | 'file' | 'auto';
|
|
88
103
|
export type CompactionScope = 'session' | 'loop' | 'run';
|
|
89
104
|
export type CompactionTrigger = 'before_user_message' | 'before_model_call' | 'before_task' | 'after_task';
|
|
90
105
|
export type CompactionAction = 'running' | 'applied' | 'skipped' | 'failed';
|
|
91
|
-
export interface CompactorDefinition {
|
|
92
|
-
/** Inline DML source or a path to a DML file */
|
|
93
|
-
source: string;
|
|
94
|
-
/** How to interpret the source field. Defaults to 'auto'. */
|
|
95
|
-
sourceType?: CompactorSourceType;
|
|
96
|
-
/** Timeout for the DML compactor run in milliseconds. */
|
|
97
|
-
timeoutMs?: number;
|
|
98
|
-
/** Optional gas limit for the compactor DML run. */
|
|
99
|
-
gasLimit?: number;
|
|
100
|
-
/** Optional model override for compactor task()/prompt() calls. */
|
|
101
|
-
model?: string;
|
|
102
|
-
/** Optional provider override for the compactor model. */
|
|
103
|
-
provider?: 'openai' | 'anthropic' | 'google' | 'openrouter';
|
|
104
|
-
/** Whether the compactor may access the caller's registered exec() tools. Defaults to false. */
|
|
105
|
-
inheritTools?: boolean;
|
|
106
|
-
/** Optional tool policy applied to the compactor run. */
|
|
107
|
-
toolPolicy?: ToolPolicy | null;
|
|
108
|
-
}
|
|
109
|
-
export interface CompactorBinding {
|
|
110
|
-
/** Optional binding label used in logs and events. */
|
|
111
|
-
name?: string;
|
|
112
|
-
/** Runtime scope to which this compactor is attached. */
|
|
113
|
-
scope: CompactionScope;
|
|
114
|
-
/** Trigger point within the scope. */
|
|
115
|
-
trigger: CompactionTrigger;
|
|
116
|
-
/** The DML compactor to run when this binding is evaluated. */
|
|
117
|
-
compactor: CompactorDefinition;
|
|
118
|
-
}
|
|
119
|
-
export interface CompactionOptions {
|
|
120
|
-
/** Enables compactor evaluation. Defaults to false. */
|
|
121
|
-
enabled?: boolean;
|
|
122
|
-
/** Compactor bindings evaluated at specific runtime hook points. */
|
|
123
|
-
bindings?: CompactorBinding[];
|
|
124
|
-
}
|
|
125
106
|
/**
|
|
126
107
|
* Options for running DML code
|
|
127
108
|
*/
|
|
@@ -143,8 +124,6 @@ export interface RunOptions {
|
|
|
143
124
|
/** Initial conversation messages seeded into memory before DML execution.
|
|
144
125
|
* These appear as proper memory messages, not in the synthesized system prompt. */
|
|
145
126
|
initialMessages?: MemoryMessage[];
|
|
146
|
-
/** Per-run override for SDK compaction settings. */
|
|
147
|
-
compaction?: CompactionOptions;
|
|
148
127
|
}
|
|
149
128
|
/**
|
|
150
129
|
* Trace entry for execution logging
|
|
@@ -177,9 +156,49 @@ export interface LLMUsage {
|
|
|
177
156
|
cacheWriteTokens?: number;
|
|
178
157
|
reasoningTokens?: number;
|
|
179
158
|
}
|
|
180
|
-
|
|
181
|
-
|
|
159
|
+
/**
|
|
160
|
+
* A single rendered variable binding from a goal-mode solution.
|
|
161
|
+
* `value` is the Prolog text of the binding ('_' when unbound).
|
|
162
|
+
*/
|
|
163
|
+
export interface DMLBinding {
|
|
164
|
+
name: string;
|
|
165
|
+
value: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* One goal-mode answer. A goal with N solutions yields N solution events.
|
|
169
|
+
* `deterministic` is an optimization hint only; the pager can always offer
|
|
170
|
+
* the next solution.
|
|
171
|
+
*/
|
|
172
|
+
export interface DMLSolution {
|
|
173
|
+
bindings: DMLBinding[];
|
|
174
|
+
deterministic: boolean;
|
|
175
|
+
}
|
|
176
|
+
/** Frame metadata attached to events emitted by a nested/reentrant run. */
|
|
177
|
+
export interface FrameEventMeta {
|
|
178
|
+
frameId?: string;
|
|
179
|
+
depth?: number;
|
|
180
|
+
frameKind?: FrameKind;
|
|
181
|
+
}
|
|
182
|
+
export interface DMLEvent extends FrameEventMeta {
|
|
183
|
+
type: 'output' | 'log' | 'answer' | 'input_required' | 'error' | 'finished' | 'stream' | 'reasoning' | 'tool_call' | 'model_call' | 'usage' | 'memory_compaction' | 'task_activity' | 'solution' | 'meta_result' | 'media';
|
|
182
184
|
content?: string;
|
|
185
|
+
/** Media produced by a step (path in the workspace, optional inline base64). */
|
|
186
|
+
media?: {
|
|
187
|
+
path?: string;
|
|
188
|
+
mimeType: string;
|
|
189
|
+
data?: string;
|
|
190
|
+
};
|
|
191
|
+
/** Model-call lifecycle (only for 'model_call' events). */
|
|
192
|
+
modelCallState?: 'started' | 'completed' | 'failed';
|
|
193
|
+
/** Model id for a 'model_call' event, when known. */
|
|
194
|
+
modelId?: string;
|
|
195
|
+
/** Goal-mode solution (only for 'solution' events). */
|
|
196
|
+
solution?: DMLSolution;
|
|
197
|
+
/** Prompt-mode meta task result (only for 'meta_result' events). */
|
|
198
|
+
metaResult?: {
|
|
199
|
+
code: string;
|
|
200
|
+
answer: string;
|
|
201
|
+
};
|
|
183
202
|
prompt?: string;
|
|
184
203
|
/** Execution trace (only present in 'finished' event when trace mode enabled) */
|
|
185
204
|
trace?: TraceEntry[];
|
|
@@ -199,6 +218,8 @@ export interface DMLEvent {
|
|
|
199
218
|
toolBackend?: 'host' | 'sandbox';
|
|
200
219
|
/** Tool exit code when available (only for 'tool_call' events) */
|
|
201
220
|
toolExitCode?: number;
|
|
221
|
+
/** Wall-clock duration of the tool call in ms (only for completed/failed 'tool_call' events) */
|
|
222
|
+
toolDurationMs?: number;
|
|
202
223
|
/** Tool summary message when available (only for 'tool_call' events) */
|
|
203
224
|
toolSummary?: string;
|
|
204
225
|
/** Tool failure message when available (only for 'tool_call' events) */
|
|
@@ -211,8 +232,6 @@ export interface DMLEvent {
|
|
|
211
232
|
compactionTrigger?: CompactionTrigger;
|
|
212
233
|
/** Compaction action outcome (only for 'memory_compaction' events) */
|
|
213
234
|
compactionAction?: CompactionAction;
|
|
214
|
-
/** Binding label used for the compaction event when available */
|
|
215
|
-
compactionBindingName?: string;
|
|
216
235
|
/** Estimated tokens before compaction (only for 'memory_compaction' events) */
|
|
217
236
|
beforeTokens?: number;
|
|
218
237
|
/** Estimated tokens after compaction (only for 'memory_compaction' events) */
|
|
@@ -239,80 +258,20 @@ export interface DMLEvent {
|
|
|
239
258
|
/**
|
|
240
259
|
* Tool definition for registering external tools
|
|
241
260
|
*/
|
|
261
|
+
/** Per-call context handed to a tool's `execute`. */
|
|
262
|
+
export interface ToolExecutionContext {
|
|
263
|
+
/** Abort signal for the current turn; long-running tools should honor it. */
|
|
264
|
+
signal?: AbortSignal;
|
|
265
|
+
/** Stream events produced while the tool runs (e.g. an `execute` child frame). */
|
|
266
|
+
onEvent?: (event: DMLEvent) => void;
|
|
267
|
+
}
|
|
242
268
|
export interface ToolDefinition {
|
|
243
269
|
/** Human-readable description of what the tool does */
|
|
244
270
|
description: string;
|
|
245
271
|
/** JSON Schema for tool parameters */
|
|
246
272
|
parameters: JsonSchema;
|
|
247
273
|
/** Function to execute the tool */
|
|
248
|
-
execute: (args: Record<string, unknown
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Tool representation for the compiler
|
|
252
|
-
*/
|
|
253
|
-
export interface CompileTool {
|
|
254
|
-
name: string;
|
|
255
|
-
description: string;
|
|
256
|
-
provider: string;
|
|
257
|
-
schema?: object;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Static Analysis Warning
|
|
261
|
-
*/
|
|
262
|
-
export interface AnalysisWarning {
|
|
263
|
-
level: 'critical' | 'high' | 'medium' | 'low';
|
|
264
|
-
message: string;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Result of DML Analysis
|
|
268
|
-
*/
|
|
269
|
-
export interface AnalysisResult {
|
|
270
|
-
valid: boolean;
|
|
271
|
-
warnings: AnalysisWarning[];
|
|
272
|
-
capabilities: string[];
|
|
273
|
-
auditorReport?: string;
|
|
274
|
-
error?: string;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Options for DML compilation
|
|
278
|
-
*/
|
|
279
|
-
export interface CompileOptions {
|
|
280
|
-
/** Model to use for compilation */
|
|
281
|
-
model?: string;
|
|
282
|
-
/** Provider for the model */
|
|
283
|
-
provider?: 'openai' | 'anthropic' | 'google' | 'openrouter';
|
|
284
|
-
/** Temperature for LLM calls (0-1) */
|
|
285
|
-
temperature?: number;
|
|
286
|
-
/** Maximum number of compilation attempts */
|
|
287
|
-
maxAttempts?: number;
|
|
288
|
-
/** Enable verbose logging during compilation */
|
|
289
|
-
verbose?: boolean;
|
|
290
|
-
/** Custom tools to describe to the compiler */
|
|
291
|
-
tools?: CompileTool[];
|
|
292
|
-
/** Run LLM-based security audit */
|
|
293
|
-
audit?: boolean;
|
|
294
|
-
/** Base URL for the LLM API (e.g. a proxy endpoint) */
|
|
295
|
-
baseUrl?: string;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Result of a DML compilation
|
|
299
|
-
*/
|
|
300
|
-
export interface CompileResult {
|
|
301
|
-
/** Compiled DML code */
|
|
302
|
-
dml: string;
|
|
303
|
-
/** Tool dependencies extracted from the DML */
|
|
304
|
-
tools: string[];
|
|
305
|
-
/** Brief explanation of what the program does */
|
|
306
|
-
explanation?: string;
|
|
307
|
-
/** Number of attempts taken to compile */
|
|
308
|
-
attempts?: number;
|
|
309
|
-
/** Validation details */
|
|
310
|
-
valid: boolean;
|
|
311
|
-
errors?: string[];
|
|
312
|
-
/** Static and Semantic Analysis results */
|
|
313
|
-
analysis?: AnalysisResult;
|
|
314
|
-
/** Token usage from LLM calls during compilation */
|
|
315
|
-
usageByModel?: import('./system/runtime/token-usage.js').TokenUsageByModel;
|
|
274
|
+
execute: (args: Record<string, unknown>, context?: ToolExecutionContext) => Promise<unknown>;
|
|
316
275
|
}
|
|
317
276
|
/**
|
|
318
277
|
* JSON Schema type for tool parameters
|
|
@@ -346,13 +305,6 @@ export interface DeepClauseSDK {
|
|
|
346
305
|
* @yields DML events (output, log, answer, etc.)
|
|
347
306
|
*/
|
|
348
307
|
runDML(code: string, options?: RunOptions): AsyncGenerator<DMLEvent>;
|
|
349
|
-
/**
|
|
350
|
-
* Compile Markdown task description to DML
|
|
351
|
-
* @param source - Markdown content or path to .md file
|
|
352
|
-
* @param options - Compilation options
|
|
353
|
-
* @returns Compiled DML and metadata
|
|
354
|
-
*/
|
|
355
|
-
compile(source: string, options?: CompileOptions): Promise<CompileResult>;
|
|
356
308
|
/**
|
|
357
309
|
* Register an external tool
|
|
358
310
|
* @param name - Tool name (used in exec())
|
|
@@ -399,6 +351,14 @@ export interface DeepClauseSDK {
|
|
|
399
351
|
*/
|
|
400
352
|
dispose(): Promise<void>;
|
|
401
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Kind of execution frame in the runner's reentrant frame stack.
|
|
356
|
+
*
|
|
357
|
+
* - `query` — the default engine created by `runDML` (one solution / agent_main)
|
|
358
|
+
* - `nested` — an `execute` child frame run by the authoring agent
|
|
359
|
+
* - `object` — a harness run after a prompt commit (runtime tool policy)
|
|
360
|
+
*/
|
|
361
|
+
export type FrameKind = 'query' | 'nested' | 'object';
|
|
402
362
|
/**
|
|
403
363
|
* Variable with type information for type-safe LLM outputs
|
|
404
364
|
*/
|
|
@@ -425,6 +385,8 @@ export interface PrologResponse {
|
|
|
425
385
|
export interface MemoryMessage {
|
|
426
386
|
role: 'system' | 'user' | 'assistant';
|
|
427
387
|
content: string;
|
|
388
|
+
/** Reference-only media attached to this message (resolved at call time). */
|
|
389
|
+
media?: MediaRef[];
|
|
428
390
|
}
|
|
429
391
|
/**
|
|
430
392
|
* Agent loop tool definitions
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAExE,YAAY,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,SAAS,GACV,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC5D,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0GAA0G;IAE1G,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAA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zB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC;CACzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DML validation and linting.
|
|
3
|
+
*
|
|
4
|
+
* Parses DML with the real Prolog reader and applies structural/lint checks.
|
|
5
|
+
* This is the surviving part of the old compiler module (the Markdown->DML
|
|
6
|
+
* generator was removed); it is exported as `deepclause-sdk/validate` and used
|
|
7
|
+
* by the CLI's `validate_dml` runtime tool and by downstream apps
|
|
8
|
+
* (`deepclause-pi`, `sop2harness`).
|
|
9
|
+
*/
|
|
10
|
+
export interface ValidationResult {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
errors: string[];
|
|
13
|
+
warnings?: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validate DML code using the actual Prolog parser
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateWithProlog(dml: string): Promise<ValidationResult>;
|
|
19
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAkBD;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyF/E"}
|