@weavelogic/knowledge-graph-agent 0.3.0 → 0.4.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 +290 -3
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/_virtual/index8.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/audit/config.d.ts +150 -0
- package/dist/audit/config.d.ts.map +1 -0
- package/dist/audit/config.js +111 -0
- package/dist/audit/config.js.map +1 -0
- package/dist/audit/index.d.ts +38 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.d.ts +276 -0
- package/dist/audit/services/audit-chain.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.js +502 -0
- package/dist/audit/services/audit-chain.js.map +1 -0
- package/dist/audit/services/index.d.ts +11 -0
- package/dist/audit/services/index.d.ts.map +1 -0
- package/dist/audit/services/syndication.d.ts +334 -0
- package/dist/audit/services/syndication.d.ts.map +1 -0
- package/dist/audit/services/syndication.js +589 -0
- package/dist/audit/services/syndication.js.map +1 -0
- package/dist/audit/types.d.ts +453 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/cli/commands/audit.d.ts +21 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +621 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/vector.d.ts +14 -0
- package/dist/cli/commands/vector.d.ts.map +1 -0
- package/dist/cli/commands/vector.js +429 -0
- package/dist/cli/commands/vector.js.map +1 -0
- package/dist/cli/commands/workflow.d.ts +12 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +471 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +26 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/database/schemas/index.d.ts +85 -0
- package/dist/database/schemas/index.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/audit/checkpoint.d.ts +58 -0
- package/dist/mcp-server/tools/audit/checkpoint.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/checkpoint.js +73 -0
- package/dist/mcp-server/tools/audit/checkpoint.js.map +1 -0
- package/dist/mcp-server/tools/audit/index.d.ts +53 -0
- package/dist/mcp-server/tools/audit/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/index.js +12 -0
- package/dist/mcp-server/tools/audit/index.js.map +1 -0
- package/dist/mcp-server/tools/audit/query.d.ts +58 -0
- package/dist/mcp-server/tools/audit/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/query.js +125 -0
- package/dist/mcp-server/tools/audit/query.js.map +1 -0
- package/dist/mcp-server/tools/audit/sync.d.ts +58 -0
- package/dist/mcp-server/tools/audit/sync.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/sync.js +126 -0
- package/dist/mcp-server/tools/audit/sync.js.map +1 -0
- package/dist/mcp-server/tools/index.d.ts +3 -0
- package/dist/mcp-server/tools/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/registry.js +90 -0
- package/dist/mcp-server/tools/registry.js.map +1 -1
- package/dist/mcp-server/tools/vector/index.d.ts +12 -0
- package/dist/mcp-server/tools/vector/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/index.js +12 -0
- package/dist/mcp-server/tools/vector/index.js.map +1 -0
- package/dist/mcp-server/tools/vector/search.d.ts +41 -0
- package/dist/mcp-server/tools/vector/search.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/search.js +224 -0
- package/dist/mcp-server/tools/vector/search.js.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts +39 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.js +170 -0
- package/dist/mcp-server/tools/vector/trajectory.js.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts +44 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.js +175 -0
- package/dist/mcp-server/tools/vector/upsert.js.map +1 -0
- package/dist/mcp-server/tools/workflow/index.d.ts +29 -0
- package/dist/mcp-server/tools/workflow/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/index.js +12 -0
- package/dist/mcp-server/tools/workflow/index.js.map +1 -0
- package/dist/mcp-server/tools/workflow/list.d.ts +41 -0
- package/dist/mcp-server/tools/workflow/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/list.js +195 -0
- package/dist/mcp-server/tools/workflow/list.js.map +1 -0
- package/dist/mcp-server/tools/workflow/start.d.ts +40 -0
- package/dist/mcp-server/tools/workflow/start.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/start.js +165 -0
- package/dist/mcp-server/tools/workflow/start.js.map +1 -0
- package/dist/mcp-server/tools/workflow/status.d.ts +38 -0
- package/dist/mcp-server/tools/workflow/status.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/status.js +97 -0
- package/dist/mcp-server/tools/workflow/status.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
- package/dist/vector/config.d.ts +300 -0
- package/dist/vector/config.d.ts.map +1 -0
- package/dist/vector/config.js +124 -0
- package/dist/vector/config.js.map +1 -0
- package/dist/vector/index.d.ts +50 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/services/index.d.ts +13 -0
- package/dist/vector/services/index.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.d.ts +405 -0
- package/dist/vector/services/trajectory-tracker.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.js +445 -0
- package/dist/vector/services/trajectory-tracker.js.map +1 -0
- package/dist/vector/services/vector-store.d.ts +339 -0
- package/dist/vector/services/vector-store.d.ts.map +1 -0
- package/dist/vector/services/vector-store.js +748 -0
- package/dist/vector/services/vector-store.js.map +1 -0
- package/dist/vector/types.d.ts +677 -0
- package/dist/vector/types.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.d.ts +196 -0
- package/dist/workflow/adapters/goap-adapter.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.js +706 -0
- package/dist/workflow/adapters/goap-adapter.js.map +1 -0
- package/dist/workflow/adapters/index.d.ts +10 -0
- package/dist/workflow/adapters/index.d.ts.map +1 -0
- package/dist/workflow/config.d.ts +135 -0
- package/dist/workflow/config.d.ts.map +1 -0
- package/dist/workflow/config.js +92 -0
- package/dist/workflow/config.js.map +1 -0
- package/dist/workflow/handlers/index.d.ts +9 -0
- package/dist/workflow/handlers/index.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts +397 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.js +454 -0
- package/dist/workflow/handlers/webhook-handlers.js.map +1 -0
- package/dist/workflow/index.d.ts +42 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/services/index.d.ts +9 -0
- package/dist/workflow/services/index.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.d.ts +318 -0
- package/dist/workflow/services/workflow-service.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.js +577 -0
- package/dist/workflow/services/workflow-service.js.map +1 -0
- package/dist/workflow/types.d.ts +470 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/workflows/realtime-collab.d.ts +245 -0
- package/dist/workflow/workflows/realtime-collab.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GOAP Adapter
|
|
3
|
+
*
|
|
4
|
+
* Adapts the existing goal-planner agent for use with Workflow DevKit.
|
|
5
|
+
* Provides A* search-based planning with OODA loop integration.
|
|
6
|
+
*
|
|
7
|
+
* @module workflow/adapters/goap-adapter
|
|
8
|
+
*/
|
|
9
|
+
import type { WorldState, GOAPAction, GOAPGoal, GOAPPlan, PlanExecutionResult, ReadinessEvaluation } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* GOAP Adapter configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface GOAPAdapterConfig {
|
|
14
|
+
/** Maximum planning iterations */
|
|
15
|
+
maxIterations?: number;
|
|
16
|
+
/** Planning timeout in ms */
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
/** Default action cost */
|
|
19
|
+
defaultCost?: number;
|
|
20
|
+
/** Enable plan caching */
|
|
21
|
+
enableCaching?: boolean;
|
|
22
|
+
/** Maximum plan length */
|
|
23
|
+
maxPlanLength?: number;
|
|
24
|
+
/** Custom actions to register */
|
|
25
|
+
actions?: GOAPAction[];
|
|
26
|
+
/** Custom heuristic function */
|
|
27
|
+
heuristic?: (state: WorldState, goal: Partial<WorldState>) => number;
|
|
28
|
+
/** Logger function */
|
|
29
|
+
logger?: (level: string, message: string, data?: Record<string, unknown>) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Default GOAP actions for knowledge graph workflows
|
|
33
|
+
*
|
|
34
|
+
* These actions represent common development workflow operations
|
|
35
|
+
* and can be extended or replaced with custom actions.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_GOAP_ACTIONS: GOAPAction[];
|
|
38
|
+
/**
|
|
39
|
+
* GOAP Adapter class
|
|
40
|
+
*
|
|
41
|
+
* Implements Goal-Oriented Action Planning using A* search algorithm.
|
|
42
|
+
* Integrates with the existing goal-planner agent patterns.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const adapter = new GOAPAdapter({
|
|
47
|
+
* actions: DEFAULT_GOAP_ACTIONS,
|
|
48
|
+
* maxIterations: 1000,
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* const plan = await adapter.createPlan(worldState, 'start-development');
|
|
52
|
+
* if (plan.achievable) {
|
|
53
|
+
* const result = await adapter.executePlan(plan, worldState);
|
|
54
|
+
* console.log('Execution result:', result);
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare class GOAPAdapter {
|
|
59
|
+
private config;
|
|
60
|
+
private actions;
|
|
61
|
+
private goals;
|
|
62
|
+
private planCache;
|
|
63
|
+
private customHeuristic?;
|
|
64
|
+
constructor(config?: GOAPAdapterConfig);
|
|
65
|
+
/**
|
|
66
|
+
* Register default actions for documentation workflows
|
|
67
|
+
*/
|
|
68
|
+
private registerDefaultActions;
|
|
69
|
+
/**
|
|
70
|
+
* Register default goals
|
|
71
|
+
*/
|
|
72
|
+
private registerDefaultGoals;
|
|
73
|
+
/**
|
|
74
|
+
* Register an action
|
|
75
|
+
*
|
|
76
|
+
* @param action - Action definition to register
|
|
77
|
+
*/
|
|
78
|
+
registerAction(action: GOAPAction): void;
|
|
79
|
+
/**
|
|
80
|
+
* Register a goal
|
|
81
|
+
*
|
|
82
|
+
* @param goal - Goal definition to register
|
|
83
|
+
*/
|
|
84
|
+
registerGoal(goal: GOAPGoal): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get a registered action by ID
|
|
87
|
+
*
|
|
88
|
+
* @param actionId - Action identifier
|
|
89
|
+
* @returns Action definition or undefined
|
|
90
|
+
*/
|
|
91
|
+
getAction(actionId: string): GOAPAction | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Get a registered goal by ID
|
|
94
|
+
*
|
|
95
|
+
* @param goalId - Goal identifier
|
|
96
|
+
* @returns Goal definition or undefined
|
|
97
|
+
*/
|
|
98
|
+
getGoal(goalId: string): GOAPGoal | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Get all registered actions
|
|
101
|
+
*
|
|
102
|
+
* @returns Array of action definitions
|
|
103
|
+
*/
|
|
104
|
+
getActions(): GOAPAction[];
|
|
105
|
+
/**
|
|
106
|
+
* Get all registered goals
|
|
107
|
+
*
|
|
108
|
+
* @returns Array of goal definitions
|
|
109
|
+
*/
|
|
110
|
+
getGoals(): GOAPGoal[];
|
|
111
|
+
/**
|
|
112
|
+
* Create a plan to achieve a goal from the current state
|
|
113
|
+
*
|
|
114
|
+
* @param currentState - Current world state
|
|
115
|
+
* @param goalId - Goal to achieve
|
|
116
|
+
* @returns Plan to achieve the goal
|
|
117
|
+
*/
|
|
118
|
+
createPlan(currentState: WorldState, goalId: string): GOAPPlan;
|
|
119
|
+
/**
|
|
120
|
+
* A* search algorithm for plan finding
|
|
121
|
+
*
|
|
122
|
+
* Uses a binary heap priority queue for efficient O(log n) operations.
|
|
123
|
+
* Implements proper path reconstruction using parent node references.
|
|
124
|
+
*/
|
|
125
|
+
private aStarSearch;
|
|
126
|
+
/**
|
|
127
|
+
* Reconstruct the plan from the goal node by following parent references
|
|
128
|
+
*
|
|
129
|
+
* @param goalNode - The node that reached the goal
|
|
130
|
+
* @param goal - The goal definition
|
|
131
|
+
* @returns Complete GOAP plan
|
|
132
|
+
*/
|
|
133
|
+
private reconstructPlan;
|
|
134
|
+
/**
|
|
135
|
+
* Heuristic function for A* (estimates cost to goal)
|
|
136
|
+
*
|
|
137
|
+
* Uses Manhattan-like distance for numeric values and
|
|
138
|
+
* fixed penalties for boolean mismatches.
|
|
139
|
+
*
|
|
140
|
+
* @param state - Current world state
|
|
141
|
+
* @param goal - Goal to reach
|
|
142
|
+
* @returns Estimated cost to reach goal
|
|
143
|
+
*/
|
|
144
|
+
private heuristic;
|
|
145
|
+
/**
|
|
146
|
+
* Check if a goal is satisfied by the current state
|
|
147
|
+
*/
|
|
148
|
+
private isGoalSatisfied;
|
|
149
|
+
/**
|
|
150
|
+
* Check if an action can be applied to a state
|
|
151
|
+
*/
|
|
152
|
+
private canApply;
|
|
153
|
+
/**
|
|
154
|
+
* Apply an action to a state and return the new state
|
|
155
|
+
*/
|
|
156
|
+
private applyAction;
|
|
157
|
+
/**
|
|
158
|
+
* Convert state to a cache key string
|
|
159
|
+
*/
|
|
160
|
+
private stateToKey;
|
|
161
|
+
/**
|
|
162
|
+
* Create cache key for a plan
|
|
163
|
+
*/
|
|
164
|
+
private createCacheKey;
|
|
165
|
+
/**
|
|
166
|
+
* Cache a plan
|
|
167
|
+
*/
|
|
168
|
+
private cachePlan;
|
|
169
|
+
/**
|
|
170
|
+
* Clear the plan cache
|
|
171
|
+
*/
|
|
172
|
+
clearCache(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Execute a plan
|
|
175
|
+
*
|
|
176
|
+
* @param plan - Plan to execute
|
|
177
|
+
* @param initialState - Initial world state
|
|
178
|
+
* @returns Execution result
|
|
179
|
+
*/
|
|
180
|
+
executePlan(plan: GOAPPlan, initialState: WorldState): Promise<PlanExecutionResult>;
|
|
181
|
+
/**
|
|
182
|
+
* Evaluate readiness for development
|
|
183
|
+
*
|
|
184
|
+
* @param state - Current world state
|
|
185
|
+
* @returns Readiness evaluation
|
|
186
|
+
*/
|
|
187
|
+
evaluateReadiness(state: WorldState): ReadinessEvaluation;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Create a GOAP adapter instance
|
|
191
|
+
*
|
|
192
|
+
* @param config - Adapter configuration
|
|
193
|
+
* @returns Configured GOAP adapter
|
|
194
|
+
*/
|
|
195
|
+
export declare function createGOAPAdapter(config?: GOAPAdapterConfig): GOAPAdapter;
|
|
196
|
+
//# sourceMappingURL=goap-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goap-adapter.d.ts","sourceRoot":"","sources":["../../../src/workflow/adapters/goap-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,U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