omnius 1.0.162 → 1.0.164
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.js +827 -246
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20504,7 +20504,6 @@ ${text}`,
|
|
|
20504
20504
|
import { existsSync as existsSync23, readdirSync as readdirSync9, readFileSync as readFileSync17, mkdirSync as mkdirSync9, writeFileSync as writeFileSync10 } from "node:fs";
|
|
20505
20505
|
import { join as join26 } from "node:path";
|
|
20506
20506
|
import { homedir as homedir7 } from "node:os";
|
|
20507
|
-
import { spawn as spawn5 } from "node:child_process";
|
|
20508
20507
|
function globalToolsDir() {
|
|
20509
20508
|
return join26(homedir7(), ".omnius", "tools");
|
|
20510
20509
|
}
|
|
@@ -20529,9 +20528,9 @@ function loadCustomTools(repoRoot) {
|
|
|
20529
20528
|
}
|
|
20530
20529
|
return Array.from(definitions.values());
|
|
20531
20530
|
}
|
|
20532
|
-
function buildCustomTools(repoRoot) {
|
|
20531
|
+
function buildCustomTools(repoRoot, options2 = {}) {
|
|
20533
20532
|
const definitions = loadCustomTools(repoRoot);
|
|
20534
|
-
return definitions.map((def) => new CustomTool(def, repoRoot));
|
|
20533
|
+
return definitions.map((def) => new CustomTool(def, repoRoot, [], { shellRunner: options2.shellRunner }));
|
|
20535
20534
|
}
|
|
20536
20535
|
function saveCustomToolDefinition(definition, scope, repoRoot) {
|
|
20537
20536
|
const dir = scope === "project" && repoRoot ? projectToolsDir(repoRoot) : globalToolsDir();
|
|
@@ -20542,8 +20541,9 @@ function saveCustomToolDefinition(definition, scope, repoRoot) {
|
|
|
20542
20541
|
const withDocsPath = { ...normalized, docsPath };
|
|
20543
20542
|
const withDocs = withDocsPath.docs ? withDocsPath : { ...withDocsPath, docs: renderCustomToolDocs(withDocsPath) };
|
|
20544
20543
|
const withProvenance = ensureCustomToolProvenance(withDocs);
|
|
20545
|
-
|
|
20546
|
-
|
|
20544
|
+
const finalDefinition = { ...withProvenance, docs: renderCustomToolDocs(withProvenance) };
|
|
20545
|
+
writeFileSync10(filePath, JSON.stringify(finalDefinition, null, 2), "utf-8");
|
|
20546
|
+
writeCustomToolDocsFile(finalDefinition, scope, repoRoot);
|
|
20547
20547
|
if (scope === "project" && repoRoot)
|
|
20548
20548
|
writeCustomToolRegistry(repoRoot);
|
|
20549
20549
|
return filePath;
|
|
@@ -20578,7 +20578,8 @@ function listCustomToolFiles(repoRoot) {
|
|
|
20578
20578
|
analytics: analytics[def.name],
|
|
20579
20579
|
qualityGate: def.qualityGate,
|
|
20580
20580
|
docsPath: def.docsPath,
|
|
20581
|
-
examples: def.examples
|
|
20581
|
+
examples: def.examples,
|
|
20582
|
+
shareability: evaluateCustomToolShareability(def)
|
|
20582
20583
|
});
|
|
20583
20584
|
seen.add(def.name);
|
|
20584
20585
|
}
|
|
@@ -20594,7 +20595,8 @@ function listCustomToolFiles(repoRoot) {
|
|
|
20594
20595
|
analytics: analytics[def.name],
|
|
20595
20596
|
qualityGate: def.qualityGate,
|
|
20596
20597
|
docsPath: def.docsPath,
|
|
20597
|
-
examples: def.examples
|
|
20598
|
+
examples: def.examples,
|
|
20599
|
+
shareability: evaluateCustomToolShareability(def)
|
|
20598
20600
|
});
|
|
20599
20601
|
}
|
|
20600
20602
|
}
|
|
@@ -20621,6 +20623,9 @@ function validateCustomToolDefinition(definition) {
|
|
|
20621
20623
|
errors.push(`steps[${index}].description is required`);
|
|
20622
20624
|
});
|
|
20623
20625
|
}
|
|
20626
|
+
errors.push(...validateRawInterpolation(definition.steps ?? [], definition.parameters, "steps"));
|
|
20627
|
+
errors.push(...validateRawInterpolation(definition.beforeEach ?? [], definition.parameters, "beforeEach"));
|
|
20628
|
+
errors.push(...validateRawInterpolation(definition.afterAll ?? [], definition.parameters, "afterAll"));
|
|
20624
20629
|
return errors;
|
|
20625
20630
|
}
|
|
20626
20631
|
function renderCustomToolDocs(definition) {
|
|
@@ -20673,12 +20678,16 @@ function renderCustomToolDocs(definition) {
|
|
|
20673
20678
|
lines.push("", "## Quality Gate", `Process: ${def.qualityGate.process}`);
|
|
20674
20679
|
if (last2) {
|
|
20675
20680
|
lines.push(`Last test: ${last2.status}${last2.testedAt ? ` at ${last2.testedAt}` : ""}`);
|
|
20681
|
+
if (last2.schemaValidation)
|
|
20682
|
+
lines.push(`Schema validation: ${last2.schemaValidation.status}${last2.schemaValidation.error ? ` - ${last2.schemaValidation.error}` : ""}`);
|
|
20676
20683
|
if (last2.args)
|
|
20677
20684
|
lines.push(`Test args: \`${JSON.stringify(last2.args)}\``);
|
|
20678
20685
|
if (last2.error)
|
|
20679
20686
|
lines.push(`Last error: ${last2.error}`);
|
|
20680
20687
|
}
|
|
20681
20688
|
}
|
|
20689
|
+
const shareability = evaluateCustomToolShareability(def);
|
|
20690
|
+
lines.push("", "## Nexus Sharing Gate", `Shareable: ${shareability.shareable ? "true" : "false"} - ${shareability.reason}`);
|
|
20682
20691
|
lines.push("", "## Maintenance", `Inspect: \`manage_tools(action="inspect", tool_name="${def.name}")\``, `Patch: \`manage_tools(action="patch", tool_name="${def.name}", patch={...}, test_args={...})\``, `Test: \`manage_tools(action="test", tool_name="${def.name}", test_args={...})\``);
|
|
20683
20692
|
return `${lines.join("\n")}
|
|
20684
20693
|
`;
|
|
@@ -20702,7 +20711,10 @@ function writeCustomToolRegistry(repoRoot) {
|
|
|
20702
20711
|
} : void 0,
|
|
20703
20712
|
qualityGate: tool.qualityGate,
|
|
20704
20713
|
docsPath: tool.docsPath,
|
|
20705
|
-
examples: tool.examples
|
|
20714
|
+
examples: tool.examples,
|
|
20715
|
+
shareability: tool.shareability,
|
|
20716
|
+
shareable: tool.shareability?.shareable ?? false,
|
|
20717
|
+
shareableReason: tool.shareability?.reason ?? "not evaluated"
|
|
20706
20718
|
}));
|
|
20707
20719
|
writeFileSync10(registryPath, JSON.stringify({
|
|
20708
20720
|
schema: "omnius.custom-tool-registry.v1",
|
|
@@ -20738,7 +20750,7 @@ function writeCustomToolContextIndex(repoRoot, tools) {
|
|
|
20738
20750
|
for (const tool of tools) {
|
|
20739
20751
|
const last2 = tool.qualityGate?.lastTest;
|
|
20740
20752
|
const example = tool.examples?.[0]?.args;
|
|
20741
|
-
lines.push(`## ${tool.name}`, "", `${tool.description}`, "", `- Scope/version: ${tool.scope} v${tool.version}`, `- Steps: ${tool.stepsCount}`, `- Last test: ${last2?.status ?? "untested"}`);
|
|
20753
|
+
lines.push(`## ${tool.name}`, "", `${tool.description}`, "", `- Scope/version: ${tool.scope} v${tool.version}`, `- Steps: ${tool.stepsCount}`, `- Last test: ${last2?.status ?? "untested"}`, `- Shareable: ${tool.shareability?.shareable ? "true" : "false"}${tool.shareability?.reason ? ` - ${tool.shareability.reason}` : ""}`);
|
|
20742
20754
|
if (tool.docsPath)
|
|
20743
20755
|
lines.push(`- Docs: ${tool.docsPath}`);
|
|
20744
20756
|
if (example)
|
|
@@ -20849,6 +20861,131 @@ function valueMatchesJsonType(value2, type) {
|
|
|
20849
20861
|
return value2 === null;
|
|
20850
20862
|
return true;
|
|
20851
20863
|
}
|
|
20864
|
+
function stringifyParameterValue(value2) {
|
|
20865
|
+
if (typeof value2 === "string")
|
|
20866
|
+
return value2;
|
|
20867
|
+
if (typeof value2 === "number" || typeof value2 === "boolean" || value2 === null)
|
|
20868
|
+
return String(value2);
|
|
20869
|
+
return JSON.stringify(value2);
|
|
20870
|
+
}
|
|
20871
|
+
function escapeForExistingShellQuote(value2, quote) {
|
|
20872
|
+
if (quote === "'")
|
|
20873
|
+
return value2.replace(/'/g, `'\\''`);
|
|
20874
|
+
return value2.replace(/[`$\\!"]/g, "\\$&");
|
|
20875
|
+
}
|
|
20876
|
+
function parameterAllowsUnsafeRaw(schema, name10) {
|
|
20877
|
+
const props = schema["properties"];
|
|
20878
|
+
if (!props || typeof props !== "object" || Array.isArray(props))
|
|
20879
|
+
return false;
|
|
20880
|
+
const prop = props[name10];
|
|
20881
|
+
return prop?.["x-omnius-unsafeRaw"] === true;
|
|
20882
|
+
}
|
|
20883
|
+
function validateRawInterpolation(steps, schema, label) {
|
|
20884
|
+
const errors = [];
|
|
20885
|
+
for (let i2 = 0; i2 < steps.length; i2++) {
|
|
20886
|
+
const command = steps[i2]?.command;
|
|
20887
|
+
if (!command)
|
|
20888
|
+
continue;
|
|
20889
|
+
const matches = command.matchAll(/\{\{raw:([A-Za-z_][A-Za-z0-9_]*)\}\}/g);
|
|
20890
|
+
for (const match of matches) {
|
|
20891
|
+
const param = match[1];
|
|
20892
|
+
if (!parameterAllowsUnsafeRaw(schema, param)) {
|
|
20893
|
+
errors.push(`${label}[${i2}] uses {{raw:${param}}} but parameter ${param} does not declare x-omnius-unsafeRaw: true`);
|
|
20894
|
+
}
|
|
20895
|
+
}
|
|
20896
|
+
}
|
|
20897
|
+
return errors;
|
|
20898
|
+
}
|
|
20899
|
+
function validateOutputAgainstSchema(output, schema) {
|
|
20900
|
+
if (!schema)
|
|
20901
|
+
return { status: "not_applicable" };
|
|
20902
|
+
let value2;
|
|
20903
|
+
try {
|
|
20904
|
+
value2 = JSON.parse(output.trim());
|
|
20905
|
+
} catch {
|
|
20906
|
+
return {
|
|
20907
|
+
status: "failed",
|
|
20908
|
+
error: "output_schema_validation_failed: expected JSON output"
|
|
20909
|
+
};
|
|
20910
|
+
}
|
|
20911
|
+
const errors = validateJsonValueAgainstSchema(value2, schema, "$");
|
|
20912
|
+
if (errors.length > 0) {
|
|
20913
|
+
return {
|
|
20914
|
+
status: "failed",
|
|
20915
|
+
error: `output_schema_validation_failed: ${errors.join("; ")}`
|
|
20916
|
+
};
|
|
20917
|
+
}
|
|
20918
|
+
return { status: "passed" };
|
|
20919
|
+
}
|
|
20920
|
+
function validateJsonValueAgainstSchema(value2, schema, path12) {
|
|
20921
|
+
const errors = [];
|
|
20922
|
+
const expected = schema["type"];
|
|
20923
|
+
const allowed = Array.isArray(expected) ? expected.map(String) : expected ? [String(expected)] : [];
|
|
20924
|
+
if (allowed.length > 0 && !allowed.some((type) => valueMatchesJsonType(value2, type))) {
|
|
20925
|
+
errors.push(`${path12} expected ${allowed.join("|")}, got ${Array.isArray(value2) ? "array" : typeof value2}`);
|
|
20926
|
+
return errors;
|
|
20927
|
+
}
|
|
20928
|
+
const enumValues = schema["enum"];
|
|
20929
|
+
if (Array.isArray(enumValues) && !enumValues.includes(value2)) {
|
|
20930
|
+
errors.push(`${path12} must be one of ${enumValues.map(String).join(", ")}`);
|
|
20931
|
+
}
|
|
20932
|
+
const required = Array.isArray(schema["required"]) ? schema["required"].map(String) : [];
|
|
20933
|
+
const properties = schema["properties"] && typeof schema["properties"] === "object" && !Array.isArray(schema["properties"]) ? schema["properties"] : {};
|
|
20934
|
+
if (required.length > 0 || Object.keys(properties).length > 0) {
|
|
20935
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
20936
|
+
errors.push(`${path12} expected object for declared properties`);
|
|
20937
|
+
return errors;
|
|
20938
|
+
}
|
|
20939
|
+
const obj = value2;
|
|
20940
|
+
for (const key of required) {
|
|
20941
|
+
if (obj[key] === void 0)
|
|
20942
|
+
errors.push(`${path12}.${key} is required`);
|
|
20943
|
+
}
|
|
20944
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
20945
|
+
if (obj[key] !== void 0) {
|
|
20946
|
+
errors.push(...validateJsonValueAgainstSchema(obj[key], propSchema, `${path12}.${key}`));
|
|
20947
|
+
}
|
|
20948
|
+
}
|
|
20949
|
+
}
|
|
20950
|
+
if (Array.isArray(value2)) {
|
|
20951
|
+
const itemSchema = schema["items"];
|
|
20952
|
+
if (itemSchema && typeof itemSchema === "object" && !Array.isArray(itemSchema)) {
|
|
20953
|
+
value2.forEach((item, index) => {
|
|
20954
|
+
errors.push(...validateJsonValueAgainstSchema(item, itemSchema, `${path12}[${index}]`));
|
|
20955
|
+
});
|
|
20956
|
+
}
|
|
20957
|
+
}
|
|
20958
|
+
return errors;
|
|
20959
|
+
}
|
|
20960
|
+
function evaluateCustomToolShareability(definition) {
|
|
20961
|
+
const def = normalizeCustomToolDefinition(definition);
|
|
20962
|
+
if (def.qualityGate?.lastTest?.status !== "passed") {
|
|
20963
|
+
return { shareable: false, reason: "quality gate has not passed" };
|
|
20964
|
+
}
|
|
20965
|
+
if (!def.docsPath)
|
|
20966
|
+
return { shareable: false, reason: "missing generated docs path" };
|
|
20967
|
+
if (!def.examples || def.examples.length === 0)
|
|
20968
|
+
return { shareable: false, reason: "missing examples" };
|
|
20969
|
+
if (!def.provenance)
|
|
20970
|
+
return { shareable: false, reason: "missing provenance" };
|
|
20971
|
+
const deps = def.dependencies;
|
|
20972
|
+
if (!deps || !(deps.tools?.length || deps.commands?.length || deps.files?.length)) {
|
|
20973
|
+
return { shareable: false, reason: "missing dependency declaration" };
|
|
20974
|
+
}
|
|
20975
|
+
const props = def.parameters["properties"];
|
|
20976
|
+
if (props && typeof props === "object" && !Array.isArray(props)) {
|
|
20977
|
+
for (const [name10, prop] of Object.entries(props)) {
|
|
20978
|
+
if (prop?.["x-omnius-unsafeRaw"] === true) {
|
|
20979
|
+
return { shareable: false, reason: `unsafe raw parameter is not shareable: ${name10}` };
|
|
20980
|
+
}
|
|
20981
|
+
}
|
|
20982
|
+
}
|
|
20983
|
+
const allSteps = [...def.steps ?? [], ...def.beforeEach ?? [], ...def.afterAll ?? []];
|
|
20984
|
+
if (allSteps.some((step) => /\{\{raw:[A-Za-z_][A-Za-z0-9_]*\}\}/.test(step.command ?? ""))) {
|
|
20985
|
+
return { shareable: false, reason: "raw shell interpolation is not shareable" };
|
|
20986
|
+
}
|
|
20987
|
+
return { shareable: true, reason: "passed quality gate with docs, examples, dependencies, and provenance" };
|
|
20988
|
+
}
|
|
20852
20989
|
function readProjectAnalytics(repoRoot) {
|
|
20853
20990
|
try {
|
|
20854
20991
|
const analyticsPath = join26(projectToolsDir(repoRoot), ".analytics.json");
|
|
@@ -20889,6 +21026,7 @@ var BUILTIN_TOOL_NAMES, CustomTool;
|
|
|
20889
21026
|
var init_custom_tool = __esm({
|
|
20890
21027
|
"packages/execution/dist/tools/custom-tool.js"() {
|
|
20891
21028
|
"use strict";
|
|
21029
|
+
init_shell();
|
|
20892
21030
|
init_provenance();
|
|
20893
21031
|
BUILTIN_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
20894
21032
|
"file_read",
|
|
@@ -20930,11 +21068,13 @@ var init_custom_tool = __esm({
|
|
|
20930
21068
|
name;
|
|
20931
21069
|
description;
|
|
20932
21070
|
parameters;
|
|
21071
|
+
customToolMetadata;
|
|
20933
21072
|
steps;
|
|
20934
21073
|
workingDir;
|
|
20935
21074
|
definition;
|
|
20936
21075
|
executionStack;
|
|
20937
21076
|
executionOptions;
|
|
21077
|
+
shellRunner;
|
|
20938
21078
|
constructor(definition, workingDir, executionStack = [], executionOptions = {}) {
|
|
20939
21079
|
this.definition = normalizeCustomToolDefinition(definition);
|
|
20940
21080
|
this.name = this.definition.name;
|
|
@@ -20944,20 +21084,37 @@ var init_custom_tool = __esm({
|
|
|
20944
21084
|
this.workingDir = workingDir;
|
|
20945
21085
|
this.executionStack = executionStack;
|
|
20946
21086
|
this.executionOptions = executionOptions;
|
|
21087
|
+
this.shellRunner = executionOptions.shellRunner ?? new ShellTool(workingDir);
|
|
21088
|
+
const analytics = readProjectAnalytics(workingDir)[this.definition.name] ?? this.definition.analytics;
|
|
21089
|
+
this.customToolMetadata = {
|
|
21090
|
+
isCustomTool: true,
|
|
21091
|
+
version: this.definition.version,
|
|
21092
|
+
docsPath: this.definition.docsPath,
|
|
21093
|
+
qualityGate: this.definition.qualityGate,
|
|
21094
|
+
dependencies: this.definition.dependencies,
|
|
21095
|
+
examples: this.definition.examples,
|
|
21096
|
+
analytics,
|
|
21097
|
+
shareability: evaluateCustomToolShareability(this.definition)
|
|
21098
|
+
};
|
|
20947
21099
|
}
|
|
20948
21100
|
async execute(args) {
|
|
20949
21101
|
const start2 = performance.now();
|
|
20950
21102
|
const outputs = [];
|
|
20951
21103
|
let allSuccess = true;
|
|
21104
|
+
let lastRawOutput = "";
|
|
21105
|
+
let failedStep;
|
|
20952
21106
|
const validation = validateArgsAgainstSchema(args, this.parameters);
|
|
20953
21107
|
if (!validation.valid) {
|
|
20954
21108
|
const durationMs2 = performance.now() - start2;
|
|
20955
21109
|
this.recordAnalytics(false, durationMs2);
|
|
21110
|
+
const error = `Invalid arguments for ${this.name}:
|
|
21111
|
+
${validation.errors.map((e2) => `- ${e2}`).join("\n")}`;
|
|
21112
|
+
const repair2 = this.buildRepairEnvelope(args, { label: "argument validation", error });
|
|
20956
21113
|
return {
|
|
20957
21114
|
success: false,
|
|
20958
|
-
output:
|
|
20959
|
-
|
|
20960
|
-
|
|
21115
|
+
output: repair2,
|
|
21116
|
+
llmContent: repair2,
|
|
21117
|
+
error,
|
|
20961
21118
|
durationMs: durationMs2
|
|
20962
21119
|
};
|
|
20963
21120
|
}
|
|
@@ -20965,11 +21122,14 @@ ${validation.errors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
20965
21122
|
if (dependencyErrors.length > 0) {
|
|
20966
21123
|
const durationMs2 = performance.now() - start2;
|
|
20967
21124
|
this.recordAnalytics(false, durationMs2);
|
|
21125
|
+
const error = `Custom tool dependency check failed:
|
|
21126
|
+
${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`;
|
|
21127
|
+
const repair2 = this.buildRepairEnvelope(args, { label: "dependency validation", error });
|
|
20968
21128
|
return {
|
|
20969
21129
|
success: false,
|
|
20970
|
-
output:
|
|
20971
|
-
|
|
20972
|
-
|
|
21130
|
+
output: repair2,
|
|
21131
|
+
llmContent: repair2,
|
|
21132
|
+
error,
|
|
20973
21133
|
durationMs: durationMs2
|
|
20974
21134
|
};
|
|
20975
21135
|
}
|
|
@@ -20995,10 +21155,12 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
20995
21155
|
try {
|
|
20996
21156
|
const result = step.tool ? await this.runNestedTool(step, args) : await this.runShellStep(step, args);
|
|
20997
21157
|
outputs.push(result.output);
|
|
21158
|
+
lastRawOutput = result.rawOutput ?? result.output;
|
|
20998
21159
|
if (!result.success) {
|
|
20999
21160
|
allSuccess = false;
|
|
21000
21161
|
if (result.error)
|
|
21001
21162
|
outputs.push(`Error: ${result.error}`);
|
|
21163
|
+
failedStep = { label, step, output: result.output, error: result.error };
|
|
21002
21164
|
if (!step.continueOnError) {
|
|
21003
21165
|
outputs.push(`${label} failed. Stopping.`);
|
|
21004
21166
|
break;
|
|
@@ -21007,32 +21169,67 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21007
21169
|
}
|
|
21008
21170
|
} catch (err) {
|
|
21009
21171
|
allSuccess = false;
|
|
21010
|
-
|
|
21172
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
21173
|
+
outputs.push(`${label} error: ${error}`);
|
|
21174
|
+
failedStep = { label, step, output: "", error };
|
|
21011
21175
|
if (!step.continueOnError)
|
|
21012
21176
|
break;
|
|
21013
21177
|
}
|
|
21014
21178
|
}
|
|
21179
|
+
const schemaValidation = validateOutputAgainstSchema(lastRawOutput || outputs.join("\n"), this.definition.outputSchema);
|
|
21180
|
+
if (schemaValidation.status === "passed") {
|
|
21181
|
+
outputs.push("Output schema validation: passed");
|
|
21182
|
+
}
|
|
21183
|
+
if (schemaValidation.status === "failed") {
|
|
21184
|
+
allSuccess = false;
|
|
21185
|
+
outputs.push(`Output schema validation failed: ${schemaValidation.error}`);
|
|
21186
|
+
failedStep ??= {
|
|
21187
|
+
label: "output schema validation",
|
|
21188
|
+
step: { description: "Validate declared output schema" },
|
|
21189
|
+
output: lastRawOutput || outputs.join("\n"),
|
|
21190
|
+
error: schemaValidation.error
|
|
21191
|
+
};
|
|
21192
|
+
}
|
|
21015
21193
|
const durationMs = performance.now() - start2;
|
|
21016
21194
|
this.recordAnalytics(allSuccess, durationMs);
|
|
21195
|
+
const output = outputs.join("\n");
|
|
21196
|
+
const repair = !allSuccess ? this.buildRepairEnvelope(args, failedStep) : void 0;
|
|
21017
21197
|
return {
|
|
21018
21198
|
success: allSuccess,
|
|
21019
|
-
output:
|
|
21199
|
+
output: repair ? `${output}
|
|
21200
|
+
|
|
21201
|
+
${repair}` : output,
|
|
21202
|
+
llmContent: repair ? `${output}
|
|
21203
|
+
|
|
21204
|
+
${repair}` : output,
|
|
21020
21205
|
error: allSuccess ? void 0 : "One or more steps failed",
|
|
21021
21206
|
durationMs
|
|
21022
21207
|
};
|
|
21023
21208
|
}
|
|
21024
|
-
/** Replace {{param}} placeholders with
|
|
21209
|
+
/** Replace {{param}} placeholders with shell-safe argument values. */
|
|
21025
21210
|
interpolate(template, args) {
|
|
21026
|
-
return template.replace(/\{\{(
|
|
21211
|
+
return template.replace(/\{\{(?:(shell|json|raw):)?([A-Za-z_][A-Za-z0-9_]*)\}\}/g, (match, mode, key, offset, source) => {
|
|
21027
21212
|
const val = args[key];
|
|
21028
21213
|
if (val === void 0 || val === null)
|
|
21029
21214
|
return "";
|
|
21030
|
-
|
|
21215
|
+
const normalizedMode = mode ?? "shell";
|
|
21216
|
+
const quote = source[offset - 1];
|
|
21217
|
+
const closedBySameQuote = (quote === "'" || quote === '"') && source[offset + match.length] === quote;
|
|
21218
|
+
if (normalizedMode === "raw") {
|
|
21219
|
+
if (!parameterAllowsUnsafeRaw(this.parameters, key)) {
|
|
21220
|
+
throw new Error(`Unsafe raw interpolation rejected for parameter "${key}". Add x-omnius-unsafeRaw: true to the parameter schema only when raw shell insertion is intentional.`);
|
|
21221
|
+
}
|
|
21222
|
+
return stringifyParameterValue(val);
|
|
21223
|
+
}
|
|
21224
|
+
const text = normalizedMode === "json" ? JSON.stringify(val) : stringifyParameterValue(val);
|
|
21225
|
+
if (closedBySameQuote)
|
|
21226
|
+
return escapeForExistingShellQuote(text, quote);
|
|
21227
|
+
return this.shellQuote(text);
|
|
21031
21228
|
});
|
|
21032
21229
|
}
|
|
21033
21230
|
interpolateValue(value2, args) {
|
|
21034
21231
|
if (typeof value2 === "string")
|
|
21035
|
-
return this.
|
|
21232
|
+
return this.interpolateNestedValue(value2, args);
|
|
21036
21233
|
if (Array.isArray(value2))
|
|
21037
21234
|
return value2.map((item) => this.interpolateValue(item, args));
|
|
21038
21235
|
if (value2 && typeof value2 === "object") {
|
|
@@ -21043,6 +21240,16 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21043
21240
|
}
|
|
21044
21241
|
return value2;
|
|
21045
21242
|
}
|
|
21243
|
+
interpolateNestedValue(template, args) {
|
|
21244
|
+
return template.replace(/\{\{(?:(shell|json|raw):)?([A-Za-z_][A-Za-z0-9_]*)\}\}/g, (_, mode, key) => {
|
|
21245
|
+
const val = args[key];
|
|
21246
|
+
if (val === void 0 || val === null)
|
|
21247
|
+
return "";
|
|
21248
|
+
if (mode === "json")
|
|
21249
|
+
return JSON.stringify(val);
|
|
21250
|
+
return stringifyParameterValue(val);
|
|
21251
|
+
});
|
|
21252
|
+
}
|
|
21046
21253
|
shouldRunStep(step, args) {
|
|
21047
21254
|
if (!step.when)
|
|
21048
21255
|
return true;
|
|
@@ -21057,10 +21264,14 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21057
21264
|
const command = this.interpolate(step.command ?? "", args);
|
|
21058
21265
|
if (!command)
|
|
21059
21266
|
return { success: false, output: "", error: "Shell step is missing command" };
|
|
21060
|
-
const result = await this.
|
|
21267
|
+
const result = await this.shellRunner.execute({ command, timeout: 6e4 });
|
|
21268
|
+
const modelFacing = result.llmContent ?? result.output;
|
|
21061
21269
|
return {
|
|
21062
|
-
|
|
21063
|
-
output: [`$ ${command}`,
|
|
21270
|
+
success: result.success,
|
|
21271
|
+
output: [`$ ${command}`, modelFacing].filter(Boolean).join("\n"),
|
|
21272
|
+
rawOutput: result.output,
|
|
21273
|
+
llmContent: modelFacing,
|
|
21274
|
+
error: result.error
|
|
21064
21275
|
};
|
|
21065
21276
|
}
|
|
21066
21277
|
async runNestedTool(step, args) {
|
|
@@ -21081,6 +21292,8 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21081
21292
|
return {
|
|
21082
21293
|
success: result.success,
|
|
21083
21294
|
output: [`custom_tool ${toolName}(${JSON.stringify(nestedArgs)})`, result.output].join("\n"),
|
|
21295
|
+
rawOutput: result.llmContent ?? result.output,
|
|
21296
|
+
llmContent: result.llmContent,
|
|
21084
21297
|
error: result.error
|
|
21085
21298
|
};
|
|
21086
21299
|
}
|
|
@@ -21100,7 +21313,7 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21100
21313
|
errors.push(`file dependency not found: ${file}`);
|
|
21101
21314
|
}
|
|
21102
21315
|
for (const command of deps.commands ?? []) {
|
|
21103
|
-
const check = await this.
|
|
21316
|
+
const check = await this.shellRunner.execute({ command: `command -v ${this.shellQuote(command)}`, timeout: 3e4 });
|
|
21104
21317
|
if (!check.success)
|
|
21105
21318
|
errors.push(`command dependency not found on PATH: ${command}`);
|
|
21106
21319
|
}
|
|
@@ -21109,6 +21322,25 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21109
21322
|
shellQuote(value2) {
|
|
21110
21323
|
return `'${value2.replace(/'/g, `'\\''`)}'`;
|
|
21111
21324
|
}
|
|
21325
|
+
buildRepairEnvelope(args, failure) {
|
|
21326
|
+
return [
|
|
21327
|
+
"[CUSTOM_TOOL_REPAIR_ENVELOPE]",
|
|
21328
|
+
`tool: ${this.name}`,
|
|
21329
|
+
`version: ${this.definition.version}`,
|
|
21330
|
+
this.definition.docsPath ? `docs_path: ${this.definition.docsPath}` : "docs_path: [missing]",
|
|
21331
|
+
`args: ${JSON.stringify(args)}`,
|
|
21332
|
+
failure?.label ? `failed_step: ${failure.label}` : "failed_step: unknown",
|
|
21333
|
+
failure?.step?.description ? `failed_step_description: ${failure.step.description}` : "",
|
|
21334
|
+
failure?.error ? `error: ${failure.error}` : "",
|
|
21335
|
+
failure?.output ? `output:
|
|
21336
|
+
${String(failure.output).slice(0, 4e3)}` : "",
|
|
21337
|
+
`quality_gate: ${JSON.stringify(this.definition.qualityGate ?? { lastTest: { status: "untested" } })}`,
|
|
21338
|
+
"repair_action: inspect the docs and patch the tool definition, then run its smoke test before relying on it again.",
|
|
21339
|
+
`suggested_patch_call: manage_tools(action="patch", tool_name="${this.name}", patch={...}, test_args=${JSON.stringify(args)})`,
|
|
21340
|
+
`suggested_test_call: manage_tools(action="test", tool_name="${this.name}", test_args=${JSON.stringify(args)})`,
|
|
21341
|
+
"[/CUSTOM_TOOL_REPAIR_ENVELOPE]"
|
|
21342
|
+
].filter(Boolean).join("\n");
|
|
21343
|
+
}
|
|
21112
21344
|
recordAnalytics(success, durationMs) {
|
|
21113
21345
|
if (this.executionOptions.recordAnalytics === false)
|
|
21114
21346
|
return;
|
|
@@ -21138,51 +21370,6 @@ ${dependencyErrors.map((e2) => `- ${e2}`).join("\n")}`,
|
|
|
21138
21370
|
} catch {
|
|
21139
21371
|
}
|
|
21140
21372
|
}
|
|
21141
|
-
/** Execute a single shell command and return output */
|
|
21142
|
-
runCommand(command) {
|
|
21143
|
-
return new Promise((resolve57) => {
|
|
21144
|
-
const child = spawn5("bash", ["-c", command], {
|
|
21145
|
-
cwd: this.workingDir,
|
|
21146
|
-
env: { ...process.env, CI: "true", NO_COLOR: "1" },
|
|
21147
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
21148
|
-
});
|
|
21149
|
-
let stdout = "";
|
|
21150
|
-
let stderr = "";
|
|
21151
|
-
const maxBuf = 512 * 1024;
|
|
21152
|
-
child.stdout.on("data", (data) => {
|
|
21153
|
-
stdout += data.toString();
|
|
21154
|
-
if (stdout.length > maxBuf)
|
|
21155
|
-
stdout = stdout.slice(0, maxBuf);
|
|
21156
|
-
});
|
|
21157
|
-
child.stderr.on("data", (data) => {
|
|
21158
|
-
stderr += data.toString();
|
|
21159
|
-
if (stderr.length > maxBuf)
|
|
21160
|
-
stderr = stderr.slice(0, maxBuf);
|
|
21161
|
-
});
|
|
21162
|
-
child.stdin.end();
|
|
21163
|
-
const timer = setTimeout(() => {
|
|
21164
|
-
try {
|
|
21165
|
-
child.kill("SIGTERM");
|
|
21166
|
-
} catch {
|
|
21167
|
-
}
|
|
21168
|
-
resolve57({ success: false, output: stdout, error: "Command timed out after 60s" });
|
|
21169
|
-
}, 6e4);
|
|
21170
|
-
child.on("close", (code8) => {
|
|
21171
|
-
clearTimeout(timer);
|
|
21172
|
-
resolve57({
|
|
21173
|
-
success: code8 === 0,
|
|
21174
|
-
output: stdout + (stderr && code8 === 0 ? `
|
|
21175
|
-
STDERR:
|
|
21176
|
-
${stderr}` : ""),
|
|
21177
|
-
error: code8 !== 0 ? stderr || `Exit code ${code8}` : void 0
|
|
21178
|
-
});
|
|
21179
|
-
});
|
|
21180
|
-
child.on("error", (err) => {
|
|
21181
|
-
clearTimeout(timer);
|
|
21182
|
-
resolve57({ success: false, output: stdout, error: err.message });
|
|
21183
|
-
});
|
|
21184
|
-
});
|
|
21185
|
-
}
|
|
21186
21373
|
};
|
|
21187
21374
|
}
|
|
21188
21375
|
});
|
|
@@ -21195,17 +21382,17 @@ function templateSteps(template) {
|
|
|
21195
21382
|
switch (template) {
|
|
21196
21383
|
case "build_test":
|
|
21197
21384
|
return [
|
|
21198
|
-
{ command: "{{build_command}}", description: "Run build command" },
|
|
21199
|
-
{ command: "{{test_command}}", description: "Run test command" }
|
|
21385
|
+
{ command: "{{raw:build_command}}", description: "Run build command" },
|
|
21386
|
+
{ command: "{{raw:test_command}}", description: "Run test command" }
|
|
21200
21387
|
];
|
|
21201
21388
|
case "test_only":
|
|
21202
21389
|
return [
|
|
21203
|
-
{ command: "{{test_command}}", description: "Run test command" }
|
|
21390
|
+
{ command: "{{raw:test_command}}", description: "Run test command" }
|
|
21204
21391
|
];
|
|
21205
21392
|
case "diagnostic":
|
|
21206
21393
|
return [
|
|
21207
21394
|
{ command: "git status --short", description: "Inspect working tree" },
|
|
21208
|
-
{ command: "{{diagnostic_command}}", description: "Run diagnostic command" }
|
|
21395
|
+
{ command: "{{raw:diagnostic_command}}", description: "Run diagnostic command" }
|
|
21209
21396
|
];
|
|
21210
21397
|
case "git_preflight":
|
|
21211
21398
|
return [
|
|
@@ -21219,14 +21406,14 @@ function templateSteps(template) {
|
|
|
21219
21406
|
function mergeTemplateParameters(template, provided) {
|
|
21220
21407
|
const hasProperties = provided["properties"] && typeof provided["properties"] === "object" && Object.keys(provided["properties"]).length > 0;
|
|
21221
21408
|
if (hasProperties)
|
|
21222
|
-
return provided;
|
|
21409
|
+
return applyTemplateRawOptIns(template, provided);
|
|
21223
21410
|
switch (template) {
|
|
21224
21411
|
case "build_test":
|
|
21225
21412
|
return {
|
|
21226
21413
|
type: "object",
|
|
21227
21414
|
properties: {
|
|
21228
|
-
build_command: { type: "string", description: "Build command to run" },
|
|
21229
|
-
test_command: { type: "string", description: "Test command to run" }
|
|
21415
|
+
build_command: { type: "string", description: "Build command to run", "x-omnius-unsafeRaw": true },
|
|
21416
|
+
test_command: { type: "string", description: "Test command to run", "x-omnius-unsafeRaw": true }
|
|
21230
21417
|
},
|
|
21231
21418
|
required: ["build_command", "test_command"]
|
|
21232
21419
|
};
|
|
@@ -21234,7 +21421,7 @@ function mergeTemplateParameters(template, provided) {
|
|
|
21234
21421
|
return {
|
|
21235
21422
|
type: "object",
|
|
21236
21423
|
properties: {
|
|
21237
|
-
test_command: { type: "string", description: "Test command to run" }
|
|
21424
|
+
test_command: { type: "string", description: "Test command to run", "x-omnius-unsafeRaw": true }
|
|
21238
21425
|
},
|
|
21239
21426
|
required: ["test_command"]
|
|
21240
21427
|
};
|
|
@@ -21242,7 +21429,7 @@ function mergeTemplateParameters(template, provided) {
|
|
|
21242
21429
|
return {
|
|
21243
21430
|
type: "object",
|
|
21244
21431
|
properties: {
|
|
21245
|
-
diagnostic_command: { type: "string", description: "Diagnostic command to run" }
|
|
21432
|
+
diagnostic_command: { type: "string", description: "Diagnostic command to run", "x-omnius-unsafeRaw": true }
|
|
21246
21433
|
},
|
|
21247
21434
|
required: ["diagnostic_command"]
|
|
21248
21435
|
};
|
|
@@ -21250,6 +21437,21 @@ function mergeTemplateParameters(template, provided) {
|
|
|
21250
21437
|
return provided;
|
|
21251
21438
|
}
|
|
21252
21439
|
}
|
|
21440
|
+
function applyTemplateRawOptIns(template, provided) {
|
|
21441
|
+
const rawParams = template === "build_test" ? ["build_command", "test_command"] : template === "test_only" ? ["test_command"] : template === "diagnostic" ? ["diagnostic_command"] : [];
|
|
21442
|
+
if (rawParams.length === 0)
|
|
21443
|
+
return provided;
|
|
21444
|
+
const properties = provided["properties"];
|
|
21445
|
+
if (!properties || typeof properties !== "object" || Array.isArray(properties))
|
|
21446
|
+
return provided;
|
|
21447
|
+
const nextProperties = { ...properties };
|
|
21448
|
+
for (const param of rawParams) {
|
|
21449
|
+
if (nextProperties[param]) {
|
|
21450
|
+
nextProperties[param] = { ...nextProperties[param], "x-omnius-unsafeRaw": true };
|
|
21451
|
+
}
|
|
21452
|
+
}
|
|
21453
|
+
return { ...provided, properties: nextProperties };
|
|
21454
|
+
}
|
|
21253
21455
|
function parseStep(raw, index) {
|
|
21254
21456
|
const command = String(raw["command"] ?? "").trim();
|
|
21255
21457
|
const tool = String(raw["tool"] ?? "").trim();
|
|
@@ -21334,7 +21536,22 @@ async function runToolSmokeTest(definition, repoRoot, args) {
|
|
|
21334
21536
|
testedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21335
21537
|
durationMs: result.durationMs,
|
|
21336
21538
|
outputPreview: truncateText(result.output, 2e3),
|
|
21337
|
-
error: result.error
|
|
21539
|
+
error: result.error,
|
|
21540
|
+
schemaValidation: schemaValidationForTest(definition, result)
|
|
21541
|
+
};
|
|
21542
|
+
}
|
|
21543
|
+
function schemaValidationForTest(definition, result) {
|
|
21544
|
+
if (!definition.outputSchema)
|
|
21545
|
+
return { status: "not_applicable" };
|
|
21546
|
+
const combined = `${result.output}
|
|
21547
|
+
${result.llmContent ?? ""}
|
|
21548
|
+
${result.error ?? ""}`;
|
|
21549
|
+
if (combined.includes("Output schema validation: passed"))
|
|
21550
|
+
return { status: "passed" };
|
|
21551
|
+
const failed = combined.match(/Output schema validation failed:\s*([^\n]+)/);
|
|
21552
|
+
return {
|
|
21553
|
+
status: "failed",
|
|
21554
|
+
error: failed?.[1] ?? result.error ?? "output_schema_validation_failed"
|
|
21338
21555
|
};
|
|
21339
21556
|
}
|
|
21340
21557
|
function truncateText(value2, max) {
|
|
@@ -21456,7 +21673,7 @@ var init_tool_creator = __esm({
|
|
|
21456
21673
|
]);
|
|
21457
21674
|
CreateToolTool = class {
|
|
21458
21675
|
name = "create_tool";
|
|
21459
|
-
description = "Create a reusable custom tool from a multi-step workflow. Use this when you notice you're performing the same sequence of operations repeatedly (3+ times). The tool will be saved and available in future sessions. Parameters in step commands use {{param}} interpolation.";
|
|
21676
|
+
description = "Create a reusable custom tool from a multi-step workflow. Use this when you notice you're performing the same sequence of operations repeatedly (3+ times). The tool will be saved and available in future sessions. Parameters in shell step commands use shell-safe {{param}} interpolation; use {{json:param}} for JSON and {{raw:param}} only when the parameter schema explicitly opts into x-omnius-unsafeRaw.";
|
|
21460
21677
|
parameters = {
|
|
21461
21678
|
type: "object",
|
|
21462
21679
|
properties: {
|
|
@@ -21474,7 +21691,7 @@ var init_tool_creator = __esm({
|
|
|
21474
21691
|
},
|
|
21475
21692
|
steps: {
|
|
21476
21693
|
type: "array",
|
|
21477
|
-
description: "Ordered list of steps. Each step has either command (shell command with {{param}} placeholders) or tool (nested custom tool name) with args, plus description, continueOnError, and optional when condition.",
|
|
21694
|
+
description: "Ordered list of steps. Each step has either command (shell command with {{param}} placeholders) or tool (nested custom tool name) with args, plus description, continueOnError, and optional when condition. {{param}} and {{shell:param}} are shell-escaped, {{json:param}} JSON-encodes, and {{raw:param}} requires x-omnius-unsafeRaw on that parameter.",
|
|
21478
21695
|
items: {
|
|
21479
21696
|
type: "object",
|
|
21480
21697
|
properties: {
|
|
@@ -21819,6 +22036,8 @@ ${errors.map((err) => `- ${err}`).join("\n")}`,
|
|
|
21819
22036
|
lines.push(` deps: ${JSON.stringify(t2.dependencies)}`);
|
|
21820
22037
|
if (t2.qualityGate?.lastTest)
|
|
21821
22038
|
lines.push(` last test: ${t2.qualityGate.lastTest.status}`);
|
|
22039
|
+
if (t2.shareability)
|
|
22040
|
+
lines.push(` shareable: ${t2.shareability.shareable ? "true" : "false"} - ${t2.shareability.reason}`);
|
|
21822
22041
|
if (t2.docsPath)
|
|
21823
22042
|
lines.push(` docs: ${t2.docsPath}`);
|
|
21824
22043
|
if (t2.analytics) {
|
|
@@ -21917,7 +22136,8 @@ ${errors.map((err) => `- ${err}`).join("\n")}`,
|
|
|
21917
22136
|
testedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21918
22137
|
durationMs: result.durationMs,
|
|
21919
22138
|
outputPreview: truncateText(result.output, 2e3),
|
|
21920
|
-
error: result.error
|
|
22139
|
+
error: result.error,
|
|
22140
|
+
schemaValidation: schemaValidationForTest(def, result)
|
|
21921
22141
|
};
|
|
21922
22142
|
saveCustomToolDefinition({
|
|
21923
22143
|
...def,
|
|
@@ -23921,13 +24141,13 @@ var init_structured_file = __esm({
|
|
|
23921
24141
|
});
|
|
23922
24142
|
|
|
23923
24143
|
// packages/execution/dist/tools/code-sandbox.js
|
|
23924
|
-
import { spawn as
|
|
24144
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
23925
24145
|
import { writeFile as writeFile9, mkdtemp, rm as rm2, readdir as readdir4, stat as stat3 } from "node:fs/promises";
|
|
23926
24146
|
import { join as join31 } from "node:path";
|
|
23927
24147
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
23928
24148
|
function runProcess(cmd, args, options2) {
|
|
23929
24149
|
return new Promise((resolve57) => {
|
|
23930
|
-
const proc =
|
|
24150
|
+
const proc = spawn5(cmd, args, {
|
|
23931
24151
|
cwd: options2.cwd,
|
|
23932
24152
|
timeout: options2.timeout,
|
|
23933
24153
|
env: {
|
|
@@ -254977,7 +255197,7 @@ New: ${newNarrative.slice(0, 200)}...`,
|
|
|
254977
255197
|
});
|
|
254978
255198
|
|
|
254979
255199
|
// packages/execution/dist/tools/repl.js
|
|
254980
|
-
import { spawn as
|
|
255200
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
254981
255201
|
import { createServer as createServer2 } from "node:net";
|
|
254982
255202
|
import { join as join34 } from "node:path";
|
|
254983
255203
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
@@ -255110,7 +255330,7 @@ except NameError:
|
|
|
255110
255330
|
// ── Process lifecycle ────────────────────────────────────────────────────
|
|
255111
255331
|
async startProcess() {
|
|
255112
255332
|
await this.startIpcServer();
|
|
255113
|
-
this.proc =
|
|
255333
|
+
this.proc = spawn6("python3", ["-u", "-i", "-q"], {
|
|
255114
255334
|
cwd: this.cwd,
|
|
255115
255335
|
stdio: ["pipe", "pipe", "pipe"],
|
|
255116
255336
|
env: {
|
|
@@ -257281,7 +257501,7 @@ var init_model_store = __esm({
|
|
|
257281
257501
|
});
|
|
257282
257502
|
|
|
257283
257503
|
// packages/execution/dist/tools/image-generate.js
|
|
257284
|
-
import { spawn as
|
|
257504
|
+
import { spawn as spawn7 } from "node:child_process";
|
|
257285
257505
|
import { existsSync as existsSync29, statSync as statSync11 } from "node:fs";
|
|
257286
257506
|
import { chmod as chmod3, mkdir as mkdir12, writeFile as writeFile17 } from "node:fs/promises";
|
|
257287
257507
|
import { join as join40, resolve as resolve19 } from "node:path";
|
|
@@ -257522,7 +257742,7 @@ function imageGenerationSetupPlan(backend, repoRoot = ".", model) {
|
|
|
257522
257742
|
async function runProcess2(command, args, options2) {
|
|
257523
257743
|
return new Promise((resolveProcess) => {
|
|
257524
257744
|
const startedAt2 = Date.now();
|
|
257525
|
-
const child =
|
|
257745
|
+
const child = spawn7(command, args, {
|
|
257526
257746
|
cwd: options2.cwd,
|
|
257527
257747
|
env: { ...process.env, ...options2.env },
|
|
257528
257748
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -259325,7 +259545,7 @@ __export(audio_generate_exports, {
|
|
|
259325
259545
|
inferAudioGenerationBackend: () => inferAudioGenerationBackend,
|
|
259326
259546
|
isAudioPresetGated: () => isAudioPresetGated
|
|
259327
259547
|
});
|
|
259328
|
-
import { execFileSync as execFileSync4, spawn as
|
|
259548
|
+
import { execFileSync as execFileSync4, spawn as spawn8 } from "node:child_process";
|
|
259329
259549
|
import { existsSync as existsSync30, readdirSync as readdirSync13, statSync as statSync12 } from "node:fs";
|
|
259330
259550
|
import { chmod as chmod4, mkdir as mkdir13, writeFile as writeFile18 } from "node:fs/promises";
|
|
259331
259551
|
import { join as join41 } from "node:path";
|
|
@@ -259469,7 +259689,7 @@ function directorySizeBytes(path12) {
|
|
|
259469
259689
|
async function runProcess3(command, args, options2) {
|
|
259470
259690
|
return new Promise((resolveProcess) => {
|
|
259471
259691
|
const startedAt2 = Date.now();
|
|
259472
|
-
const child =
|
|
259692
|
+
const child = spawn8(command, args, {
|
|
259473
259693
|
cwd: options2.cwd,
|
|
259474
259694
|
env: { ...process.env, ...options2.env },
|
|
259475
259695
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -261259,7 +261479,7 @@ if __name__ == "__main__":
|
|
|
261259
261479
|
});
|
|
261260
261480
|
|
|
261261
261481
|
// packages/execution/dist/tools/video-generate.js
|
|
261262
|
-
import { spawn as
|
|
261482
|
+
import { spawn as spawn9 } from "node:child_process";
|
|
261263
261483
|
import { existsSync as existsSync31, readFileSync as readFileSync22, statSync as statSync13 } from "node:fs";
|
|
261264
261484
|
import { chmod as chmod5, mkdir as mkdir14, writeFile as writeFile19 } from "node:fs/promises";
|
|
261265
261485
|
import { homedir as homedir11 } from "node:os";
|
|
@@ -261513,7 +261733,7 @@ function videoGenerationSetupPlan(backend, repoRoot = ".", model) {
|
|
|
261513
261733
|
async function runProcess4(command, args, options2) {
|
|
261514
261734
|
return new Promise((resolveProcess) => {
|
|
261515
261735
|
const startedAt2 = Date.now();
|
|
261516
|
-
const child =
|
|
261736
|
+
const child = spawn9(command, args, {
|
|
261517
261737
|
cwd: options2.cwd,
|
|
261518
261738
|
env: { ...process.env, ...options2.env },
|
|
261519
261739
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -261749,7 +261969,7 @@ async function probeComfyAvailable(baseUrl) {
|
|
|
261749
261969
|
}
|
|
261750
261970
|
async function launchComfyBackground(args) {
|
|
261751
261971
|
const env2 = { ...process.env, PYTHONUNBUFFERED: "1" };
|
|
261752
|
-
const child =
|
|
261972
|
+
const child = spawn9("python3", [
|
|
261753
261973
|
args.bootstrap,
|
|
261754
261974
|
"--dir",
|
|
261755
261975
|
args.installDir,
|
|
@@ -261882,7 +262102,7 @@ async function muxAudioIntoVideo(args) {
|
|
|
261882
262102
|
args.outputPath
|
|
261883
262103
|
];
|
|
261884
262104
|
return await new Promise((resolve57) => {
|
|
261885
|
-
const child =
|
|
262105
|
+
const child = spawn9(ffmpegBin(), argv, { stdio: ["ignore", "pipe", "pipe"] });
|
|
261886
262106
|
let stderr = "";
|
|
261887
262107
|
child.stderr?.on("data", (chunk) => {
|
|
261888
262108
|
stderr += chunk.toString();
|
|
@@ -261898,7 +262118,7 @@ async function muxAudioIntoVideo(args) {
|
|
|
261898
262118
|
}
|
|
261899
262119
|
async function ffmpegExtractFirstFrame(videoPath, thumbnailPath) {
|
|
261900
262120
|
return await new Promise((resolve57) => {
|
|
261901
|
-
const child =
|
|
262121
|
+
const child = spawn9(ffmpegBin(), [
|
|
261902
262122
|
"-hide_banner",
|
|
261903
262123
|
"-loglevel",
|
|
261904
262124
|
"error",
|
|
@@ -264951,7 +265171,7 @@ __export(vision_exports, {
|
|
|
264951
265171
|
resetMoondreamClient: () => resetMoondreamClient
|
|
264952
265172
|
});
|
|
264953
265173
|
import { readFileSync as readFileSync23, existsSync as existsSync32, statSync as statSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync14 } from "node:fs";
|
|
264954
|
-
import { execSync as execSync16, spawn as
|
|
265174
|
+
import { execSync as execSync16, spawn as spawn10, spawnSync as spawnSync4 } from "node:child_process";
|
|
264955
265175
|
import { resolve as resolve22, extname as extname6, basename as basename7, dirname as dirname9, join as join43 } from "node:path";
|
|
264956
265176
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
264957
265177
|
async function probeStation(endpoint) {
|
|
@@ -265023,7 +265243,7 @@ async function autoLaunchStation(port = 2020) {
|
|
|
265023
265243
|
if (!existsSync32(launcherScript))
|
|
265024
265244
|
return false;
|
|
265025
265245
|
return new Promise((resolvePromise) => {
|
|
265026
|
-
const child =
|
|
265246
|
+
const child = spawn10(pythonBin, [launcherScript, "--port", String(port)], {
|
|
265027
265247
|
stdio: ["ignore", "pipe", "pipe"]
|
|
265028
265248
|
});
|
|
265029
265249
|
stationProcess = child;
|
|
@@ -266908,7 +267128,7 @@ Note: Advanced Python pipeline not available — install pytesseract, opencv-pyt
|
|
|
266908
267128
|
});
|
|
266909
267129
|
|
|
266910
267130
|
// packages/execution/dist/tools/browser-action.js
|
|
266911
|
-
import { execSync as execSync21, spawn as
|
|
267131
|
+
import { execSync as execSync21, spawn as spawn11 } from "node:child_process";
|
|
266912
267132
|
import { copyFileSync, existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as readFileSync26 } from "node:fs";
|
|
266913
267133
|
import { basename as basename11, dirname as dirname11, join as join47, resolve as resolve26 } from "node:path";
|
|
266914
267134
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
@@ -266956,7 +267176,7 @@ async function launchService() {
|
|
|
266956
267176
|
if (!existsSync36(SCRAPE_SCRIPT)) {
|
|
266957
267177
|
return `Scrape service script not found at ${SCRAPE_SCRIPT}`;
|
|
266958
267178
|
}
|
|
266959
|
-
serviceProcess =
|
|
267179
|
+
serviceProcess = spawn11(python, [SCRAPE_SCRIPT], {
|
|
266960
267180
|
stdio: "ignore",
|
|
266961
267181
|
env: {
|
|
266962
267182
|
...process.env,
|
|
@@ -267425,7 +267645,7 @@ var init_browser_action = __esm({
|
|
|
267425
267645
|
});
|
|
267426
267646
|
|
|
267427
267647
|
// packages/execution/dist/tools/autoresearch.js
|
|
267428
|
-
import { execSync as execSync22, spawn as
|
|
267648
|
+
import { execSync as execSync22, spawn as spawn12 } from "node:child_process";
|
|
267429
267649
|
import { existsSync as existsSync37, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, appendFileSync, copyFileSync as copyFileSync2 } from "node:fs";
|
|
267430
267650
|
import { join as join48, resolve as resolve27, dirname as dirname12 } from "node:path";
|
|
267431
267651
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
@@ -267685,7 +267905,7 @@ Next steps:
|
|
|
267685
267905
|
const timeoutMs = timeoutMin * 60 * 1e3;
|
|
267686
267906
|
const logPath3 = join48(workspace, "run.log");
|
|
267687
267907
|
return new Promise((resolveResult) => {
|
|
267688
|
-
const proc =
|
|
267908
|
+
const proc = spawn12("uv", ["run", "train.py"], {
|
|
267689
267909
|
cwd: workspace,
|
|
267690
267910
|
timeout: timeoutMs,
|
|
267691
267911
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -269708,7 +269928,7 @@ var init_tool_alias = __esm({
|
|
|
269708
269928
|
});
|
|
269709
269929
|
|
|
269710
269930
|
// packages/execution/dist/tools/opencode.js
|
|
269711
|
-
import { execSync as execSync24, spawn as
|
|
269931
|
+
import { execSync as execSync24, spawn as spawn13 } from "node:child_process";
|
|
269712
269932
|
import { existsSync as existsSync38 } from "node:fs";
|
|
269713
269933
|
import { join as join52, resolve as resolve31 } from "node:path";
|
|
269714
269934
|
function findOpencode() {
|
|
@@ -269896,7 +270116,7 @@ var init_opencode = __esm({
|
|
|
269896
270116
|
let output = "";
|
|
269897
270117
|
const maxOutput = 5e5;
|
|
269898
270118
|
let timedOut = false;
|
|
269899
|
-
const child =
|
|
270119
|
+
const child = spawn13(binary, cmdArgs, {
|
|
269900
270120
|
cwd: dir,
|
|
269901
270121
|
env: { ...process.env, CI: "true", NONINTERACTIVE: "1" },
|
|
269902
270122
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -269982,7 +270202,7 @@ var init_opencode = __esm({
|
|
|
269982
270202
|
});
|
|
269983
270203
|
|
|
269984
270204
|
// packages/execution/dist/tools/factory.js
|
|
269985
|
-
import { execSync as execSync25, spawn as
|
|
270205
|
+
import { execSync as execSync25, spawn as spawn14 } from "node:child_process";
|
|
269986
270206
|
import { existsSync as existsSync39 } from "node:fs";
|
|
269987
270207
|
import { join as join53 } from "node:path";
|
|
269988
270208
|
function findDroid() {
|
|
@@ -270201,7 +270421,7 @@ var init_factory = __esm({
|
|
|
270201
270421
|
let output = "";
|
|
270202
270422
|
const maxOutput = 5e5;
|
|
270203
270423
|
let timedOut = false;
|
|
270204
|
-
const child =
|
|
270424
|
+
const child = spawn14(binary, cmdArgs, {
|
|
270205
270425
|
cwd: dir,
|
|
270206
270426
|
env: { ...process.env },
|
|
270207
270427
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -518845,7 +519065,7 @@ Saved to: ${tempFile}`,
|
|
|
518845
519065
|
});
|
|
518846
519066
|
|
|
518847
519067
|
// packages/execution/dist/tools/audio-playback.js
|
|
518848
|
-
import { execFileSync as execFileSync5, execSync as execSync30, spawn as
|
|
519068
|
+
import { execFileSync as execFileSync5, execSync as execSync30, spawn as spawn15 } from "node:child_process";
|
|
518849
519069
|
import { copyFileSync as copyFileSync3, existsSync as existsSync45, statSync as statSync22, writeFileSync as writeFileSync18, mkdirSync as mkdirSync19, readdirSync as readdirSync17, writeSync } from "node:fs";
|
|
518850
519070
|
import { basename as basename14, extname as extname10, isAbsolute as isAbsolute2, join as join62 } from "node:path";
|
|
518851
519071
|
import { homedir as homedir16, tmpdir as tmpdir11 } from "node:os";
|
|
@@ -519413,7 +519633,7 @@ function ensureLuxttsDaemon() {
|
|
|
519413
519633
|
}
|
|
519414
519634
|
finish(false);
|
|
519415
519635
|
}, 12e4);
|
|
519416
|
-
const daemon =
|
|
519636
|
+
const daemon = spawn15(venvPy, [inferScript], {
|
|
519417
519637
|
stdio: ["pipe", "pipe", "pipe"],
|
|
519418
519638
|
cwd: tmpdir11(),
|
|
519419
519639
|
env: { ...process.env, LUXTTS_REPO_PATH: repoDir }
|
|
@@ -523985,7 +524205,7 @@ print(json.dumps({"ok": False, "error": "No whisper backend available"}))
|
|
|
523985
524205
|
});
|
|
523986
524206
|
|
|
523987
524207
|
// packages/execution/dist/tools/full-sub-agent.js
|
|
523988
|
-
import { spawn as
|
|
524208
|
+
import { spawn as spawn16, ChildProcess } from "node:child_process";
|
|
523989
524209
|
import { randomBytes as randomBytes17 } from "node:crypto";
|
|
523990
524210
|
function buildSubProcessArgs(opts) {
|
|
523991
524211
|
const args = [];
|
|
@@ -524026,7 +524246,7 @@ function spawnFullSubAgent(task, opts, onOutput, onComplete) {
|
|
|
524026
524246
|
timeoutMs: opts.timeoutMs,
|
|
524027
524247
|
offline: opts.offline
|
|
524028
524248
|
});
|
|
524029
|
-
const child =
|
|
524249
|
+
const child = spawn16("node", [omniusBin, ...cliArgs], {
|
|
524030
524250
|
cwd: opts.workingDir || process.cwd(),
|
|
524031
524251
|
env: {
|
|
524032
524252
|
...process.env,
|
|
@@ -524468,7 +524688,7 @@ var init_agent_tool = __esm({
|
|
|
524468
524688
|
})();
|
|
524469
524689
|
if (isolation === "worktree") {
|
|
524470
524690
|
this.callbacks.onViewRegister?.(agentId, label);
|
|
524471
|
-
const
|
|
524691
|
+
const spawn33 = this.callbacks.spawnSubprocess({
|
|
524472
524692
|
id: agentId,
|
|
524473
524693
|
task: composedPrompt,
|
|
524474
524694
|
model,
|
|
@@ -524478,7 +524698,7 @@ var init_agent_tool = __esm({
|
|
|
524478
524698
|
success: true,
|
|
524479
524699
|
output: `Agent spawned (subprocess, worktree): ${agentId}
|
|
524480
524700
|
Type: ${subagentType}
|
|
524481
|
-
PID: ${
|
|
524701
|
+
PID: ${spawn33.pid}
|
|
524482
524702
|
Task: ${prompt.slice(0, 100)}
|
|
524483
524703
|
Use task_status("${agentId}") to check progress.`,
|
|
524484
524704
|
durationMs: performance.now() - start2
|
|
@@ -524916,7 +525136,7 @@ var init_send_message = __esm({
|
|
|
524916
525136
|
});
|
|
524917
525137
|
|
|
524918
525138
|
// packages/execution/dist/mcp/transport.js
|
|
524919
|
-
import { spawn as
|
|
525139
|
+
import { spawn as spawn17 } from "node:child_process";
|
|
524920
525140
|
async function createTransport(config) {
|
|
524921
525141
|
if (!config.type || config.type === "stdio") {
|
|
524922
525142
|
const transport = new StdioTransport();
|
|
@@ -524948,7 +525168,7 @@ var init_transport5 = __esm({
|
|
|
524948
525168
|
async connect(config) {
|
|
524949
525169
|
const env2 = { ...process.env, ...config.env };
|
|
524950
525170
|
const args = config.args ?? [];
|
|
524951
|
-
this.process =
|
|
525171
|
+
this.process = spawn17(config.command, args, {
|
|
524952
525172
|
env: env2,
|
|
524953
525173
|
stdio: ["pipe", "pipe", "pipe"]
|
|
524954
525174
|
});
|
|
@@ -527573,7 +527793,7 @@ Topic: ${segments.slice(0, 5).map((s2) => s2.text).join(" ").slice(0, 300)}`,
|
|
|
527573
527793
|
|
|
527574
527794
|
// packages/execution/dist/tools/video-scan.js
|
|
527575
527795
|
import { existsSync as existsSync59, readFileSync as readFileSync44, statSync as statSync25 } from "node:fs";
|
|
527576
|
-
import { spawn as
|
|
527796
|
+
import { spawn as spawn18 } from "node:child_process";
|
|
527577
527797
|
import { resolve as resolve36, dirname as dirname18, join as join74, basename as basename16 } from "node:path";
|
|
527578
527798
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
527579
527799
|
import { homedir as homedir25 } from "node:os";
|
|
@@ -527618,7 +527838,7 @@ async function autoLaunchSidecar(cfg) {
|
|
|
527618
527838
|
if (!launcher)
|
|
527619
527839
|
return false;
|
|
527620
527840
|
sidecarLaunchPromise = new Promise((resolveLaunch) => {
|
|
527621
|
-
const child =
|
|
527841
|
+
const child = spawn18(venvPython2, [launcher, "--port", String(cfg.sidecar_port)], {
|
|
527622
527842
|
stdio: ["ignore", "pipe", "pipe"],
|
|
527623
527843
|
env: {
|
|
527624
527844
|
...process.env,
|
|
@@ -527824,7 +528044,7 @@ Format OK: ${r2.format_ok}`;
|
|
|
527824
528044
|
|
|
527825
528045
|
// packages/execution/dist/tools/lance.js
|
|
527826
528046
|
import { existsSync as existsSync60, readFileSync as readFileSync45 } from "node:fs";
|
|
527827
|
-
import { spawn as
|
|
528047
|
+
import { spawn as spawn19 } from "node:child_process";
|
|
527828
528048
|
import { resolve as resolve37, dirname as dirname19, join as join75, basename as basename17 } from "node:path";
|
|
527829
528049
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
527830
528050
|
import { homedir as homedir26 } from "node:os";
|
|
@@ -527869,7 +528089,7 @@ async function autoLaunchSidecar2(cfg) {
|
|
|
527869
528089
|
if (!launcher)
|
|
527870
528090
|
return false;
|
|
527871
528091
|
sidecarLaunchPromise2 = new Promise((resolveLaunch) => {
|
|
527872
|
-
const child =
|
|
528092
|
+
const child = spawn19(venvPython2, [launcher, "--port", String(cfg.sidecar_port)], {
|
|
527873
528093
|
stdio: ["ignore", "pipe", "pipe"],
|
|
527874
528094
|
env: {
|
|
527875
528095
|
...process.env,
|
|
@@ -528204,14 +528424,14 @@ var init_fortemi_bridge = __esm({
|
|
|
528204
528424
|
});
|
|
528205
528425
|
|
|
528206
528426
|
// packages/execution/dist/shellRunner.js
|
|
528207
|
-
import { spawn as
|
|
528427
|
+
import { spawn as spawn20 } from "node:child_process";
|
|
528208
528428
|
async function runShell(options2) {
|
|
528209
528429
|
const { command, args = [], cwd: cwd4, env: env2, timeoutMs = DEFAULT_TIMEOUT_MS2 } = options2;
|
|
528210
528430
|
const mergedEnv = env2 ? { ...process.env, ...env2 } : process.env;
|
|
528211
528431
|
return new Promise((resolve57) => {
|
|
528212
528432
|
const start2 = Date.now();
|
|
528213
528433
|
let timedOut = false;
|
|
528214
|
-
const child =
|
|
528434
|
+
const child = spawn20(command, args, {
|
|
528215
528435
|
cwd: cwd4,
|
|
528216
528436
|
env: mergedEnv
|
|
528217
528437
|
// Do NOT use shell:true — we pass command + args separately
|
|
@@ -528310,7 +528530,7 @@ var init_gitWorktree = __esm({
|
|
|
528310
528530
|
// packages/execution/dist/patchApplier.js
|
|
528311
528531
|
import { readFileSync as readFileSync47, writeFileSync as writeFileSync28, existsSync as existsSync62, mkdirSync as mkdirSync30 } from "node:fs";
|
|
528312
528532
|
import { dirname as dirname20 } from "node:path";
|
|
528313
|
-
import { spawn as
|
|
528533
|
+
import { spawn as spawn21 } from "node:child_process";
|
|
528314
528534
|
async function applyPatch(patch) {
|
|
528315
528535
|
switch (patch.type) {
|
|
528316
528536
|
case "block-replace":
|
|
@@ -528360,7 +528580,7 @@ async function applyUnifiedDiff(patch) {
|
|
|
528360
528580
|
function runWithStdin(options2) {
|
|
528361
528581
|
const { command, args, cwd: cwd4, stdin } = options2;
|
|
528362
528582
|
return new Promise((resolve57) => {
|
|
528363
|
-
const child =
|
|
528583
|
+
const child = spawn21(command, args, {
|
|
528364
528584
|
cwd: cwd4,
|
|
528365
528585
|
stdio: ["pipe", "pipe", "pipe"]
|
|
528366
528586
|
});
|
|
@@ -529087,6 +529307,7 @@ __export(dist_exports, {
|
|
|
529087
529307
|
ensureDepsForGroup: () => ensureDepsForGroup,
|
|
529088
529308
|
ensureDiskSpaceForDownload: () => ensureDiskSpaceForDownload,
|
|
529089
529309
|
ensureUnifiedCacheDirs: () => ensureUnifiedCacheDirs,
|
|
529310
|
+
evaluateCustomToolShareability: () => evaluateCustomToolShareability,
|
|
529090
529311
|
evictModelsToFreeSpace: () => evictModelsToFreeSpace,
|
|
529091
529312
|
extractSkillForQuery: () => extractSkillForQuery,
|
|
529092
529313
|
fetchWithNetworkEgressPolicy: () => fetchWithNetworkEgressPolicy,
|
|
@@ -532057,7 +532278,7 @@ var init_ollama_pool_cleanup = __esm({
|
|
|
532057
532278
|
});
|
|
532058
532279
|
|
|
532059
532280
|
// packages/orchestrator/dist/ollama-pool.js
|
|
532060
|
-
import { spawn as
|
|
532281
|
+
import { spawn as spawn22, exec as exec2 } from "node:child_process";
|
|
532061
532282
|
import { existsSync as existsSync65, readFileSync as readFileSync50, readdirSync as readdirSync21, statfsSync as statfsSync3, statSync as statSync26 } from "node:fs";
|
|
532062
532283
|
import { homedir as homedir28 } from "node:os";
|
|
532063
532284
|
import { join as join79 } from "node:path";
|
|
@@ -532530,7 +532751,7 @@ var init_ollama_pool = __esm({
|
|
|
532530
532751
|
env2["CUDA_VISIBLE_DEVICES"] = gpuUuid;
|
|
532531
532752
|
env2["GPU_DEVICE_ORDINAL"] = gpuIndex === null ? "" : String(gpuIndex);
|
|
532532
532753
|
}
|
|
532533
|
-
const child =
|
|
532754
|
+
const child = spawn22(config.ollamaBinary, ["serve"], {
|
|
532534
532755
|
env: env2,
|
|
532535
532756
|
stdio: ["ignore", "pipe", "pipe"],
|
|
532536
532757
|
detached: true
|
|
@@ -557918,6 +558139,17 @@ ${taskStateStr}
|
|
|
557918
558139
|
if (mcpToolNames.length > 0) {
|
|
557919
558140
|
postCompactRestore.push(`Available MCP tools: ${mcpToolNames.join(", ")}`);
|
|
557920
558141
|
}
|
|
558142
|
+
const activeCustomTools = [...this.tools.values()].map((tool) => ({ tool, meta: tool.customToolMetadata })).filter(({ tool, meta }) => meta?.isCustomTool === true && (this._activatedTools.has(tool.name) || meta.qualityGate?.lastTest?.status === "passed")).slice(0, 8);
|
|
558143
|
+
if (activeCustomTools.length > 0) {
|
|
558144
|
+
postCompactRestore.push([
|
|
558145
|
+
"Active custom tools:",
|
|
558146
|
+
...activeCustomTools.map(({ tool, meta }) => {
|
|
558147
|
+
const last2 = meta.qualityGate?.lastTest;
|
|
558148
|
+
const failure = last2?.status === "failed" && last2.error ? `, last failure=${String(last2.error).slice(0, 120)}` : "";
|
|
558149
|
+
return `- ${tool.name} v${meta.version ?? 1}: docs=${meta.docsPath ?? "missing"}, lastTest=${last2?.status ?? "untested"}${failure}, patch=manage_tools(action="patch", tool_name="${tool.name}", patch={...}, test_args={...}), test=manage_tools(action="test", tool_name="${tool.name}", test_args={...})`;
|
|
558150
|
+
})
|
|
558151
|
+
].join("\n"));
|
|
558152
|
+
}
|
|
557921
558153
|
if (postCompactRestore.length > 0) {
|
|
557922
558154
|
enrichments.push(`[Post-compaction context restore]
|
|
557923
558155
|
${postCompactRestore.join("\n")}`);
|
|
@@ -559347,10 +559579,49 @@ ${transcript}`
|
|
|
559347
559579
|
}
|
|
559348
559580
|
}
|
|
559349
559581
|
const getDesc = (tool) => dynamicDescs.get(tool.name) ?? tool.description;
|
|
559582
|
+
const getCustomToolMetadata = (tool) => {
|
|
559583
|
+
const meta = tool.customToolMetadata;
|
|
559584
|
+
return meta?.isCustomTool === true ? meta : void 0;
|
|
559585
|
+
};
|
|
559586
|
+
const customToolSearchText = (tool) => {
|
|
559587
|
+
const meta = getCustomToolMetadata(tool);
|
|
559588
|
+
if (!meta)
|
|
559589
|
+
return "";
|
|
559590
|
+
return JSON.stringify({
|
|
559591
|
+
docsPath: meta.docsPath,
|
|
559592
|
+
qualityGate: meta.qualityGate,
|
|
559593
|
+
dependencies: meta.dependencies,
|
|
559594
|
+
examples: meta.examples,
|
|
559595
|
+
analytics: meta.analytics,
|
|
559596
|
+
shareability: meta.shareability
|
|
559597
|
+
});
|
|
559598
|
+
};
|
|
559599
|
+
const customToolDetails = (tool) => {
|
|
559600
|
+
const meta = getCustomToolMetadata(tool);
|
|
559601
|
+
if (!meta)
|
|
559602
|
+
return "";
|
|
559603
|
+
const last2 = meta.qualityGate?.lastTest;
|
|
559604
|
+
const example = Array.isArray(meta.examples) && meta.examples[0] ? `
|
|
559605
|
+
Example: ${tool.name}(${JSON.stringify(meta.examples[0].args ?? {})})` : "";
|
|
559606
|
+
return [
|
|
559607
|
+
"",
|
|
559608
|
+
`Custom tool: v${meta.version ?? 1}`,
|
|
559609
|
+
`Quality gate: ${last2?.status ?? "untested"}${last2?.schemaValidation?.status ? `, schema=${last2.schemaValidation.status}` : ""}`,
|
|
559610
|
+
meta.docsPath ? `Docs: ${meta.docsPath}` : "Docs: [missing]",
|
|
559611
|
+
meta.analytics?.runs ? `Usage: ${meta.analytics.runs} run(s), ${Math.round(meta.analytics.successes / Math.max(1, meta.analytics.runs) * 100)}% success` : "",
|
|
559612
|
+
meta.shareability ? `Shareable: ${meta.shareability.shareable ? "true" : "false"} - ${meta.shareability.reason ?? ""}` : "",
|
|
559613
|
+
example
|
|
559614
|
+
].filter(Boolean).join("\n");
|
|
559615
|
+
};
|
|
559350
559616
|
const getIndexLabel = (tool) => {
|
|
559351
|
-
const
|
|
559617
|
+
const meta = getCustomToolMetadata(tool);
|
|
559618
|
+
const desc = `${getDesc(tool)} ${customToolSearchText(tool)}`.toLowerCase().replace(/[`"'()[\]{}:;,.!?/\\|-]+/g, " ");
|
|
559352
559619
|
const keywords2 = Array.from(new Set(desc.split(/\s+/).filter((word2) => word2.length > 2 && !STOPWORDS3.has(word2) && !tool.name.toLowerCase().includes(word2)))).slice(0, 4);
|
|
559353
|
-
|
|
559620
|
+
const base3 = keywords2.length > 0 ? `${tool.name}(${keywords2.join(",")})` : tool.name;
|
|
559621
|
+
if (!meta)
|
|
559622
|
+
return base3;
|
|
559623
|
+
const status = meta.qualityGate?.lastTest?.status ?? "untested";
|
|
559624
|
+
return `${base3}:custom:${status}`;
|
|
559354
559625
|
};
|
|
559355
559626
|
const CORE_TOOLS3 = /* @__PURE__ */ new Set([
|
|
559356
559627
|
"file_read",
|
|
@@ -559375,7 +559646,8 @@ ${transcript}`
|
|
|
559375
559646
|
for (const tool of allTools) {
|
|
559376
559647
|
if (CORE_TOOLS3.has(tool.name))
|
|
559377
559648
|
continue;
|
|
559378
|
-
const
|
|
559649
|
+
const customMeta = getCustomToolMetadata(tool);
|
|
559650
|
+
const toolText = `${tool.name} ${getDesc(tool)} ${customToolSearchText(tool)}`.toLowerCase();
|
|
559379
559651
|
const toolWords = toolText.split(/\s+/).filter((w) => w.length > 2);
|
|
559380
559652
|
let score = 0;
|
|
559381
559653
|
for (const tw of toolWords) {
|
|
@@ -559387,7 +559659,26 @@ ${transcript}`
|
|
|
559387
559659
|
}
|
|
559388
559660
|
}
|
|
559389
559661
|
if (taskText.includes(tool.name.replace(/_/g, " ")) || taskText.includes(tool.name)) {
|
|
559390
|
-
score += 10;
|
|
559662
|
+
score += customMeta ? 16 : 10;
|
|
559663
|
+
}
|
|
559664
|
+
if (customMeta) {
|
|
559665
|
+
const lastStatus = customMeta.qualityGate?.lastTest?.status;
|
|
559666
|
+
if (lastStatus === "passed")
|
|
559667
|
+
score += 6;
|
|
559668
|
+
else if (lastStatus)
|
|
559669
|
+
score -= 4;
|
|
559670
|
+
if (customMeta.analytics?.runs > 0) {
|
|
559671
|
+
score += Math.round(customMeta.analytics.successes / Math.max(1, customMeta.analytics.runs) * 4);
|
|
559672
|
+
if (customMeta.analytics.lastRunAt)
|
|
559673
|
+
score += 1;
|
|
559674
|
+
}
|
|
559675
|
+
if (customMeta.shareability?.shareable)
|
|
559676
|
+
score += 2;
|
|
559677
|
+
const docsExamplesDeps = customToolSearchText(tool).toLowerCase();
|
|
559678
|
+
for (const word2 of taskWords) {
|
|
559679
|
+
if (docsExamplesDeps.includes(word2))
|
|
559680
|
+
score += 2;
|
|
559681
|
+
}
|
|
559391
559682
|
}
|
|
559392
559683
|
if ([
|
|
559393
559684
|
"explore_tools",
|
|
@@ -559511,7 +559802,7 @@ ${catalog}`,
|
|
|
559511
559802
|
continue;
|
|
559512
559803
|
lines.push("");
|
|
559513
559804
|
lines.push(`## ${tool.name}`);
|
|
559514
|
-
lines.push(getDesc(tool));
|
|
559805
|
+
lines.push(`${getDesc(tool)}${customToolDetails(tool)}`);
|
|
559515
559806
|
lines.push(`Parameters: ${JSON.stringify(tool.parameters)}`);
|
|
559516
559807
|
}
|
|
559517
559808
|
}
|
|
@@ -559523,7 +559814,32 @@ ${catalog}`,
|
|
|
559523
559814
|
}
|
|
559524
559815
|
return { success: true, output: lines.join("\n") };
|
|
559525
559816
|
}
|
|
559526
|
-
const matches = deferred.filter((t2) => t2.name.toLowerCase().includes(query) || getDesc(t2).toLowerCase().includes(query)).
|
|
559817
|
+
const matches = deferred.filter((t2) => t2.name.toLowerCase().includes(query) || getDesc(t2).toLowerCase().includes(query) || customToolSearchText(t2).toLowerCase().includes(query)).sort((a2, b) => {
|
|
559818
|
+
const scoreTool = (tool) => {
|
|
559819
|
+
const meta = getCustomToolMetadata(tool);
|
|
559820
|
+
let score = 0;
|
|
559821
|
+
if (tool.name.toLowerCase() === query)
|
|
559822
|
+
score += 30;
|
|
559823
|
+
if (tool.name.toLowerCase().includes(query))
|
|
559824
|
+
score += 10;
|
|
559825
|
+
if (getDesc(tool).toLowerCase().includes(query))
|
|
559826
|
+
score += 4;
|
|
559827
|
+
if (customToolSearchText(tool).toLowerCase().includes(query))
|
|
559828
|
+
score += 6;
|
|
559829
|
+
if (meta?.qualityGate?.lastTest?.status === "passed")
|
|
559830
|
+
score += 6;
|
|
559831
|
+
else if (meta)
|
|
559832
|
+
score -= 4;
|
|
559833
|
+
const analytics = meta?.analytics;
|
|
559834
|
+
if (analytics?.runs > 0) {
|
|
559835
|
+
score += Math.round(analytics.successes / Math.max(1, analytics.runs) * 4);
|
|
559836
|
+
if (analytics.lastRunAt)
|
|
559837
|
+
score += 1;
|
|
559838
|
+
}
|
|
559839
|
+
return score;
|
|
559840
|
+
};
|
|
559841
|
+
return scoreTool(b) - scoreTool(a2);
|
|
559842
|
+
}).slice(0, 5);
|
|
559527
559843
|
if (matches.length === 0) {
|
|
559528
559844
|
const subsetHint = Object.keys(subsetCatalog).join(", ");
|
|
559529
559845
|
return {
|
|
@@ -559537,7 +559853,7 @@ ${catalog}`,
|
|
|
559537
559853
|
const result = matches.map((t2) => {
|
|
559538
559854
|
const paramsStr = JSON.stringify(t2.parameters, null, 2);
|
|
559539
559855
|
return `## ${t2.name}
|
|
559540
|
-
${getDesc(t2)}
|
|
559856
|
+
${getDesc(t2)}${customToolDetails(t2)}
|
|
559541
559857
|
|
|
559542
559858
|
Parameters:
|
|
559543
559859
|
${paramsStr}`;
|
|
@@ -565552,7 +565868,7 @@ __export(listen_exports, {
|
|
|
565552
565868
|
isVideoPath: () => isVideoPath,
|
|
565553
565869
|
waitForTranscribeCli: () => waitForTranscribeCli
|
|
565554
565870
|
});
|
|
565555
|
-
import { spawn as
|
|
565871
|
+
import { spawn as spawn23, execSync as execSync47 } from "node:child_process";
|
|
565556
565872
|
import { accessSync, constants, existsSync as existsSync88, mkdirSync as mkdirSync48, writeFileSync as writeFileSync43, readdirSync as readdirSync28 } from "node:fs";
|
|
565557
565873
|
import { join as join103, dirname as dirname27 } from "node:path";
|
|
565558
565874
|
import { homedir as homedir32 } from "node:os";
|
|
@@ -565674,7 +565990,7 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
565674
565990
|
const venvPython2 = join103(homedir32(), ".omnius", "venv", bin, exe);
|
|
565675
565991
|
if (!existsSync88(venvPython2)) return null;
|
|
565676
565992
|
return new Promise((resolve57) => {
|
|
565677
|
-
const child =
|
|
565993
|
+
const child = spawn23(venvPython2, [script], {
|
|
565678
565994
|
stdio: ["pipe", "pipe", "pipe"],
|
|
565679
565995
|
env: process.env
|
|
565680
565996
|
});
|
|
@@ -565811,7 +566127,7 @@ function ensureTranscribeCliBackground() {
|
|
|
565811
566127
|
const command = terminalElevation && needsSudo ? "sudo" : "npm";
|
|
565812
566128
|
const args = terminalElevation && needsSudo ? ["npm", "i", "-g", "transcribe-cli"] : ["i", "-g", "transcribe-cli"];
|
|
565813
566129
|
return new Promise((resolve57) => {
|
|
565814
|
-
const child =
|
|
566130
|
+
const child = spawn23(command, args, {
|
|
565815
566131
|
stdio: terminalElevation ? "inherit" : "ignore",
|
|
565816
566132
|
timeout: 18e4
|
|
565817
566133
|
});
|
|
@@ -565907,7 +566223,7 @@ var init_listen = __esm({
|
|
|
565907
566223
|
}
|
|
565908
566224
|
} catch {
|
|
565909
566225
|
}
|
|
565910
|
-
this.process =
|
|
566226
|
+
this.process = spawn23(pyPath, [
|
|
565911
566227
|
this.scriptPath,
|
|
565912
566228
|
"--model",
|
|
565913
566229
|
this.model,
|
|
@@ -566238,7 +566554,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
566238
566554
|
return `Failed to start live transcription: ${msg}${tcHint}`;
|
|
566239
566555
|
}
|
|
566240
566556
|
}
|
|
566241
|
-
this.micProcess =
|
|
566557
|
+
this.micProcess = spawn23(micCmd.cmd, micCmd.args, {
|
|
566242
566558
|
stdio: ["pipe", "pipe", "pipe"],
|
|
566243
566559
|
env: { ...process.env }
|
|
566244
566560
|
});
|
|
@@ -566351,7 +566667,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
566351
566667
|
if (!micCmd) {
|
|
566352
566668
|
return "No microphone capture tool found.";
|
|
566353
566669
|
}
|
|
566354
|
-
this.micProcess =
|
|
566670
|
+
this.micProcess = spawn23(micCmd.cmd, micCmd.args, {
|
|
566355
566671
|
stdio: ["pipe", "pipe", "pipe"],
|
|
566356
566672
|
env: { ...process.env }
|
|
566357
566673
|
});
|
|
@@ -572520,6 +572836,7 @@ __export(render_exports, {
|
|
|
572520
572836
|
renderAssistantText: () => renderAssistantText,
|
|
572521
572837
|
renderCompactHeader: () => renderCompactHeader,
|
|
572522
572838
|
renderConfig: () => renderConfig,
|
|
572839
|
+
renderContextIntakeBox: () => renderContextIntakeBox,
|
|
572523
572840
|
renderError: () => renderError,
|
|
572524
572841
|
renderHeader: () => renderHeader,
|
|
572525
572842
|
renderImageAsciiPreview: () => renderImageAsciiPreview,
|
|
@@ -572931,6 +573248,54 @@ function renderToolDynamicBlock(kind, render2, opts) {
|
|
|
572931
573248
|
}
|
|
572932
573249
|
process.stdout.write(text);
|
|
572933
573250
|
}
|
|
573251
|
+
function appendContextBoxSection(body, label, value2) {
|
|
573252
|
+
const text = String(value2 ?? "").trim();
|
|
573253
|
+
if (!text) return;
|
|
573254
|
+
if (body.length > 0) body.push({ text: "", mode: "wrap", kind: "plain" });
|
|
573255
|
+
body.push({ text: label, mode: "wrap", kind: "dim" });
|
|
573256
|
+
for (const line of text.split("\n")) {
|
|
573257
|
+
body.push({ text: line, mode: "wrap", kind: "markdown" });
|
|
573258
|
+
}
|
|
573259
|
+
}
|
|
573260
|
+
function appendContextBoxList(body, label, values) {
|
|
573261
|
+
const items = (values ?? []).map((item) => item.trim()).filter(Boolean);
|
|
573262
|
+
if (items.length === 0) return;
|
|
573263
|
+
if (body.length > 0) body.push({ text: "", mode: "wrap", kind: "plain" });
|
|
573264
|
+
body.push({ text: label, mode: "wrap", kind: "dim" });
|
|
573265
|
+
for (const item of items) {
|
|
573266
|
+
body.push({ text: `- ${item}`, mode: "wrap", kind: "markdown" });
|
|
573267
|
+
}
|
|
573268
|
+
}
|
|
573269
|
+
function renderContextIntakeBox(opts) {
|
|
573270
|
+
const body = [];
|
|
573271
|
+
appendContextBoxSection(body, "Added context:", opts.rawText);
|
|
573272
|
+
appendContextBoxSection(body, "Triage:", opts.inference);
|
|
573273
|
+
appendContextBoxSection(body, "Runner instruction:", opts.runnerInstruction);
|
|
573274
|
+
appendContextBoxList(body, "Conflicts:", opts.conflicts);
|
|
573275
|
+
appendContextBoxList(body, "Alternative interpretations:", opts.alternatives);
|
|
573276
|
+
if (body.length === 0) {
|
|
573277
|
+
body.push({
|
|
573278
|
+
text: "No context content recorded.",
|
|
573279
|
+
mode: "wrap",
|
|
573280
|
+
kind: "dim"
|
|
573281
|
+
});
|
|
573282
|
+
}
|
|
573283
|
+
const metrics2 = [
|
|
573284
|
+
...opts.metadata ?? [],
|
|
573285
|
+
opts.packetId ? `id ${opts.packetId.slice(0, 8)}` : ""
|
|
573286
|
+
].filter(Boolean).join(" · ");
|
|
573287
|
+
renderToolDynamicBlock(
|
|
573288
|
+
"tool-result",
|
|
573289
|
+
(width) => buildToolBoxLines({
|
|
573290
|
+
title: opts.title,
|
|
573291
|
+
metrics: metrics2,
|
|
573292
|
+
body,
|
|
573293
|
+
colorCode: 226,
|
|
573294
|
+
metricsColorCode: 222
|
|
573295
|
+
}, width),
|
|
573296
|
+
opts.host === void 0 ? {} : { host: opts.host }
|
|
573297
|
+
);
|
|
573298
|
+
}
|
|
572934
573299
|
function buildToolCallBoxLines(toolName, args, verbose, width) {
|
|
572935
573300
|
const icon = _emojisEnabled ? `${TOOL_ICONS[toolName] ?? "🔧"} ` : "";
|
|
572936
573301
|
const label = TOOL_LABELS[toolName] ?? toolName;
|
|
@@ -573737,7 +574102,7 @@ var init_render = __esm({
|
|
|
573737
574102
|
|
|
573738
574103
|
// packages/cli/src/tui/voice-session.ts
|
|
573739
574104
|
import { createServer as createServer4 } from "node:http";
|
|
573740
|
-
import { spawn as
|
|
574105
|
+
import { spawn as spawn24, execSync as execSync49 } from "node:child_process";
|
|
573741
574106
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
573742
574107
|
function generateFrontendHTML() {
|
|
573743
574108
|
return `<!DOCTYPE html>
|
|
@@ -574782,7 +575147,7 @@ var init_voice_session = __esm({
|
|
|
574782
575147
|
const timeout2 = setTimeout(() => {
|
|
574783
575148
|
reject(new Error("Cloudflared tunnel start timeout (30s)"));
|
|
574784
575149
|
}, 3e4);
|
|
574785
|
-
this.cloudflaredProcess =
|
|
575150
|
+
this.cloudflaredProcess = spawn24("cloudflared", [
|
|
574786
575151
|
"tunnel",
|
|
574787
575152
|
"--url",
|
|
574788
575153
|
`http://127.0.0.1:${port}`
|
|
@@ -575659,7 +576024,7 @@ var init_usage_bars = __esm({
|
|
|
575659
576024
|
// packages/cli/src/tui/expose.ts
|
|
575660
576025
|
import { createServer as createServer5, request as httpRequest } from "node:http";
|
|
575661
576026
|
import { request as httpsRequest } from "node:https";
|
|
575662
|
-
import { spawn as
|
|
576027
|
+
import { spawn as spawn25, exec as exec3 } from "node:child_process";
|
|
575663
576028
|
import { EventEmitter as EventEmitter8 } from "node:events";
|
|
575664
576029
|
import { randomBytes as randomBytes20, timingSafeEqual } from "node:crypto";
|
|
575665
576030
|
import { URL as URL2 } from "node:url";
|
|
@@ -576819,7 +577184,7 @@ var init_expose = __esm({
|
|
|
576819
577184
|
clearTimeout(timeout2);
|
|
576820
577185
|
clearInterval(progressInterval);
|
|
576821
577186
|
};
|
|
576822
|
-
this.cloudflaredProcess =
|
|
577187
|
+
this.cloudflaredProcess = spawn25("cloudflared", [
|
|
576823
577188
|
"tunnel",
|
|
576824
577189
|
"--url",
|
|
576825
577190
|
`http://127.0.0.1:${port}`,
|
|
@@ -582325,11 +582690,13 @@ var init_status_bar = __esm({
|
|
|
582325
582690
|
stdinHooked = false;
|
|
582326
582691
|
/** COHERE distributed cognitive commons active flag */
|
|
582327
582692
|
_cohereActive = false;
|
|
582328
|
-
/** Mouse tracking state
|
|
582329
|
-
_mouseTrackingEnabled =
|
|
582330
|
-
/**
|
|
582693
|
+
/** Mouse tracking state for header buttons + scroll wheel. */
|
|
582694
|
+
_mouseTrackingEnabled = false;
|
|
582695
|
+
/** Enabled automatically once MouseFilterStream is installed; /mouse off is an emergency escape hatch. */
|
|
582696
|
+
_mouseTrackingPreferred = false;
|
|
582697
|
+
/** Legacy keyboard-selection guard; mouse drag selection is terminal-native. */
|
|
582331
582698
|
_mouseSelecting = false;
|
|
582332
|
-
/** Text selection state
|
|
582699
|
+
/** Text selection state for keyboard/explicit copy paths; mouse drag is not owned by the TUI. */
|
|
582333
582700
|
_textSelection = new TextSelection({
|
|
582334
582701
|
getContentLines: () => this._contentLines,
|
|
582335
582702
|
getScrollOffset: () => this._contentScrollOffset,
|
|
@@ -583864,12 +584231,11 @@ var init_status_bar = __esm({
|
|
|
583864
584231
|
return this._cohereActive;
|
|
583865
584232
|
}
|
|
583866
584233
|
// ── Mouse tracking management ──────────────────────────────────────
|
|
583867
|
-
//
|
|
583868
|
-
//
|
|
583869
|
-
//
|
|
583870
|
-
//
|
|
583871
|
-
//
|
|
583872
|
-
// All mode transitions check neovim focus to avoid conflicts.
|
|
584234
|
+
// Mouse reporting is required for header buttons and scroll-wheel routing.
|
|
584235
|
+
// Use click-only reporting (?1000h) instead of drag-motion reporting (?1002h)
|
|
584236
|
+
// so Omnius does not own click-drag selection or paint fake highlights while
|
|
584237
|
+
// tokens are streaming. Overlay/select UIs may temporarily suspend mouse mode
|
|
584238
|
+
// and then call restoreMouseTracking() on return.
|
|
583873
584239
|
/** Callback to check if neovim has focus (set by interactive.ts to avoid circular import) */
|
|
583874
584240
|
_isNeovimFocused = null;
|
|
583875
584241
|
/** Register neovim focus checker — called from interactive.ts after neovim-mode imports */
|
|
@@ -583880,27 +584246,38 @@ var init_status_bar = __esm({
|
|
|
583880
584246
|
isMouseTrackingEnabled() {
|
|
583881
584247
|
return this._mouseTrackingEnabled;
|
|
583882
584248
|
}
|
|
583883
|
-
/** Enable mouse tracking
|
|
584249
|
+
/** Enable mouse tracking for header buttons + scroll wheel. */
|
|
583884
584250
|
enableMouseTracking() {
|
|
584251
|
+
this._mouseTrackingPreferred = true;
|
|
584252
|
+
this.restoreMouseTracking();
|
|
584253
|
+
}
|
|
584254
|
+
/** Temporarily turn off terminal mouse reporting without changing user preference. */
|
|
584255
|
+
suspendMouseTracking() {
|
|
584256
|
+
if (!this._mouseTrackingEnabled) return;
|
|
584257
|
+
this._mouseTrackingEnabled = false;
|
|
584258
|
+
if (process.stdout.isTTY) {
|
|
584259
|
+
this._trueStdoutWrite.call(process.stdout, "\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l");
|
|
584260
|
+
}
|
|
584261
|
+
}
|
|
584262
|
+
/** Re-apply the current mouse preference after overlays, password prompts, or redraws. */
|
|
584263
|
+
restoreMouseTracking() {
|
|
584264
|
+
if (!this._mouseTrackingPreferred) {
|
|
584265
|
+
this.suspendMouseTracking();
|
|
584266
|
+
return;
|
|
584267
|
+
}
|
|
583885
584268
|
if (this._mouseTrackingEnabled || isOverlayActive()) return;
|
|
583886
584269
|
if (this._isNeovimFocused?.()) return;
|
|
583887
584270
|
this._mouseTrackingEnabled = true;
|
|
583888
584271
|
if (process.stdout.isTTY) {
|
|
583889
|
-
this._trueStdoutWrite.call(process.stdout, "\x1B[?
|
|
584272
|
+
this._trueStdoutWrite.call(process.stdout, "\x1B[?1000h\x1B[?1006h");
|
|
583890
584273
|
}
|
|
583891
584274
|
}
|
|
583892
584275
|
/** Disable mouse tracking entirely (overlay transitions + exit). */
|
|
583893
584276
|
disableMouseTracking() {
|
|
583894
|
-
|
|
583895
|
-
this.
|
|
583896
|
-
if (process.stdout.isTTY) {
|
|
583897
|
-
this._trueStdoutWrite.call(process.stdout, "\x1B[?1002l\x1B[?1006l");
|
|
583898
|
-
}
|
|
584277
|
+
this._mouseTrackingPreferred = false;
|
|
584278
|
+
this.suspendMouseTracking();
|
|
583899
584279
|
}
|
|
583900
|
-
/**
|
|
583901
|
-
* because mouse tracking stays active at all times. Disabling tracking would
|
|
583902
|
-
* break scroll wheel and in-app selection highlighting. */
|
|
583903
|
-
/** Cancel mouse idle timer (user is actively scrolling or streaming started) */
|
|
584280
|
+
/** Cancel mouse idle timer (legacy hook; mouse tracking is preference-driven). */
|
|
583904
584281
|
cancelMouseIdle() {
|
|
583905
584282
|
}
|
|
583906
584283
|
// ── Text Selection + Header Buttons ─────────────────────────────────
|
|
@@ -583919,7 +584296,8 @@ var init_status_bar = __esm({
|
|
|
583919
584296
|
/**
|
|
583920
584297
|
* Handle a mouse pointer event (press/drag/release).
|
|
583921
584298
|
* Called by MouseFilterStream's pointer handler.
|
|
583922
|
-
* Routes to
|
|
584299
|
+
* Routes to header/footer/tab clicks and scroll affordances. Content-area
|
|
584300
|
+
* drag selection is deliberately left to the terminal.
|
|
583923
584301
|
*/
|
|
583924
584302
|
handlePointerEvent(type, col, row) {
|
|
583925
584303
|
if (!this.active) return;
|
|
@@ -583997,26 +584375,7 @@ var init_status_bar = __esm({
|
|
|
583997
584375
|
const L = layout();
|
|
583998
584376
|
const inContent = row >= this.scrollRegionTop && row <= L.contentBottom;
|
|
583999
584377
|
if (inContent) {
|
|
584000
|
-
|
|
584001
|
-
this._mouseSelecting = true;
|
|
584002
|
-
this._autoScroll = false;
|
|
584003
|
-
this._textSelection.onMousePress(row, col);
|
|
584004
|
-
return;
|
|
584005
|
-
}
|
|
584006
|
-
if (type === "drag") {
|
|
584007
|
-
this._textSelection.onMouseDrag(row, col);
|
|
584008
|
-
this.repaintContent();
|
|
584009
|
-
return;
|
|
584010
|
-
}
|
|
584011
|
-
if (type === "release") {
|
|
584012
|
-
this._mouseSelecting = false;
|
|
584013
|
-
this._textSelection.onMouseRelease(row, col);
|
|
584014
|
-
if (this._textSelection.hasSelection) {
|
|
584015
|
-
this._textSelection.copyToClipboard();
|
|
584016
|
-
this.repaintContent();
|
|
584017
|
-
}
|
|
584018
|
-
return;
|
|
584019
|
-
}
|
|
584378
|
+
return;
|
|
584020
584379
|
}
|
|
584021
584380
|
}
|
|
584022
584381
|
/** Copy current selection to clipboard. Returns true if copied. */
|
|
@@ -584423,7 +584782,7 @@ var init_status_bar = __esm({
|
|
|
584423
584782
|
setTermSize(process.stdout.rows ?? 24, process.stdout.columns ?? 80);
|
|
584424
584783
|
setFooterHeight(this._currentFooterHeight);
|
|
584425
584784
|
this.cancelMouseIdle();
|
|
584426
|
-
this.
|
|
584785
|
+
this.restoreMouseTracking();
|
|
584427
584786
|
const L = layout();
|
|
584428
584787
|
const scrollEnd = L.scrollRegionBottom;
|
|
584429
584788
|
if (this.writeDepth === 1 && !this._origWrite) {
|
|
@@ -584803,7 +585162,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
584803
585162
|
scrollContentUp(lines = 1) {
|
|
584804
585163
|
if (!this.active) return;
|
|
584805
585164
|
this.cancelMouseIdle();
|
|
584806
|
-
this.
|
|
585165
|
+
this.restoreMouseTracking();
|
|
584807
585166
|
this._autoScroll = false;
|
|
584808
585167
|
const maxOffset = this.maxContentScrollOffset();
|
|
584809
585168
|
this._contentScrollOffset = Math.min(
|
|
@@ -584817,7 +585176,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
584817
585176
|
scrollContentDown(lines = 1) {
|
|
584818
585177
|
if (!this.active) return;
|
|
584819
585178
|
this.cancelMouseIdle();
|
|
584820
|
-
this.
|
|
585179
|
+
this.restoreMouseTracking();
|
|
584821
585180
|
this._contentScrollOffset = Math.min(
|
|
584822
585181
|
this.maxContentScrollOffset(),
|
|
584823
585182
|
Math.max(0, this._contentScrollOffset - lines)
|
|
@@ -586814,11 +587173,11 @@ __export(personaplex_exports, {
|
|
|
586814
587173
|
import { existsSync as existsSync97, writeFileSync as writeFileSync49, readFileSync as readFileSync78, mkdirSync as mkdirSync54, copyFileSync as copyFileSync4, readdirSync as readdirSync32, statSync as statSync37 } from "node:fs";
|
|
586815
587174
|
import { join as join113, dirname as dirname32 } from "node:path";
|
|
586816
587175
|
import { homedir as homedir36 } from "node:os";
|
|
586817
|
-
import { execSync as execSync50, spawn as
|
|
587176
|
+
import { execSync as execSync50, spawn as spawn26 } from "node:child_process";
|
|
586818
587177
|
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
586819
587178
|
function execAsync(cmd, opts = {}) {
|
|
586820
587179
|
return new Promise((resolve57, reject) => {
|
|
586821
|
-
const child =
|
|
587180
|
+
const child = spawn26("bash", ["-c", cmd], {
|
|
586822
587181
|
stdio: ["ignore", "pipe", "pipe"],
|
|
586823
587182
|
timeout: opts.timeout ?? 3e5,
|
|
586824
587183
|
env: opts.env ?? process.env
|
|
@@ -587454,7 +587813,7 @@ print('Converted')
|
|
|
587454
587813
|
serverEnv["HYBRID_LLM_MODEL"] = ollamaModel;
|
|
587455
587814
|
serverEnv["HYBRID_MODEL_FAST"] = "qwen3.5:4b";
|
|
587456
587815
|
}
|
|
587457
|
-
const child =
|
|
587816
|
+
const child = spawn26(venvPython2, serverArgs, {
|
|
587458
587817
|
stdio: ["ignore", "pipe", "pipe"],
|
|
587459
587818
|
detached: true,
|
|
587460
587819
|
env: serverEnv,
|
|
@@ -587583,7 +587942,7 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
|
|
|
587583
587942
|
log22(`Cloning voice "${voiceName}" from ${inputWav}...`);
|
|
587584
587943
|
log22("This requires loading the full 7B model — may take 30-60s...");
|
|
587585
587944
|
return new Promise((resolve57) => {
|
|
587586
|
-
const child =
|
|
587945
|
+
const child = spawn26(venvPython2, [
|
|
587587
587946
|
cloneScript,
|
|
587588
587947
|
"--input",
|
|
587589
587948
|
inputWav,
|
|
@@ -587820,7 +588179,7 @@ __export(setup_exports, {
|
|
|
587820
588179
|
updateOllama: () => updateOllama
|
|
587821
588180
|
});
|
|
587822
588181
|
import * as readline from "node:readline";
|
|
587823
|
-
import { execSync as execSync51, spawn as
|
|
588182
|
+
import { execSync as execSync51, spawn as spawn27, exec as exec5 } from "node:child_process";
|
|
587824
588183
|
import { promisify as promisify6 } from "node:util";
|
|
587825
588184
|
import { existsSync as existsSync98, writeFileSync as writeFileSync50, readFileSync as readFileSync79, appendFileSync as appendFileSync7, mkdirSync as mkdirSync55 } from "node:fs";
|
|
587826
588185
|
import { join as join114 } from "node:path";
|
|
@@ -588679,7 +589038,7 @@ async function ensureOllamaRunning(backendUrl2, rl) {
|
|
|
588679
589038
|
process.stdout.write(` ${c3.cyan("●")} Starting ollama serve...
|
|
588680
589039
|
`);
|
|
588681
589040
|
try {
|
|
588682
|
-
const child =
|
|
589041
|
+
const child = spawn27("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
588683
589042
|
child.unref();
|
|
588684
589043
|
} catch {
|
|
588685
589044
|
process.stdout.write(` ${c3.cyan("⚠")} Could not start ollama serve.
|
|
@@ -589360,7 +589719,7 @@ ${c3.cyan(OMNIUS_FIRST_RUN_BANNER)}
|
|
|
589360
589719
|
${c3.cyan("●")} Ollama is installed but not running. Starting automatically...
|
|
589361
589720
|
`);
|
|
589362
589721
|
try {
|
|
589363
|
-
const child =
|
|
589722
|
+
const child = spawn27("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
589364
589723
|
child.unref();
|
|
589365
589724
|
await new Promise((resolve57) => setTimeout(resolve57, 3e3));
|
|
589366
589725
|
try {
|
|
@@ -589388,7 +589747,7 @@ ${c3.cyan(OMNIUS_FIRST_RUN_BANNER)}
|
|
|
589388
589747
|
${c3.cyan("●")} Starting ollama serve...
|
|
589389
589748
|
`);
|
|
589390
589749
|
try {
|
|
589391
|
-
const child =
|
|
589750
|
+
const child = spawn27("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
589392
589751
|
child.unref();
|
|
589393
589752
|
await new Promise((resolve57) => setTimeout(resolve57, 3e3));
|
|
589394
589753
|
try {
|
|
@@ -594546,7 +594905,7 @@ __export(daemon_exports, {
|
|
|
594546
594905
|
startDaemon: () => startDaemon,
|
|
594547
594906
|
stopDaemon: () => stopDaemon
|
|
594548
594907
|
});
|
|
594549
|
-
import { spawn as
|
|
594908
|
+
import { spawn as spawn28 } from "node:child_process";
|
|
594550
594909
|
import { existsSync as existsSync104, readFileSync as readFileSync82, writeFileSync as writeFileSync51, mkdirSync as mkdirSync56, unlinkSync as unlinkSync19, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
|
|
594551
594910
|
import { join as join118 } from "node:path";
|
|
594552
594911
|
import { homedir as homedir39 } from "node:os";
|
|
@@ -594637,7 +594996,7 @@ async function startDaemon() {
|
|
|
594637
594996
|
try {
|
|
594638
594997
|
outFd = openSync3(join118(OMNIUS_DIR2, "daemon.log"), "a");
|
|
594639
594998
|
errFd = openSync3(join118(OMNIUS_DIR2, "daemon.err.log"), "a");
|
|
594640
|
-
const child =
|
|
594999
|
+
const child = spawn28(daemonCommand.command, daemonCommand.args, {
|
|
594641
595000
|
detached: true,
|
|
594642
595001
|
stdio: ["ignore", outFd, errFd],
|
|
594643
595002
|
env: {
|
|
@@ -599154,7 +599513,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
|
599154
599513
|
}
|
|
599155
599514
|
}
|
|
599156
599515
|
if (process.stdout.isTTY) {
|
|
599157
|
-
process.stdout.write("\x1B[?
|
|
599516
|
+
process.stdout.write("\x1B[?1000h\x1B[?1006h");
|
|
599158
599517
|
}
|
|
599159
599518
|
if (process.stdout.isTTY) {
|
|
599160
599519
|
process.stdout.write("\x1B[?1003l");
|
|
@@ -600387,9 +600746,9 @@ ${reason}
|
|
|
600387
600746
|
try {
|
|
600388
600747
|
if (hadMouse) {
|
|
600389
600748
|
ctx3.enableMouse?.();
|
|
600390
|
-
writeDirectTerminal("\x1B[?
|
|
600749
|
+
writeDirectTerminal("\x1B[?1000h\x1B[?1006h");
|
|
600391
600750
|
} else {
|
|
600392
|
-
writeDirectTerminal("\x1B[?1002l\x1B[?1006l");
|
|
600751
|
+
writeDirectTerminal("\x1B[?1000l\x1B[?1002l\x1B[?1006l");
|
|
600393
600752
|
}
|
|
600394
600753
|
} catch {
|
|
600395
600754
|
}
|
|
@@ -600418,7 +600777,7 @@ async function acquireSudoCredentials(ctx3, reason) {
|
|
|
600418
600777
|
}
|
|
600419
600778
|
async function runSudoScript(ctx3, script) {
|
|
600420
600779
|
try {
|
|
600421
|
-
const { spawn:
|
|
600780
|
+
const { spawn: spawn33 } = await import("node:child_process");
|
|
600422
600781
|
const full = `set -e; ${script}`;
|
|
600423
600782
|
await withTransientTerminalPrivilegePrompt(
|
|
600424
600783
|
ctx3,
|
|
@@ -600430,7 +600789,7 @@ async function runSudoScript(ctx3, script) {
|
|
|
600430
600789
|
);
|
|
600431
600790
|
const cmd = isRoot ? "bash" : "sudo";
|
|
600432
600791
|
const args = isRoot ? ["-lc", full] : hasInteractiveTty ? ["bash", "-lc", full] : ["-n", "bash", "-lc", full];
|
|
600433
|
-
const child =
|
|
600792
|
+
const child = spawn33(cmd, args, {
|
|
600434
600793
|
stdio: hasInteractiveTty ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
600435
600794
|
env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
|
|
600436
600795
|
});
|
|
@@ -602871,8 +603230,8 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
602871
603230
|
writeFileSync54(jwtFile, JSON.stringify(jwtPayload, null, 2));
|
|
602872
603231
|
renderInfo(`Launching fortemi-react from ${fDir}...`);
|
|
602873
603232
|
try {
|
|
602874
|
-
const { spawn:
|
|
602875
|
-
const child =
|
|
603233
|
+
const { spawn: spawn33 } = __require("node:child_process");
|
|
603234
|
+
const child = spawn33(
|
|
602876
603235
|
"npx",
|
|
602877
603236
|
["vite", "dev", "--host", "0.0.0.0", "--port", "3000"],
|
|
602878
603237
|
{
|
|
@@ -603538,14 +603897,14 @@ Clone a new voice: /voice clone <wav-file> [name]`);
|
|
|
603538
603897
|
if (t2 === "off" || t2 === "0" || t2 === "false" || t2 === "no") {
|
|
603539
603898
|
ctx3.disableMouse?.();
|
|
603540
603899
|
renderInfo(
|
|
603541
|
-
"Mouse tracking: off —
|
|
603900
|
+
"Mouse tracking: off — app header buttons and scroll wheel are paused. Re-enable with /mouse on."
|
|
603542
603901
|
);
|
|
603543
603902
|
return "handled";
|
|
603544
603903
|
}
|
|
603545
603904
|
if (t2 === "on" || t2 === "1" || t2 === "true" || t2 === "yes") {
|
|
603546
603905
|
ctx3.enableMouse?.();
|
|
603547
603906
|
renderInfo(
|
|
603548
|
-
"Mouse tracking: on — header buttons + scroll wheel active
|
|
603907
|
+
"Mouse tracking: on — header buttons + scroll wheel active; drag-motion capture remains disabled."
|
|
603549
603908
|
);
|
|
603550
603909
|
return "handled";
|
|
603551
603910
|
}
|
|
@@ -603556,7 +603915,7 @@ Clone a new voice: /voice clone <wav-file> [name]`);
|
|
|
603556
603915
|
if (isOnNow) {
|
|
603557
603916
|
ctx3.disableMouse?.();
|
|
603558
603917
|
renderInfo(
|
|
603559
|
-
"Mouse tracking: off —
|
|
603918
|
+
"Mouse tracking: off — app header buttons and scroll wheel are paused. Re-enable with /mouse on."
|
|
603560
603919
|
);
|
|
603561
603920
|
} else {
|
|
603562
603921
|
ctx3.enableMouse?.();
|
|
@@ -603878,9 +604237,9 @@ systemctl --user daemon-reload || true
|
|
|
603878
604237
|
systemctl --user enable --now omnius-daemon.service || true
|
|
603879
604238
|
sleep 1
|
|
603880
604239
|
`;
|
|
603881
|
-
const { spawn:
|
|
604240
|
+
const { spawn: spawn33 } = await import("node:child_process");
|
|
603882
604241
|
await new Promise((resolve57) => {
|
|
603883
|
-
const child =
|
|
604242
|
+
const child = spawn33("bash", ["-lc", takeover], {
|
|
603884
604243
|
stdio: "inherit"
|
|
603885
604244
|
});
|
|
603886
604245
|
onChildExit(child, () => resolve57());
|
|
@@ -611367,8 +611726,8 @@ ${escapedContent}EOF'`, {
|
|
|
611367
611726
|
}
|
|
611368
611727
|
await new Promise((r2) => setTimeout(r2, 1e3));
|
|
611369
611728
|
process.env.OLLAMA_NUM_PARALLEL = String(n2);
|
|
611370
|
-
const { spawn:
|
|
611371
|
-
const child =
|
|
611729
|
+
const { spawn: spawn33 } = await import("node:child_process");
|
|
611730
|
+
const child = spawn33("ollama", ["serve"], {
|
|
611372
611731
|
stdio: "ignore",
|
|
611373
611732
|
detached: true,
|
|
611374
611733
|
env: { ...process.env, OLLAMA_NUM_PARALLEL: String(n2) }
|
|
@@ -612248,7 +612607,7 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
612248
612607
|
}
|
|
612249
612608
|
};
|
|
612250
612609
|
}
|
|
612251
|
-
const { exec: exec6, spawn:
|
|
612610
|
+
const { exec: exec6, spawn: spawn33, execSync: es2 } = await import("node:child_process");
|
|
612252
612611
|
const execA = (cmd, opts) => new Promise(
|
|
612253
612612
|
(res, rej) => exec6(
|
|
612254
612613
|
cmd,
|
|
@@ -612663,7 +613022,7 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
612663
613022
|
}
|
|
612664
613023
|
}, 1e3);
|
|
612665
613024
|
heartbeat.unref?.();
|
|
612666
|
-
const child =
|
|
613025
|
+
const child = spawn33(cmd, {
|
|
612667
613026
|
shell: true,
|
|
612668
613027
|
stdio: ["ignore", "pipe", "pipe"],
|
|
612669
613028
|
env: {
|
|
@@ -613586,7 +613945,7 @@ async function showExposeDashboard(gateway, rl, ctx3) {
|
|
|
613586
613945
|
stopped = true;
|
|
613587
613946
|
process.stdin.removeListener("data", onData);
|
|
613588
613947
|
if (process.stdout.isTTY) {
|
|
613589
|
-
process.stdout.write("\x1B[?
|
|
613948
|
+
process.stdout.write("\x1B[?1000h\x1B[?1006h");
|
|
613590
613949
|
}
|
|
613591
613950
|
};
|
|
613592
613951
|
const origResolve = resolve57;
|
|
@@ -614121,12 +614480,74 @@ function loadPatternSuggestions(repoRoot, store2) {
|
|
|
614121
614480
|
for (const p2 of all2.slice(0, 3)) {
|
|
614122
614481
|
const steps = p2.pattern.map((e2) => e2.tool).join(" → ");
|
|
614123
614482
|
lines.push(`- [${p2.occurrences}x, ${p2.scope}] ${steps}`);
|
|
614483
|
+
const candidate = buildToolCreationCandidate(p2);
|
|
614484
|
+
if (candidate) {
|
|
614485
|
+
lines.push(` Candidate: ${candidate}`);
|
|
614486
|
+
}
|
|
614124
614487
|
}
|
|
614125
614488
|
return lines.join("\n");
|
|
614126
614489
|
} catch {
|
|
614127
614490
|
return "";
|
|
614128
614491
|
}
|
|
614129
614492
|
}
|
|
614493
|
+
function buildToolCreationCandidate(pattern) {
|
|
614494
|
+
const tools = pattern.pattern.map((entry) => entry.tool);
|
|
614495
|
+
const toolName = sanitizeToolName(`auto_${tools.join("_")}`).slice(0, 64).replace(/_+$/g, "") || "auto_workflow";
|
|
614496
|
+
const params = Array.from(new Set(pattern.pattern.flatMap((entry) => entry.argKeys))).filter(Boolean).slice(0, 8);
|
|
614497
|
+
const properties = Object.fromEntries(params.map((param) => [param, { type: "string", description: `Value observed for ${param}` }]));
|
|
614498
|
+
const steps = pattern.pattern.map((entry, index) => ({
|
|
614499
|
+
description: `Run observed ${entry.tool} step ${index + 1}`,
|
|
614500
|
+
tool: entry.tool,
|
|
614501
|
+
args: Object.fromEntries(entry.argKeys.map((key) => [key, `{{${key}}}`]))
|
|
614502
|
+
}));
|
|
614503
|
+
const testArgs = Object.fromEntries(params.map((param) => [param, `<${param}>`]));
|
|
614504
|
+
return [
|
|
614505
|
+
`create_tool(tool_name="${toolName}", scope="${pattern.scope}", `,
|
|
614506
|
+
`tool_parameters=${JSON.stringify({ type: "object", properties, required: params })}, `,
|
|
614507
|
+
`steps=${JSON.stringify(steps)}, test_args=${JSON.stringify(testArgs)})`
|
|
614508
|
+
].join("");
|
|
614509
|
+
}
|
|
614510
|
+
function sanitizeToolName(value2) {
|
|
614511
|
+
const cleaned = value2.toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/_+/g, "_").replace(/^_+/, "");
|
|
614512
|
+
return /^[a-z]/.test(cleaned) ? cleaned : `tool_${cleaned}`;
|
|
614513
|
+
}
|
|
614514
|
+
function loadCustomToolsContext(repoRoot) {
|
|
614515
|
+
try {
|
|
614516
|
+
const registryPath = join122(repoRoot, ".omnius", "tools", "registry.json");
|
|
614517
|
+
const indexPath = join122(repoRoot, ".omnius", "tools", "README.md");
|
|
614518
|
+
if (!existsSync109(registryPath)) return "";
|
|
614519
|
+
const registry4 = JSON.parse(readFileSync87(registryPath, "utf-8"));
|
|
614520
|
+
const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
|
|
614521
|
+
const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
|
|
614522
|
+
if (byRate !== 0) return byRate;
|
|
614523
|
+
return String(b.analytics?.lastRunAt ?? "").localeCompare(String(a2.analytics?.lastRunAt ?? ""));
|
|
614524
|
+
});
|
|
614525
|
+
if (tools.length === 0) return "";
|
|
614526
|
+
return tools.map((tool) => {
|
|
614527
|
+
const example = tool.examples?.[0];
|
|
614528
|
+
const successRate = tool.analytics?.successRate !== void 0 ? `${Math.round(tool.analytics.successRate * 100)}%` : "n/a";
|
|
614529
|
+
const tested = tool.qualityGate?.lastTest?.testedAt?.split("T")[0] ?? "passed";
|
|
614530
|
+
const schema = tool.qualityGate?.lastTest?.schemaValidation?.status;
|
|
614531
|
+
const bits = [
|
|
614532
|
+
`- ${tool.name} v${tool.version ?? 1}: ${String(tool.description ?? "").slice(0, 140)}`,
|
|
614533
|
+
`docs=${tool.docsPath ?? "missing"}`,
|
|
614534
|
+
existsSync109(indexPath) ? `index=${indexPath}` : "",
|
|
614535
|
+
`test=${tested}${schema ? `, schema=${schema}` : ""}`,
|
|
614536
|
+
`success=${successRate}`,
|
|
614537
|
+
example?.args ? `example=${tool.name}(${JSON.stringify(example.args)})` : "",
|
|
614538
|
+
tool.shareability ? `shareable=${tool.shareability.shareable ? "true" : "false"}:${tool.shareability.reason ?? ""}` : ""
|
|
614539
|
+
].filter(Boolean);
|
|
614540
|
+
return bits.join(" | ");
|
|
614541
|
+
}).join("\n");
|
|
614542
|
+
} catch {
|
|
614543
|
+
return "";
|
|
614544
|
+
}
|
|
614545
|
+
}
|
|
614546
|
+
function limitCustomToolsContext(context2, modelTier) {
|
|
614547
|
+
if (!context2) return "";
|
|
614548
|
+
const limit = modelTier === "small" ? 5 : modelTier === "medium" ? 10 : 20;
|
|
614549
|
+
return context2.split("\n").filter(Boolean).slice(0, limit).join("\n");
|
|
614550
|
+
}
|
|
614130
614551
|
function buildProjectContext(repoRoot, stores) {
|
|
614131
614552
|
const skills = discoverSkills(repoRoot);
|
|
614132
614553
|
writeCompressedSkillsArtifact(repoRoot, skills);
|
|
@@ -614140,6 +614561,7 @@ function buildProjectContext(repoRoot, stores) {
|
|
|
614140
614561
|
taskMemories: stores?.taskMemoryStore ? loadTaskMemories(repoRoot, stores.taskMemoryStore) : "",
|
|
614141
614562
|
failurePatterns: stores?.failureStore ? loadFailurePatterns(stores.failureStore) : "",
|
|
614142
614563
|
patternSuggestions: stores?.toolPatternStore ? loadPatternSuggestions(repoRoot, stores.toolPatternStore) : "",
|
|
614564
|
+
customToolsContext: loadCustomToolsContext(repoRoot),
|
|
614143
614565
|
skillsSummary: buildSkillsSummary(skills)
|
|
614144
614566
|
};
|
|
614145
614567
|
}
|
|
@@ -614227,6 +614649,14 @@ ${ctx3.sessionHistory}`);
|
|
|
614227
614649
|
${ctx3.failurePatterns}
|
|
614228
614650
|
|
|
614229
614651
|
Avoid approaches that led to these failures. If you encounter these errors, try a different strategy.`);
|
|
614652
|
+
}
|
|
614653
|
+
const customTools = limitCustomToolsContext(ctx3.customToolsContext, modelTier);
|
|
614654
|
+
if (customTools) {
|
|
614655
|
+
sections.push(`## Tested Custom Tools
|
|
614656
|
+
|
|
614657
|
+
${customTools}
|
|
614658
|
+
|
|
614659
|
+
These tools have passed their smoke test and are available as normal function tools. Use tool_search by tool name for full schema if deferred.`);
|
|
614230
614660
|
}
|
|
614231
614661
|
if (modelTier === "large" && ctx3.patternSuggestions) {
|
|
614232
614662
|
sections.push(`## Tool Creation Suggestions
|
|
@@ -638601,7 +639031,6 @@ var init_mouse_filter = __esm({
|
|
|
638601
639031
|
const hasShift = (btn & 4) !== 0 && btn < 32;
|
|
638602
639032
|
if (btn === 2) {
|
|
638603
639033
|
} else if (hasShift) {
|
|
638604
|
-
process.stdout.write("\x1B[?1002l\x1B[?1006l");
|
|
638605
639034
|
} else if ((btn === 0 || btn === 1) && suffix === "M") {
|
|
638606
639035
|
this.onPointer("press", col, row);
|
|
638607
639036
|
} else if (btn >= 32 && btn <= 35 && suffix === "M") {
|
|
@@ -641705,7 +642134,7 @@ __export(graphical_sudo_exports, {
|
|
|
641705
642134
|
detectSudoHelper: () => detectSudoHelper,
|
|
641706
642135
|
runGraphicalSudo: () => runGraphicalSudo
|
|
641707
642136
|
});
|
|
641708
|
-
import { spawn as
|
|
642137
|
+
import { spawn as spawn29 } from "node:child_process";
|
|
641709
642138
|
import { existsSync as existsSync130, mkdirSync as mkdirSync76, writeFileSync as writeFileSync68, chmodSync as chmodSync4 } from "node:fs";
|
|
641710
642139
|
import { join as join143 } from "node:path";
|
|
641711
642140
|
import { tmpdir as tmpdir21 } from "node:os";
|
|
@@ -641775,7 +642204,7 @@ async function runGraphicalSudo(opts) {
|
|
|
641775
642204
|
args = ["/bin/bash", opts.scriptPath, ...opts.args ?? []];
|
|
641776
642205
|
}
|
|
641777
642206
|
return new Promise((resolve57, reject) => {
|
|
641778
|
-
const child =
|
|
642207
|
+
const child = spawn29(cmd, args, {
|
|
641779
642208
|
env: { ...process.env, ...opts.env || {}, ...extraEnv },
|
|
641780
642209
|
stdio: ["ignore", "pipe", "pipe"]
|
|
641781
642210
|
});
|
|
@@ -654499,7 +654928,7 @@ var init_profiles = __esm({
|
|
|
654499
654928
|
});
|
|
654500
654929
|
|
|
654501
654930
|
// packages/cli/src/docker.ts
|
|
654502
|
-
import { execSync as execSync57, spawn as
|
|
654931
|
+
import { execSync as execSync57, spawn as spawn30 } from "node:child_process";
|
|
654503
654932
|
import { existsSync as existsSync134, mkdirSync as mkdirSync79, writeFileSync as writeFileSync71 } from "node:fs";
|
|
654504
654933
|
import { join as join147, resolve as resolve51, dirname as dirname40 } from "node:path";
|
|
654505
654934
|
import { homedir as homedir52 } from "node:os";
|
|
@@ -654780,7 +655209,7 @@ function runInContainer(opts) {
|
|
|
654780
655209
|
if (opts.maxTurns) omniusArgs.push("--max-turns", String(opts.maxTurns));
|
|
654781
655210
|
if (opts.timeoutS) omniusArgs.push("--timeout", String(opts.timeoutS));
|
|
654782
655211
|
args.push(...omniusArgs);
|
|
654783
|
-
return
|
|
655212
|
+
return spawn30("docker", args, {
|
|
654784
655213
|
stdio: ["ignore", "pipe", "pipe"]
|
|
654785
655214
|
});
|
|
654786
655215
|
}
|
|
@@ -654983,7 +655412,7 @@ import { createRequire as createRequire7 } from "node:module";
|
|
|
654983
655412
|
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
654984
655413
|
import { dirname as dirname41, join as join149, resolve as resolve52 } from "node:path";
|
|
654985
655414
|
import { homedir as homedir53 } from "node:os";
|
|
654986
|
-
import { spawn as
|
|
655415
|
+
import { spawn as spawn31, execSync as execSync58 } from "node:child_process";
|
|
654987
655416
|
import { mkdirSync as mkdirSync80, writeFileSync as writeFileSync72, readFileSync as readFileSync109, readdirSync as readdirSync48, existsSync as existsSync135, watch as fsWatch4, renameSync as renameSync9, unlinkSync as unlinkSync28 } from "node:fs";
|
|
654988
655417
|
import { randomBytes as randomBytes27, randomUUID as randomUUID17 } from "node:crypto";
|
|
654989
655418
|
import { createHash as createHash34 } from "node:crypto";
|
|
@@ -657357,7 +657786,7 @@ ${task}` : task;
|
|
|
657357
657786
|
runEnv["OMNIUS_RUN_SCOPE"] = req2._authScope || "admin";
|
|
657358
657787
|
runEnv["OLLAMA_HOST"] = currentCfg.backendUrl || process.env["OLLAMA_HOST"] || "http://127.0.0.1:11434";
|
|
657359
657788
|
if (currentCfg.apiKey) runEnv["OMNIUS_API_KEY_INHERIT"] = currentCfg.apiKey;
|
|
657360
|
-
const child =
|
|
657789
|
+
const child = spawn31(process.execPath, [omniusBin, ...args], {
|
|
657361
657790
|
cwd: resolve52(process.cwd()),
|
|
657362
657791
|
env: runEnv,
|
|
657363
657792
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -657686,7 +658115,7 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
657686
658115
|
cleanEnv.PATH = pathParts.join(":");
|
|
657687
658116
|
let child;
|
|
657688
658117
|
if (isWin2) {
|
|
657689
|
-
child =
|
|
658118
|
+
child = spawn31(npmBin, ["install", "-g", pkgSpec, "--no-audit", "--no-fund", "--no-progress"], {
|
|
657690
658119
|
detached: true,
|
|
657691
658120
|
stdio: ["ignore", logFd, logFd],
|
|
657692
658121
|
windowsHide: true,
|
|
@@ -657708,13 +658137,13 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
657708
658137
|
}
|
|
657709
658138
|
}
|
|
657710
658139
|
if (npmCli) {
|
|
657711
|
-
child =
|
|
658140
|
+
child = spawn31(nodeBin, [npmCli, "install", "-g", pkgSpec, "--no-audit", "--no-fund", "--no-progress"], {
|
|
657712
658141
|
detached: true,
|
|
657713
658142
|
stdio: ["ignore", logFd, logFd],
|
|
657714
658143
|
env: cleanEnv
|
|
657715
658144
|
});
|
|
657716
658145
|
} else {
|
|
657717
|
-
child =
|
|
658146
|
+
child = spawn31(npmBin, ["install", "-g", pkgSpec, "--no-audit", "--no-fund", "--no-progress"], {
|
|
657718
658147
|
detached: true,
|
|
657719
658148
|
stdio: ["ignore", logFd, logFd],
|
|
657720
658149
|
env: cleanEnv
|
|
@@ -657725,7 +658154,7 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
657725
658154
|
const installPid = child.pid ?? 0;
|
|
657726
658155
|
if (installPid > 0 && !isWin2) {
|
|
657727
658156
|
try {
|
|
657728
|
-
const follower =
|
|
658157
|
+
const follower = spawn31("bash", ["-c", `while kill -0 ${installPid} 2>/dev/null; do sleep 1; done; echo "__EXIT_CODE=0" >> "${logPath3}"`], {
|
|
657729
658158
|
detached: true,
|
|
657730
658159
|
stdio: "ignore"
|
|
657731
658160
|
});
|
|
@@ -657748,7 +658177,7 @@ async function handleV1Update(req2, res, requestId) {
|
|
|
657748
658177
|
hasSystemdUnit ? `systemctl --user restart omnius-daemon.service >/dev/null 2>&1 || true` : `${JSON.stringify(omniusAbs)} serve --quiet --daemon >/dev/null 2>&1 & disown`,
|
|
657749
658178
|
`kill -TERM ${process.pid} >/dev/null 2>&1 || true`
|
|
657750
658179
|
].join("; ");
|
|
657751
|
-
const relauncher =
|
|
658180
|
+
const relauncher = spawn31("bash", ["-c", relaunchScript], {
|
|
657752
658181
|
detached: true,
|
|
657753
658182
|
stdio: "ignore",
|
|
657754
658183
|
env: cleanEnv
|
|
@@ -657970,7 +658399,7 @@ async function handleV1Run(req2, res) {
|
|
|
657970
658399
|
});
|
|
657971
658400
|
job.sandbox = "container";
|
|
657972
658401
|
} else {
|
|
657973
|
-
child =
|
|
658402
|
+
child = spawn31(process.execPath, [omniusBin, ...args], {
|
|
657974
658403
|
cwd: cwd4,
|
|
657975
658404
|
env: runEnv,
|
|
657976
658405
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -660109,7 +660538,7 @@ ${historyLines}
|
|
|
660109
660538
|
}
|
|
660110
660539
|
runEnv["OLLAMA_HOST"] = currentCfg.backendUrl || process.env["OLLAMA_HOST"] || "http://127.0.0.1:11434";
|
|
660111
660540
|
if (currentCfg.apiKey) runEnv["OMNIUS_API_KEY_INHERIT"] = currentCfg.apiKey;
|
|
660112
|
-
const child =
|
|
660541
|
+
const child = spawn31(process.execPath, [omniusBin, ...args], {
|
|
660113
660542
|
cwd: cwdPath,
|
|
660114
660543
|
env: runEnv,
|
|
660115
660544
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -663345,7 +663774,7 @@ function buildTools(repoRoot, config, contextWindowSize, modelTier) {
|
|
|
663345
663774
|
new CreateToolTool(repoRoot),
|
|
663346
663775
|
new ManageToolsTool(repoRoot),
|
|
663347
663776
|
// Load agent-created custom tools from .omnius/tools/ and ~/.omnius/tools/
|
|
663348
|
-
...buildCustomTools(repoRoot),
|
|
663777
|
+
...buildCustomTools(repoRoot, { shellRunner: shellTool }),
|
|
663349
663778
|
// Skill system (AIWG skills — discovery and execution)
|
|
663350
663779
|
new SkillListTool(repoRoot),
|
|
663351
663780
|
new SkillExecuteTool(repoRoot),
|
|
@@ -663882,6 +664311,70 @@ async function createSteeringIntakeBackend(config, repoRoot) {
|
|
|
663882
664311
|
false
|
|
663883
664312
|
);
|
|
663884
664313
|
}
|
|
664314
|
+
function formatTaskCompletionMeta(meta) {
|
|
664315
|
+
if (!meta) return "no prior task metrics recorded";
|
|
664316
|
+
const dur = meta.durationMs < 6e4 ? `${(meta.durationMs / 1e3).toFixed(1)}s` : `${Math.floor(meta.durationMs / 6e4)}m ${Math.floor(meta.durationMs % 6e4 / 1e3)}s`;
|
|
664317
|
+
return `${meta.turns} turns, ${meta.toolCalls} tool calls, ${dur}, ${meta.model}`;
|
|
664318
|
+
}
|
|
664319
|
+
function buildNewTaskIntakePacket(ingress, interpretation, previousPrompt, previousSummary, previousMeta) {
|
|
664320
|
+
const lines = [
|
|
664321
|
+
"[NEW_TASK_INTAKE v1]",
|
|
664322
|
+
`id: ${ingress.id}`,
|
|
664323
|
+
`sourceSurface: ${ingress.sourceSurface}`,
|
|
664324
|
+
`feedbackKind: next_user_task`,
|
|
664325
|
+
`authority: ${ingress.authority}`,
|
|
664326
|
+
`timestamp: ${ingress.timestamp}`,
|
|
664327
|
+
"",
|
|
664328
|
+
"Instruction hierarchy:",
|
|
664329
|
+
"- Treat this as user-level task intent, below system/developer/tool safety and above older task assumptions when they conflict.",
|
|
664330
|
+
"",
|
|
664331
|
+
"Previous task prompt:",
|
|
664332
|
+
previousPrompt.trim() || "(not recorded)",
|
|
664333
|
+
"",
|
|
664334
|
+
"Previous task completion:",
|
|
664335
|
+
previousSummary.trim() || "(not recorded)",
|
|
664336
|
+
"",
|
|
664337
|
+
"Previous task metrics:",
|
|
664338
|
+
formatTaskCompletionMeta(previousMeta),
|
|
664339
|
+
"",
|
|
664340
|
+
"New task:",
|
|
664341
|
+
ingress.rawText,
|
|
664342
|
+
""
|
|
664343
|
+
];
|
|
664344
|
+
if (interpretation) {
|
|
664345
|
+
lines.push(
|
|
664346
|
+
"Model-derived task transition assessment:",
|
|
664347
|
+
`inference: ${interpretation.inference}`,
|
|
664348
|
+
`runnerInstruction: ${interpretation.runnerInstruction}`
|
|
664349
|
+
);
|
|
664350
|
+
if (interpretation.conflicts?.length) {
|
|
664351
|
+
lines.push(
|
|
664352
|
+
"conflicts:",
|
|
664353
|
+
...interpretation.conflicts.map((item) => `- ${item}`)
|
|
664354
|
+
);
|
|
664355
|
+
}
|
|
664356
|
+
if (interpretation.alternatives?.length) {
|
|
664357
|
+
lines.push(
|
|
664358
|
+
"alternative interpretations:",
|
|
664359
|
+
...interpretation.alternatives.map((item) => `- ${item}`)
|
|
664360
|
+
);
|
|
664361
|
+
}
|
|
664362
|
+
if (interpretation.memoryNote) {
|
|
664363
|
+
lines.push(`memoryNote: ${interpretation.memoryNote}`);
|
|
664364
|
+
}
|
|
664365
|
+
lines.push("");
|
|
664366
|
+
} else {
|
|
664367
|
+
lines.push("Model-derived task transition assessment: unavailable", "");
|
|
664368
|
+
}
|
|
664369
|
+
lines.push(
|
|
664370
|
+
"Interleave contract:",
|
|
664371
|
+
"- Consume this before the first assistant/tool decision for the new task.",
|
|
664372
|
+
"- Decide whether the new task continues, corrects, or pivots away from the previous task.",
|
|
664373
|
+
"- Use the new task as the active objective; prior-task context is only relevant when it changes the next action.",
|
|
664374
|
+
"[/NEW_TASK_INTAKE]"
|
|
664375
|
+
);
|
|
664376
|
+
return lines.join("\n");
|
|
664377
|
+
}
|
|
663885
664378
|
function createDMNEventHandler(verbose, writeContent) {
|
|
663886
664379
|
return (event) => {
|
|
663887
664380
|
switch (event.type) {
|
|
@@ -666203,7 +666696,7 @@ async function startInteractive(config, repoPath) {
|
|
|
666203
666696
|
tuiBgSeq() + // theme bg for content area
|
|
666204
666697
|
`\x1B[2J\x1B[3J\x1B[H\x1B[1;${termRows()}r\x1B[?25l`
|
|
666205
666698
|
// hide cursor during setup
|
|
666206
|
-
// NOTE: mouse tracking (?
|
|
666699
|
+
// NOTE: mouse tracking (?1000h ?1006h) is deferred until AFTER setup
|
|
666207
666700
|
// wizard completes and MouseFilterStream is created. Enabling mouse
|
|
666208
666701
|
// here would leak SGR coordinate sequences into readline prompts.
|
|
666209
666702
|
);
|
|
@@ -667244,6 +667737,7 @@ This is an independent background session started from /background.`
|
|
|
667244
667737
|
let lastSteeringRetracted = false;
|
|
667245
667738
|
let _recallText = null;
|
|
667246
667739
|
let _recallTimer = null;
|
|
667740
|
+
let promptRecallCancelled = false;
|
|
667247
667741
|
const RECALL_WINDOW_MS = 1500;
|
|
667248
667742
|
let sessionSudoPassword = null;
|
|
667249
667743
|
let sudoPromptPending = false;
|
|
@@ -667441,12 +667935,7 @@ This is an independent background session started from /background.`
|
|
|
667441
667935
|
if (process.stdin.isTTY && typeof process.stdin.setRawMode === "function") {
|
|
667442
667936
|
process.stdin.setRawMode(true);
|
|
667443
667937
|
}
|
|
667444
|
-
|
|
667445
|
-
process.stdout.write(
|
|
667446
|
-
"\x1B[?1002h\x1B[?1006h"
|
|
667447
|
-
// enable SGR mouse mode
|
|
667448
|
-
);
|
|
667449
|
-
}
|
|
667938
|
+
statusBar.enableMouseTracking();
|
|
667450
667939
|
function persistHistoryLine(line) {
|
|
667451
667940
|
if (!line.trim()) return;
|
|
667452
667941
|
try {
|
|
@@ -668049,9 +668538,7 @@ Log: ${nexusLogPath}`)
|
|
|
668049
668538
|
return;
|
|
668050
668539
|
}
|
|
668051
668540
|
sudoPromptPending = true;
|
|
668052
|
-
|
|
668053
|
-
process.stdout.write("\x1B[?1000l\x1B[?1002l\x1B[?1006l");
|
|
668054
|
-
}
|
|
668541
|
+
statusBar.suspendMouseTracking();
|
|
668055
668542
|
writeContent(() => {
|
|
668056
668543
|
process.stdout.write(
|
|
668057
668544
|
`
|
|
@@ -670556,9 +671043,7 @@ ${result.content.slice(0, 2e3)}${result.content.length > 2e3 ? "\n[truncated]" :
|
|
|
670556
671043
|
passwordShowPlain = false;
|
|
670557
671044
|
sessionSudoPassword = input;
|
|
670558
671045
|
activeTask.runner.setSudoPassword(input);
|
|
670559
|
-
|
|
670560
|
-
process.stdout.write("\x1B[?1002h\x1B[?1006h");
|
|
670561
|
-
}
|
|
671046
|
+
statusBar.enableMouseTracking();
|
|
670562
671047
|
statusBar.setInputStateProvider(() => ({
|
|
670563
671048
|
line: rl.line ?? "",
|
|
670564
671049
|
cursor: rl.cursor ?? 0
|
|
@@ -670801,8 +671286,26 @@ ${result.text}`;
|
|
|
670801
671286
|
injected: true,
|
|
670802
671287
|
rawOnly: interpretation === null
|
|
670803
671288
|
});
|
|
671289
|
+
const activeToolCallCount = activeTask.toolCallCount;
|
|
671290
|
+
const activeFilesTouchedCount = activeTask.filesTouched.size;
|
|
671291
|
+
writeContent(
|
|
671292
|
+
() => renderContextIntakeBox({
|
|
671293
|
+
title: isReplacement ? "Context Intake (replacement)" : "Context Intake",
|
|
671294
|
+
rawText: input,
|
|
671295
|
+
inference: interpretation?.inference,
|
|
671296
|
+
runnerInstruction: interpretation?.runnerInstruction,
|
|
671297
|
+
conflicts: interpretation?.conflicts,
|
|
671298
|
+
alternatives: interpretation?.alternatives,
|
|
671299
|
+
packetId: ingress.id,
|
|
671300
|
+
metadata: [
|
|
671301
|
+
"mid-task",
|
|
671302
|
+
`${activeToolCallCount} calls`,
|
|
671303
|
+
`${activeFilesTouchedCount} files`,
|
|
671304
|
+
interpretation ? "triaged" : "raw"
|
|
671305
|
+
]
|
|
671306
|
+
})
|
|
671307
|
+
);
|
|
670804
671308
|
if (interpretation?.inference) {
|
|
670805
|
-
writeContent(() => renderSteeringIntake(interpretation.inference));
|
|
670806
671309
|
if (voiceEngine.enabled && voiceEngine.voiceMode === "verbose") {
|
|
670807
671310
|
const emoState = emotionEngine.getState();
|
|
670808
671311
|
const emoCtx = emoState ? {
|
|
@@ -670966,12 +671469,82 @@ Summarize or analyze this transcription as appropriate.`;
|
|
|
670966
671469
|
const inputLineCount = fullInput.split("\n").length;
|
|
670967
671470
|
const displayText = isImage ? `[Image: ${cleanPath}]` : inputLineCount > 1 ? `[pasted ${inputLineCount} lines]` : fullInput;
|
|
670968
671471
|
writeContent(() => renderUserMessage(displayText));
|
|
671472
|
+
promptRecallCancelled = false;
|
|
670969
671473
|
_recallText = input;
|
|
670970
671474
|
if (_recallTimer) clearTimeout(_recallTimer);
|
|
670971
671475
|
_recallTimer = setTimeout(() => {
|
|
670972
671476
|
_recallText = null;
|
|
670973
671477
|
_recallTimer = null;
|
|
670974
671478
|
}, RECALL_WINDOW_MS);
|
|
671479
|
+
const previousPromptForIntake = lastSubmittedPrompt;
|
|
671480
|
+
const previousSummaryForIntake = lastCompletedSummary;
|
|
671481
|
+
const previousMetaForIntake = lastTaskMeta;
|
|
671482
|
+
let taskIntakePacket = "";
|
|
671483
|
+
if (previousSummaryForIntake.trim()) {
|
|
671484
|
+
const priorContext = [
|
|
671485
|
+
previousPromptForIntake.trim() ? `Previous task prompt:
|
|
671486
|
+
${previousPromptForIntake.trim()}` : "",
|
|
671487
|
+
`Previous task completion:
|
|
671488
|
+
${previousSummaryForIntake.trim()}`,
|
|
671489
|
+
`Previous task metrics:
|
|
671490
|
+
${formatTaskCompletionMeta(previousMetaForIntake)}`
|
|
671491
|
+
].filter(Boolean).join("\n\n");
|
|
671492
|
+
const ingress = createSteeringIngress({
|
|
671493
|
+
rawText: fullInput,
|
|
671494
|
+
sourceSurface: "tui",
|
|
671495
|
+
currentTaskGoal: priorContext,
|
|
671496
|
+
recentActivity: previousMetaForIntake ? formatTaskCompletionMeta(previousMetaForIntake) : void 0,
|
|
671497
|
+
filesTouched: sessionFilesTouched,
|
|
671498
|
+
toolCallCount: previousMetaForIntake?.toolCalls ?? sessionToolCallCount
|
|
671499
|
+
});
|
|
671500
|
+
let interpretation = null;
|
|
671501
|
+
try {
|
|
671502
|
+
const intakeBackend = await createSteeringIntakeBackend(
|
|
671503
|
+
currentConfig,
|
|
671504
|
+
repoRoot
|
|
671505
|
+
);
|
|
671506
|
+
interpretation = await interpretSteeringIngress(
|
|
671507
|
+
intakeBackend,
|
|
671508
|
+
ingress,
|
|
671509
|
+
Math.min(currentConfig.timeoutMs || 15e3, 15e3)
|
|
671510
|
+
);
|
|
671511
|
+
} catch {
|
|
671512
|
+
interpretation = null;
|
|
671513
|
+
}
|
|
671514
|
+
taskIntakePacket = buildNewTaskIntakePacket(
|
|
671515
|
+
ingress,
|
|
671516
|
+
interpretation,
|
|
671517
|
+
previousPromptForIntake,
|
|
671518
|
+
previousSummaryForIntake,
|
|
671519
|
+
previousMetaForIntake
|
|
671520
|
+
);
|
|
671521
|
+
appendSteeringLedgerEntry(repoRoot, {
|
|
671522
|
+
type: "ingress",
|
|
671523
|
+
packetId: ingress.id,
|
|
671524
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
671525
|
+
ingress,
|
|
671526
|
+
interpretation,
|
|
671527
|
+
injected: true,
|
|
671528
|
+
rawOnly: interpretation === null
|
|
671529
|
+
});
|
|
671530
|
+
writeContent(
|
|
671531
|
+
() => renderContextIntakeBox({
|
|
671532
|
+
title: "Task Intake",
|
|
671533
|
+
rawText: fullInput,
|
|
671534
|
+
inference: interpretation?.inference,
|
|
671535
|
+
runnerInstruction: interpretation?.runnerInstruction,
|
|
671536
|
+
conflicts: interpretation?.conflicts,
|
|
671537
|
+
alternatives: interpretation?.alternatives,
|
|
671538
|
+
packetId: ingress.id,
|
|
671539
|
+
metadata: [
|
|
671540
|
+
"new task",
|
|
671541
|
+
previousMetaForIntake ? `${previousMetaForIntake.toolCalls} prior calls` : "prior task",
|
|
671542
|
+
interpretation ? "triaged" : "raw"
|
|
671543
|
+
]
|
|
671544
|
+
})
|
|
671545
|
+
);
|
|
671546
|
+
}
|
|
671547
|
+
if (promptRecallCancelled) return;
|
|
670975
671548
|
lastSubmittedPrompt = fullInput;
|
|
670976
671549
|
const taskPreview = fullInput.length > 100 ? fullInput.slice(0, 100) + "..." : fullInput;
|
|
670977
671550
|
emotionEngine.setCurrentTask(taskPreview);
|
|
@@ -670996,6 +671569,13 @@ Summarize or analyze this transcription as appropriate.`;
|
|
|
670996
671569
|
NEW TASK: ${fullInput}`;
|
|
670997
671570
|
restoredSessionContext = null;
|
|
670998
671571
|
}
|
|
671572
|
+
if (taskIntakePacket) {
|
|
671573
|
+
taskInput = `${taskIntakePacket}
|
|
671574
|
+
|
|
671575
|
+
---
|
|
671576
|
+
|
|
671577
|
+
${taskInput}`;
|
|
671578
|
+
}
|
|
670999
671579
|
try {
|
|
671000
671580
|
statusBar.setProcessing(true);
|
|
671001
671581
|
statusBar.recordSpeedTaskStart();
|
|
@@ -671304,6 +671884,7 @@ ${c3.dim("(Use /quit to exit)")}
|
|
|
671304
671884
|
if (_recallText !== null) {
|
|
671305
671885
|
const recalled = _recallText;
|
|
671306
671886
|
_recallText = null;
|
|
671887
|
+
promptRecallCancelled = true;
|
|
671307
671888
|
if (_recallTimer) {
|
|
671308
671889
|
clearTimeout(_recallTimer);
|
|
671309
671890
|
_recallTimer = null;
|
|
@@ -671876,7 +672457,7 @@ __export(run_exports, {
|
|
|
671876
672457
|
statusCommand: () => statusCommand
|
|
671877
672458
|
});
|
|
671878
672459
|
import { resolve as resolve54 } from "node:path";
|
|
671879
|
-
import { spawn as
|
|
672460
|
+
import { spawn as spawn32 } from "node:child_process";
|
|
671880
672461
|
import { mkdirSync as mkdirSync83, writeFileSync as writeFileSync75, readFileSync as readFileSync112, readdirSync as readdirSync50, existsSync as existsSync137 } from "node:fs";
|
|
671881
672462
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
671882
672463
|
import { join as join152 } from "node:path";
|
|
@@ -671989,7 +672570,7 @@ async function runBackground(task, config, opts) {
|
|
|
671989
672570
|
const omniusBin = process.argv[1] || "omnius";
|
|
671990
672571
|
const args = [task, "--json"];
|
|
671991
672572
|
if (config.model) args.push("--model", config.model);
|
|
671992
|
-
const child =
|
|
672573
|
+
const child = spawn32(process.execPath, [omniusBin, ...args], {
|
|
671993
672574
|
cwd: repoRoot,
|
|
671994
672575
|
env: { ...process.env, OMNIUS_JOB_ID: id },
|
|
671995
672576
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -673189,9 +673770,9 @@ async function main() {
|
|
|
673189
673770
|
const mode = process.argv[process.argv.indexOf("--self-test") + 1] || "crossmodal";
|
|
673190
673771
|
if (mode === "crossmodal") {
|
|
673191
673772
|
process.stdout.write("Running crossmodal smoke tests...\n");
|
|
673192
|
-
const { spawn:
|
|
673773
|
+
const { spawn: spawn33 } = await import("node:child_process");
|
|
673193
673774
|
const run2 = (file) => new Promise((resolve57, reject) => {
|
|
673194
|
-
const p2 =
|
|
673775
|
+
const p2 = spawn33(process.execPath, [file], { stdio: ["ignore", "pipe", "pipe"] });
|
|
673195
673776
|
p2.stdout.on("data", (d2) => process.stdout.write(d2));
|
|
673196
673777
|
p2.stderr.on("data", (d2) => process.stdout.write(d2));
|
|
673197
673778
|
onChildExit(p2, (code8) => code8 === 0 ? resolve57() : reject(new Error(`${file} exited ${code8}`)));
|