deepclause-sdk 0.0.80 → 0.0.82

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,303 @@
1
+ % Security planner — generates a multi-strategy DML plan for finding bugs and vulnerabilities.
2
+ % Each strategy uses a different analysis approach. Prolog backtracking tries them in order.
3
+
4
+ tool(consult_recipes(Query, Result),
5
+ "Search the recipe library for workflow guidance and conventions.") :-
6
+ exec(consult_recipes(query: Query, max_results: 3), Result).
7
+
8
+ tool(search_web(Query, Results),
9
+ "Search the web for CVEs, security advisories, and documentation.") :-
10
+ exec(web_search(query: Query), Results).
11
+
12
+ tool(fetch_url(Url, Content),
13
+ "Fetch a web page for security documentation or advisory details.") :-
14
+ exec(url_fetch(url: Url), Result),
15
+ get_dict(body, Result, Content).
16
+
17
+ tool(run_bash(Command, Output),
18
+ "Run a shell command in the workspace. Use for grep, find, static analyzers, etc.") :-
19
+ exec(bash(command: Command), Output).
20
+
21
+ tool(ask_user(Prompt, Response),
22
+ "Ask the user for clarification about scope, severity thresholds, or context.") :-
23
+ exec(ask_user(prompt: Prompt), Result),
24
+ get_dict(user_response, Result, Response).
25
+
26
+ agent_main(Request) :-
27
+ load_dml_reference(DmlReference),
28
+ resolve_model_info(ModelId, Complexity, Reasoning, TaskCount),
29
+ format(string(SystemPrompt), "You create multi-strategy security analysis plans for DeepClause.~n~nTarget: ~w~n~nA multi-strategy plan contains multiple agent_main clauses. Prolog tries them in order — if the first strategy finds nothing, it backtracks and tries the next strategy. answer/1 commits on success.~n~nYour job:~n1. Generate a short slug for the plan file.~n2. Generate ~w fundamentally different strategies for finding bugs and vulnerabilities.~n3. For each strategy, generate a task list with tool assignments and reasoning effort.~n4. Each strategy should examine the codebase from a different angle.~n5. The assembler creates a DML file with one agent_main clause per strategy, plus a fallback.~n~nStrategy ideas (suggest different ones based on the target):~n- Static pattern analysis: grep for dangerous functions, hardcoded secrets, SQL injection patterns~n- Data flow analysis: trace user input through the code to sinks (eval, exec, SQL queries, template rendering)~n- Dependency audit: scan package files for known vulnerabilities, check for pinned vs floating versions~n- Configuration review: check for insecure defaults, missing auth, exposed secrets, permissive CORS~n- Input validation audit: check all entry points for missing/insufficient validation~n- Error handling review: check for information leaks in error messages, unhandled exceptions~n- Authentication/authorization review: check for broken access control, session management issues~n- Race condition / concurrency analysis: check for TOCTOU, missing locks, async issues~n~nEach strategy should produce a findings report. The first strategy to find and report issues wins via answer/1.~n~nDML language reference:~n~n~s", [Request, TaskCount, DmlReference]),
30
+ system(SystemPrompt),
31
+
32
+ task("Create a short file-safe slug for this security analysis target: '{Request}'.~nRequirements:~n- lowercase letters, digits, and underscores only~n- 2 to 6 words when possible~n- no file extension~n- prefix with 'audit_' if not already present~nStore only the slug in PlanSlug.", string(PlanSlug)),
33
+
34
+ generate_strategies(Request, TaskCount, Strategies),
35
+
36
+ generate_all_strategy_tasks(Request, Strategies, StrategyPlans),
37
+
38
+ make_directory_path('plans'),
39
+ format(string(FilePath), "plans/~w.dml", [PlanSlug]),
40
+
41
+ build_review_message(FilePath, StrategyPlans, ReviewMessage),
42
+ output(ReviewMessage),
43
+
44
+ output("Assembling multi-strategy security plan file..."),
45
+ assemble_multi_strategy_dml(StrategyPlans, PlanDml),
46
+ exec(write_file(path: FilePath, content: PlanDml), _),
47
+ exec(validate_dml(dml_file: FilePath), ValidationResult),
48
+ finish_plan_creation(FilePath, PlanSlug, ValidationResult, ReviewMessage).
49
+
50
+ %% resolve_model_info(-ModelId, -Complexity, -Reasoning, -TaskCount)
51
+ resolve_model_info(ModelId, Complexity, Reasoning, TaskCount) :-
52
+ ( catch(
53
+ ( param(model_info, ModelInfo),
54
+ is_dict(ModelInfo),
55
+ get_dict(modelId, ModelInfo, ModelId),
56
+ ( get_dict(complexity, ModelInfo, C) -> Complexity = C ; Complexity = medium ),
57
+ ( get_dict(reasoning, ModelInfo, R), R == true -> Reasoning = true ; Reasoning = false )
58
+ ),
59
+ _,
60
+ fail
61
+ )
62
+ -> true
63
+ ; ModelId = "unknown",
64
+ Complexity = medium,
65
+ Reasoning = false
66
+ ),
67
+ task_count_for_complexity(Complexity, TaskCount).
68
+
69
+ task_count_for_complexity("high", "3").
70
+ task_count_for_complexity("medium", "3").
71
+ task_count_for_complexity("low", "3").
72
+ task_count_for_complexity(high, "3").
73
+ task_count_for_complexity(medium, "3").
74
+ task_count_for_complexity(low, "3").
75
+
76
+ %% generate_strategies(+Request, +TaskCount, -Strategies)
77
+ generate_strategies(Request, TaskCount, Strategies) :-
78
+ task("Generate {TaskCount} fundamentally different security analysis strategies for this target:
79
+
80
+ '{Request}'
81
+
82
+ Each strategy must use a different analysis approach:
83
+ - Different tooling (grep vs static analyzer vs dependency scanner vs manual review)
84
+ - Different vulnerability classes (injection vs auth vs config vs crypto vs deps)
85
+ - Different code perspectives (input paths vs output paths vs state management vs error handling)
86
+
87
+ For each strategy provide:
88
+ - A short name identifying the approach
89
+ - A colon
90
+ - A brief description of what it looks for and how
91
+
92
+ One strategy per line. Each strategy should be independently capable of finding real issues.
93
+
94
+ Store the list of strategy strings in Strategies.", list(string(Strategies))).
95
+
96
+ %% generate_all_strategy_tasks(+Request, +Strategies, -StrategyPlans)
97
+ generate_all_strategy_tasks(_Request, [], []).
98
+ generate_all_strategy_tasks(Request, [Strategy|RestStrategies], [plan{strategy: Strategy, steps: Steps}|RestPlans]) :-
99
+ generate_strategy_tasks(Request, Strategy, Steps),
100
+ generate_all_strategy_tasks(Request, RestStrategies, RestPlans).
101
+
102
+ %% generate_strategy_tasks(+Request, +Strategy, -Steps)
103
+ generate_strategy_tasks(Request, Strategy, Steps) :-
104
+ ( param(model_info, ModelInfo)
105
+ -> ( get_dict(reasoning, ModelInfo, R), R == true
106
+ -> ReasoningNote = "The execution model supports reasoning. Assign reasoning effort per task: none, low, medium, or high. Use 'high' for complex data flow analysis."
107
+ ; ReasoningNote = "The execution model does not support reasoning. Set reasoning to 'none' for all tasks."
108
+ )
109
+ ; ReasoningNote = "Set reasoning to 'none' for all tasks."
110
+ ),
111
+ task("Break this security analysis strategy into 3 to 8 focused execution tasks.
112
+
113
+ Target: {Request}
114
+ Strategy: {Strategy}
115
+
116
+ Available tools (use ONLY these exact names):
117
+ - run_bash: Run a shell command (grep, find, static analyzers, cat files, etc.)
118
+ - search_web: Search for CVEs and security documentation
119
+ - fetch_url: Fetch security advisories or documentation
120
+ - consult_recipes: Search recipe library for workflow guidance
121
+ - ask_user: Ask the user for clarification
122
+
123
+ Note: There is no separate save_file or read_file tool. File operations go through run_bash.
124
+
125
+ {ReasoningNote}
126
+
127
+ Also specify a recipe query for each task if relevant (null otherwise).
128
+
129
+ Return a JSON array of objects:
130
+ [{\"description\": \"task description\", \"tools\": [\"tool_name\", ...], \"reasoning\": \"none|low|medium|high\", \"recipe\": \"query string or null\"}]
131
+
132
+ Return ONLY the JSON array.", string(TasksJson)),
133
+ ( catch(parse_plan_json(TasksJson, Steps), _, fail)
134
+ -> true
135
+ ; fallback_plan_steps_from_strategy(Strategy, Steps)
136
+ ).
137
+
138
+ %% Valid tool names
139
+ valid_plan_tool(run_bash).
140
+ valid_plan_tool(run_skill).
141
+ valid_plan_tool(consult_recipes).
142
+ valid_plan_tool(search_web).
143
+ valid_plan_tool(search_news).
144
+ valid_plan_tool(fetch_url).
145
+ valid_plan_tool(download_file).
146
+ valid_plan_tool(create_new_skill).
147
+ valid_plan_tool(ask_user).
148
+ valid_plan_tool(inform_user).
149
+
150
+ tool_name_to_atom(Raw, Atom) :-
151
+ ( atom(Raw) -> Atom = Raw
152
+ ; string(Raw) -> atom_string(Atom, Raw)
153
+ ; Atom = Raw
154
+ ).
155
+
156
+ parse_plan_json(Json, PlanSteps) :-
157
+ atom_json_dict(Json, JsonArray, []),
158
+ is_list(JsonArray),
159
+ maplist(parse_plan_step, JsonArray, PlanSteps).
160
+
161
+ parse_plan_step(Dict, plan_step{description: Desc, tools: Tools, reasoning: Reasoning, recipe: Recipe}) :-
162
+ Desc = Dict.get(description),
163
+ ( Desc = null -> throw(parse_error) ; true ),
164
+ ToolsRaw = Dict.get(tools),
165
+ ( is_list(ToolsRaw)
166
+ -> findall(TA, (member(TR, ToolsRaw), tool_name_to_atom(TR, TA), valid_plan_tool(TA)), ValidTools),
167
+ ( ValidTools = [] -> Tools = all ; Tools = ValidTools )
168
+ ; Tools = all ),
169
+ ReasoningRaw = Dict.get(reasoning),
170
+ ( atom(ReasoningRaw) -> atom_string(ReasoningRaw, Reasoning)
171
+ ; string(ReasoningRaw) -> Reasoning = ReasoningRaw
172
+ ; Reasoning = "none"
173
+ ),
174
+ RecipeRaw = Dict.get(recipe),
175
+ ( ( RecipeRaw = null ; var(RecipeRaw) )
176
+ -> Recipe = "none"
177
+ ; atom(RecipeRaw)
178
+ -> atom_string(RecipeRaw, Recipe)
179
+ ; string(RecipeRaw)
180
+ -> Recipe = RecipeRaw
181
+ ; Recipe = "none"
182
+ ).
183
+
184
+ fallback_plan_steps_from_strategy(Strategy, [plan_step{description: Strategy, tools: all, reasoning: "none", recipe: "none"}]).
185
+
186
+ %% assemble_multi_strategy_dml(+StrategyPlans, -PlanDml)
187
+ assemble_multi_strategy_dml(StrategyPlans, PlanDml) :-
188
+ conductor_tool_definitions(ToolBlock),
189
+ build_strategy_clauses(StrategyPlans, Clauses),
190
+ format(string(PlanDml), "% Generated DeepClause security analysis plan.~n% Prolog tries strategies in order; answer/1 commits on success.~n~n~s~n~n~s~nagent_main :-~n answer(\"No vulnerabilities found by any strategy.\").~n", [ToolBlock, Clauses]).
191
+
192
+ %% build_strategy_clauses(+StrategyPlans, -Clauses)
193
+ build_strategy_clauses([], "").
194
+ build_strategy_clauses([Plan|Rest], Clauses) :-
195
+ Strategy = Plan.strategy,
196
+ Steps = Plan.steps,
197
+ build_system_prompt_for_strategy(Strategy, SystemPrompt),
198
+ build_task_lines(Steps, TaskLines),
199
+ format(string(StratOutput), "Starting strategy: ~w", [Strategy]),
200
+ format(string(StratAnswer), "Findings reported via strategy: ~w", [Strategy]),
201
+ format(string(Clause), "agent_main :-~n system(~q),~n output(~q),~n~s answer(~q).~n~n", [SystemPrompt, StratOutput, TaskLines, StratAnswer]),
202
+ build_strategy_clauses(Rest, RestClauses),
203
+ string_concat(Clause, RestClauses, Clauses).
204
+
205
+ %% build_system_prompt_for_strategy(+Strategy, -SystemPrompt)
206
+ build_system_prompt_for_strategy(Strategy, SystemPrompt) :-
207
+ format(string(SystemPrompt), "You are a security analyst executing a generated DeepClause plan using this strategy:~n~nStrategy: ~w~n~nWorkflow:~n- Start by understanding the codebase structure and identifying the relevant files~n- Read source files and configuration to understand the attack surface~n- Apply the strategy's analysis approach systematically~n- For each finding, record: severity (critical/high/medium/low/info), file path, line number (if applicable), description, and recommendation~n- Write findings to .deepclause.tmp/scratchpad.md (append with >>) so other strategies can see them~n- Read the scratchpad at the start: run_bash('cat .deepclause.tmp/scratchpad.md 2>/dev/null || echo empty')~n- If this strategy finds no issues, it fails and a different strategy is tried automatically~n- Be thorough but avoid false positives — verify each finding before reporting~n- Output a summary of findings before calling answer", [Strategy]).
208
+
209
+ %% build_task_lines(+PlanSteps, -TaskLines)
210
+ build_task_lines([], "").
211
+ build_task_lines([Step|Rest], TaskLines) :-
212
+ build_single_task_line(Step, Line),
213
+ build_task_lines(Rest, RestLines),
214
+ string_concat(Line, RestLines, TaskLines).
215
+
216
+ build_single_task_line(Step, Line) :-
217
+ Desc = Step.description,
218
+ Tools = Step.tools,
219
+ Reasoning = Step.reasoning,
220
+ Recipe = Step.recipe,
221
+ ( Tools == all
222
+ -> format(string(InnerTask), "task(~q)", [Desc])
223
+ ; format(string(InnerTask), "with_tools(~w, task(~q))", [Tools, Desc])
224
+ ),
225
+ ( Reasoning \= "none"
226
+ -> format(string(WithReasoning), "with_reasoning(~n ~w~n , ~w)", [InnerTask, Reasoning])
227
+ ; WithReasoning = InnerTask
228
+ ),
229
+ ( Recipe \= "none"
230
+ -> format(string(Line), " with_recipe(~n ~w~n , '~w'),~n", [WithReasoning, Recipe])
231
+ ; format(string(Line), " ~w,~n", [WithReasoning])
232
+ ).
233
+
234
+ %% build_review_message(+FilePath, +StrategyPlans, -ReviewMessage)
235
+ build_review_message(FilePath, StrategyPlans, ReviewMessage) :-
236
+ length(StrategyPlans, Count),
237
+ build_strategy_review_lines(StrategyPlans, 1, StrategyLines),
238
+ format(string(ReviewMessage), "Proposed security analysis plan~n- Output file: ~w~n- Strategies: ~w~n~n~s", [FilePath, Count, StrategyLines]).
239
+
240
+ build_strategy_review_lines([], _, "").
241
+ build_strategy_review_lines([Plan|Rest], Num, Lines) :-
242
+ Strategy = Plan.strategy,
243
+ Steps = Plan.steps,
244
+ length(Steps, StepCount),
245
+ format(string(Current), "~w. ~w (~w tasks)~n", [Num, Strategy, StepCount]),
246
+ NextNum is Num + 1,
247
+ build_strategy_review_lines(Rest, NextNum, RestLines),
248
+ string_concat(Current, RestLines, Lines).
249
+
250
+ finish_plan_creation(FilePath, PlanSlug, ValidationResult, FinalPlanReview) :-
251
+ get_dict(valid, ValidationResult, true),
252
+ output("Security plan validated successfully."),
253
+ format(string(Message), "I've created a security analysis plan in ~w.\n\n~s\nRun it with /run ~w or /~w.", [FilePath, FinalPlanReview, FilePath, PlanSlug]),
254
+ answer(Message).
255
+
256
+ finish_plan_creation(FilePath, _, ValidationResult, _) :-
257
+ format(string(Message), "I wrote ~w, but the plan failed validation: ~w", [FilePath, ValidationResult]),
258
+ answer(Message).
259
+
260
+ conductor_tool_definitions(ToolBlock) :-
261
+ atomics_to_string([
262
+ '% --- Tool predicates ---',
263
+ '',
264
+ 'tool(consult_recipes(Query, Result), "Search the recipe library for workflow guidance and conventions.") :-',
265
+ '',
266
+ ' exec(consult_recipes(query: Query, max_results: 3), Result).',
267
+ '',
268
+ 'tool(search_web(Query, Results), "Search the web for CVEs, security advisories, and documentation.") :-',
269
+ '',
270
+ ' exec(web_search(query: Query), Results).',
271
+ '',
272
+ 'tool(search_news(Query, Results), "Search recent news for security advisories.") :-',
273
+ '',
274
+ ' exec(news_search(query: Query), Results).',
275
+ '',
276
+ 'tool(fetch_url(Url, Content), "Fetch a web page for security documentation or advisory details.") :-',
277
+ '',
278
+ ' exec(url_fetch(url: Url), Result),',
279
+ ' get_dict(body, Result, Content).',
280
+ '',
281
+ 'tool(run_bash(Command, Output), "Run a shell command. Use for grep, find, cat, static analyzers, etc.") :-',
282
+ '',
283
+ ' exec(bash(command: Command), Output).',
284
+ '',
285
+ 'tool(ask_user(Prompt, Response), "Ask the user for clarification about scope or severity thresholds.") :-',
286
+ '',
287
+ ' exec(ask_user(prompt: Prompt), Result),',
288
+ ' get_dict(user_response, Result, Response).',
289
+ '',
290
+ 'tool(inform_user(Message, Result), "Send a status update.") :-',
291
+ ' output(Message),',
292
+ ' Result = "ok".'
293
+ ], "\n", ToolBlock).
294
+
295
+ load_dml_reference(DmlReference) :-
296
+ ( exists_file('.deepclause/docs/DML_REFERENCE.md')
297
+ -> read_file('.deepclause/docs/DML_REFERENCE.md', DmlReference)
298
+ ; DmlReference = "DML reference unavailable. Use standard DeepClause DML conventions."
299
+ ).
300
+
301
+ agent_main(Request) :-
302
+ format(string(Message), "I could not create a valid security analysis plan for this target: ~w. Try specifying the target more precisely (e.g., a directory path, file pattern, or specific concern).", [Request]),
303
+ answer(Message).
@@ -34,4 +34,17 @@ export interface ResolvedModelCapabilities {
34
34
  }
35
35
  export declare function resolveModelCapabilities(modelId: string, providerName: string): ResolvedModelCapabilities;
36
36
  export declare function buildReasoningProviderOptions(effort: string, reasoningType: ReasoningType, budgetMap?: Record<string, number>): Record<string, unknown>;
37
+ export interface AvailableProvider {
38
+ provider: string;
39
+ modelId: string;
40
+ label: string;
41
+ direct: boolean;
42
+ }
43
+ export declare function getAvailableProviders(dbModelId: string): AvailableProvider[];
44
+ export interface ModelSearchResult {
45
+ modelId: string;
46
+ entry: ModelDatabaseEntry;
47
+ providers: AvailableProvider[];
48
+ }
49
+ export declare function searchModels(query: string): ModelSearchResult[];
37
50
  //# sourceMappingURL=model-database.d.ts.map
@@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66,4 +66,45 @@ export function buildReasoningProviderOptions(effort, reasoningType, budgetMap)
66
66
  return {};
67
67
  }
68
68
  }
69
+ const VENDOR_TO_PROVIDER = {
70
+ openai: 'openai',
71
+ anthropic: 'anthropic',
72
+ google: 'google',
73
+ };
74
+ export function getAvailableProviders(dbModelId) {
75
+ const vendor = dbModelId.split('/')[0];
76
+ const providers = [];
77
+ const directProvider = VENDOR_TO_PROVIDER[vendor];
78
+ if (directProvider) {
79
+ providers.push({
80
+ provider: directProvider,
81
+ modelId: dbModelId.split('/').slice(1).join('/'),
82
+ label: `${directProvider} (direct)`,
83
+ direct: true,
84
+ });
85
+ }
86
+ providers.push({
87
+ provider: 'openrouter',
88
+ modelId: dbModelId,
89
+ label: 'openrouter',
90
+ direct: false,
91
+ });
92
+ return providers;
93
+ }
94
+ export function searchModels(query) {
95
+ const db = loadDatabase();
96
+ const q = query.toLowerCase().trim();
97
+ const results = [];
98
+ for (const [id, entry] of Object.entries(db.models)) {
99
+ const haystack = `${id} ${entry.name} ${entry.family}`.toLowerCase();
100
+ if (haystack.includes(q)) {
101
+ results.push({
102
+ modelId: id,
103
+ entry,
104
+ providers: getAvailableProviders(id),
105
+ });
106
+ }
107
+ }
108
+ return results;
109
+ }
69
110
  //# sourceMappingURL=model-database.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-database.js","sourceRoot":"","sources":["../../../src/system/config/model-database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AA6BtC,IAAI,cAAc,GAAyB,IAAI,CAAC;AAEhD,SAAS,YAAY;I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X,KAAK;gBACL,SAAS,EAAE,qBAAqB,CAAC,EAAE,CAAC;aACrC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepclause-sdk",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "DeepClause CLI Tool, TUI and Typescript SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",