opencode-ultra 0.8.1 → 0.8.2
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/hooks/keyword-detector.d.ts +1 -1
- package/dist/index.js +68 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface DetectedKeyword {
|
|
2
|
-
type: "ultrawork" | "search" | "analyze" | "think" | "evolve";
|
|
2
|
+
type: "ultrawork" | "search" | "analyze" | "think" | "evolve" | "evolve-exe" | "evolve-scan" | "evolve-publish";
|
|
3
3
|
message: string;
|
|
4
4
|
}
|
|
5
5
|
export declare function removeCodeBlocks(text: string): string;
|
package/dist/index.js
CHANGED
|
@@ -14826,6 +14826,9 @@ var ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i;
|
|
|
14826
14826
|
var THINK_PATTERN = /\b(think\s+hard|think\s+through|think\s+deeply|think\s+carefully)\b|\u3058\u3063\u304F\u308A|\u6DF1\u304F\u8003\u3048\u3066|\u719F\u8003/i;
|
|
14827
14827
|
var SEARCH_PATTERN = /\b(search|find|locate|lookup|look\s*up|explore|discover|scan|grep|query|browse|detect|trace|seek|track|pinpoint|hunt)\b|where\s+is|show\s+me|list\s+all|\u691C\u7D22|\u63A2\u3057\u3066|\u898B\u3064\u3051\u3066|\u30B5\u30FC\u30C1|\u63A2\u7D22|\u30B9\u30AD\u30E3\u30F3|\u3069\u3053|\u767A\u898B|\u635C\u7D22|\u898B\u3064\u3051\u51FA\u3059|\u4E00\u89A7|\u641C\u7D22|\u67E5\u627E|\u5BFB\u627E|\u67E5\u8BE2|\u68C0\u7D22|\u5B9A\u4F4D|\u626B\u63CF|\u53D1\u73B0|\u5728\u54EA\u91CC|\u627E\u51FA\u6765|\u5217\u51FA/i;
|
|
14828
14828
|
var ANALYZE_PATTERN = /\b(analyze|analyse|investigate|examine|research|study|deep[\s-]?dive|inspect|audit|evaluate|assess|review|diagnose|scrutinize|dissect|debug|comprehend|interpret|breakdown|understand)\b|why\s+is|how\s+does|how\s+to|\u5206\u6790|\u8ABF\u67FB|\u89E3\u6790|\u691C\u8A0E|\u7814\u7A76|\u8A3A\u65AD|\u7406\u89E3|\u8AAC\u660E|\u691C\u8A3C|\u7CBE\u67FB|\u7A76\u660E|\u30C7\u30D0\u30C3\u30B0|\u306A\u305C|\u3069\u3046|\u4ED5\u7D44\u307F|\u8C03\u67E5|\u68C0\u67E5|\u5256\u6790|\u6DF1\u5165|\u8BCA\u65AD|\u89E3\u91CA|\u8C03\u8BD5|\u4E3A\u4EC0\u4E48|\u539F\u7406|\u641E\u6E05\u695A|\u5F04\u660E\u767D/i;
|
|
14829
|
+
var EVOLVE_EXE_PATTERN = /\bevolve[\s\u3000_-]*(exe|exec|execute|run|\u5B9F\u884C)/i;
|
|
14830
|
+
var EVOLVE_SCAN_PATTERN = /\bevolve[\s\u3000_-]*(scan|\u30B9\u30AD\u30E3\u30F3|report|\u30EC\u30DD\u30FC\u30C8)/i;
|
|
14831
|
+
var EVOLVE_PUBLISH_PATTERN = /\bevolve[\s\u3000_-]*(publish|\u516C\u958B|\u30EA\u30EA\u30FC\u30B9|release)/i;
|
|
14829
14832
|
var EVOLVE_PATTERN = /\b(evolve|self[\s-]?improve|self[\s-]?upgrade|plugin[\s-]?scout|ecosystem[\s-]?scan)\b|\u81EA\u5DF1\u6539\u5584|\u9032\u5316|\u30D7\u30E9\u30B0\u30A4\u30F3\u63A2\u7D22|\u30A8\u30B3\u30B7\u30B9\u30C6\u30E0|\u81EA\u6211\u8FDB\u5316|\u63D2\u4EF6\u641C\u7D22/i;
|
|
14830
14833
|
function removeCodeBlocks(text) {
|
|
14831
14834
|
return text.replace(CODE_BLOCK_PATTERN, "").replace(INLINE_CODE_PATTERN, "");
|
|
@@ -14838,11 +14841,19 @@ var KEYWORD_DEFS = [
|
|
|
14838
14841
|
{ pattern: SEARCH_PATTERN, type: "search", getMessage: () => SEARCH_MESSAGE },
|
|
14839
14842
|
{ pattern: ANALYZE_PATTERN, type: "analyze", getMessage: () => ANALYZE_MESSAGE },
|
|
14840
14843
|
{ pattern: THINK_PATTERN, type: "think", getMessage: () => THINK_MESSAGE },
|
|
14844
|
+
{ pattern: EVOLVE_EXE_PATTERN, type: "evolve-exe", getMessage: (_ctx, text) => buildEvolveExeMessage(text) },
|
|
14845
|
+
{ pattern: EVOLVE_SCAN_PATTERN, type: "evolve-scan", getMessage: () => EVOLVE_SCAN_MESSAGE },
|
|
14846
|
+
{ pattern: EVOLVE_PUBLISH_PATTERN, type: "evolve-publish", getMessage: () => EVOLVE_PUBLISH_MESSAGE },
|
|
14841
14847
|
{ pattern: EVOLVE_PATTERN, type: "evolve", getMessage: (ctx) => buildEvolveMessage(ctx) }
|
|
14842
14848
|
];
|
|
14843
14849
|
function detectKeywords(text, evolveCtx) {
|
|
14844
14850
|
const clean = removeCodeBlocks(text);
|
|
14845
|
-
|
|
14851
|
+
const matched = KEYWORD_DEFS.filter(({ pattern }) => pattern.test(clean)).map(({ type, getMessage }) => ({ type, message: getMessage(evolveCtx, clean) }));
|
|
14852
|
+
const hasSubCommand = matched.some((k) => k.type === "evolve-exe" || k.type === "evolve-scan" || k.type === "evolve-publish");
|
|
14853
|
+
if (hasSubCommand) {
|
|
14854
|
+
return matched.filter((k) => k.type !== "evolve");
|
|
14855
|
+
}
|
|
14856
|
+
return matched;
|
|
14846
14857
|
}
|
|
14847
14858
|
var ULTRAWORK_MESSAGE = `<ultrawork-mode>
|
|
14848
14859
|
|
|
@@ -14928,6 +14939,47 @@ IF COMPLEX \u2014 DO NOT STRUGGLE ALONE. Consult specialists:
|
|
|
14928
14939
|
|
|
14929
14940
|
SYNTHESIZE findings before proceeding.`;
|
|
14930
14941
|
var THINK_MESSAGE = `Extended thinking enabled. Take your time to reason thoroughly.`;
|
|
14942
|
+
function extractEvolveExeArgs(text) {
|
|
14943
|
+
if (!text)
|
|
14944
|
+
return "";
|
|
14945
|
+
const match = text.match(/\bevolve[\s_-]*(?:exe|exec|execute|run|\u5B9F\u884C)\s+(.+?)$/im);
|
|
14946
|
+
return match?.[1]?.trim() ?? "";
|
|
14947
|
+
}
|
|
14948
|
+
function buildEvolveExeMessage(text) {
|
|
14949
|
+
const args = extractEvolveExeArgs(text);
|
|
14950
|
+
const proposalsArg = args || "all";
|
|
14951
|
+
return `[evolve-exe] EXECUTE EVOLVE PROPOSALS.
|
|
14952
|
+
|
|
14953
|
+
You MUST call the \`evolve_exe\` tool immediately. Do NOT research, do NOT propose \u2014 just execute.
|
|
14954
|
+
|
|
14955
|
+
\`\`\`
|
|
14956
|
+
evolve_exe({ proposals: "${proposalsArg}" })
|
|
14957
|
+
\`\`\`
|
|
14958
|
+
|
|
14959
|
+
If the user said "dry" or "dryrun", add \`dryRun: true\`.
|
|
14960
|
+
If the user said "publish", add \`publish: true\`.
|
|
14961
|
+
If no proposals file exists, tell the user to run \`evolve scan\` first.`;
|
|
14962
|
+
}
|
|
14963
|
+
var EVOLVE_SCAN_MESSAGE = `[evolve-scan] SCAN EXISTING PROPOSALS.
|
|
14964
|
+
|
|
14965
|
+
You MUST call the \`evolve_scan\` tool immediately to read and report on existing proposals.
|
|
14966
|
+
Do NOT do ecosystem research. Just read .opencode/evolve-proposals.jsonl and generate the numbered report.
|
|
14967
|
+
|
|
14968
|
+
\`\`\`
|
|
14969
|
+
evolve_scan({})
|
|
14970
|
+
\`\`\`
|
|
14971
|
+
|
|
14972
|
+
Show the numbered proposal list to the user after the scan completes.`;
|
|
14973
|
+
var EVOLVE_PUBLISH_MESSAGE = `[evolve-publish] PUBLISH THE PLUGIN.
|
|
14974
|
+
|
|
14975
|
+
You MUST call the \`evolve_publish\` tool immediately.
|
|
14976
|
+
|
|
14977
|
+
\`\`\`
|
|
14978
|
+
evolve_publish({ bump: "patch" })
|
|
14979
|
+
\`\`\`
|
|
14980
|
+
|
|
14981
|
+
If the user specified a bump level (minor, major), use that instead of patch.
|
|
14982
|
+
If the user mentioned a deploy target (e.g. "ssh-124"), add \`deploy: "ssh-124"\`.`;
|
|
14931
14983
|
function buildEvolveMessage(ctx) {
|
|
14932
14984
|
const inventory = ctx ? buildSelfInventory(ctx) : "(No capability data available \u2014 read source manually)";
|
|
14933
14985
|
return `[evolve-mode] SELF-IMPROVEMENT CYCLE ACTIVATED.
|
|
@@ -30237,6 +30289,9 @@ var OpenCodeUltra = async (ctx) => {
|
|
|
30237
30289
|
}
|
|
30238
30290
|
pendingKeywords.set(input.sessionID, detected);
|
|
30239
30291
|
const hasEvolve = detected.some((k) => k.type === "evolve");
|
|
30292
|
+
const hasEvolveExe = detected.some((k) => k.type === "evolve-exe");
|
|
30293
|
+
const hasEvolveScan = detected.some((k) => k.type === "evolve-scan");
|
|
30294
|
+
const hasEvolvePublish = detected.some((k) => k.type === "evolve-publish");
|
|
30240
30295
|
if (hasEvolve) {
|
|
30241
30296
|
const anchor = `
|
|
30242
30297
|
|
|
@@ -30249,6 +30304,18 @@ Phase 4: SCORE \u2014 Call evolve_score({ markdown: "## Improvement: ...\\n**Pri
|
|
|
30249
30304
|
Phase 5: SAVE \u2014 Call ledger_save({ name: "evolve-scan-YYYY-MM-DD", content: "..." }).
|
|
30250
30305
|
DO NOT skip tools. Text-only output is FORBIDDEN. Every phase requires tool calls.`;
|
|
30251
30306
|
output.parts.push({ type: "text", text: anchor });
|
|
30307
|
+
} else if (hasEvolveExe) {
|
|
30308
|
+
output.parts.push({ type: "text", text: `
|
|
30309
|
+
|
|
30310
|
+
[EVOLVE EXE \u2014 CALL THE TOOL NOW. Do not explain, do not research. Call evolve_exe immediately.]` });
|
|
30311
|
+
} else if (hasEvolveScan) {
|
|
30312
|
+
output.parts.push({ type: "text", text: `
|
|
30313
|
+
|
|
30314
|
+
[EVOLVE SCAN \u2014 CALL THE TOOL NOW. Call evolve_scan({}) immediately and show results.]` });
|
|
30315
|
+
} else if (hasEvolvePublish) {
|
|
30316
|
+
output.parts.push({ type: "text", text: `
|
|
30317
|
+
|
|
30318
|
+
[EVOLVE PUBLISH \u2014 CALL THE TOOL NOW. Call evolve_publish immediately.]` });
|
|
30252
30319
|
}
|
|
30253
30320
|
if (hasUltrawork) {
|
|
30254
30321
|
for (const part of output.parts) {
|