opencode-agentic-engine 0.1.6 → 0.1.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAyiG/D,eAAO,MAAM,aAAa,EAAE,MAAqB,CAAA;AAEjD,QAAA,MAAM,YAAY,EAAE,YAGnB,CAAA;AACD,eAAe,YAAY,CAAA;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAC5J,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AA8lG/D,eAAO,MAAM,aAAa,EAAE,MAAqB,CAAA;AAEjD,QAAA,MAAM,YAAY,EAAE,YAGnB,CAAA;AACD,eAAe,YAAY,CAAA;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAC5J,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // opencode-agentic-engine v0.1.6
1
+ // opencode-agentic-engine v0.1.9
2
2
  // Bundled for zero-install drop-in
3
3
 
4
4
  // src/index.ts
@@ -7,7 +7,7 @@ import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, mkdirSy
7
7
  import { execFileSync as execFileSync5 } from "node:child_process";
8
8
  import { join as join6, dirname as dirname5 } from "node:path";
9
9
  import { fileURLToPath } from "node:url";
10
- import { tmpdir } from "node:os";
10
+ import { tmpdir, homedir } from "node:os";
11
11
 
12
12
  // src/core/intent-parser.ts
13
13
  var IntentParser = class {
@@ -6541,12 +6541,7 @@ var createEngine = async (input, _options) => {
6541
6541
  const configLoader = new ConfigLoader(worktree);
6542
6542
  const config = configLoader.load();
6543
6543
  configLoader.startWatch();
6544
- const agentsDir = join6(worktree, ".opencode", "agents");
6545
- const agenticAgentPath = join6(agentsDir, "agentic.md");
6546
- if (!existsSync8(agenticAgentPath)) {
6547
- try {
6548
- mkdirSync4(agentsDir, { recursive: true });
6549
- writeFileSync4(agenticAgentPath, `---
6544
+ const agentContent = `---
6550
6545
  description: Multi-agent software engineering assistant \u2014 22 tools for autonomous planning, execution, verification, delegation, and self-evolution.
6551
6546
  mode: all
6552
6547
  ---
@@ -6566,8 +6561,15 @@ You have access to **22 specialized agentic_* tools** designed for software engi
6566
6561
  - Use **agentic_auto** instead of implementing step by step manually
6567
6562
  - Use **agentic_execute** instead of tracking progress manually
6568
6563
 
6564
+ ### BEFORE STARTING ANY TASK \u2014 Gather Knowledge First
6565
+ Your training data has a cutoff date. Before implementing:
6566
+ 1. **Search skills**: \`agentic_skill find "relevant technology"\` \u2014 learn from past successes/failures
6567
+ 2. **Search episodes**: \`agentic_episodes search "similar task"\` \u2014 see what worked before
6568
+ 3. **Check latest versions**: Use \`websearch\` for "technology X latest version 2026" to ensure you use current APIs
6569
+ 4. Only then start implementing
6570
+
6569
6571
  ### FOR MULTI-STEP FEATURES (apps, APIs, refactors):
6570
- Call **agentic_auto** IMMEDIATELY. Just pass the goal. Example:
6572
+ Call **agentic_auto** IMMEDIATELY. It auto-gathers skills + doc context. Example:
6571
6573
  \`@agentic_auto goal="Buat aplikasi POS dengan Express dan SQLite"\`
6572
6574
 
6573
6575
  ### FOR SINGLE-STEP TASKS:
@@ -6575,8 +6577,8 @@ Call the specific tool (agentic_nav, agentic_execute, etc.) directly.
6575
6577
 
6576
6578
  ## Standard Workflow
6577
6579
 
6578
- 1. **agentic_auto** \u2014 For multi-step tasks, call this FIRST. It handles everything.
6579
- 2. OR manually: **agentic_plan** \u2192 **agentic_nav** \u2192 **agentic_execute** \u2192 **agentic_verify** \u2192 **agentic_reflect**
6580
+ 1. **agentic_auto** \u2014 For multi-step tasks, call this FIRST. It auto-gathers knowledge
6581
+ 2. OR manually: **agentic_skill find** \u2192 **agentic_episodes search** \u2192 **agentic_plan** \u2192 **agentic_execute** \u2192 **agentic_verify**
6580
6582
 
6581
6583
  ## Tool Reference
6582
6584
 
@@ -6617,9 +6619,18 @@ Call the specific tool (agentic_nav, agentic_execute, etc.) directly.
6617
6619
  3. Never ask "should I..." \u2014 just call the tool
6618
6620
  4. If a step fails, call **agentic_reflect** before retrying
6619
6621
  5. After all steps done, call **agentic_verify** for final verification
6620
- `, "utf-8");
6621
- } catch {
6622
- }
6622
+ `;
6623
+ try {
6624
+ const globalAgentsDir = join6(homedir(), ".config", "opencode", "agents");
6625
+ mkdirSync4(globalAgentsDir, { recursive: true });
6626
+ writeFileSync4(join6(globalAgentsDir, "agentic.md"), agentContent, "utf-8");
6627
+ } catch {
6628
+ }
6629
+ try {
6630
+ const localAgentsDir = join6(worktree, ".opencode", "agents");
6631
+ mkdirSync4(localAgentsDir, { recursive: true });
6632
+ writeFileSync4(join6(localAgentsDir, "agentic.md"), agentContent, "utf-8");
6633
+ } catch {
6623
6634
  }
6624
6635
  const intentParser = new IntentParser();
6625
6636
  const executor = new Executor();
@@ -6787,7 +6798,7 @@ Call the specific tool (agentic_nav, agentic_execute, etc.) directly.
6787
6798
  await traceLogger.init();
6788
6799
  } catch {
6789
6800
  }
6790
- autoUpdatePlugin("0.1.6");
6801
+ autoUpdatePlugin("0.1.9");
6791
6802
  configLoader.onChange((newConfig) => {
6792
6803
  vectorStore.setSearchWeights(newConfig.memory.search.keywordWeight, newConfig.memory.search.vectorWeight);
6793
6804
  vectorStore.setStopWordsLanguages(newConfig.memory.stopWordsLanguages);
@@ -6962,7 +6973,8 @@ ${patch.instruction}`;
6962
6973
  let subtasks = args.subtasks ?? [];
6963
6974
  if (subtasks.length === 0 && args.autoDecompose !== false) {
6964
6975
  if (args.llmDecompose !== false) {
6965
- await navigator.scan(worktree);
6976
+ const scanDir = context.directory || context.worktree || worktree;
6977
+ await navigator.scan(scanDir);
6966
6978
  const codebaseSummary = navigator.getSummary();
6967
6979
  try {
6968
6980
  const llmIntent = await planner.decomposeWithLLM(llmEngine2, args.goal, codebaseSummary);
@@ -7056,9 +7068,10 @@ Start with \`agentic_execute\` for the first ready step.`,
7056
7068
  maxResults: tool.schema.number().optional().describe("Maximum number of files to return (default: 10)"),
7057
7069
  showSummary: tool.schema.boolean().optional().describe("Show full project structure summary")
7058
7070
  },
7059
- async execute(args, _context) {
7071
+ async execute(args, context) {
7060
7072
  const maxResults = args.maxResults ?? 10;
7061
- await navigator.scan(worktree);
7073
+ const scanDir = context.directory || context.worktree || worktree;
7074
+ await navigator.scan(scanDir);
7062
7075
  const files = navigator.findRelevantFiles(args.query, maxResults);
7063
7076
  for (const file of files) {
7064
7077
  vectorStore.addDocument(`file:${file}`, `File ${file}`, {
@@ -9471,8 +9484,53 @@ ${dataset.data.slice(0, 2e3)}${dataset.data.length > 2e3 ? "\n\u2026 (truncated)
9471
9484
  llmEngine2.setSessionId(context.sessionID);
9472
9485
  const startTime = Date.now();
9473
9486
  const projectDir = ctxDir(context);
9487
+ let knowledgeContext = "";
9488
+ try {
9489
+ const relevantSkills = skillStore.find(args.goal);
9490
+ if (relevantSkills.length > 0) {
9491
+ knowledgeContext += `
9492
+ ## Relevant Skills from Past Sessions
9493
+ `;
9494
+ for (const sk of relevantSkills.slice(0, 5)) {
9495
+ knowledgeContext += `- **${sk.definition.meta.name}** (${(sk.successRate * 100).toFixed(0)}% success, ${sk.usageCount}x): ${sk.definition.workflow.steps.map((s) => s.description).join(" \u2192 ")}
9496
+ `;
9497
+ }
9498
+ }
9499
+ const similarTasks = episodicStore.search(args.goal);
9500
+ if (similarTasks.length > 0) {
9501
+ knowledgeContext += `
9502
+ ## Similar Past Tasks
9503
+ `;
9504
+ for (const ep of similarTasks.slice(0, 3)) {
9505
+ knowledgeContext += `- **${ep.planGoal}** \u2192 outcome: ${ep.outcome}
9506
+ `;
9507
+ }
9508
+ }
9509
+ const techPattern = args.goal.match(/(node\.js|express|react|vue|angular|tailwind|bootstrap|sqlite|mongodb|postgres|typescript|next\.js|nuxt|svelte|prisma|drizzle|trpc|graphql|socket\.io|docker)/gi);
9510
+ if (techPattern) {
9511
+ const uniqueTech = [...new Set(techPattern.map((t) => t.toLowerCase().replace(/\.js$/, "").replace(/\.io$/, "")))];
9512
+ knowledgeContext += `
9513
+ ## Latest Technology Versions
9514
+ `;
9515
+ for (const tech of uniqueTech.slice(0, 4)) {
9516
+ try {
9517
+ const pkgName = tech === "node" ? "node" : tech === "socket" ? "socket.io" : tech;
9518
+ const res = await fetch(`https://registry.npmjs.org/${pkgName}/latest`, { signal: AbortSignal.timeout(3e3) });
9519
+ if (res.ok) {
9520
+ const data = await res.json();
9521
+ if (data.version) {
9522
+ knowledgeContext += `- **${tech}**: v${data.version}${data.description ? ` \u2014 ${data.description.slice(0, 80)}` : ""}
9523
+ `;
9524
+ }
9525
+ }
9526
+ } catch {
9527
+ }
9528
+ }
9529
+ }
9530
+ } catch {
9531
+ }
9474
9532
  await navigator.scan(projectDir);
9475
- const summary = navigator.getSummary();
9533
+ const summary = navigator.getSummary() + knowledgeContext;
9476
9534
  let subtasks = [];
9477
9535
  try {
9478
9536
  const intent = await planner.decomposeWithLLM(llmEngine2, args.goal, summary);