@kynver-app/mcp-agent-os 0.3.27 → 0.3.29
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
const putMock = vi.fn().mockResolvedValue({ consent: { state: "pending" } });
|
|
3
|
+
vi.mock("../../lib/kynver-client.js", () => ({
|
|
4
|
+
get: vi.fn(),
|
|
5
|
+
post: vi.fn(),
|
|
6
|
+
put: (...args) => putMock(...args),
|
|
7
|
+
}));
|
|
8
|
+
import { registerMemoryQualityFeedbackTools } from "../memory-quality-feedback.js";
|
|
9
|
+
describe("agent_os_memory_quality_consent_set HTTP contract", () => {
|
|
10
|
+
let consentSetHandler;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
putMock.mockClear();
|
|
13
|
+
registerMemoryQualityFeedbackTools({
|
|
14
|
+
register: (name, _description, _schema, cb) => {
|
|
15
|
+
if (name === "agent_os_memory_quality_consent_set") {
|
|
16
|
+
consentSetHandler = cb;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
resolveToolSlug: async (slug) => slug ?? "ghost",
|
|
20
|
+
jsonResult: (data) => ({ content: [], structuredContent: data }),
|
|
21
|
+
compact: (source) => source,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
it("uses PUT for consent transitions (API route is PUT-only)", async () => {
|
|
25
|
+
await consentSetHandler({ action: "grant" });
|
|
26
|
+
expect(putMock).toHaveBeenCalledOnce();
|
|
27
|
+
expect(putMock).toHaveBeenCalledWith("/agent-os/ghost/memory/quality-feedback/consent", { action: "grant" });
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Both proxy to `/api/agent-os/{slug}/memory/quality-feedback` on Kynver.
|
|
8
8
|
*/
|
|
9
9
|
import { z } from "zod";
|
|
10
|
-
import { get, post } from "../lib/kynver-client.js";
|
|
10
|
+
import { get, post, put } from "../lib/kynver-client.js";
|
|
11
11
|
const SIGNAL_VALUES = ["positive", "negative"];
|
|
12
12
|
const OUTCOME_KIND_VALUES = [
|
|
13
13
|
"retrieval_used",
|
|
@@ -57,6 +57,29 @@ export function registerMemoryQualityFeedbackTools({ register, resolveToolSlug,
|
|
|
57
57
|
const { slug: _slug, ...body } = args;
|
|
58
58
|
return jsonResult(await post(`/agent-os/${encodeURIComponent(s)}/memory/quality-feedback`, compact(body)));
|
|
59
59
|
});
|
|
60
|
+
register("agent_os_memory_quality_consent_get", [
|
|
61
|
+
"Get L2 aggregate learning consent for the AgentOS workspace.",
|
|
62
|
+
"Operator access required (owner or admin). L1 private learning is always on; L2 requires explicit opt-in.",
|
|
63
|
+
].join(" "), {
|
|
64
|
+
slug: z.string().optional().describe("AgentOS slug. Defaults to configured primary."),
|
|
65
|
+
}, async (args) => {
|
|
66
|
+
const s = await resolveToolSlug(args.slug);
|
|
67
|
+
return jsonResult(await get(`/agent-os/${encodeURIComponent(s)}/memory/quality-feedback/consent`));
|
|
68
|
+
});
|
|
69
|
+
register("agent_os_memory_quality_consent_set", [
|
|
70
|
+
"Transition L2 aggregate learning consent (request | grant | revoke | reset).",
|
|
71
|
+
"Operator access required. Grant enables de-identified aggregate export; revoke purges exported signals.",
|
|
72
|
+
].join(" "), {
|
|
73
|
+
action: z
|
|
74
|
+
.enum(["request", "grant", "revoke", "reset"])
|
|
75
|
+
.describe("Consent state-machine action."),
|
|
76
|
+
slug: z.string().optional().describe("AgentOS slug. Defaults to configured primary."),
|
|
77
|
+
}, async (args) => {
|
|
78
|
+
const s = await resolveToolSlug(args.slug);
|
|
79
|
+
return jsonResult(await put(`/agent-os/${encodeURIComponent(s)}/memory/quality-feedback/consent`, {
|
|
80
|
+
action: args.action,
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
60
83
|
register("agent_os_memory_quality_status_get", [
|
|
61
84
|
"List recent memory quality feedback events for the AgentOS workspace.",
|
|
62
85
|
"Operator access required (owner or admin).",
|
|
@@ -28,6 +28,8 @@ export function registerOperatingRulesTools(deps) {
|
|
|
28
28
|
const qs = new URLSearchParams();
|
|
29
29
|
if (args.personaSlug?.trim())
|
|
30
30
|
qs.set("personaSlug", args.personaSlug.trim());
|
|
31
|
+
if (args.planId?.trim())
|
|
32
|
+
qs.set("planId", args.planId.trim());
|
|
31
33
|
if (args.includeMarkdown)
|
|
32
34
|
qs.set("includeMarkdown", "1");
|
|
33
35
|
const suffix = qs.toString() ? `?${qs}` : "";
|
package/package.json
CHANGED