@putervision/agent-reasoning-mcp 0.1.1
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/CONTRIBUTING.md +7 -0
- package/LICENSE +21 -0
- package/PROJECT_INSTRUCTIONS_TEMPLATE.md +9 -0
- package/README.md +95 -0
- package/SECURITY.md +11 -0
- package/dist/chunk-2UKYRERH.js +403 -0
- package/dist/chunk-2UKYRERH.js.map +1 -0
- package/dist/chunk-6CYLIFQX.js +442 -0
- package/dist/chunk-6CYLIFQX.js.map +1 -0
- package/dist/chunk-6EWSPFTX.js +1541 -0
- package/dist/chunk-6EWSPFTX.js.map +1 -0
- package/dist/chunk-F4TEZ2TS.js +615 -0
- package/dist/chunk-F4TEZ2TS.js.map +1 -0
- package/dist/chunk-SOCPGFU4.js +538 -0
- package/dist/chunk-SOCPGFU4.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +169 -0
- package/dist/cli.js.map +1 -0
- package/dist/db-EL7JURVI.js +35 -0
- package/dist/db-EL7JURVI.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/init-JCBP646U.js +15 -0
- package/dist/init-JCBP646U.js.map +1 -0
- package/dist/lib.d.ts +1003 -0
- package/dist/lib.js +237 -0
- package/dist/lib.js.map +1 -0
- package/glama.json +42 -0
- package/manifest.json +26 -0
- package/package.json +119 -0
- package/server.json +42 -0
package/dist/lib.d.ts
ADDED
|
@@ -0,0 +1,1003 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
|
|
5
|
+
type GoalId = string & {
|
|
6
|
+
readonly __brand: unique symbol;
|
|
7
|
+
};
|
|
8
|
+
type BeliefId = string & {
|
|
9
|
+
readonly __brand: unique symbol;
|
|
10
|
+
};
|
|
11
|
+
type TraceId = string & {
|
|
12
|
+
readonly __brand: unique symbol;
|
|
13
|
+
};
|
|
14
|
+
type IntentionId = string & {
|
|
15
|
+
readonly __brand: unique symbol;
|
|
16
|
+
};
|
|
17
|
+
type ProfileId = string & {
|
|
18
|
+
readonly __brand: unique symbol;
|
|
19
|
+
};
|
|
20
|
+
type PatternId = string & {
|
|
21
|
+
readonly __brand: unique symbol;
|
|
22
|
+
};
|
|
23
|
+
type SnapshotId = string & {
|
|
24
|
+
readonly __brand: unique symbol;
|
|
25
|
+
};
|
|
26
|
+
type EventId = string & {
|
|
27
|
+
readonly __brand: unique symbol;
|
|
28
|
+
};
|
|
29
|
+
type GoalStatus = 'active' | 'completed' | 'failed' | 'abandoned' | 'suspended';
|
|
30
|
+
type IntentionStatus = 'pending' | 'dispatched' | 'running' | 'completed' | 'failed' | 'aborted' | 'interrupted';
|
|
31
|
+
type BeliefCategory = 'spatial' | 'entity' | 'state' | 'rule' | 'social';
|
|
32
|
+
interface Goal {
|
|
33
|
+
id: GoalId;
|
|
34
|
+
project: string;
|
|
35
|
+
session_id?: string;
|
|
36
|
+
parent_id?: GoalId | null;
|
|
37
|
+
title: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
status: GoalStatus;
|
|
40
|
+
priority: number;
|
|
41
|
+
utility_weights?: Record<string, number>;
|
|
42
|
+
deadline_at?: string;
|
|
43
|
+
progress?: number;
|
|
44
|
+
success_criteria?: string[];
|
|
45
|
+
failure_reason?: string;
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
client_request_id?: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
updated_at: string;
|
|
50
|
+
version: number;
|
|
51
|
+
}
|
|
52
|
+
interface Belief {
|
|
53
|
+
id: BeliefId;
|
|
54
|
+
project: string;
|
|
55
|
+
session_id?: string;
|
|
56
|
+
category: BeliefCategory;
|
|
57
|
+
subject: string;
|
|
58
|
+
predicate: string;
|
|
59
|
+
object: unknown;
|
|
60
|
+
confidence: number;
|
|
61
|
+
source: 'observation' | 'deduction' | 'agent_communication' | 'a_priori';
|
|
62
|
+
source_id?: string;
|
|
63
|
+
expires_at?: string;
|
|
64
|
+
decay_rate: number;
|
|
65
|
+
last_decayed_at?: string;
|
|
66
|
+
client_request_id?: string;
|
|
67
|
+
metadata?: Record<string, unknown>;
|
|
68
|
+
created_at: string;
|
|
69
|
+
updated_at: string;
|
|
70
|
+
}
|
|
71
|
+
interface DecisionTrace {
|
|
72
|
+
id: TraceId;
|
|
73
|
+
project: string;
|
|
74
|
+
session_id?: string;
|
|
75
|
+
goal_id?: GoalId;
|
|
76
|
+
situation_summary: string;
|
|
77
|
+
candidate_actions: CandidateAction[];
|
|
78
|
+
utility_profile: string;
|
|
79
|
+
chosen_action: string;
|
|
80
|
+
reasoning_chain: string[];
|
|
81
|
+
risk_assessment?: RiskAssessmentResult;
|
|
82
|
+
outcome?: string;
|
|
83
|
+
latency_ms: number;
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
created_at: string;
|
|
86
|
+
}
|
|
87
|
+
interface CandidateAction {
|
|
88
|
+
action: string;
|
|
89
|
+
parameters?: Record<string, unknown>;
|
|
90
|
+
estimated_utility: number;
|
|
91
|
+
utility_breakdown?: Record<string, number>;
|
|
92
|
+
risk_score?: number;
|
|
93
|
+
feasibility?: number;
|
|
94
|
+
}
|
|
95
|
+
interface RiskAssessmentResult {
|
|
96
|
+
threat_level: 'none' | 'low' | 'medium' | 'high' | 'critical';
|
|
97
|
+
risk_score: number;
|
|
98
|
+
threats: string[];
|
|
99
|
+
opportunities: string[];
|
|
100
|
+
mitigations: string[];
|
|
101
|
+
}
|
|
102
|
+
interface UtilityProfile {
|
|
103
|
+
id: ProfileId;
|
|
104
|
+
project: string;
|
|
105
|
+
name: string;
|
|
106
|
+
description?: string;
|
|
107
|
+
weights: {
|
|
108
|
+
aggression: number;
|
|
109
|
+
caution: number;
|
|
110
|
+
greed: number;
|
|
111
|
+
efficiency: number;
|
|
112
|
+
exploration: number;
|
|
113
|
+
cooperation: number;
|
|
114
|
+
[key: string]: number;
|
|
115
|
+
};
|
|
116
|
+
is_active: boolean;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
created_at: string;
|
|
119
|
+
updated_at: string;
|
|
120
|
+
}
|
|
121
|
+
interface Intention {
|
|
122
|
+
id: IntentionId;
|
|
123
|
+
project: string;
|
|
124
|
+
goal_id: GoalId;
|
|
125
|
+
trace_id?: TraceId;
|
|
126
|
+
session_id?: string;
|
|
127
|
+
behavior_name: string;
|
|
128
|
+
parameters: Record<string, unknown>;
|
|
129
|
+
priority: number;
|
|
130
|
+
status: IntentionStatus;
|
|
131
|
+
deadline_at?: string;
|
|
132
|
+
abort_conditions?: Array<{
|
|
133
|
+
condition_type: string;
|
|
134
|
+
condition_params: Record<string, unknown>;
|
|
135
|
+
}>;
|
|
136
|
+
result?: Record<string, unknown>;
|
|
137
|
+
client_request_id?: string;
|
|
138
|
+
created_at: string;
|
|
139
|
+
updated_at: string;
|
|
140
|
+
}
|
|
141
|
+
interface KnowledgePattern {
|
|
142
|
+
id: PatternId;
|
|
143
|
+
project: string;
|
|
144
|
+
pattern_type: 'heuristic' | 'anti_pattern' | 'optimization' | 'contingency';
|
|
145
|
+
context_tags: string[];
|
|
146
|
+
situation_pattern: string;
|
|
147
|
+
recommended_strategy: string;
|
|
148
|
+
confidence: number;
|
|
149
|
+
sample_count: number;
|
|
150
|
+
success_rate: number;
|
|
151
|
+
metadata?: Record<string, unknown>;
|
|
152
|
+
created_at: string;
|
|
153
|
+
updated_at: string;
|
|
154
|
+
}
|
|
155
|
+
interface ReasoningEvent {
|
|
156
|
+
id: EventId;
|
|
157
|
+
project: string;
|
|
158
|
+
entity_id: string;
|
|
159
|
+
entity_type: 'goal' | 'belief' | 'trace' | 'profile' | 'intention' | 'knowledge';
|
|
160
|
+
action: string;
|
|
161
|
+
prev_hash: string;
|
|
162
|
+
hash: string;
|
|
163
|
+
details?: Record<string, unknown>;
|
|
164
|
+
timestamp: string;
|
|
165
|
+
}
|
|
166
|
+
interface SituationSnapshot {
|
|
167
|
+
session_id: string;
|
|
168
|
+
timestamp?: string;
|
|
169
|
+
world?: {
|
|
170
|
+
entities: Array<{
|
|
171
|
+
id: string;
|
|
172
|
+
type: string;
|
|
173
|
+
position: [number, number, number];
|
|
174
|
+
status: string;
|
|
175
|
+
}>;
|
|
176
|
+
relations?: Array<{
|
|
177
|
+
source: string;
|
|
178
|
+
relation: string;
|
|
179
|
+
target: string;
|
|
180
|
+
}>;
|
|
181
|
+
observer_position?: [number, number, number];
|
|
182
|
+
};
|
|
183
|
+
vision?: {
|
|
184
|
+
current_state_id?: string;
|
|
185
|
+
description?: string;
|
|
186
|
+
grounded_elements?: Array<{
|
|
187
|
+
selector: string;
|
|
188
|
+
label: string;
|
|
189
|
+
}>;
|
|
190
|
+
};
|
|
191
|
+
state?: {
|
|
192
|
+
tasks?: Array<{
|
|
193
|
+
id: string;
|
|
194
|
+
title: string;
|
|
195
|
+
status?: string;
|
|
196
|
+
priority?: number;
|
|
197
|
+
}>;
|
|
198
|
+
active_goals?: Array<{
|
|
199
|
+
id: string;
|
|
200
|
+
title: string;
|
|
201
|
+
priority: number;
|
|
202
|
+
}>;
|
|
203
|
+
blockers?: Array<{
|
|
204
|
+
id: string;
|
|
205
|
+
description: string;
|
|
206
|
+
}>;
|
|
207
|
+
decisions?: Array<{
|
|
208
|
+
id: string;
|
|
209
|
+
recommendation: string;
|
|
210
|
+
}>;
|
|
211
|
+
recent_decisions?: Array<{
|
|
212
|
+
id: string;
|
|
213
|
+
recommendation: string;
|
|
214
|
+
}>;
|
|
215
|
+
};
|
|
216
|
+
vitals?: {
|
|
217
|
+
hp?: number;
|
|
218
|
+
resources?: Record<string, number>;
|
|
219
|
+
threat_level?: number;
|
|
220
|
+
[key: string]: unknown;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare const SetGoalSchema: z.ZodObject<{
|
|
225
|
+
action: z.ZodEnum<["create", "update", "decompose", "get", "list", "abandon"]>;
|
|
226
|
+
id: z.ZodOptional<z.ZodString>;
|
|
227
|
+
parent_id: z.ZodOptional<z.ZodString>;
|
|
228
|
+
title: z.ZodOptional<z.ZodString>;
|
|
229
|
+
description: z.ZodOptional<z.ZodString>;
|
|
230
|
+
status: z.ZodOptional<z.ZodEnum<["active", "completed", "failed", "abandoned", "suspended"]>>;
|
|
231
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
utility_weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
233
|
+
deadline_at: z.ZodOptional<z.ZodString>;
|
|
234
|
+
progress: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
success_criteria: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
236
|
+
subgoals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
237
|
+
title: z.ZodString;
|
|
238
|
+
description: z.ZodOptional<z.ZodString>;
|
|
239
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
240
|
+
}, "strip", z.ZodTypeAny, {
|
|
241
|
+
title: string;
|
|
242
|
+
priority?: number | undefined;
|
|
243
|
+
description?: string | undefined;
|
|
244
|
+
}, {
|
|
245
|
+
title: string;
|
|
246
|
+
priority?: number | undefined;
|
|
247
|
+
description?: string | undefined;
|
|
248
|
+
}>, "many">>;
|
|
249
|
+
client_request_id: z.ZodOptional<z.ZodString>;
|
|
250
|
+
project: z.ZodOptional<z.ZodString>;
|
|
251
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
}, "strip", z.ZodTypeAny, {
|
|
253
|
+
action: "create" | "update" | "decompose" | "get" | "list" | "abandon";
|
|
254
|
+
title?: string | undefined;
|
|
255
|
+
limit?: number | undefined;
|
|
256
|
+
id?: string | undefined;
|
|
257
|
+
status?: "active" | "completed" | "failed" | "abandoned" | "suspended" | undefined;
|
|
258
|
+
priority?: number | undefined;
|
|
259
|
+
parent_id?: string | undefined;
|
|
260
|
+
progress?: number | undefined;
|
|
261
|
+
subgoals?: {
|
|
262
|
+
title: string;
|
|
263
|
+
priority?: number | undefined;
|
|
264
|
+
description?: string | undefined;
|
|
265
|
+
}[] | undefined;
|
|
266
|
+
description?: string | undefined;
|
|
267
|
+
project?: string | undefined;
|
|
268
|
+
utility_weights?: Record<string, number> | undefined;
|
|
269
|
+
deadline_at?: string | undefined;
|
|
270
|
+
success_criteria?: string[] | undefined;
|
|
271
|
+
client_request_id?: string | undefined;
|
|
272
|
+
}, {
|
|
273
|
+
action: "create" | "update" | "decompose" | "get" | "list" | "abandon";
|
|
274
|
+
title?: string | undefined;
|
|
275
|
+
limit?: number | undefined;
|
|
276
|
+
id?: string | undefined;
|
|
277
|
+
status?: "active" | "completed" | "failed" | "abandoned" | "suspended" | undefined;
|
|
278
|
+
priority?: number | undefined;
|
|
279
|
+
parent_id?: string | undefined;
|
|
280
|
+
progress?: number | undefined;
|
|
281
|
+
subgoals?: {
|
|
282
|
+
title: string;
|
|
283
|
+
priority?: number | undefined;
|
|
284
|
+
description?: string | undefined;
|
|
285
|
+
}[] | undefined;
|
|
286
|
+
description?: string | undefined;
|
|
287
|
+
project?: string | undefined;
|
|
288
|
+
utility_weights?: Record<string, number> | undefined;
|
|
289
|
+
deadline_at?: string | undefined;
|
|
290
|
+
success_criteria?: string[] | undefined;
|
|
291
|
+
client_request_id?: string | undefined;
|
|
292
|
+
}>;
|
|
293
|
+
declare const EvaluateSituationSchema: z.ZodObject<{
|
|
294
|
+
action: z.ZodEnum<["snapshot", "quick"]>;
|
|
295
|
+
snapshot: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
session_id: z.ZodString;
|
|
297
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
298
|
+
world: z.ZodOptional<z.ZodAny>;
|
|
299
|
+
vision: z.ZodOptional<z.ZodAny>;
|
|
300
|
+
state: z.ZodOptional<z.ZodAny>;
|
|
301
|
+
vitals: z.ZodOptional<z.ZodAny>;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
session_id: string;
|
|
304
|
+
state?: any;
|
|
305
|
+
timestamp?: string | undefined;
|
|
306
|
+
vitals?: any;
|
|
307
|
+
vision?: any;
|
|
308
|
+
world?: any;
|
|
309
|
+
}, {
|
|
310
|
+
session_id: string;
|
|
311
|
+
state?: any;
|
|
312
|
+
timestamp?: string | undefined;
|
|
313
|
+
vitals?: any;
|
|
314
|
+
vision?: any;
|
|
315
|
+
world?: any;
|
|
316
|
+
}>>;
|
|
317
|
+
quick_context: z.ZodOptional<z.ZodString>;
|
|
318
|
+
candidate_actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
319
|
+
action: z.ZodString;
|
|
320
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
321
|
+
description: z.ZodOptional<z.ZodString>;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
action: string;
|
|
324
|
+
description?: string | undefined;
|
|
325
|
+
parameters?: Record<string, any> | undefined;
|
|
326
|
+
}, {
|
|
327
|
+
action: string;
|
|
328
|
+
description?: string | undefined;
|
|
329
|
+
parameters?: Record<string, any> | undefined;
|
|
330
|
+
}>, "many">>;
|
|
331
|
+
utility_profile: z.ZodOptional<z.ZodString>;
|
|
332
|
+
project: z.ZodOptional<z.ZodString>;
|
|
333
|
+
}, "strip", z.ZodTypeAny, {
|
|
334
|
+
action: "snapshot" | "quick";
|
|
335
|
+
snapshot?: {
|
|
336
|
+
session_id: string;
|
|
337
|
+
state?: any;
|
|
338
|
+
timestamp?: string | undefined;
|
|
339
|
+
vitals?: any;
|
|
340
|
+
vision?: any;
|
|
341
|
+
world?: any;
|
|
342
|
+
} | undefined;
|
|
343
|
+
utility_profile?: string | undefined;
|
|
344
|
+
project?: string | undefined;
|
|
345
|
+
quick_context?: string | undefined;
|
|
346
|
+
candidate_actions?: {
|
|
347
|
+
action: string;
|
|
348
|
+
description?: string | undefined;
|
|
349
|
+
parameters?: Record<string, any> | undefined;
|
|
350
|
+
}[] | undefined;
|
|
351
|
+
}, {
|
|
352
|
+
action: "snapshot" | "quick";
|
|
353
|
+
snapshot?: {
|
|
354
|
+
session_id: string;
|
|
355
|
+
state?: any;
|
|
356
|
+
timestamp?: string | undefined;
|
|
357
|
+
vitals?: any;
|
|
358
|
+
vision?: any;
|
|
359
|
+
world?: any;
|
|
360
|
+
} | undefined;
|
|
361
|
+
utility_profile?: string | undefined;
|
|
362
|
+
project?: string | undefined;
|
|
363
|
+
quick_context?: string | undefined;
|
|
364
|
+
candidate_actions?: {
|
|
365
|
+
action: string;
|
|
366
|
+
description?: string | undefined;
|
|
367
|
+
parameters?: Record<string, any> | undefined;
|
|
368
|
+
}[] | undefined;
|
|
369
|
+
}>;
|
|
370
|
+
declare const ReplanSchema: z.ZodObject<{
|
|
371
|
+
action: z.ZodEnum<["blocker", "event", "full"]>;
|
|
372
|
+
goal_id: z.ZodString;
|
|
373
|
+
blocker_description: z.ZodOptional<z.ZodString>;
|
|
374
|
+
trigger_event: z.ZodOptional<z.ZodString>;
|
|
375
|
+
preserve_completed: z.ZodOptional<z.ZodBoolean>;
|
|
376
|
+
project: z.ZodOptional<z.ZodString>;
|
|
377
|
+
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
action: "blocker" | "event" | "full";
|
|
379
|
+
goal_id: string;
|
|
380
|
+
blocker_description?: string | undefined;
|
|
381
|
+
project?: string | undefined;
|
|
382
|
+
trigger_event?: string | undefined;
|
|
383
|
+
preserve_completed?: boolean | undefined;
|
|
384
|
+
}, {
|
|
385
|
+
action: "blocker" | "event" | "full";
|
|
386
|
+
goal_id: string;
|
|
387
|
+
blocker_description?: string | undefined;
|
|
388
|
+
project?: string | undefined;
|
|
389
|
+
trigger_event?: string | undefined;
|
|
390
|
+
preserve_completed?: boolean | undefined;
|
|
391
|
+
}>;
|
|
392
|
+
declare const AssessRiskSchema: z.ZodObject<{
|
|
393
|
+
action: z.ZodEnum<["action", "plan", "compare"]>;
|
|
394
|
+
candidate_action: z.ZodOptional<z.ZodString>;
|
|
395
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
396
|
+
candidate_actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
397
|
+
action: z.ZodString;
|
|
398
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
399
|
+
}, "strip", z.ZodTypeAny, {
|
|
400
|
+
action: string;
|
|
401
|
+
parameters?: Record<string, any> | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
action: string;
|
|
404
|
+
parameters?: Record<string, any> | undefined;
|
|
405
|
+
}>, "many">>;
|
|
406
|
+
situation_context: z.ZodOptional<z.ZodAny>;
|
|
407
|
+
project: z.ZodOptional<z.ZodString>;
|
|
408
|
+
}, "strip", z.ZodTypeAny, {
|
|
409
|
+
action: "action" | "plan" | "compare";
|
|
410
|
+
candidate_action?: string | undefined;
|
|
411
|
+
project?: string | undefined;
|
|
412
|
+
parameters?: Record<string, any> | undefined;
|
|
413
|
+
candidate_actions?: {
|
|
414
|
+
action: string;
|
|
415
|
+
parameters?: Record<string, any> | undefined;
|
|
416
|
+
}[] | undefined;
|
|
417
|
+
situation_context?: any;
|
|
418
|
+
}, {
|
|
419
|
+
action: "action" | "plan" | "compare";
|
|
420
|
+
candidate_action?: string | undefined;
|
|
421
|
+
project?: string | undefined;
|
|
422
|
+
parameters?: Record<string, any> | undefined;
|
|
423
|
+
candidate_actions?: {
|
|
424
|
+
action: string;
|
|
425
|
+
parameters?: Record<string, any> | undefined;
|
|
426
|
+
}[] | undefined;
|
|
427
|
+
situation_context?: any;
|
|
428
|
+
}>;
|
|
429
|
+
declare const QueryKnowledgeSchema: z.ZodObject<{
|
|
430
|
+
action: z.ZodEnum<["search", "patterns", "similar_situations"]>;
|
|
431
|
+
query: z.ZodOptional<z.ZodString>;
|
|
432
|
+
pattern_type: z.ZodOptional<z.ZodEnum<["heuristic", "anti_pattern", "optimization", "contingency"]>>;
|
|
433
|
+
context_tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
434
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
435
|
+
project: z.ZodOptional<z.ZodString>;
|
|
436
|
+
}, "strip", z.ZodTypeAny, {
|
|
437
|
+
action: "search" | "patterns" | "similar_situations";
|
|
438
|
+
query?: string | undefined;
|
|
439
|
+
limit?: number | undefined;
|
|
440
|
+
pattern_type?: "heuristic" | "anti_pattern" | "optimization" | "contingency" | undefined;
|
|
441
|
+
project?: string | undefined;
|
|
442
|
+
context_tags?: string[] | undefined;
|
|
443
|
+
}, {
|
|
444
|
+
action: "search" | "patterns" | "similar_situations";
|
|
445
|
+
query?: string | undefined;
|
|
446
|
+
limit?: number | undefined;
|
|
447
|
+
pattern_type?: "heuristic" | "anti_pattern" | "optimization" | "contingency" | undefined;
|
|
448
|
+
project?: string | undefined;
|
|
449
|
+
context_tags?: string[] | undefined;
|
|
450
|
+
}>;
|
|
451
|
+
declare const SetUtilityWeightsSchema: z.ZodObject<{
|
|
452
|
+
action: z.ZodEnum<["configure", "get", "list", "activate"]>;
|
|
453
|
+
name: z.ZodOptional<z.ZodString>;
|
|
454
|
+
description: z.ZodOptional<z.ZodString>;
|
|
455
|
+
weights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
456
|
+
is_active: z.ZodOptional<z.ZodBoolean>;
|
|
457
|
+
project: z.ZodOptional<z.ZodString>;
|
|
458
|
+
}, "strip", z.ZodTypeAny, {
|
|
459
|
+
action: "get" | "list" | "configure" | "activate";
|
|
460
|
+
name?: string | undefined;
|
|
461
|
+
weights?: Record<string, number> | undefined;
|
|
462
|
+
description?: string | undefined;
|
|
463
|
+
project?: string | undefined;
|
|
464
|
+
is_active?: boolean | undefined;
|
|
465
|
+
}, {
|
|
466
|
+
action: "get" | "list" | "configure" | "activate";
|
|
467
|
+
name?: string | undefined;
|
|
468
|
+
weights?: Record<string, number> | undefined;
|
|
469
|
+
description?: string | undefined;
|
|
470
|
+
project?: string | undefined;
|
|
471
|
+
is_active?: boolean | undefined;
|
|
472
|
+
}>;
|
|
473
|
+
declare const GetDecisionTraceSchema: z.ZodObject<{
|
|
474
|
+
action: z.ZodEnum<["latest", "get", "list", "explain"]>;
|
|
475
|
+
trace_id: z.ZodOptional<z.ZodString>;
|
|
476
|
+
goal_id: z.ZodOptional<z.ZodString>;
|
|
477
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
478
|
+
project: z.ZodOptional<z.ZodString>;
|
|
479
|
+
}, "strip", z.ZodTypeAny, {
|
|
480
|
+
action: "get" | "list" | "latest" | "explain";
|
|
481
|
+
goal_id?: string | undefined;
|
|
482
|
+
trace_id?: string | undefined;
|
|
483
|
+
limit?: number | undefined;
|
|
484
|
+
project?: string | undefined;
|
|
485
|
+
}, {
|
|
486
|
+
action: "get" | "list" | "latest" | "explain";
|
|
487
|
+
goal_id?: string | undefined;
|
|
488
|
+
trace_id?: string | undefined;
|
|
489
|
+
limit?: number | undefined;
|
|
490
|
+
project?: string | undefined;
|
|
491
|
+
}>;
|
|
492
|
+
declare const ManageBeliefsSchema: z.ZodObject<{
|
|
493
|
+
action: z.ZodEnum<["update", "query", "expire", "reconcile"]>;
|
|
494
|
+
category: z.ZodOptional<z.ZodEnum<["spatial", "entity", "state", "rule", "social"]>>;
|
|
495
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
496
|
+
predicate: z.ZodOptional<z.ZodString>;
|
|
497
|
+
object: z.ZodOptional<z.ZodAny>;
|
|
498
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
499
|
+
source: z.ZodOptional<z.ZodEnum<["observation", "deduction", "agent_communication", "a_priori"]>>;
|
|
500
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
501
|
+
decay_rate: z.ZodOptional<z.ZodNumber>;
|
|
502
|
+
belief_id: z.ZodOptional<z.ZodString>;
|
|
503
|
+
client_request_id: z.ZodOptional<z.ZodString>;
|
|
504
|
+
project: z.ZodOptional<z.ZodString>;
|
|
505
|
+
}, "strip", z.ZodTypeAny, {
|
|
506
|
+
action: "update" | "query" | "expire" | "reconcile";
|
|
507
|
+
object?: any;
|
|
508
|
+
category?: "spatial" | "entity" | "state" | "rule" | "social" | undefined;
|
|
509
|
+
subject?: string | undefined;
|
|
510
|
+
predicate?: string | undefined;
|
|
511
|
+
confidence?: number | undefined;
|
|
512
|
+
project?: string | undefined;
|
|
513
|
+
client_request_id?: string | undefined;
|
|
514
|
+
source?: "observation" | "deduction" | "agent_communication" | "a_priori" | undefined;
|
|
515
|
+
expires_at?: string | undefined;
|
|
516
|
+
decay_rate?: number | undefined;
|
|
517
|
+
belief_id?: string | undefined;
|
|
518
|
+
}, {
|
|
519
|
+
action: "update" | "query" | "expire" | "reconcile";
|
|
520
|
+
object?: any;
|
|
521
|
+
category?: "spatial" | "entity" | "state" | "rule" | "social" | undefined;
|
|
522
|
+
subject?: string | undefined;
|
|
523
|
+
predicate?: string | undefined;
|
|
524
|
+
confidence?: number | undefined;
|
|
525
|
+
project?: string | undefined;
|
|
526
|
+
client_request_id?: string | undefined;
|
|
527
|
+
source?: "observation" | "deduction" | "agent_communication" | "a_priori" | undefined;
|
|
528
|
+
expires_at?: string | undefined;
|
|
529
|
+
decay_rate?: number | undefined;
|
|
530
|
+
belief_id?: string | undefined;
|
|
531
|
+
}>;
|
|
532
|
+
declare const ManageIntentionsSchema: z.ZodObject<{
|
|
533
|
+
action: z.ZodEnum<["create", "dispatch", "get", "list", "cancel", "resolve"]>;
|
|
534
|
+
intention_id: z.ZodOptional<z.ZodString>;
|
|
535
|
+
goal_id: z.ZodOptional<z.ZodString>;
|
|
536
|
+
trace_id: z.ZodOptional<z.ZodString>;
|
|
537
|
+
behavior_name: z.ZodOptional<z.ZodString>;
|
|
538
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
539
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
540
|
+
deadline_at: z.ZodOptional<z.ZodString>;
|
|
541
|
+
abort_conditions: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
542
|
+
result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
543
|
+
status: z.ZodOptional<z.ZodEnum<["pending", "dispatched", "running", "completed", "failed", "aborted", "interrupted"]>>;
|
|
544
|
+
client_request_id: z.ZodOptional<z.ZodString>;
|
|
545
|
+
project: z.ZodOptional<z.ZodString>;
|
|
546
|
+
}, "strip", z.ZodTypeAny, {
|
|
547
|
+
action: "create" | "get" | "list" | "dispatch" | "cancel" | "resolve";
|
|
548
|
+
goal_id?: string | undefined;
|
|
549
|
+
intention_id?: string | undefined;
|
|
550
|
+
trace_id?: string | undefined;
|
|
551
|
+
status?: "completed" | "failed" | "pending" | "dispatched" | "running" | "aborted" | "interrupted" | undefined;
|
|
552
|
+
priority?: number | undefined;
|
|
553
|
+
behavior_name?: string | undefined;
|
|
554
|
+
result?: Record<string, any> | undefined;
|
|
555
|
+
project?: string | undefined;
|
|
556
|
+
deadline_at?: string | undefined;
|
|
557
|
+
client_request_id?: string | undefined;
|
|
558
|
+
parameters?: Record<string, any> | undefined;
|
|
559
|
+
abort_conditions?: any[] | undefined;
|
|
560
|
+
}, {
|
|
561
|
+
action: "create" | "get" | "list" | "dispatch" | "cancel" | "resolve";
|
|
562
|
+
goal_id?: string | undefined;
|
|
563
|
+
intention_id?: string | undefined;
|
|
564
|
+
trace_id?: string | undefined;
|
|
565
|
+
status?: "completed" | "failed" | "pending" | "dispatched" | "running" | "aborted" | "interrupted" | undefined;
|
|
566
|
+
priority?: number | undefined;
|
|
567
|
+
behavior_name?: string | undefined;
|
|
568
|
+
result?: Record<string, any> | undefined;
|
|
569
|
+
project?: string | undefined;
|
|
570
|
+
deadline_at?: string | undefined;
|
|
571
|
+
client_request_id?: string | undefined;
|
|
572
|
+
parameters?: Record<string, any> | undefined;
|
|
573
|
+
abort_conditions?: any[] | undefined;
|
|
574
|
+
}>;
|
|
575
|
+
declare const ManageReasoningDbSchema: z.ZodObject<{
|
|
576
|
+
action: z.ZodEnum<["backup", "stats", "audit", "snapshot", "diff", "restore"]>;
|
|
577
|
+
name: z.ZodOptional<z.ZodString>;
|
|
578
|
+
description: z.ZodOptional<z.ZodString>;
|
|
579
|
+
project: z.ZodOptional<z.ZodString>;
|
|
580
|
+
}, "strip", z.ZodTypeAny, {
|
|
581
|
+
action: "snapshot" | "stats" | "audit" | "diff" | "restore" | "backup";
|
|
582
|
+
name?: string | undefined;
|
|
583
|
+
description?: string | undefined;
|
|
584
|
+
project?: string | undefined;
|
|
585
|
+
}, {
|
|
586
|
+
action: "snapshot" | "stats" | "audit" | "diff" | "restore" | "backup";
|
|
587
|
+
name?: string | undefined;
|
|
588
|
+
description?: string | undefined;
|
|
589
|
+
project?: string | undefined;
|
|
590
|
+
}>;
|
|
591
|
+
|
|
592
|
+
declare class ReasoningError extends Error {
|
|
593
|
+
readonly code: string;
|
|
594
|
+
readonly details?: unknown;
|
|
595
|
+
constructor(message: string, code?: string, details?: unknown);
|
|
596
|
+
}
|
|
597
|
+
declare class DatabaseError extends ReasoningError {
|
|
598
|
+
constructor(message: string, details?: unknown);
|
|
599
|
+
}
|
|
600
|
+
declare class ValidationError extends ReasoningError {
|
|
601
|
+
constructor(message: string, details?: unknown);
|
|
602
|
+
}
|
|
603
|
+
declare class NotFoundError extends ReasoningError {
|
|
604
|
+
constructor(message: string, details?: unknown);
|
|
605
|
+
}
|
|
606
|
+
declare class ConflictError extends ReasoningError {
|
|
607
|
+
constructor(message: string, details?: unknown);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
611
|
+
declare const LOG_LEVELS: Record<LogLevel, number>;
|
|
612
|
+
declare function getLogLevel(): number;
|
|
613
|
+
declare const logger: {
|
|
614
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
615
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
616
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
617
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
declare function generateId(): string;
|
|
621
|
+
|
|
622
|
+
declare function getCurrentIsoString(): string;
|
|
623
|
+
declare function parseIsoString(iso: string): Date;
|
|
624
|
+
declare function getElapsedTimeMs(startTimeIso: string): number;
|
|
625
|
+
|
|
626
|
+
declare function validatePath(filePath: string, project?: string): string;
|
|
627
|
+
declare function getRegistryPath(): string;
|
|
628
|
+
declare function getRegistry(): Record<string, string>;
|
|
629
|
+
declare function registerProject(projectName: string, projectRoot: string): void;
|
|
630
|
+
declare function unregisterProject(projectName: string): void;
|
|
631
|
+
declare function sanitizeSlug(str: string): string;
|
|
632
|
+
declare function resolveProjectRoot(project?: string, cwd?: string): string;
|
|
633
|
+
declare function getProjectSlug(project?: string, cwd?: string): string;
|
|
634
|
+
declare function getBaseDir(projectRoot: string): string;
|
|
635
|
+
declare function getProjectDbDir(project?: string, cwd?: string): string;
|
|
636
|
+
declare function getDbPath(project?: string, cwd?: string): string;
|
|
637
|
+
declare function getDb(project?: string, cwd?: string): Database.Database;
|
|
638
|
+
declare function getReadOnlyDb(project?: string, cwd?: string): Database.Database;
|
|
639
|
+
declare function closeDb(project?: string, cwd?: string): void;
|
|
640
|
+
declare function closeAllDbs(): void;
|
|
641
|
+
|
|
642
|
+
declare class GoalEngine {
|
|
643
|
+
static createGoal(db: Database.Database, params: {
|
|
644
|
+
project: string;
|
|
645
|
+
session_id?: string;
|
|
646
|
+
parent_id?: string;
|
|
647
|
+
title: string;
|
|
648
|
+
description?: string;
|
|
649
|
+
status?: GoalStatus;
|
|
650
|
+
priority?: number;
|
|
651
|
+
utility_weights?: Record<string, number>;
|
|
652
|
+
deadline_at?: string;
|
|
653
|
+
success_criteria?: string[];
|
|
654
|
+
metadata?: Record<string, unknown>;
|
|
655
|
+
client_request_id?: string;
|
|
656
|
+
}): Goal;
|
|
657
|
+
static updateGoal(db: Database.Database, params: {
|
|
658
|
+
project: string;
|
|
659
|
+
id: string;
|
|
660
|
+
title?: string;
|
|
661
|
+
description?: string;
|
|
662
|
+
status?: GoalStatus;
|
|
663
|
+
priority?: number;
|
|
664
|
+
progress?: number;
|
|
665
|
+
failure_reason?: string;
|
|
666
|
+
metadata?: Record<string, unknown>;
|
|
667
|
+
}): Goal;
|
|
668
|
+
static decomposeGoal(db: Database.Database, params: {
|
|
669
|
+
project: string;
|
|
670
|
+
parent_id: string;
|
|
671
|
+
subgoals: Array<{
|
|
672
|
+
title: string;
|
|
673
|
+
description?: string;
|
|
674
|
+
priority?: number;
|
|
675
|
+
}>;
|
|
676
|
+
}): {
|
|
677
|
+
parent_goal: Goal;
|
|
678
|
+
subgoals: Goal[];
|
|
679
|
+
};
|
|
680
|
+
static getGoal(db: Database.Database, params: {
|
|
681
|
+
project: string;
|
|
682
|
+
id: string;
|
|
683
|
+
}): Goal;
|
|
684
|
+
static listGoals(db: Database.Database, params: {
|
|
685
|
+
project: string;
|
|
686
|
+
status?: GoalStatus;
|
|
687
|
+
parent_id?: string;
|
|
688
|
+
limit?: number;
|
|
689
|
+
}): Goal[];
|
|
690
|
+
static abandonGoal(db: Database.Database, params: {
|
|
691
|
+
project: string;
|
|
692
|
+
id: string;
|
|
693
|
+
reason?: string;
|
|
694
|
+
}): Goal;
|
|
695
|
+
private static mapRowToGoal;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
declare class BeliefEngine {
|
|
699
|
+
static updateBelief(db: Database.Database, params: {
|
|
700
|
+
project: string;
|
|
701
|
+
session_id?: string;
|
|
702
|
+
category: BeliefCategory;
|
|
703
|
+
subject: string;
|
|
704
|
+
predicate: string;
|
|
705
|
+
object: unknown;
|
|
706
|
+
confidence?: number;
|
|
707
|
+
source?: 'observation' | 'deduction' | 'agent_communication' | 'a_priori';
|
|
708
|
+
source_id?: string;
|
|
709
|
+
expires_at?: string;
|
|
710
|
+
decay_rate?: number;
|
|
711
|
+
client_request_id?: string;
|
|
712
|
+
metadata?: Record<string, unknown>;
|
|
713
|
+
}): Belief;
|
|
714
|
+
static queryBeliefs(db: Database.Database, params: {
|
|
715
|
+
project: string;
|
|
716
|
+
category?: BeliefCategory;
|
|
717
|
+
subject?: string;
|
|
718
|
+
predicate?: string;
|
|
719
|
+
min_confidence?: number;
|
|
720
|
+
limit?: number;
|
|
721
|
+
}): Belief[];
|
|
722
|
+
static decayBeliefs(db: Database.Database, project: string): void;
|
|
723
|
+
static expireBeliefs(db: Database.Database, project: string): number;
|
|
724
|
+
static getBelief(db: Database.Database, params: {
|
|
725
|
+
project: string;
|
|
726
|
+
id: string;
|
|
727
|
+
}): Belief;
|
|
728
|
+
private static mapRowToBelief;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
declare class UtilityProfileEngine {
|
|
732
|
+
static configureProfile(db: Database.Database, params: {
|
|
733
|
+
project: string;
|
|
734
|
+
name: string;
|
|
735
|
+
description?: string;
|
|
736
|
+
weights: Record<string, number>;
|
|
737
|
+
is_active?: boolean;
|
|
738
|
+
}): UtilityProfile;
|
|
739
|
+
static getActiveProfile(db: Database.Database, project: string): UtilityProfile;
|
|
740
|
+
static getProfile(db: Database.Database, params: {
|
|
741
|
+
project: string;
|
|
742
|
+
name: string;
|
|
743
|
+
}): UtilityProfile;
|
|
744
|
+
static listProfiles(db: Database.Database, project: string): UtilityProfile[];
|
|
745
|
+
static activateProfile(db: Database.Database, params: {
|
|
746
|
+
project: string;
|
|
747
|
+
name: string;
|
|
748
|
+
}): UtilityProfile;
|
|
749
|
+
private static mapRowToProfile;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
declare class IntentionEngine {
|
|
753
|
+
static createIntention(db: Database.Database, params: {
|
|
754
|
+
project: string;
|
|
755
|
+
goal_id: string;
|
|
756
|
+
trace_id?: string;
|
|
757
|
+
session_id?: string;
|
|
758
|
+
behavior_name: string;
|
|
759
|
+
parameters?: Record<string, unknown>;
|
|
760
|
+
priority?: number;
|
|
761
|
+
deadline_at?: string;
|
|
762
|
+
abort_conditions?: Array<{
|
|
763
|
+
condition_type: string;
|
|
764
|
+
condition_params: Record<string, unknown>;
|
|
765
|
+
}>;
|
|
766
|
+
client_request_id?: string;
|
|
767
|
+
}): Intention;
|
|
768
|
+
static dispatchIntention(db: Database.Database, params: {
|
|
769
|
+
project: string;
|
|
770
|
+
id: string;
|
|
771
|
+
}): Intention;
|
|
772
|
+
static resolveIntention(db: Database.Database, params: {
|
|
773
|
+
project: string;
|
|
774
|
+
id: string;
|
|
775
|
+
status: 'completed' | 'failed' | 'aborted' | 'interrupted';
|
|
776
|
+
result?: Record<string, unknown>;
|
|
777
|
+
}): Intention;
|
|
778
|
+
static getIntention(db: Database.Database, params: {
|
|
779
|
+
project: string;
|
|
780
|
+
id: string;
|
|
781
|
+
}): Intention;
|
|
782
|
+
static listIntentions(db: Database.Database, params: {
|
|
783
|
+
project: string;
|
|
784
|
+
status?: IntentionStatus;
|
|
785
|
+
goal_id?: string;
|
|
786
|
+
limit?: number;
|
|
787
|
+
}): Intention[];
|
|
788
|
+
private static mapRowToIntention;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
declare class DecisionTraceEngine {
|
|
792
|
+
static recordTrace(db: Database.Database, params: {
|
|
793
|
+
project: string;
|
|
794
|
+
session_id?: string;
|
|
795
|
+
goal_id?: string;
|
|
796
|
+
situation_summary: string;
|
|
797
|
+
candidate_actions: CandidateAction[];
|
|
798
|
+
utility_profile: string;
|
|
799
|
+
chosen_action: string;
|
|
800
|
+
reasoning_chain: string[];
|
|
801
|
+
risk_assessment?: RiskAssessmentResult;
|
|
802
|
+
outcome?: string;
|
|
803
|
+
latency_ms?: number;
|
|
804
|
+
metadata?: Record<string, unknown>;
|
|
805
|
+
}): DecisionTrace;
|
|
806
|
+
static getTrace(db: Database.Database, params: {
|
|
807
|
+
project: string;
|
|
808
|
+
id: string;
|
|
809
|
+
}): DecisionTrace;
|
|
810
|
+
static listTraces(db: Database.Database, params: {
|
|
811
|
+
project: string;
|
|
812
|
+
goal_id?: string;
|
|
813
|
+
limit?: number;
|
|
814
|
+
}): DecisionTrace[];
|
|
815
|
+
static getLatestTrace(db: Database.Database, project: string): DecisionTrace | null;
|
|
816
|
+
static explainTrace(db: Database.Database, params: {
|
|
817
|
+
project: string;
|
|
818
|
+
id: string;
|
|
819
|
+
}): string;
|
|
820
|
+
private static mapRowToTrace;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
declare class EvaluatorEngine {
|
|
824
|
+
static evaluateSituation(db: Database.Database, params: {
|
|
825
|
+
project: string;
|
|
826
|
+
snapshot?: SituationSnapshot;
|
|
827
|
+
quick_context?: string;
|
|
828
|
+
candidate_actions?: Array<{
|
|
829
|
+
action: string;
|
|
830
|
+
parameters?: Record<string, unknown>;
|
|
831
|
+
description?: string;
|
|
832
|
+
}>;
|
|
833
|
+
utility_profile?: string;
|
|
834
|
+
}): {
|
|
835
|
+
chosen_action: CandidateAction;
|
|
836
|
+
ranked_candidates: CandidateAction[];
|
|
837
|
+
reasoning_chain: string[];
|
|
838
|
+
risk_assessment: any;
|
|
839
|
+
trace_id: string;
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
declare class UtilityEngine {
|
|
844
|
+
static scoreCandidate(candidate: {
|
|
845
|
+
action: string;
|
|
846
|
+
parameters?: Record<string, unknown>;
|
|
847
|
+
attributes?: Record<string, number>;
|
|
848
|
+
}, profile: UtilityProfile): CandidateAction;
|
|
849
|
+
static rankCandidates(candidates: Array<{
|
|
850
|
+
action: string;
|
|
851
|
+
parameters?: Record<string, unknown>;
|
|
852
|
+
attributes?: Record<string, number>;
|
|
853
|
+
}>, profile: UtilityProfile): CandidateAction[];
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
declare class RiskEngine {
|
|
857
|
+
static assessAction(actionName: string, params?: Record<string, unknown>, context?: Record<string, unknown>, profile?: UtilityProfile): RiskAssessmentResult;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
declare class ReplannerEngine {
|
|
861
|
+
static replanGoal(db: Database.Database, params: {
|
|
862
|
+
project: string;
|
|
863
|
+
goal_id: string;
|
|
864
|
+
blocker_description?: string;
|
|
865
|
+
trigger_event?: string;
|
|
866
|
+
preserve_completed?: boolean;
|
|
867
|
+
}): {
|
|
868
|
+
original_goal: Goal;
|
|
869
|
+
new_subgoals: Goal[];
|
|
870
|
+
cancelled_intentions: number;
|
|
871
|
+
recommended_action: string;
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
declare class KnowledgeEngine {
|
|
876
|
+
static createPattern(db: Database.Database, params: {
|
|
877
|
+
project: string;
|
|
878
|
+
pattern_type: 'heuristic' | 'anti_pattern' | 'optimization' | 'contingency';
|
|
879
|
+
context_tags: string[];
|
|
880
|
+
situation_pattern: string;
|
|
881
|
+
recommended_strategy: string;
|
|
882
|
+
confidence?: number;
|
|
883
|
+
metadata?: Record<string, unknown>;
|
|
884
|
+
}): KnowledgePattern;
|
|
885
|
+
static queryKnowledge(db: Database.Database, params: {
|
|
886
|
+
project: string;
|
|
887
|
+
query?: string;
|
|
888
|
+
pattern_type?: string;
|
|
889
|
+
context_tags?: string[];
|
|
890
|
+
limit?: number;
|
|
891
|
+
}): KnowledgePattern[];
|
|
892
|
+
private static mapRowToPattern;
|
|
893
|
+
/**
|
|
894
|
+
* Seeds tactical domain heuristics for gaming and autonomous agent navigation.
|
|
895
|
+
*/
|
|
896
|
+
static seedDefaultPatterns(db: Database.Database, project: string): number;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
declare class SnapshotEngine {
|
|
900
|
+
static saveSnapshot(db: Database.Database, params: {
|
|
901
|
+
project: string;
|
|
902
|
+
name: string;
|
|
903
|
+
description?: string;
|
|
904
|
+
}): {
|
|
905
|
+
snapshot_id: string;
|
|
906
|
+
name: string;
|
|
907
|
+
timestamp: string;
|
|
908
|
+
};
|
|
909
|
+
static restoreSnapshot(db: Database.Database, params: {
|
|
910
|
+
project: string;
|
|
911
|
+
name: string;
|
|
912
|
+
}): {
|
|
913
|
+
restored_goals: number;
|
|
914
|
+
restored_beliefs: number;
|
|
915
|
+
};
|
|
916
|
+
static listSnapshots(db: Database.Database, params: {
|
|
917
|
+
project: string;
|
|
918
|
+
limit?: number;
|
|
919
|
+
}): Array<{
|
|
920
|
+
id: string;
|
|
921
|
+
name: string;
|
|
922
|
+
description?: string;
|
|
923
|
+
created_at: string;
|
|
924
|
+
}>;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
declare function computeEventHash(params: {
|
|
928
|
+
prev_hash: string;
|
|
929
|
+
id: string;
|
|
930
|
+
project: string;
|
|
931
|
+
entity_id: string;
|
|
932
|
+
entity_type: string;
|
|
933
|
+
action: string;
|
|
934
|
+
timestamp: string;
|
|
935
|
+
details?: Record<string, unknown>;
|
|
936
|
+
}): string;
|
|
937
|
+
declare function logReasoningEvent(db: Database.Database, params: {
|
|
938
|
+
project: string;
|
|
939
|
+
entity_id: string;
|
|
940
|
+
entity_type: 'goal' | 'belief' | 'trace' | 'profile' | 'intention' | 'knowledge';
|
|
941
|
+
action: string;
|
|
942
|
+
details?: Record<string, unknown>;
|
|
943
|
+
}): ReasoningEvent;
|
|
944
|
+
declare function verifyEventChain(db: Database.Database, project: string): {
|
|
945
|
+
valid: boolean;
|
|
946
|
+
total_events: number;
|
|
947
|
+
corrupted_event_id?: string;
|
|
948
|
+
error?: string;
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
interface StateBridgeData {
|
|
952
|
+
tasks: Array<{
|
|
953
|
+
id: string;
|
|
954
|
+
title: string;
|
|
955
|
+
status: string;
|
|
956
|
+
priority: number;
|
|
957
|
+
}>;
|
|
958
|
+
blockers: Array<{
|
|
959
|
+
id: string;
|
|
960
|
+
description: string;
|
|
961
|
+
}>;
|
|
962
|
+
decisions: Array<{
|
|
963
|
+
id: string;
|
|
964
|
+
recommendation: string;
|
|
965
|
+
}>;
|
|
966
|
+
}
|
|
967
|
+
declare class StateBridge {
|
|
968
|
+
static normalizeStateData(rawStateData: any): StateBridgeData;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
interface WorldBridgeData {
|
|
972
|
+
entities: Array<{
|
|
973
|
+
id: string;
|
|
974
|
+
type: string;
|
|
975
|
+
position: [number, number, number];
|
|
976
|
+
status: string;
|
|
977
|
+
}>;
|
|
978
|
+
relations: Array<{
|
|
979
|
+
source: string;
|
|
980
|
+
relation: string;
|
|
981
|
+
target: string;
|
|
982
|
+
}>;
|
|
983
|
+
observer_position?: [number, number, number];
|
|
984
|
+
}
|
|
985
|
+
declare class WorldBridge {
|
|
986
|
+
static normalizeWorldData(rawWorldData: any): WorldBridgeData;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
interface VisionBridgeData {
|
|
990
|
+
current_state_id?: string;
|
|
991
|
+
description?: string;
|
|
992
|
+
grounded_elements: Array<{
|
|
993
|
+
selector: string;
|
|
994
|
+
label: string;
|
|
995
|
+
}>;
|
|
996
|
+
}
|
|
997
|
+
declare class VisionBridge {
|
|
998
|
+
static normalizeVisionData(rawVisionData: any): VisionBridgeData;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
declare const server: McpServer;
|
|
1002
|
+
|
|
1003
|
+
export { AssessRiskSchema, type Belief, type BeliefCategory, BeliefEngine, type BeliefId, type CandidateAction, ConflictError, DatabaseError, type DecisionTrace, DecisionTraceEngine, EvaluateSituationSchema, EvaluatorEngine, type EventId, GetDecisionTraceSchema, type Goal, GoalEngine, type GoalId, type GoalStatus, type Intention, IntentionEngine, type IntentionId, type IntentionStatus, KnowledgeEngine, type KnowledgePattern, LOG_LEVELS, ManageBeliefsSchema, ManageIntentionsSchema, ManageReasoningDbSchema, NotFoundError, type PatternId, type ProfileId, QueryKnowledgeSchema, ReasoningError, type ReasoningEvent, ReplanSchema, ReplannerEngine, type RiskAssessmentResult, RiskEngine, SetGoalSchema, SetUtilityWeightsSchema, type SituationSnapshot, SnapshotEngine, type SnapshotId, StateBridge, type StateBridgeData, type TraceId, UtilityEngine, type UtilityProfile, UtilityProfileEngine, ValidationError, VisionBridge, type VisionBridgeData, WorldBridge, type WorldBridgeData, closeAllDbs, closeDb, computeEventHash, generateId, getBaseDir, getCurrentIsoString, getDb, getDbPath, getElapsedTimeMs, getLogLevel, getProjectDbDir, getProjectSlug, getReadOnlyDb, getRegistry, getRegistryPath, logReasoningEvent, logger, parseIsoString, registerProject, resolveProjectRoot, sanitizeSlug, server, unregisterProject, validatePath, verifyEventChain };
|