opencode-ultra 0.6.2 → 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 +83 -48
- 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,84 +14921,95 @@ 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
|
-
|
|
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.
|
|
14925
14927
|
|
|
14926
14928
|
## MISSION
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
+
Compare opencode-ultra's current capabilities with other OpenCode plugins, then propose concrete improvements.
|
|
14929
14930
|
This is NOT about installing other plugins. This is about LEARNING from the ecosystem and making opencode-ultra better.
|
|
14930
14931
|
|
|
14931
|
-
##
|
|
14932
|
-
|
|
14933
|
-
- **ledger_save** \u2014 persist improvement proposals for future implementation
|
|
14932
|
+
## opencode-ultra CURRENT CAPABILITIES (auto-generated from source)
|
|
14933
|
+
${inventory}
|
|
14934
14934
|
|
|
14935
|
-
|
|
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.
|
|
14936
14936
|
|
|
14937
|
-
|
|
14937
|
+
## PHASE 1: ECOSYSTEM RESEARCH (spawn_agent)
|
|
14938
14938
|
|
|
14939
|
+
Research what other plugins offer:
|
|
14939
14940
|
\`\`\`
|
|
14940
14941
|
spawn_agent({
|
|
14941
14942
|
agents: [
|
|
14942
|
-
{agent: "scout", prompt: "Search npm and GitHub for OpenCode 1.2.x plugins. For EACH plugin
|
|
14943
|
-
{agent: "
|
|
14943
|
+
{agent: "scout", prompt: "Search npm and GitHub for OpenCode 1.2.x plugins. For EACH interesting plugin: what features does it provide? What hooks, tools, or techniques does it use? Focus on UNIQUE capabilities. Return a structured feature inventory per plugin.", description: "Ecosystem scan"},
|
|
14944
|
+
{agent: "librarian", prompt: "Search for OpenCode plugin best practices, architectural patterns, and advanced techniques. Look at oh-my-opencode, opencode-supermemory, opencode-dcp, opencode-rate-limit-fallback, opencode-worktree, opencode-mad. What patterns do they share? What's unique?", description: "Plugin patterns research"}
|
|
14944
14945
|
]
|
|
14945
14946
|
})
|
|
14946
14947
|
\`\`\`
|
|
14947
14948
|
|
|
14948
|
-
## HARD GATE: DO NOT proceed to Phase 2 until BOTH agents return results.
|
|
14949
|
-
If the explore agent fails to find files, try reading from the current project directory or use Grep to locate opencode-ultra source files. You MUST have a concrete list of opencode-ultra's current capabilities before comparing.
|
|
14950
|
-
|
|
14951
14949
|
## PHASE 2: COMPARE
|
|
14952
14950
|
|
|
14953
|
-
Build a
|
|
14954
|
-
|
|
14955
|
-
**CRITICAL**: The "opencode-ultra" column MUST be filled with Yes/No/Partial based on the explore agent's output. NEVER write "TBD" or "unknown" \u2014 if you don't know, re-read the source.
|
|
14951
|
+
Build a Feature Matrix using the capability list above and agent results.
|
|
14956
14952
|
|
|
14957
|
-
|
|
14958
|
-
| Feature | opencode-ultra (current) | Other plugin(s) | Gap? |
|
|
14959
|
-
|---------|-------------------------|-----------------|------|
|
|
14960
|
-
| (feature) | Yes / No / Partial \u2014 cite which file | Which plugin has it | Missing / Partial / Covered |
|
|
14953
|
+
**RULE**: The "opencode-ultra" column MUST be Yes/No/Partial based on the inventory above. NEVER write "TBD", "unknown", or "\u4E0D\u660E".
|
|
14961
14954
|
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
- **Complementary** to existing capabilities (not duplicate)
|
|
14955
|
+
| Feature | opencode-ultra | Other plugin(s) | Gap? |
|
|
14956
|
+
|---------|---------------|-----------------|------|
|
|
14957
|
+
| (feature) | Yes \u2014 (tool/hook name) | Which plugin | Covered / Missing / Partial |
|
|
14966
14958
|
|
|
14967
|
-
|
|
14968
|
-
- Auth plugins (opencode-antigravity-auth etc.) \u2014 domain-specific, not relevant
|
|
14969
|
-
- oh-my-opencode features we already ported \u2014 mark as "Covered"
|
|
14970
|
-
- Trivial wrappers or abandoned projects
|
|
14959
|
+
Focus on genuinely useful, feasible, complementary features.
|
|
14971
14960
|
|
|
14972
14961
|
## PHASE 3: PROPOSE
|
|
14973
|
-
For each identified gap (Missing or Partial), produce a concrete improvement proposal:
|
|
14974
14962
|
|
|
14975
|
-
|
|
14963
|
+
For each Missing or Partial gap:
|
|
14964
|
+
|
|
14976
14965
|
## Improvement: [Feature Name]
|
|
14977
14966
|
**Inspiration**: [Plugin name] \u2014 [what it does]
|
|
14978
|
-
**Current state
|
|
14979
|
-
**Why**: [
|
|
14980
|
-
**How**: [
|
|
14967
|
+
**Current state**: [what opencode-ultra has now from the inventory]
|
|
14968
|
+
**Why**: [concrete benefit]
|
|
14969
|
+
**How**: [which file to modify, what to add]
|
|
14981
14970
|
**Effort**: Low / Medium / High
|
|
14982
|
-
**Priority**: P0
|
|
14983
|
-
\`\`\`
|
|
14971
|
+
**Priority**: P0 / P1 / P2
|
|
14984
14972
|
|
|
14985
|
-
Sort
|
|
14973
|
+
Sort by Priority then Effort.
|
|
14986
14974
|
|
|
14987
14975
|
## PHASE 4: SAVE
|
|
14988
|
-
Save the full analysis to the continuity ledger:
|
|
14989
14976
|
\`\`\`
|
|
14990
14977
|
ledger_save({
|
|
14991
14978
|
name: "evolve-scan-YYYY-MM-DD",
|
|
14992
|
-
content: "# Evolve Scan Results\\n\\n## Feature Matrix\\n...\\n##
|
|
14979
|
+
content: "# Evolve Scan Results\\n\\n## Feature Matrix\\n...\\n## Proposals\\n..."
|
|
14993
14980
|
})
|
|
14994
14981
|
\`\`\`
|
|
14995
14982
|
|
|
14996
|
-
##
|
|
14997
|
-
-
|
|
14998
|
-
-
|
|
14999
|
-
-
|
|
15000
|
-
|
|
15001
|
-
|
|
14983
|
+
## RULES
|
|
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".
|
|
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
|
+
}
|
|
15002
15013
|
|
|
15003
15014
|
// src/hooks/rules-injector.ts
|
|
15004
15015
|
import * as fs2 from "fs";
|
|
@@ -29076,7 +29087,31 @@ var OpenCodeUltra = async (ctx) => {
|
|
|
29076
29087
|
}
|
|
29077
29088
|
if (!disabledHooks.has("keyword-detector")) {
|
|
29078
29089
|
const promptText = extractPromptText(output.parts);
|
|
29079
|
-
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);
|
|
29080
29115
|
if (detected.length > 0) {
|
|
29081
29116
|
const hasUltrawork = detected.some((k) => k.type === "ultrawork");
|
|
29082
29117
|
if (hasUltrawork) {
|
package/package.json
CHANGED