@everworker/oneringai 0.4.0 → 0.4.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/index.cjs +134 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +134 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -14100,7 +14100,7 @@ declare const desktopTools: (ToolFunction<DesktopScreenshotArgs, DesktopScreensh
|
|
|
14100
14100
|
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
|
|
14101
14101
|
*
|
|
14102
14102
|
* Generated by: scripts/generate-tool-registry.ts
|
|
14103
|
-
* Generated at: 2026-02-
|
|
14103
|
+
* Generated at: 2026-02-20T19:29:58.960Z
|
|
14104
14104
|
*
|
|
14105
14105
|
* To regenerate: npm run generate:tools
|
|
14106
14106
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -14100,7 +14100,7 @@ declare const desktopTools: (ToolFunction<DesktopScreenshotArgs, DesktopScreensh
|
|
|
14100
14100
|
* AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
|
|
14101
14101
|
*
|
|
14102
14102
|
* Generated by: scripts/generate-tool-registry.ts
|
|
14103
|
-
* Generated at: 2026-02-
|
|
14103
|
+
* Generated at: 2026-02-20T19:29:58.960Z
|
|
14104
14104
|
*
|
|
14105
14105
|
* To regenerate: npm run generate:tools
|
|
14106
14106
|
*/
|
package/dist/index.js
CHANGED
|
@@ -14473,7 +14473,7 @@ var PRIORITY_VALUES = {
|
|
|
14473
14473
|
};
|
|
14474
14474
|
var DEFAULT_CONFIG = {
|
|
14475
14475
|
maxEntries: 20,
|
|
14476
|
-
maxTotalTokens:
|
|
14476
|
+
maxTotalTokens: 4e4,
|
|
14477
14477
|
defaultPriority: "normal",
|
|
14478
14478
|
showTimestamps: false
|
|
14479
14479
|
};
|
|
@@ -16658,7 +16658,7 @@ var StrategyRegistry = class {
|
|
|
16658
16658
|
// src/core/context-nextgen/types.ts
|
|
16659
16659
|
var DEFAULT_FEATURES = {
|
|
16660
16660
|
workingMemory: true,
|
|
16661
|
-
inContextMemory:
|
|
16661
|
+
inContextMemory: true,
|
|
16662
16662
|
persistentInstructions: false,
|
|
16663
16663
|
userInfo: false
|
|
16664
16664
|
};
|
|
@@ -23899,6 +23899,12 @@ function defaultTaskPrompt(task) {
|
|
|
23899
23899
|
}
|
|
23900
23900
|
parts.push("");
|
|
23901
23901
|
}
|
|
23902
|
+
if (task.dependsOn.length > 0) {
|
|
23903
|
+
parts.push("Note: Results from prerequisite tasks are available in your live context.");
|
|
23904
|
+
parts.push("Small results appear directly; larger results are in working memory \u2014 use memory_retrieve to access them.");
|
|
23905
|
+
parts.push("Review the plan overview and dependency results before starting.");
|
|
23906
|
+
parts.push("");
|
|
23907
|
+
}
|
|
23902
23908
|
parts.push("After completing the work, store key results in memory once, then respond with a text summary (no more tool calls).");
|
|
23903
23909
|
return parts.join("\n");
|
|
23904
23910
|
}
|
|
@@ -23982,6 +23988,127 @@ async function collectValidationContext(agent, responseText) {
|
|
|
23982
23988
|
toolCallLog
|
|
23983
23989
|
};
|
|
23984
23990
|
}
|
|
23991
|
+
function estimateTokens(text) {
|
|
23992
|
+
return Math.ceil(text.length / 4);
|
|
23993
|
+
}
|
|
23994
|
+
function buildPlanOverview(execution, definition, currentTaskId) {
|
|
23995
|
+
const parts = [];
|
|
23996
|
+
const progress = execution.progress ?? 0;
|
|
23997
|
+
parts.push(`Routine: ${definition.name}`);
|
|
23998
|
+
if (definition.description) {
|
|
23999
|
+
parts.push(`Goal: ${definition.description}`);
|
|
24000
|
+
}
|
|
24001
|
+
parts.push(`Progress: ${Math.round(progress * 100)}%`);
|
|
24002
|
+
parts.push("");
|
|
24003
|
+
parts.push("Tasks:");
|
|
24004
|
+
for (const task of execution.plan.tasks) {
|
|
24005
|
+
let statusIcon;
|
|
24006
|
+
switch (task.status) {
|
|
24007
|
+
case "completed":
|
|
24008
|
+
statusIcon = "[x]";
|
|
24009
|
+
break;
|
|
24010
|
+
case "in_progress":
|
|
24011
|
+
statusIcon = "[>]";
|
|
24012
|
+
break;
|
|
24013
|
+
case "failed":
|
|
24014
|
+
statusIcon = "[!]";
|
|
24015
|
+
break;
|
|
24016
|
+
case "skipped":
|
|
24017
|
+
statusIcon = "[-]";
|
|
24018
|
+
break;
|
|
24019
|
+
default:
|
|
24020
|
+
statusIcon = "[ ]";
|
|
24021
|
+
}
|
|
24022
|
+
let line = `${statusIcon} ${task.name}`;
|
|
24023
|
+
if (task.dependsOn.length > 0) {
|
|
24024
|
+
const depNames = task.dependsOn.map((depId) => execution.plan.tasks.find((t) => t.id === depId)?.name ?? depId).join(", ");
|
|
24025
|
+
line += ` (after: ${depNames})`;
|
|
24026
|
+
}
|
|
24027
|
+
if (task.id === currentTaskId) {
|
|
24028
|
+
line += " \u2190 CURRENT";
|
|
24029
|
+
}
|
|
24030
|
+
parts.push(line);
|
|
24031
|
+
}
|
|
24032
|
+
return parts.join("\n");
|
|
24033
|
+
}
|
|
24034
|
+
async function injectRoutineContext(agent, execution, definition, currentTask) {
|
|
24035
|
+
const icmPlugin = agent.context.getPlugin("in_context_memory");
|
|
24036
|
+
const wmPlugin = agent.context.memory;
|
|
24037
|
+
if (!icmPlugin && !wmPlugin) {
|
|
24038
|
+
logger.warn("injectRoutineContext: No ICM or WM plugin available \u2014 skipping context injection");
|
|
24039
|
+
return;
|
|
24040
|
+
}
|
|
24041
|
+
const planOverview = buildPlanOverview(execution, definition, currentTask.id);
|
|
24042
|
+
if (icmPlugin) {
|
|
24043
|
+
icmPlugin.set("__routine_plan", "Routine plan overview with task statuses", planOverview, "high");
|
|
24044
|
+
}
|
|
24045
|
+
if (icmPlugin) {
|
|
24046
|
+
for (const entry of icmPlugin.list()) {
|
|
24047
|
+
if (entry.key.startsWith("__dep_result_") || entry.key === "__routine_deps") {
|
|
24048
|
+
icmPlugin.delete(entry.key);
|
|
24049
|
+
}
|
|
24050
|
+
}
|
|
24051
|
+
}
|
|
24052
|
+
if (wmPlugin) {
|
|
24053
|
+
const { entries: wmEntries } = await wmPlugin.query();
|
|
24054
|
+
for (const entry of wmEntries) {
|
|
24055
|
+
if (entry.key.startsWith("__dep_result_") || entry.key.startsWith("findings/__dep_result_")) {
|
|
24056
|
+
await wmPlugin.delete(entry.key);
|
|
24057
|
+
}
|
|
24058
|
+
}
|
|
24059
|
+
}
|
|
24060
|
+
if (currentTask.dependsOn.length === 0) return;
|
|
24061
|
+
const inContextDeps = [];
|
|
24062
|
+
const workingMemoryDeps = [];
|
|
24063
|
+
for (const depId of currentTask.dependsOn) {
|
|
24064
|
+
const depTask = execution.plan.tasks.find((t) => t.id === depId);
|
|
24065
|
+
if (!depTask?.result?.output) continue;
|
|
24066
|
+
const output = typeof depTask.result.output === "string" ? depTask.result.output : JSON.stringify(depTask.result.output);
|
|
24067
|
+
const tokens = estimateTokens(output);
|
|
24068
|
+
const depKey = `__dep_result_${depId}`;
|
|
24069
|
+
const depLabel = `Result from task "${depTask.name}"`;
|
|
24070
|
+
if (tokens < 5e3 && icmPlugin) {
|
|
24071
|
+
icmPlugin.set(depKey, depLabel, output, "high");
|
|
24072
|
+
inContextDeps.push(depTask.name);
|
|
24073
|
+
} else if (wmPlugin) {
|
|
24074
|
+
await wmPlugin.store(depKey, depLabel, output, { tier: "findings" });
|
|
24075
|
+
workingMemoryDeps.push(depTask.name);
|
|
24076
|
+
} else if (icmPlugin) {
|
|
24077
|
+
const truncated = output.slice(0, 2e4) + "\n... (truncated, full result not available)";
|
|
24078
|
+
icmPlugin.set(depKey, depLabel, truncated, "high");
|
|
24079
|
+
inContextDeps.push(depTask.name + " (truncated)");
|
|
24080
|
+
}
|
|
24081
|
+
}
|
|
24082
|
+
if (icmPlugin && (inContextDeps.length > 0 || workingMemoryDeps.length > 0)) {
|
|
24083
|
+
const summaryParts = ["Dependency results available:"];
|
|
24084
|
+
if (inContextDeps.length > 0) {
|
|
24085
|
+
summaryParts.push(`In context (visible now): ${inContextDeps.join(", ")}`);
|
|
24086
|
+
}
|
|
24087
|
+
if (workingMemoryDeps.length > 0) {
|
|
24088
|
+
summaryParts.push(`In working memory (use memory_retrieve): ${workingMemoryDeps.join(", ")}`);
|
|
24089
|
+
}
|
|
24090
|
+
icmPlugin.set("__routine_deps", "Dependency results location guide", summaryParts.join("\n"), "high");
|
|
24091
|
+
}
|
|
24092
|
+
}
|
|
24093
|
+
async function cleanupRoutineContext(agent) {
|
|
24094
|
+
const icmPlugin = agent.context.getPlugin("in_context_memory");
|
|
24095
|
+
const wmPlugin = agent.context.memory;
|
|
24096
|
+
if (icmPlugin) {
|
|
24097
|
+
for (const entry of icmPlugin.list()) {
|
|
24098
|
+
if (entry.key.startsWith("__routine_") || entry.key.startsWith("__dep_result_")) {
|
|
24099
|
+
icmPlugin.delete(entry.key);
|
|
24100
|
+
}
|
|
24101
|
+
}
|
|
24102
|
+
}
|
|
24103
|
+
if (wmPlugin) {
|
|
24104
|
+
const { entries: wmEntries } = await wmPlugin.query();
|
|
24105
|
+
for (const entry of wmEntries) {
|
|
24106
|
+
if (entry.key.startsWith("__dep_result_") || entry.key.startsWith("findings/__dep_result_")) {
|
|
24107
|
+
await wmPlugin.delete(entry.key);
|
|
24108
|
+
}
|
|
24109
|
+
}
|
|
24110
|
+
}
|
|
24111
|
+
}
|
|
23985
24112
|
async function validateTaskCompletion(agent, task, responseText, validationPromptBuilder) {
|
|
23986
24113
|
const hasExplicitValidation = task.validation?.skipReflection === false && task.validation?.completionCriteria && task.validation.completionCriteria.length > 0;
|
|
23987
24114
|
if (!hasExplicitValidation) {
|
|
@@ -24127,6 +24254,7 @@ async function executeRoutine(options) {
|
|
|
24127
24254
|
};
|
|
24128
24255
|
agent.registerHook("pause:check", iterationLimiter);
|
|
24129
24256
|
const getTask = () => execution.plan.tasks[taskIndex];
|
|
24257
|
+
await injectRoutineContext(agent, execution, definition, getTask());
|
|
24130
24258
|
while (!taskCompleted) {
|
|
24131
24259
|
try {
|
|
24132
24260
|
const taskPrompt = buildTaskPrompt(getTask());
|
|
@@ -24229,6 +24357,10 @@ async function executeRoutine(options) {
|
|
|
24229
24357
|
);
|
|
24230
24358
|
return execution;
|
|
24231
24359
|
} finally {
|
|
24360
|
+
try {
|
|
24361
|
+
await cleanupRoutineContext(agent);
|
|
24362
|
+
} catch {
|
|
24363
|
+
}
|
|
24232
24364
|
for (const { name, hook } of registeredHooks) {
|
|
24233
24365
|
try {
|
|
24234
24366
|
agent.unregisterHook(name, hook);
|