@agentapplicationprotocol/sdk 0.3.0 → 0.3.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.
package/dist/server.js CHANGED
@@ -10,6 +10,22 @@ async function writeSSEEvents(stream, events) {
10
10
  await stream.writeSSE({ event, data: JSON.stringify(data) });
11
11
  }
12
12
  }
13
+ function redactSecretOptions(session, agents) {
14
+ const { options } = session.agent;
15
+ if (!options)
16
+ return session;
17
+ const agentInfo = agents.find((a) => a.name === session.agent.name);
18
+ const secretNames = new Set(agentInfo?.options?.filter((o) => o.type === "secret").map((o) => o.name) ?? []);
19
+ if (secretNames.size === 0)
20
+ return session;
21
+ return {
22
+ ...session,
23
+ agent: {
24
+ ...session.agent,
25
+ options: Object.fromEntries(Object.entries(options).map(([k, v]) => [k, secretNames.has(k) ? "***" : v])),
26
+ },
27
+ };
28
+ }
13
29
  class Server {
14
30
  constructor(handler, options = {}) {
15
31
  this.app = new hono_1.Hono();
@@ -55,8 +71,11 @@ class Server {
55
71
  });
56
72
  // GET /session/:id
57
73
  router.get("/session/:id", async (c) => {
58
- const session = await handler.getSession(c.req.param("id"));
59
- return c.json(session);
74
+ const [session, meta] = await Promise.all([
75
+ handler.getSession(c.req.param("id")),
76
+ handler.getMeta(),
77
+ ]);
78
+ return c.json(redactSecretOptions(session, meta.agents));
60
79
  });
61
80
  // GET /sessions
62
81
  router.get("/sessions", async (c) => {
package/dist/types.d.ts CHANGED
@@ -159,7 +159,7 @@ export interface CreateSessionRequest {
159
159
  }
160
160
  /** Request body for `POST /session/:id`. */
161
161
  export interface SessionTurnRequest {
162
- /** Session-level agent overrides. Agent name cannot be changed. */
162
+ /** Session-level agent overrides. Agent name cannot be changed. Options merged by key. */
163
163
  agent?: Omit<AgentConfig, "name">;
164
164
  /** Response mode. Defaults to `"none"`. */
165
165
  stream?: StreamMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentapplicationprotocol/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript SDK for the Agent Application Protocol (AAP)",
5
5
  "license": "Apache-2.0",
6
6
  "files": [