@yuaone/core 0.6.1 → 0.7.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/dist/agent-loop.d.ts +38 -0
- package/dist/agent-loop.d.ts.map +1 -1
- package/dist/agent-loop.js +532 -117
- package/dist/agent-loop.js.map +1 -1
- package/dist/code-indexer.d.ts +50 -0
- package/dist/code-indexer.d.ts.map +1 -0
- package/dist/code-indexer.js +199 -0
- package/dist/code-indexer.js.map +1 -0
- package/dist/failure-recovery.d.ts +15 -2
- package/dist/failure-recovery.d.ts.map +1 -1
- package/dist/failure-recovery.js +53 -2
- package/dist/failure-recovery.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/llm-client.d.ts +20 -2
- package/dist/llm-client.d.ts.map +1 -1
- package/dist/llm-client.js +213 -8
- package/dist/llm-client.js.map +1 -1
- package/dist/llm-orchestrator.d.ts +74 -0
- package/dist/llm-orchestrator.d.ts.map +1 -0
- package/dist/llm-orchestrator.js +144 -0
- package/dist/llm-orchestrator.js.map +1 -0
- package/dist/planner/index.d.ts +9 -0
- package/dist/planner/index.d.ts.map +1 -0
- package/dist/planner/index.js +5 -0
- package/dist/planner/index.js.map +1 -0
- package/dist/planner/milestone-checker.d.ts +48 -0
- package/dist/planner/milestone-checker.d.ts.map +1 -0
- package/dist/planner/milestone-checker.js +113 -0
- package/dist/planner/milestone-checker.js.map +1 -0
- package/dist/planner/plan-evaluator.d.ts +35 -0
- package/dist/planner/plan-evaluator.d.ts.map +1 -0
- package/dist/planner/plan-evaluator.js +92 -0
- package/dist/planner/plan-evaluator.js.map +1 -0
- package/dist/planner/replanning-engine.d.ts +37 -0
- package/dist/planner/replanning-engine.d.ts.map +1 -0
- package/dist/planner/replanning-engine.js +130 -0
- package/dist/planner/replanning-engine.js.map +1 -0
- package/dist/planner/risk-estimator.d.ts +44 -0
- package/dist/planner/risk-estimator.d.ts.map +1 -0
- package/dist/planner/risk-estimator.js +108 -0
- package/dist/planner/risk-estimator.js.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/world-model/index.d.ts +8 -0
- package/dist/world-model/index.d.ts.map +1 -0
- package/dist/world-model/index.js +5 -0
- package/dist/world-model/index.js.map +1 -0
- package/dist/world-model/simulation-engine.d.ts +58 -0
- package/dist/world-model/simulation-engine.d.ts.map +1 -0
- package/dist/world-model/simulation-engine.js +191 -0
- package/dist/world-model/simulation-engine.js.map +1 -0
- package/dist/world-model/state-store.d.ts +149 -0
- package/dist/world-model/state-store.d.ts.map +1 -0
- package/dist/world-model/state-store.js +379 -0
- package/dist/world-model/state-store.js.map +1 -0
- package/dist/world-model/state-updater.d.ts +35 -0
- package/dist/world-model/state-updater.d.ts.map +1 -0
- package/dist/world-model/state-updater.js +131 -0
- package/dist/world-model/state-updater.js.map +1 -0
- package/dist/world-model/transition-model.d.ts +54 -0
- package/dist/world-model/transition-model.d.ts.map +1 -0
- package/dist/world-model/transition-model.js +240 -0
- package/dist/world-model/transition-model.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module world-model/transition-model
|
|
3
|
+
* @description Predicts how each tool call will change the WorldState.
|
|
4
|
+
* Uses rule-based heuristics with calibration via actual outcomes.
|
|
5
|
+
*/
|
|
6
|
+
// ─── Helpers ───
|
|
7
|
+
function emptyDelta() {
|
|
8
|
+
return {
|
|
9
|
+
filesChanged: [],
|
|
10
|
+
filesCreated: [],
|
|
11
|
+
filesDeleted: [],
|
|
12
|
+
buildInvalidated: false,
|
|
13
|
+
testInvalidated: false,
|
|
14
|
+
gitDirty: false,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function getStringArg(args, ...keys) {
|
|
18
|
+
for (const key of keys) {
|
|
19
|
+
if (typeof args[key] === "string")
|
|
20
|
+
return args[key];
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
// ─── TransitionModel ───
|
|
25
|
+
export class TransitionModel {
|
|
26
|
+
history;
|
|
27
|
+
/** Per tool-type accuracy for calibration */
|
|
28
|
+
accuracy;
|
|
29
|
+
constructor() {
|
|
30
|
+
this.history = [];
|
|
31
|
+
this.accuracy = new Map();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Predict what will happen when a tool is called with given args.
|
|
35
|
+
* Uses rule-based heuristics + calibration multipliers.
|
|
36
|
+
*/
|
|
37
|
+
predict(tool, args, currentState) {
|
|
38
|
+
const delta = emptyDelta();
|
|
39
|
+
let baseProbability = 0.10;
|
|
40
|
+
let reasoning = "unknown tool — default failure probability";
|
|
41
|
+
const toolLower = tool.toLowerCase();
|
|
42
|
+
if (toolLower === "file_write" || toolLower === "file_edit") {
|
|
43
|
+
const filePath = getStringArg(args, "path", "file_path");
|
|
44
|
+
if (filePath)
|
|
45
|
+
delta.filesChanged.push(filePath);
|
|
46
|
+
delta.buildInvalidated = true;
|
|
47
|
+
delta.testInvalidated = true;
|
|
48
|
+
delta.gitDirty = true;
|
|
49
|
+
baseProbability = 0.05;
|
|
50
|
+
reasoning = "file write/edit — rarely fails, invalidates build and tests";
|
|
51
|
+
}
|
|
52
|
+
else if (toolLower === "shell_exec") {
|
|
53
|
+
const command = getStringArg(args, "command", "cmd") ?? "";
|
|
54
|
+
const cmdLower = command.toLowerCase();
|
|
55
|
+
if (cmdLower.includes("tsc") || cmdLower.includes("build") || cmdLower.includes("compile")) {
|
|
56
|
+
// This IS the build — not invalidated
|
|
57
|
+
delta.buildInvalidated = false;
|
|
58
|
+
delta.testInvalidated = false;
|
|
59
|
+
// Count dirty files in currentState to scale failure probability
|
|
60
|
+
let changedFilesCount = 0;
|
|
61
|
+
for (const [, fileState] of currentState.files) {
|
|
62
|
+
if (fileState.exists)
|
|
63
|
+
changedFilesCount++;
|
|
64
|
+
}
|
|
65
|
+
baseProbability = 0.15 + 0.03 * changedFilesCount;
|
|
66
|
+
reasoning = `build command — base 0.15 + 0.03 × ${changedFilesCount} changed files = ${baseProbability.toFixed(3)}`;
|
|
67
|
+
}
|
|
68
|
+
else if (cmdLower.includes("test") ||
|
|
69
|
+
cmdLower.includes("jest") ||
|
|
70
|
+
cmdLower.includes("vitest") ||
|
|
71
|
+
cmdLower.includes("mocha")) {
|
|
72
|
+
// This IS the test run
|
|
73
|
+
delta.testInvalidated = false;
|
|
74
|
+
baseProbability = 0.20;
|
|
75
|
+
reasoning = "test command — higher baseline failure probability (0.20)";
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
baseProbability = 0.10;
|
|
79
|
+
reasoning = "shell command — default failure probability";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (toolLower === "git_ops") {
|
|
83
|
+
const operation = getStringArg(args, "operation", "op") ?? "";
|
|
84
|
+
if (operation === "commit") {
|
|
85
|
+
delta.gitDirty = false;
|
|
86
|
+
baseProbability = 0.02;
|
|
87
|
+
reasoning = "git commit — very unlikely to fail";
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
baseProbability = 0.05;
|
|
91
|
+
reasoning = "git operation — low failure probability";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (toolLower === "grep" ||
|
|
95
|
+
toolLower === "glob" ||
|
|
96
|
+
toolLower === "file_read" ||
|
|
97
|
+
toolLower === "code_search") {
|
|
98
|
+
// Read-only — no state changes
|
|
99
|
+
baseProbability = 0.01;
|
|
100
|
+
reasoning = "read-only tool — minimal failure probability";
|
|
101
|
+
}
|
|
102
|
+
// Apply calibration multiplier if available
|
|
103
|
+
const acc = this.accuracy.get(toolLower);
|
|
104
|
+
const calibratedProbability = acc
|
|
105
|
+
? Math.min(1.0, baseProbability * acc.multiplier)
|
|
106
|
+
: baseProbability;
|
|
107
|
+
if (acc && acc.multiplier !== 1.0) {
|
|
108
|
+
reasoning += ` (calibrated ×${acc.multiplier.toFixed(2)})`;
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
tool,
|
|
112
|
+
args,
|
|
113
|
+
expectedDelta: delta,
|
|
114
|
+
failureProbability: calibratedProbability,
|
|
115
|
+
reasoning,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* After actual execution, calibrate the model's accuracy for this tool type.
|
|
120
|
+
* Uses a simple exponential moving average on the multiplier.
|
|
121
|
+
*/
|
|
122
|
+
calibrate(predicted, actual, success) {
|
|
123
|
+
const toolLower = predicted.tool.toLowerCase();
|
|
124
|
+
// Record outcome
|
|
125
|
+
this.history.push({
|
|
126
|
+
predicted,
|
|
127
|
+
actual,
|
|
128
|
+
success,
|
|
129
|
+
timestamp: Date.now(),
|
|
130
|
+
});
|
|
131
|
+
// Update per-tool accuracy
|
|
132
|
+
const existing = this.accuracy.get(toolLower) ?? {
|
|
133
|
+
attempts: 0,
|
|
134
|
+
successes: 0,
|
|
135
|
+
multiplier: 1.0,
|
|
136
|
+
};
|
|
137
|
+
existing.attempts++;
|
|
138
|
+
if (success)
|
|
139
|
+
existing.successes++;
|
|
140
|
+
// Adjust multiplier: if actual failure rate differs from predicted, nudge multiplier
|
|
141
|
+
// Use EMA with alpha = 0.2
|
|
142
|
+
if (existing.attempts >= 3) {
|
|
143
|
+
const actualFailRate = 1 - existing.successes / existing.attempts;
|
|
144
|
+
const predictedFailRate = predicted.failureProbability;
|
|
145
|
+
if (predictedFailRate > 0) {
|
|
146
|
+
const ratio = actualFailRate / predictedFailRate;
|
|
147
|
+
const alpha = 0.2;
|
|
148
|
+
existing.multiplier = existing.multiplier * (1 - alpha) + ratio * alpha;
|
|
149
|
+
// Clamp multiplier to reasonable range
|
|
150
|
+
existing.multiplier = Math.max(0.1, Math.min(5.0, existing.multiplier));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
this.accuracy.set(toolLower, existing);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Predict the final WorldState after executing a sequence of tool calls.
|
|
157
|
+
* Applies each transition's expected delta to produce the final state.
|
|
158
|
+
*/
|
|
159
|
+
predictSequence(tools, initialState) {
|
|
160
|
+
// Build a lightweight mutable copy of the state for prediction
|
|
161
|
+
let state = {
|
|
162
|
+
files: new Map(initialState.files),
|
|
163
|
+
build: { ...initialState.build, errors: [...initialState.build.errors] },
|
|
164
|
+
test: { ...initialState.test, failingTests: [...initialState.test.failingTests] },
|
|
165
|
+
git: {
|
|
166
|
+
...initialState.git,
|
|
167
|
+
stagedFiles: [...initialState.git.stagedFiles],
|
|
168
|
+
uncommittedFiles: [...initialState.git.uncommittedFiles],
|
|
169
|
+
},
|
|
170
|
+
deps: {
|
|
171
|
+
...initialState.deps,
|
|
172
|
+
missing: [...initialState.deps.missing],
|
|
173
|
+
outdated: [...initialState.deps.outdated],
|
|
174
|
+
},
|
|
175
|
+
timestamp: initialState.timestamp,
|
|
176
|
+
};
|
|
177
|
+
for (const { tool, args } of tools) {
|
|
178
|
+
const transition = this.predict(tool, args, state);
|
|
179
|
+
const delta = transition.expectedDelta;
|
|
180
|
+
// Apply file changes
|
|
181
|
+
for (const path of delta.filesChanged) {
|
|
182
|
+
const existing = state.files.get(path);
|
|
183
|
+
state.files.set(path, {
|
|
184
|
+
path,
|
|
185
|
+
exists: true,
|
|
186
|
+
hash: "",
|
|
187
|
+
lines: existing?.lines ?? 0,
|
|
188
|
+
lastModified: Date.now(),
|
|
189
|
+
});
|
|
190
|
+
// Mark git dirty
|
|
191
|
+
if (delta.gitDirty && !state.git.uncommittedFiles.includes(path)) {
|
|
192
|
+
state.git.uncommittedFiles.push(path);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
for (const path of delta.filesCreated) {
|
|
196
|
+
state.files.set(path, {
|
|
197
|
+
path,
|
|
198
|
+
exists: true,
|
|
199
|
+
hash: "",
|
|
200
|
+
lines: 0,
|
|
201
|
+
lastModified: Date.now(),
|
|
202
|
+
});
|
|
203
|
+
if (delta.gitDirty && !state.git.uncommittedFiles.includes(path)) {
|
|
204
|
+
state.git.uncommittedFiles.push(path);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
for (const path of delta.filesDeleted) {
|
|
208
|
+
const existing = state.files.get(path);
|
|
209
|
+
if (existing) {
|
|
210
|
+
state.files.set(path, { ...existing, exists: false });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Apply build/test invalidation
|
|
214
|
+
if (delta.buildInvalidated) {
|
|
215
|
+
state.build = { ...state.build, status: "unknown" };
|
|
216
|
+
}
|
|
217
|
+
if (delta.testInvalidated) {
|
|
218
|
+
state.test = { ...state.test, status: "unknown" };
|
|
219
|
+
}
|
|
220
|
+
// Apply git dirty
|
|
221
|
+
if (delta.gitDirty) {
|
|
222
|
+
state.git = { ...state.git, dirty: true };
|
|
223
|
+
}
|
|
224
|
+
else if (tool.toLowerCase() === "git_ops") {
|
|
225
|
+
// git commit clears dirty
|
|
226
|
+
const operation = typeof args["operation"] === "string" ? args["operation"] : "";
|
|
227
|
+
if (operation === "commit") {
|
|
228
|
+
state.git = {
|
|
229
|
+
...state.git,
|
|
230
|
+
dirty: false,
|
|
231
|
+
uncommittedFiles: [],
|
|
232
|
+
stagedFiles: [],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return state;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=transition-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition-model.js","sourceRoot":"","sources":["../../src/world-model/transition-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+CH,kBAAkB;AAElB,SAAS,UAAU;IACjB,OAAO;QACL,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,EAAE;QAChB,gBAAgB,EAAE,KAAK;QACvB,eAAe,EAAE,KAAK;QACtB,QAAQ,EAAE,KAAK;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