akm-opencode 0.9.25202610050121 → 0.9.27202610072331
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/README.md +1 -1
- package/dist/index.js +34 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# akm-opencode
|
|
2
2
|
|
|
3
|
-
OpenCode plugin for [AKM](https://github.com/itlackey/akm) `0.9.
|
|
3
|
+
OpenCode plugin for [AKM](https://github.com/itlackey/akm) `0.9.27`. It exposes exactly five public tools and uses lifecycle hooks to bring relevant AKM context into a session. The dependency is exact-pinned because the plugin calls AKM's in-process `dist/` APIs.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -2354,11 +2354,11 @@ var AKM_HINTS_PREFIX = [
|
|
|
2354
2354
|
"# AKM is available in this session",
|
|
2355
2355
|
"",
|
|
2356
2356
|
"- Assets for this project (skills, knowledge, memories, workflows) live in the AKM bundle. Before writing or editing a file whose format or keys you are not sure of, find them with `akm_curate` (by task) or `akm_search` (by name), and read one with `akm_show` before relying on it.",
|
|
2357
|
-
"- Record `akm_feedback` on an asset
|
|
2357
|
+
"- Record `akm_feedback` on an asset when it helped, or when its content proved wrong or stale; keep durable project knowledge with `akm_remember`.",
|
|
2358
2358
|
"- `akm hints` has this bundle's conventions; `akm help` has the CLI."
|
|
2359
2359
|
].join(`
|
|
2360
2360
|
`);
|
|
2361
|
-
var AKM_CURATED_TAIL = "\n\nTip: call `akm_show <ref>` to fetch full content.
|
|
2361
|
+
var AKM_CURATED_TAIL = "\n\nTip: call `akm_show <ref>` to fetch full content. Only if an asset is wrong or stale, call `akm_feedback <ref> negative` with a note saying <what is wrong and what it should say>: that lowers its ranking. To correct a fact you have verified, also pass `replace`, `with` and `source`. Use `positive` when it helped. An asset that simply didn't fit your task is not negative feedback: record nothing.";
|
|
2362
2362
|
var AKM_CONTEXT_TRUNCATED_MARKER = `
|
|
2363
2363
|
|
|
2364
2364
|
[truncated for context]`;
|
|
@@ -3364,7 +3364,7 @@ ${hint}` : hint;
|
|
|
3364
3364
|
}
|
|
3365
3365
|
}),
|
|
3366
3366
|
akm_show: tool({
|
|
3367
|
-
description: "Show an AKM asset by [bundle//]conceptId[#fragment]. Read an asset this way before relying on it, then record akm_feedback
|
|
3367
|
+
description: "Show an AKM asset by [bundle//]conceptId[#fragment]. Read an asset this way before relying on it, then record akm_feedback when it helped, or when its content proved wrong or stale.",
|
|
3368
3368
|
args: {
|
|
3369
3369
|
ref: tool.schema.string().describe("Asset ref returned by akm_curate or akm_search, optionally with a #fragment \u2014 e.g. `skills/code-review` or `local//knowledge/deploy#Rollback`."),
|
|
3370
3370
|
detail: tool.schema.enum(["brief", "summary", "normal", "full"]).optional().describe("Response detail level. Defaults to 'normal'.")
|
|
@@ -3391,16 +3391,44 @@ ${hint}` : hint;
|
|
|
3391
3391
|
}
|
|
3392
3392
|
}),
|
|
3393
3393
|
akm_feedback: tool({
|
|
3394
|
-
description: "Record feedback for a bundle asset. Negative feedback
|
|
3394
|
+
description: "Record feedback for a bundle asset. Negative feedback is only for content that is wrong or stale. With a note it flags the asset and lowers its ranking; the next improve run may repair only its description, title or when_to_use from the note, so say what is wrong and what it should say. To correct a wrong fact in its text, also pass replace, with and source: akm checks the fix and queues it as a proposal for review. Attach a fix only when you have verified the correct fact (ran the command, read the official doc or the source file), otherwise record the note only. Positive feedback only raises the asset's ranking. An asset that simply didn't fit your task is not negative feedback: record nothing. Call it after akm_show when the asset's content materially helped, or proved wrong or stale. A failed akm call is not feedback on the asset.",
|
|
3395
3395
|
args: {
|
|
3396
3396
|
ref: tool.schema.string().describe("Asset ref to record feedback for."),
|
|
3397
3397
|
sentiment: tool.schema.enum(["positive", "negative"]).describe("Whether the feedback is positive or negative."),
|
|
3398
|
-
note: tool.schema.string().optional().describe("What is wrong and what should
|
|
3398
|
+
note: tool.schema.string().optional().describe("What is wrong and what it should say. Required for negative feedback."),
|
|
3399
|
+
replace: tool.schema.array(tool.schema.string()).optional().describe("Exact current text to correct, copied verbatim from the asset's file (akm_show returns its path). Each must appear exactly once there. Pair each with a with entry, in order. Negative feedback only."),
|
|
3400
|
+
with: tool.schema.array(tool.schema.string()).optional().describe("The corrected text for each replace entry, in order. Change only the wrong words or lines: no rewording, no added headings or intros."),
|
|
3401
|
+
source: tool.schema.string().optional().describe("The URL, command or file that shows the correct fact. Required with replace.")
|
|
3399
3402
|
},
|
|
3400
|
-
async execute({ ref, sentiment, note }, context) {
|
|
3403
|
+
async execute({ ref, sentiment, note, replace, with: corrections, source }, context) {
|
|
3404
|
+
const fixes = replace?.length ?? 0;
|
|
3405
|
+
const corrected = corrections?.length ?? 0;
|
|
3406
|
+
let refusal;
|
|
3407
|
+
if (fixes !== corrected)
|
|
3408
|
+
refusal = `Each replace needs one with (got ${fixes} replace and ${corrected} with).`;
|
|
3409
|
+
else if (fixes > 0 && sentiment !== "negative")
|
|
3410
|
+
refusal = "replace, with and source are only for negative feedback.";
|
|
3411
|
+
else if (fixes > 0 && !source?.trim())
|
|
3412
|
+
refusal = "A fix needs source: the URL, command or file that shows the correct fact.";
|
|
3413
|
+
if (refusal) {
|
|
3414
|
+
await writePluginLog(logClient, "warn", "AKM feedback refused", {
|
|
3415
|
+
subsystem: "feedback",
|
|
3416
|
+
toolName: "akm_feedback",
|
|
3417
|
+
sessionID: context.sessionID,
|
|
3418
|
+
directory: context.directory,
|
|
3419
|
+
ref,
|
|
3420
|
+
sentiment,
|
|
3421
|
+
error: refusal
|
|
3422
|
+
});
|
|
3423
|
+
return JSON.stringify({ ok: false, error: refusal });
|
|
3424
|
+
}
|
|
3401
3425
|
const args = ["feedback", ref, sentiment === "positive" ? "--positive" : "--negative"];
|
|
3402
3426
|
if (note)
|
|
3403
3427
|
args.push("--reason", note);
|
|
3428
|
+
for (let i = 0;i < fixes; i++)
|
|
3429
|
+
args.push("--replace", replace[i], `--with=${corrections[i]}`);
|
|
3430
|
+
if (source)
|
|
3431
|
+
args.push("--source", source);
|
|
3404
3432
|
const raw = await runCli(client, args, { toolName: "akm_feedback", sessionID: context.sessionID, directory: context.directory });
|
|
3405
3433
|
const parsed = safeJsonParse(raw);
|
|
3406
3434
|
if (parsed?.ok === false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akm-opencode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.27202610072331",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for AKM with discovery tools, feedback, memory, and automatic learning proposals from corrections and recurring workflows.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@opencode-ai/plugin": "^1.18.14",
|
|
41
|
-
"akm-cli": "0.9.
|
|
41
|
+
"akm-cli": "0.9.27"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^26.1.1",
|