@i4ctime/q-ring 0.17.0 → 0.17.5

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/mcp.js CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  getSecret,
22
22
  hasSecret,
23
23
  httpRequest,
24
+ listAgentSessionsForAgents,
24
25
  listHooks,
25
26
  listMemory,
26
27
  listSecrets,
@@ -35,18 +36,19 @@ import {
35
36
  setAuditAgentLabel,
36
37
  setPolicyRoot,
37
38
  setSecret,
39
+ summariseSession,
38
40
  tunnelCreate,
39
41
  tunnelDestroy,
40
42
  tunnelList,
41
43
  tunnelRead,
42
44
  verifyAuditChain
43
- } from "./chunk-KFILBHOY.js";
45
+ } from "./chunk-VMDD5QTJ.js";
44
46
 
45
47
  // src/mcp.ts
46
48
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
47
49
 
48
50
  // src/mcp/server.ts
49
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
51
+ import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
50
52
 
51
53
  // src/mcp/tool-annotations.ts
52
54
  var hints = (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) => ({ readOnlyHint, destructiveHint, idempotentHint, openWorldHint });
@@ -2827,7 +2829,7 @@ ${result.stderr}`);
2827
2829
  if (dashboardInstance) {
2828
2830
  return text(`Dashboard already running at ${dashboardInstance.url}`);
2829
2831
  }
2830
- const { startDashboardServer } = await import("./dashboard-WVPR5BQO.js");
2832
+ const { startDashboardServer } = await import("./dashboard-K7LYTWSL.js");
2831
2833
  dashboardInstance = startDashboardServer({ port: params.port });
2832
2834
  return text(
2833
2835
  `Dashboard started at ${dashboardInstance.url}
@@ -2995,8 +2997,70 @@ function registerPolicyTools(server2) {
2995
2997
  );
2996
2998
  }
2997
2999
 
3000
+ // src/mcp/resources.ts
3001
+ import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
3002
+ var MIME = "application/json";
3003
+ var LIST_URI = "qring://sessions";
3004
+ var RESOURCE_QUERY = {
3005
+ since: new Date(Date.now() - 7 * 24 * 60 * 60 * 1e3).toISOString(),
3006
+ limit: 50,
3007
+ maxEvents: 200
3008
+ };
3009
+ function auditVisible() {
3010
+ return checkToolPolicy("audit_log").allowed;
3011
+ }
3012
+ function registerMcpResources(server2) {
3013
+ server2.registerResource(
3014
+ "agent-sessions",
3015
+ LIST_URI,
3016
+ {
3017
+ title: "Agent sessions",
3018
+ description: "Audit activity folded into per-agent sessions (last 7 days): which MCP client did what, when, against which key names. Summaries only \u2014 read qring://sessions/{id} for a session's event timeline. Never contains secret values.",
3019
+ mimeType: MIME
3020
+ },
3021
+ async (uri) => {
3022
+ const sessions = auditVisible() ? listAgentSessionsForAgents(RESOURCE_QUERY).map(summariseSession) : [];
3023
+ return {
3024
+ contents: [{ uri: uri.href, mimeType: MIME, text: JSON.stringify({ sessions }, null, 2) }]
3025
+ };
3026
+ }
3027
+ );
3028
+ server2.registerResource(
3029
+ "agent-session",
3030
+ new ResourceTemplate("qring://sessions/{id}", {
3031
+ list: async () => {
3032
+ if (!auditVisible()) return { resources: [] };
3033
+ return {
3034
+ resources: listAgentSessionsForAgents(RESOURCE_QUERY).map((s) => ({
3035
+ uri: `${LIST_URI}/${s.id}`,
3036
+ name: s.wrapLabel ? `airlock: ${s.wrapLabel}` : s.agent,
3037
+ description: `${s.eventCount} events, ${s.startedAt} \u2192 ${s.endedAt}`,
3038
+ mimeType: MIME
3039
+ }))
3040
+ };
3041
+ }
3042
+ }),
3043
+ {
3044
+ title: "Agent session timeline",
3045
+ description: "One agent session's audit timeline, most recent event first. Key names and actions only \u2014 never secret values.",
3046
+ mimeType: MIME
3047
+ },
3048
+ async (uri, variables) => {
3049
+ const id = String(variables.id ?? "");
3050
+ const session = auditVisible() ? listAgentSessionsForAgents({ ...RESOURCE_QUERY, limit: void 0 }).find(
3051
+ (s) => s.id === id
3052
+ ) : void 0;
3053
+ if (!session) throw new Error(`Session not found: ${id}`);
3054
+ return {
3055
+ contents: [{ uri: uri.href, mimeType: MIME, text: JSON.stringify(session, null, 2) }]
3056
+ };
3057
+ }
3058
+ );
3059
+ }
3060
+
2998
3061
  // src/mcp/tool-registration.ts
2999
3062
  function registerMcpTools(server2) {
3063
+ registerMcpResources(server2);
3000
3064
  registerSecretTools(server2);
3001
3065
  registerProjectTools(server2);
3002
3066
  registerTunnelTools(server2);
@@ -3012,7 +3076,7 @@ function registerMcpTools(server2) {
3012
3076
  // src/mcp/server.ts
3013
3077
  function createMcpServer() {
3014
3078
  setPolicyRoot(process.cwd());
3015
- const server2 = new McpServer({
3079
+ const server2 = new McpServer2({
3016
3080
  name: "q-ring",
3017
3081
  version: PACKAGE_VERSION
3018
3082
  });