opencode-ultra 0.6.3 → 0.6.4
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 +77 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14831,11 +14831,11 @@ var KEYWORD_DEFS = [
|
|
|
14831
14831
|
{ pattern: SEARCH_PATTERN, type: "search", getMessage: () => SEARCH_MESSAGE },
|
|
14832
14832
|
{ pattern: ANALYZE_PATTERN, type: "analyze", getMessage: () => ANALYZE_MESSAGE },
|
|
14833
14833
|
{ pattern: THINK_PATTERN, type: "think", getMessage: () => THINK_MESSAGE },
|
|
14834
|
-
{ pattern: EVOLVE_PATTERN, type: "evolve", getMessage: () =>
|
|
14834
|
+
{ pattern: EVOLVE_PATTERN, type: "evolve", getMessage: (ctx) => buildEvolveMessage(ctx) }
|
|
14835
14835
|
];
|
|
14836
|
-
function detectKeywords(text) {
|
|
14836
|
+
function detectKeywords(text, evolveCtx) {
|
|
14837
14837
|
const clean = removeCodeBlocks(text);
|
|
14838
|
-
return KEYWORD_DEFS.filter(({ pattern }) => pattern.test(clean)).map(({ type, getMessage }) => ({ type, message: getMessage() }));
|
|
14838
|
+
return KEYWORD_DEFS.filter(({ pattern }) => pattern.test(clean)).map(({ type, getMessage }) => ({ type, message: getMessage(evolveCtx) }));
|
|
14839
14839
|
}
|
|
14840
14840
|
var ULTRAWORK_MESSAGE = `<ultrawork-mode>
|
|
14841
14841
|
|
|
@@ -14921,40 +14921,22 @@ IF COMPLEX \u2014 DO NOT STRUGGLE ALONE. Consult specialists:
|
|
|
14921
14921
|
|
|
14922
14922
|
SYNTHESIZE findings before proceeding.`;
|
|
14923
14923
|
var THINK_MESSAGE = `Extended thinking enabled. Take your time to reason thoroughly.`;
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
opencode-ultra is INSTALLED as a plugin. Its source is at:
|
|
14928
|
-
**~/.cache/opencode/node_modules/opencode-ultra/**
|
|
14929
|
-
NOT in the working directory. You must read from this path.
|
|
14924
|
+
function buildEvolveMessage(ctx) {
|
|
14925
|
+
const inventory = ctx ? buildSelfInventory(ctx) : "(No capability data available \u2014 read source manually)";
|
|
14926
|
+
return `[evolve-mode] SELF-IMPROVEMENT CYCLE ACTIVATED.
|
|
14930
14927
|
|
|
14931
14928
|
## MISSION
|
|
14932
|
-
Compare opencode-ultra's
|
|
14933
|
-
|
|
14929
|
+
Compare opencode-ultra's current capabilities with other OpenCode plugins, then propose concrete improvements.
|
|
14934
14930
|
This is NOT about installing other plugins. This is about LEARNING from the ecosystem and making opencode-ultra better.
|
|
14935
14931
|
|
|
14936
|
-
##
|
|
14937
|
-
|
|
14938
|
-
Before researching other plugins, you MUST understand what opencode-ultra already has.
|
|
14939
|
-
Read these files yourself using Read/Grep/Glob (do NOT spawn an agent for this \u2014 you can read directly):
|
|
14940
|
-
|
|
14941
|
-
1. ~/.cache/opencode/node_modules/opencode-ultra/README.md
|
|
14942
|
-
2. ~/.cache/opencode/node_modules/opencode-ultra/dist/index.js (search for tool names, hook names)
|
|
14943
|
-
|
|
14944
|
-
Or use Glob to list: ~/.cache/opencode/node_modules/opencode-ultra/**/*.ts
|
|
14945
|
-
|
|
14946
|
-
From the README and source, build this inventory:
|
|
14947
|
-
- Tools provided: (list each tool name and what it does)
|
|
14948
|
-
- Hooks used: (list each hook and its purpose)
|
|
14949
|
-
- Agents defined: (list each agent, its model, its role)
|
|
14950
|
-
- Safety features: (sanitizer, trust score, spawn limits, etc.)
|
|
14951
|
-
- Other features: (concurrency, categories, keyword detection, etc.)
|
|
14932
|
+
## opencode-ultra CURRENT CAPABILITIES (auto-generated from source)
|
|
14933
|
+
${inventory}
|
|
14952
14934
|
|
|
14953
|
-
|
|
14935
|
+
You already have the full capability list above. Do NOT try to read opencode-ultra source files \u2014 this inventory IS the source of truth.
|
|
14954
14936
|
|
|
14955
|
-
## PHASE
|
|
14937
|
+
## PHASE 1: ECOSYSTEM RESEARCH (spawn_agent)
|
|
14956
14938
|
|
|
14957
|
-
|
|
14939
|
+
Research what other plugins offer:
|
|
14958
14940
|
\`\`\`
|
|
14959
14941
|
spawn_agent({
|
|
14960
14942
|
agents: [
|
|
@@ -14964,45 +14946,70 @@ spawn_agent({
|
|
|
14964
14946
|
})
|
|
14965
14947
|
\`\`\`
|
|
14966
14948
|
|
|
14967
|
-
## PHASE
|
|
14949
|
+
## PHASE 2: COMPARE
|
|
14968
14950
|
|
|
14969
|
-
Build a Feature Matrix using
|
|
14951
|
+
Build a Feature Matrix using the capability list above and agent results.
|
|
14970
14952
|
|
|
14971
|
-
**RULE**: The "opencode-ultra" column MUST
|
|
14953
|
+
**RULE**: The "opencode-ultra" column MUST be Yes/No/Partial based on the inventory above. NEVER write "TBD", "unknown", or "\u4E0D\u660E".
|
|
14972
14954
|
|
|
14973
14955
|
| Feature | opencode-ultra | Other plugin(s) | Gap? |
|
|
14974
14956
|
|---------|---------------|-----------------|------|
|
|
14975
|
-
|
|
|
14976
|
-
| (example) | No | opencode-dcp | Missing |
|
|
14977
|
-
| (example) | Partial \u2014 basic in sanitizer.ts | envsitter-guard | Partial |
|
|
14957
|
+
| (feature) | Yes \u2014 (tool/hook name) | Which plugin | Covered / Missing / Partial |
|
|
14978
14958
|
|
|
14979
|
-
|
|
14959
|
+
Focus on genuinely useful, feasible, complementary features.
|
|
14980
14960
|
|
|
14981
|
-
|
|
14961
|
+
## PHASE 3: PROPOSE
|
|
14962
|
+
|
|
14963
|
+
For each Missing or Partial gap:
|
|
14982
14964
|
|
|
14983
14965
|
## Improvement: [Feature Name]
|
|
14984
14966
|
**Inspiration**: [Plugin name] \u2014 [what it does]
|
|
14985
|
-
**Current state**: [what opencode-ultra has now
|
|
14967
|
+
**Current state**: [what opencode-ultra has now from the inventory]
|
|
14986
14968
|
**Why**: [concrete benefit]
|
|
14987
|
-
**How**: [which file to modify, what to add
|
|
14969
|
+
**How**: [which file to modify, what to add]
|
|
14988
14970
|
**Effort**: Low / Medium / High
|
|
14989
14971
|
**Priority**: P0 / P1 / P2
|
|
14990
14972
|
|
|
14991
14973
|
Sort by Priority then Effort.
|
|
14992
14974
|
|
|
14993
|
-
## PHASE
|
|
14975
|
+
## PHASE 4: SAVE
|
|
14994
14976
|
\`\`\`
|
|
14995
14977
|
ledger_save({
|
|
14996
14978
|
name: "evolve-scan-YYYY-MM-DD",
|
|
14997
|
-
content: "# Evolve Scan Results\\n\\n##
|
|
14979
|
+
content: "# Evolve Scan Results\\n\\n## Feature Matrix\\n...\\n## Proposals\\n..."
|
|
14998
14980
|
})
|
|
14999
14981
|
\`\`\`
|
|
15000
14982
|
|
|
15001
14983
|
## RULES
|
|
15002
|
-
-
|
|
15003
|
-
-
|
|
15004
|
-
- Proposals must cite specific opencode-ultra files for the "How" section.
|
|
14984
|
+
- Use the capability inventory above as ground truth. No file reading needed.
|
|
14985
|
+
- Proposals must cite specific tools/hooks from the inventory for "Current state".
|
|
15005
14986
|
- Present proposals to user for approval before implementation.`;
|
|
14987
|
+
}
|
|
14988
|
+
function buildSelfInventory(ctx) {
|
|
14989
|
+
const lines = [];
|
|
14990
|
+
lines.push("### Tools");
|
|
14991
|
+
for (const t of ctx.tools) {
|
|
14992
|
+
lines.push(`- ${t}`);
|
|
14993
|
+
}
|
|
14994
|
+
lines.push("");
|
|
14995
|
+
lines.push("### Hooks");
|
|
14996
|
+
for (const h of ctx.hooks) {
|
|
14997
|
+
lines.push(`- ${h}`);
|
|
14998
|
+
}
|
|
14999
|
+
lines.push("");
|
|
15000
|
+
lines.push("### Agents");
|
|
15001
|
+
for (const [name, def] of Object.entries(ctx.agents)) {
|
|
15002
|
+
const shortModel = def.model.split("/").pop() ?? def.model;
|
|
15003
|
+
lines.push(`- **${name}** (${shortModel}) \u2014 ${def.description}`);
|
|
15004
|
+
}
|
|
15005
|
+
lines.push("");
|
|
15006
|
+
lines.push("### Additional Features");
|
|
15007
|
+
for (const f of ctx.features) {
|
|
15008
|
+
lines.push(`- ${f}`);
|
|
15009
|
+
}
|
|
15010
|
+
return lines.join(`
|
|
15011
|
+
`);
|
|
15012
|
+
}
|
|
15006
15013
|
|
|
15007
15014
|
// src/hooks/rules-injector.ts
|
|
15008
15015
|
import * as fs2 from "fs";
|
|
@@ -29080,7 +29087,31 @@ var OpenCodeUltra = async (ctx) => {
|
|
|
29080
29087
|
}
|
|
29081
29088
|
if (!disabledHooks.has("keyword-detector")) {
|
|
29082
29089
|
const promptText = extractPromptText(output.parts);
|
|
29083
|
-
const
|
|
29090
|
+
const evolveCtx = {
|
|
29091
|
+
agents: Object.fromEntries(Object.entries(agents).map(([name, def]) => [name, { model: def.model, description: def.description }])),
|
|
29092
|
+
tools: Object.keys(toolRegistry),
|
|
29093
|
+
hooks: [
|
|
29094
|
+
...!disabledHooks.has("keyword-detector") ? ["keyword-detector (ultrawork/search/analyze/think/evolve detection)"] : [],
|
|
29095
|
+
...!disabledHooks.has("rules-injector") ? ["rules-injector (architecture.md/codestyle.md/rules.md injection)"] : [],
|
|
29096
|
+
...!disabledHooks.has("fragment-injector") ? ["fragment-injector (conditional context fragments)"] : [],
|
|
29097
|
+
...!disabledHooks.has("prompt-renderer") ? ["prompt-renderer (template-based prompt rendering)"] : [],
|
|
29098
|
+
...!disabledHooks.has("todo-enforcer") ? ["todo-enforcer (force completion of unfinished TODOs)"] : [],
|
|
29099
|
+
...!disabledHooks.has("comment-checker") ? ["comment-checker (detect AI slop comments in code)"] : [],
|
|
29100
|
+
...!disabledHooks.has("token-truncation") ? ["token-truncation (auto-truncate large tool outputs)"] : [],
|
|
29101
|
+
...!disabledHooks.has("session-compaction") ? ["session-compaction (auto-compact long sessions)"] : []
|
|
29102
|
+
],
|
|
29103
|
+
features: [
|
|
29104
|
+
pool ? "concurrency control (semaphore-based per-provider/model limits)" : "no concurrency limits",
|
|
29105
|
+
"prompt injection sanitizer (17 patterns, 6 categories)",
|
|
29106
|
+
"trust score system (5-factor npm package evaluation)",
|
|
29107
|
+
"spawn limit (max concurrent sub-agents)",
|
|
29108
|
+
"agent timeout (per-agent execution timeout)",
|
|
29109
|
+
pluginConfig.categories ? "categories (model/variant routing per task type)" : "no categories configured",
|
|
29110
|
+
"continuity ledger (persistent key-value store across sessions)",
|
|
29111
|
+
"multi-language keyword detection (EN/JP/CN)"
|
|
29112
|
+
]
|
|
29113
|
+
};
|
|
29114
|
+
const detected = detectKeywords(promptText, evolveCtx);
|
|
29084
29115
|
if (detected.length > 0) {
|
|
29085
29116
|
const hasUltrawork = detected.some((k) => k.type === "ultrawork");
|
|
29086
29117
|
if (hasUltrawork) {
|
package/package.json
CHANGED