akm-opencode 0.7.0 → 0.7.1

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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/index.ts +20 -18
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,10 +14,11 @@ Add to your OpenCode config (`opencode.json`):
14
14
 
15
15
  ## Tools
16
16
 
17
- The plugin exposes **19 high-value tools**. Long-tail verbs (`add`, `save`, `import`, `clone`, `update`, `remove`, `list`-sources, `registry-search`, `index`-reindex, `config`, `upgrade`, ad-hoc `run`, raw `agent`) are reachable via `akm_help` plus the raw `akm` CLI through the `bash` tool.
17
+ The plugin exposes **20 high-value tools**. Long-tail verbs (`add`, `save`, `import`, `clone`, `update`, `remove`, `list`-sources, `registry-search`, `index`-reindex, `config`, `upgrade`, ad-hoc `run`, raw `agent`) are reachable via `akm_help` plus the raw `akm` CLI through the `bash` tool.
18
18
 
19
19
  | Tool | Description |
20
20
  |------|-------------|
21
+ | `akm_info` | Show `akm info` output together with the installed `akm-opencode` plugin version and install location |
21
22
  | `akm_search` | Search the local stash, the registry, or both. Type filter accepts `skill`, `command`, `agent`, `knowledge`, `lesson`, `memory`, `script`, `workflow`, `vault`, `wiki`, `any`; proposed hits can be included explicitly |
22
23
  | `akm_show` | Show a stash asset by its ref |
23
24
  | `akm_agent` | Dispatch a stash `agent:*` into OpenCode using the stash prompt and metadata |
package/index.ts CHANGED
@@ -25,6 +25,7 @@ const AKM_RETROSPECTIVE_FEEDBACK_RE = createRetrospectiveFeedbackRegex()
25
25
  const AKM_RETROSPECTIVE_NEGATIVE_RE = createRetrospectiveNegativeRegex()
26
26
  const AKM_EXPLICIT_CORRECTION_RE = createExplicitCorrectionRegex()
27
27
  const PLUGIN_VERSION = readPackageVersion()
28
+ const PLUGIN_INSTALL_LOCATION = moduleDir
28
29
 
29
30
  // Per-session state that drives the compound-engineering loop.
30
31
  // These maps are keyed by OpenCode sessionID.
@@ -1536,6 +1537,17 @@ function parseCliJson<T>(raw: string): T | CliError {
1536
1537
  }
1537
1538
  }
1538
1539
 
1540
+ function formatAkmInfoResponse(raw: string): string {
1541
+ const parsed = parseCliJson<Record<string, unknown>>(raw)
1542
+ if (isCliError(parsed)) return JSON.stringify(parsed)
1543
+ return JSON.stringify({
1544
+ ok: true,
1545
+ pluginVersion: PLUGIN_VERSION,
1546
+ pluginInstallLocation: PLUGIN_INSTALL_LOCATION,
1547
+ akmInfo: parsed,
1548
+ })
1549
+ }
1550
+
1539
1551
  function blockedToolResponse(args: Record<string, unknown>): string | null {
1540
1552
  return typeof args.__akmBlocked === "string"
1541
1553
  ? JSON.stringify({ ok: false, error: args.__akmBlocked })
@@ -2043,24 +2055,6 @@ export const AkmPlugin: Plugin = async ({ client, worktree, directory }) => {
2043
2055
  // Best-effort only.
2044
2056
  }
2045
2057
  },
2046
- "experimental.session.compacting": async (input, output) => {
2047
- try {
2048
- const sid = input.sessionID
2049
- if (!sid) return
2050
- if (!Array.isArray(output.context)) return
2051
- markContextEpochDirty(sid)
2052
- const blocks = [
2053
- sessionHints.get(sid) ? `${AKM_HINTS_PREFIX}\n\n${sessionHints.get(sid)}` : "",
2054
- sessionCurated.get(sid) ? `${AKM_CURATED_HEADER}\n${sessionCurated.get(sid)}${AKM_CURATED_TAIL}` : "",
2055
- sessionWorkflow.get(sid) ? formatWorkflowContext(sessionWorkflow.get(sid)!) : "",
2056
- (await getPendingProposalCount(logClient, sid)).count > 0 && !(await getPendingProposalCount(logClient, sid)).unsupported ? formatPendingProposalContext((await getPendingProposalCount(logClient, sid)).count) : "",
2057
- sessionCuratorReport.get(sid) ? formatCuratorReportContext(sessionCuratorReport.get(sid)!) : "",
2058
- ]
2059
- output.context.push(...applyContextBudget(blocks))
2060
- } catch {
2061
- // Never break compaction because of plugin context.
2062
- }
2063
- },
2064
2058
  // experimental.chat.system.transform is how OpenCode exposes the
2065
2059
  // additionalContext channel. We append the cached hints (once per session)
2066
2060
  // and the curated assets (once per turn) so the next LLM call sees them.
@@ -2312,6 +2306,14 @@ export const AkmPlugin: Plugin = async ({ client, worktree, directory }) => {
2312
2306
  }
2313
2307
  },
2314
2308
  tool: {
2309
+ akm_info: tool({
2310
+ description: "Show `akm info` output plus the installed akm-opencode plugin version and install location.",
2311
+ args: {},
2312
+ async execute() {
2313
+ const raw = await runCli(client as unknown as LogCapableClient, ["info"], { toolName: "akm_info" })
2314
+ return formatAkmInfoResponse(raw)
2315
+ },
2316
+ }),
2315
2317
  akm_search: tool({
2316
2318
  description: "Search your stash or the akm registry for scripts, skills, commands, agents, knowledge, memories, workflows, vaults, and wikis. Use source='registry' for installable community kits.",
2317
2319
  args: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-opencode",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for AKM v0.7.0 - search, show, and manage extension assets via the akm CLI, including vaults, wikis, workflows, the proposal queue, lesson assets, and reflect/propose/distill commands, with agentic hooks that auto-load relevant stash assets, record feedback, and harvest session memories so the stash improves every session.",
6
6
  "keywords": [