@kynver-app/mcp-agent-os 0.3.28 → 0.3.30
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",
|
|
@@ -76,7 +76,7 @@ export function registerMemoryQualityFeedbackTools({ register, resolveToolSlug,
|
|
|
76
76
|
slug: z.string().optional().describe("AgentOS slug. Defaults to configured primary."),
|
|
77
77
|
}, async (args) => {
|
|
78
78
|
const s = await resolveToolSlug(args.slug);
|
|
79
|
-
return jsonResult(await
|
|
79
|
+
return jsonResult(await put(`/agent-os/${encodeURIComponent(s)}/memory/quality-feedback/consent`, {
|
|
80
80
|
action: args.action,
|
|
81
81
|
}));
|
|
82
82
|
});
|
package/package.json
CHANGED