@agentapplicationprotocol/server 0.6.0 → 0.6.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.
@@ -74,7 +74,12 @@ function aap(handler) {
74
74
  });
75
75
  router.get("/sessions", async (c) => {
76
76
  const after = c.req.query("after");
77
- return c.json(await handler.listSessions({ after }));
77
+ const result = await handler.listSessions({ after });
78
+ const { agents } = handler.getMeta();
79
+ return c.json({
80
+ ...result,
81
+ sessions: result.sessions.map((s) => redactSecretOptions(s, agents)),
82
+ });
78
83
  });
79
84
  router.delete("/session/:id", async (c) => {
80
85
  await handler.deleteSession(c.req.param("id"));
@@ -88,6 +88,37 @@ function req(method, path, body, headers) {
88
88
  (0, vitest_1.expect)(await res.json()).toEqual(sessionList);
89
89
  (0, vitest_1.expect)(handler.listSessions).toHaveBeenCalledWith({ after: "cursor1" });
90
90
  });
91
+ (0, vitest_1.it)("GET /sessions redacts secret options in each session", async () => {
92
+ const secretSession = {
93
+ sessionId: "s1",
94
+ agent: { name: "a", options: { key: "mysecret", model: "gpt-4" } },
95
+ };
96
+ const app = makeApp(makeHandler({
97
+ listSessions: vitest_1.vi.fn().mockResolvedValue({ sessions: [secretSession] }),
98
+ getMeta: vitest_1.vi.fn().mockReturnValue({
99
+ agents: [
100
+ {
101
+ name: "a",
102
+ version: "1.0.0",
103
+ options: [
104
+ { type: "secret", name: "key", default: "" },
105
+ { type: "text", name: "model", default: "" },
106
+ ],
107
+ },
108
+ ],
109
+ }),
110
+ }));
111
+ const res = await app.fetch(req("GET", "/sessions"));
112
+ (0, vitest_1.expect)(res.status).toBe(200);
113
+ (0, vitest_1.expect)(await res.json()).toEqual({
114
+ sessions: [
115
+ {
116
+ ...secretSession,
117
+ agent: { ...secretSession.agent, options: { key: "***", model: "gpt-4" } },
118
+ },
119
+ ],
120
+ });
121
+ });
91
122
  (0, vitest_1.it)("PUT /session returns 400 if last message is not a user message", async () => {
92
123
  const app = makeApp(makeHandler());
93
124
  const res = await app.fetch(req("PUT", "/session", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentapplicationprotocol/server",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "AAP server",
5
5
  "keywords": [
6
6
  "aap",
@@ -31,7 +31,7 @@
31
31
  "ai": "^6.0.141",
32
32
  "hono": "^4.12.8",
33
33
  "zod": "^4.3.6",
34
- "@agentapplicationprotocol/core": "0.6.0"
34
+ "@agentapplicationprotocol/core": "0.6.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@ai-sdk/openai": "^3.0.48",