@guardiojs/guardio 0.0.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.
Files changed (91) hide show
  1. package/README.md +213 -0
  2. package/bin/guardio.mjs +2 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +74 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config/PluginManager.d.ts +40 -0
  8. package/dist/config/PluginManager.d.ts.map +1 -0
  9. package/dist/config/PluginManager.js +130 -0
  10. package/dist/config/PluginManager.js.map +1 -0
  11. package/dist/config/index.d.ts +5 -0
  12. package/dist/config/index.d.ts.map +1 -0
  13. package/dist/config/index.js +2 -0
  14. package/dist/config/index.js.map +1 -0
  15. package/dist/config/types.d.ts +37 -0
  16. package/dist/config/types.d.ts.map +1 -0
  17. package/dist/config/types.js +2 -0
  18. package/dist/config/types.js.map +1 -0
  19. package/dist/core/GuardioCore.d.ts +19 -0
  20. package/dist/core/GuardioCore.d.ts.map +1 -0
  21. package/dist/core/GuardioCore.js +115 -0
  22. package/dist/core/GuardioCore.js.map +1 -0
  23. package/dist/core/index.d.ts +3 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +2 -0
  26. package/dist/core/index.js.map +1 -0
  27. package/dist/core/types.d.ts +29 -0
  28. package/dist/core/types.d.ts.map +1 -0
  29. package/dist/core/types.js +2 -0
  30. package/dist/core/types.js.map +1 -0
  31. package/dist/index.d.ts +7 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +6 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/interfaces/InterventionPluginInterface.d.ts +20 -0
  36. package/dist/interfaces/InterventionPluginInterface.d.ts.map +1 -0
  37. package/dist/interfaces/InterventionPluginInterface.js +2 -0
  38. package/dist/interfaces/InterventionPluginInterface.js.map +1 -0
  39. package/dist/interfaces/InterventionTypes.d.ts +8 -0
  40. package/dist/interfaces/InterventionTypes.d.ts.map +1 -0
  41. package/dist/interfaces/InterventionTypes.js +2 -0
  42. package/dist/interfaces/InterventionTypes.js.map +1 -0
  43. package/dist/interfaces/NotificationPluginInterface.d.ts +13 -0
  44. package/dist/interfaces/NotificationPluginInterface.d.ts.map +1 -0
  45. package/dist/interfaces/NotificationPluginInterface.js +2 -0
  46. package/dist/interfaces/NotificationPluginInterface.js.map +1 -0
  47. package/dist/interfaces/PolicyPluginInterface.d.ts +16 -0
  48. package/dist/interfaces/PolicyPluginInterface.d.ts.map +1 -0
  49. package/dist/interfaces/PolicyPluginInterface.js +2 -0
  50. package/dist/interfaces/PolicyPluginInterface.js.map +1 -0
  51. package/dist/interfaces/PolicyTypes.d.ts +12 -0
  52. package/dist/interfaces/PolicyTypes.d.ts.map +1 -0
  53. package/dist/interfaces/PolicyTypes.js +2 -0
  54. package/dist/interfaces/PolicyTypes.js.map +1 -0
  55. package/dist/interfaces/index.d.ts +6 -0
  56. package/dist/interfaces/index.d.ts.map +1 -0
  57. package/dist/interfaces/index.js +2 -0
  58. package/dist/interfaces/index.js.map +1 -0
  59. package/dist/plugins/intervention/DefaultInterventionPlugin.d.ts +12 -0
  60. package/dist/plugins/intervention/DefaultInterventionPlugin.d.ts.map +1 -0
  61. package/dist/plugins/intervention/DefaultInterventionPlugin.js +14 -0
  62. package/dist/plugins/intervention/DefaultInterventionPlugin.js.map +1 -0
  63. package/dist/plugins/intervention/HttpInterventionPlugin.d.ts +22 -0
  64. package/dist/plugins/intervention/HttpInterventionPlugin.d.ts.map +1 -0
  65. package/dist/plugins/intervention/HttpInterventionPlugin.js +99 -0
  66. package/dist/plugins/intervention/HttpInterventionPlugin.js.map +1 -0
  67. package/dist/plugins/intervention/index.d.ts +3 -0
  68. package/dist/plugins/intervention/index.d.ts.map +1 -0
  69. package/dist/plugins/intervention/index.js +3 -0
  70. package/dist/plugins/intervention/index.js.map +1 -0
  71. package/dist/plugins/notification/DefaultNotificationPlugin.d.ts +8 -0
  72. package/dist/plugins/notification/DefaultNotificationPlugin.d.ts.map +1 -0
  73. package/dist/plugins/notification/DefaultNotificationPlugin.js +9 -0
  74. package/dist/plugins/notification/DefaultNotificationPlugin.js.map +1 -0
  75. package/dist/plugins/notification/index.d.ts +2 -0
  76. package/dist/plugins/notification/index.d.ts.map +1 -0
  77. package/dist/plugins/notification/index.js +2 -0
  78. package/dist/plugins/notification/index.js.map +1 -0
  79. package/dist/plugins/policy/DefaultPolicyPlugin.d.ts +16 -0
  80. package/dist/plugins/policy/DefaultPolicyPlugin.d.ts.map +1 -0
  81. package/dist/plugins/policy/DefaultPolicyPlugin.js +21 -0
  82. package/dist/plugins/policy/DefaultPolicyPlugin.js.map +1 -0
  83. package/dist/plugins/policy/RegexPolicyPlugin.d.ts +38 -0
  84. package/dist/plugins/policy/RegexPolicyPlugin.d.ts.map +1 -0
  85. package/dist/plugins/policy/RegexPolicyPlugin.js +65 -0
  86. package/dist/plugins/policy/RegexPolicyPlugin.js.map +1 -0
  87. package/dist/plugins/policy/index.d.ts +3 -0
  88. package/dist/plugins/policy/index.d.ts.map +1 -0
  89. package/dist/plugins/policy/index.js +3 -0
  90. package/dist/plugins/policy/index.js.map +1 -0
  91. package/package.json +41 -0
@@ -0,0 +1,115 @@
1
+ import { spawn } from "node:child_process";
2
+ import * as readline from "node:readline";
3
+ import { PluginManager } from "../config/PluginManager.js";
4
+ export class GuardioCore {
5
+ config;
6
+ policyPlugins = [];
7
+ interventionPlugins = [];
8
+ child = null;
9
+ appInterface = null;
10
+ toolInterface = null;
11
+ pendingResponseId = null;
12
+ appQueue = [];
13
+ constructor(config) {
14
+ this.config = config;
15
+ }
16
+ async run() {
17
+ const pluginManager = new PluginManager();
18
+ const cwd = this.config.cwd ?? process.cwd();
19
+ this.policyPlugins = await pluginManager.getPolicyPlugins(cwd, this.config.configPath);
20
+ if (this.policyPlugins.length === 0) {
21
+ throw new Error("No policy plugins in config. Add at least one plugin with type 'policy'.");
22
+ }
23
+ this.interventionPlugins = await pluginManager.getInterventionPlugins(cwd, this.config.configPath);
24
+ this.child = spawn(this.config.command, this.config.args, {
25
+ stdio: ["pipe", "pipe", "inherit"],
26
+ });
27
+ this.appInterface = readline.createInterface({
28
+ input: process.stdin,
29
+ terminal: false,
30
+ });
31
+ this.toolInterface = readline.createInterface({
32
+ input: this.child.stdout,
33
+ terminal: false,
34
+ });
35
+ this.attachAppHandler();
36
+ this.attachToolHandler();
37
+ }
38
+ sendErrorResponse(id, message) {
39
+ process.stdout.write(JSON.stringify({
40
+ jsonrpc: "2.0",
41
+ id,
42
+ error: { code: -32000, message },
43
+ }) + "\n");
44
+ }
45
+ async processAppLine(line) {
46
+ try {
47
+ const request = JSON.parse(line);
48
+ if (request.method === "tools/call") {
49
+ const toolName = request.params?.name ?? "(unknown)";
50
+ const args = request.params?.arguments;
51
+ const context = { toolName, args };
52
+ for (const policy of this.policyPlugins) {
53
+ const result = policy.evaluate(context);
54
+ if (result === "blocked") {
55
+ console.error(`[SECURITY] Blocked attempt to call: ${toolName} (policy: ${policy.name})`);
56
+ this.sendErrorResponse(request.id, "Security Layer: Call Rejected");
57
+ this.drainAppQueue();
58
+ return;
59
+ }
60
+ }
61
+ if (this.interventionPlugins.length > 0) {
62
+ const interventionContext = { toolName, args };
63
+ for (const plugin of this.interventionPlugins) {
64
+ const actResult = await Promise.resolve(plugin.act(interventionContext));
65
+ if (actResult === false) {
66
+ this.sendErrorResponse(request.id, `Call to ${toolName} was rejected by intervention plugin ${plugin.name}`);
67
+ this.drainAppQueue();
68
+ return;
69
+ }
70
+ }
71
+ }
72
+ this.pendingResponseId = request.id ?? null;
73
+ this.child.stdin?.write(line + "\n");
74
+ return;
75
+ }
76
+ this.child.stdin?.write(line + "\n");
77
+ }
78
+ catch {
79
+ this.child.stdin?.write(line + "\n");
80
+ }
81
+ }
82
+ drainAppQueue() {
83
+ this.pendingResponseId = null;
84
+ while (this.appQueue.length > 0) {
85
+ const line = this.appQueue.shift();
86
+ if (line !== undefined)
87
+ this.processAppLine(line);
88
+ }
89
+ }
90
+ attachAppHandler() {
91
+ this.appInterface.on("line", async (line) => {
92
+ if (this.pendingResponseId !== null) {
93
+ this.appQueue.push(line);
94
+ return;
95
+ }
96
+ await this.processAppLine(line);
97
+ });
98
+ }
99
+ attachToolHandler() {
100
+ this.toolInterface.on("line", (line) => {
101
+ process.stdout.write(line + "\n");
102
+ if (this.pendingResponseId !== null) {
103
+ try {
104
+ const response = JSON.parse(line);
105
+ if (response.id === this.pendingResponseId)
106
+ this.drainAppQueue();
107
+ }
108
+ catch {
109
+ // not JSON or no id – keep waiting
110
+ }
111
+ }
112
+ });
113
+ }
114
+ }
115
+ //# sourceMappingURL=GuardioCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GuardioCore.js","sourceRoot":"","sources":["../../src/core/GuardioCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAK1C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,OAAO,WAAW;IACL,MAAM,CAAoB;IACnC,aAAa,GAA4B,EAAE,CAAC;IAC5C,mBAAmB,GAAkC,EAAE,CAAC;IAExD,KAAK,GAAoC,IAAI,CAAC;IAC9C,YAAY,GAA8B,IAAI,CAAC;IAC/C,aAAa,GAA8B,IAAI,CAAC;IAEhD,iBAAiB,GAA2B,IAAI,CAAC;IACxC,QAAQ,GAAa,EAAE,CAAC;IAEzC,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,MAAM,aAAa,CAAC,gBA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EAAE,CAAC;gBACpC,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAoB,CAAC;oBACrD,IAAI,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,iBAAiB;wBAAE,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnE,CAAC;gBAAC,MAAM,CAAC;oBACP,mCAAmC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export { GuardioCore } from "./GuardioCore.js";
2
+ export type { GuardioCoreConfig, JsonRpcRequest, JsonRpcResponse, } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { GuardioCore } from "./GuardioCore.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,29 @@
1
+ export interface JsonRpcRequest {
2
+ jsonrpc?: string;
3
+ id?: string | number;
4
+ method?: string;
5
+ params?: {
6
+ name?: string;
7
+ arguments?: unknown;
8
+ };
9
+ }
10
+ export interface JsonRpcResponse {
11
+ jsonrpc?: string;
12
+ id?: string | number;
13
+ result?: unknown;
14
+ error?: {
15
+ code: number;
16
+ message: string;
17
+ };
18
+ }
19
+ export interface GuardioCoreConfig {
20
+ /** Command to run the real MCP server (e.g. "node") */
21
+ command: string;
22
+ /** Arguments for the command (e.g. ["/path/to/server.js"]) */
23
+ args: string[];
24
+ /** Cwd for resolving guardio.config (default: process.cwd()) */
25
+ cwd?: string;
26
+ /** Explicit path to guardio config file (optional) */
27
+ configPath?: string;
28
+ }
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export { GuardioCore } from "./core/index.js";
2
+ export type { GuardioCoreConfig, JsonRpcRequest, JsonRpcResponse, } from "./core/index.js";
3
+ export type { PolicyPluginInterface, NotificationPluginInterface, InterventionPluginInterface, InterventionResult, PolicyRequestContext, PolicyResult, InterventionRequestContext, } from "./interfaces/index.js";
4
+ export { DefaultPolicyPlugin, RegexPolicyPlugin, type DefaultPolicyPluginConfig, type RegexPolicyPluginConfig, type RegexPolicyRule, type RegexPolicyRuleResult, } from "./plugins/policy/index.js";
5
+ export { DefaultNotificationPlugin } from "./plugins/notification/index.js";
6
+ export { DefaultInterventionPlugin, HttpInterventionPlugin, type HttpInterventionPluginConfig, } from "./plugins/intervention/index.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,4BAA4B,GAClC,MAAM,iCAAiC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // Programmatic API: core, interfaces, and default plugins
2
+ export { GuardioCore } from "./core/index.js";
3
+ export { DefaultPolicyPlugin, RegexPolicyPlugin, } from "./plugins/policy/index.js";
4
+ export { DefaultNotificationPlugin } from "./plugins/notification/index.js";
5
+ export { DefaultInterventionPlugin, HttpInterventionPlugin, } from "./plugins/intervention/index.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAe9C,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAKlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GAEvB,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { InterventionRequestContext } from "./InterventionTypes.js";
2
+ /**
3
+ * Return type of act(): void/true = continue and forward; false = reject the call.
4
+ */
5
+ export type InterventionResult = void | boolean | Promise<void> | Promise<boolean>;
6
+ /**
7
+ * Intervention plugin interface: run side effects when a tool call is about to be forwarded
8
+ * (e.g. logging, approval UI). Receives config from guardio config.
9
+ * Return false (or Promise<false>) to reject the call; void/true to continue.
10
+ */
11
+ export interface InterventionPluginInterface {
12
+ readonly name: string;
13
+ /**
14
+ * Act on the tool call (e.g. log, show approval UI). Called when the call is allowed and before forwarding.
15
+ * @param context - Request context containing toolName and args
16
+ * @returns false to reject the call; void or true to continue
17
+ */
18
+ act(context: InterventionRequestContext): InterventionResult;
19
+ }
20
+ //# sourceMappingURL=InterventionPluginInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InterventionPluginInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/InterventionPluginInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,IAAI,GACJ,OAAO,GACP,OAAO,CAAC,IAAI,CAAC,GACb,OAAO,CAAC,OAAO,CAAC,CAAC;AAErB;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,GAAG,CAAC,OAAO,EAAE,0BAA0B,GAAG,kBAAkB,CAAC;CAC9D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InterventionPluginInterface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InterventionPluginInterface.js","sourceRoot":"","sources":["../../src/interfaces/InterventionPluginInterface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Context passed to intervention plugin's act() for a tool call request.
3
+ */
4
+ export interface InterventionRequestContext {
5
+ toolName: string;
6
+ args: unknown;
7
+ }
8
+ //# sourceMappingURL=InterventionTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InterventionTypes.d.ts","sourceRoot":"","sources":["../../src/interfaces/InterventionTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InterventionTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InterventionTypes.js","sourceRoot":"","sources":["../../src/interfaces/InterventionTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Notification plugin interface for side effects when tool calls are
3
+ * intercepted (e.g. logging, metrics, alerts). Can be no-op for now.
4
+ */
5
+ export interface NotificationPluginInterface {
6
+ /**
7
+ * Notify about a tool call event (e.g. before/after approval).
8
+ * @param toolName - Name of the tool
9
+ * @param args - Arguments passed to the tool
10
+ */
11
+ notify(toolName: string, args: unknown): void;
12
+ }
13
+ //# sourceMappingURL=NotificationPluginInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationPluginInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/NotificationPluginInterface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NotificationPluginInterface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationPluginInterface.js","sourceRoot":"","sources":["../../src/interfaces/NotificationPluginInterface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { PolicyRequestContext } from "./PolicyTypes.js";
2
+ import type { PolicyResult } from "./PolicyTypes.js";
3
+ /**
4
+ * Policy plugin interface for evaluating whether a tool call is allowed.
5
+ * Implementations can perform simple checks or more complex policy logic.
6
+ */
7
+ export interface PolicyPluginInterface {
8
+ readonly name: string;
9
+ /**
10
+ * Evaluate the tool call and return a policy result.
11
+ * @param context - Request context containing toolName and args
12
+ * @returns "allowed" to forward without approval, "blocked" to reject, "require_approval" to ask human
13
+ */
14
+ evaluate(context: PolicyRequestContext): PolicyResult;
15
+ }
16
+ //# sourceMappingURL=PolicyPluginInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyPluginInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/PolicyPluginInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CAAC;CACvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PolicyPluginInterface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyPluginInterface.js","sourceRoot":"","sources":["../../src/interfaces/PolicyPluginInterface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Context passed to policy evaluation for a tool call request.
3
+ */
4
+ export interface PolicyRequestContext {
5
+ toolName: string;
6
+ args: unknown;
7
+ }
8
+ /**
9
+ * Result of policy evaluation: allow, block, or require human approval.
10
+ */
11
+ export type PolicyResult = "allowed" | "blocked" | "require_approval";
12
+ //# sourceMappingURL=PolicyTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyTypes.d.ts","sourceRoot":"","sources":["../../src/interfaces/PolicyTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PolicyTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyTypes.js","sourceRoot":"","sources":["../../src/interfaces/PolicyTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export type { PolicyPluginInterface } from "./PolicyPluginInterface.js";
2
+ export type { NotificationPluginInterface } from "./NotificationPluginInterface.js";
3
+ export type { InterventionPluginInterface, InterventionResult, } from "./InterventionPluginInterface.js";
4
+ export type { PolicyRequestContext, PolicyResult } from "./PolicyTypes.js";
5
+ export type { InterventionRequestContext } from "./InterventionTypes.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,YAAY,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AACpF,YAAY,EACV,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { InterventionPluginInterface } from "../../interfaces/InterventionPluginInterface.js";
2
+ import type { InterventionRequestContext } from "../../interfaces/InterventionTypes.js";
3
+ /**
4
+ * Default intervention plugin: no-op. Receives config from guardio config; override act() for side effects.
5
+ */
6
+ export declare class DefaultInterventionPlugin implements InterventionPluginInterface {
7
+ private readonly config;
8
+ readonly name = "default";
9
+ constructor(config?: Record<string, unknown>);
10
+ act(_context: InterventionRequestContext): void;
11
+ }
12
+ //# sourceMappingURL=DefaultInterventionPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultInterventionPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/intervention/DefaultInterventionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAExF;;GAEG;AACH,qBAAa,yBAA0B,YAAW,2BAA2B;IAG/D,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,QAAQ,CAAC,IAAI,aAAa;gBAEG,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAEjE,GAAG,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI;CAGhD"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Default intervention plugin: no-op. Receives config from guardio config; override act() for side effects.
3
+ */
4
+ export class DefaultInterventionPlugin {
5
+ config;
6
+ name = "default";
7
+ constructor(config = {}) {
8
+ this.config = config;
9
+ }
10
+ act(_context) {
11
+ // Empty for now; config is available as this.config for subclasses or future use
12
+ }
13
+ }
14
+ //# sourceMappingURL=DefaultInterventionPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultInterventionPlugin.js","sourceRoot":"","sources":["../../../src/plugins/intervention/DefaultInterventionPlugin.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAGP;IAFpB,IAAI,GAAG,SAAS,CAAC;IAE1B,YAA6B,SAAkC,EAAE;QAApC,WAAM,GAAN,MAAM,CAA8B;IAAG,CAAC;IAErE,GAAG,CAAC,QAAoC;QACtC,iFAAiF;IACnF,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import type { InterventionPluginInterface } from "../../interfaces/InterventionPluginInterface.js";
2
+ import type { InterventionRequestContext } from "../../interfaces/InterventionTypes.js";
3
+ export interface HttpInterventionPluginConfig {
4
+ port?: number;
5
+ timeoutMs?: number;
6
+ }
7
+ /**
8
+ * Intervention plugin that starts an HTTP server and waits for user approve/reject
9
+ * before the tool call is forwarded. Config: { port?, timeoutMs? }.
10
+ */
11
+ export declare class HttpInterventionPlugin implements InterventionPluginInterface {
12
+ readonly name = "http";
13
+ private readonly port;
14
+ private readonly timeoutMs;
15
+ private server;
16
+ private readonly pendingApprovals;
17
+ private approvalCounter;
18
+ constructor(config?: Record<string, unknown>);
19
+ private ensureServer;
20
+ act(context: InterventionRequestContext): Promise<boolean>;
21
+ }
22
+ //# sourceMappingURL=HttpInterventionPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpInterventionPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/intervention/HttpInterventionPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAKxF,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,2BAA2B;IACxE,QAAQ,CAAC,IAAI,UAAU;IAEvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,MAAM,CAAgD;IAC9D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAG7B;IACJ,OAAO,CAAC,eAAe,CAAK;gBAEhB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAMhD,OAAO,CAAC,YAAY;IAsDpB,GAAG,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC;CA+B3D"}
@@ -0,0 +1,99 @@
1
+ import { createServer } from "node:http";
2
+ import { exec } from "node:child_process";
3
+ const DEFAULT_PORT = 3939;
4
+ const DEFAULT_TIMEOUT_MS = 120_000;
5
+ /**
6
+ * Intervention plugin that starts an HTTP server and waits for user approve/reject
7
+ * before the tool call is forwarded. Config: { port?, timeoutMs? }.
8
+ */
9
+ export class HttpInterventionPlugin {
10
+ name = "http";
11
+ port;
12
+ timeoutMs;
13
+ server = null;
14
+ pendingApprovals = new Map();
15
+ approvalCounter = 0;
16
+ constructor(config = {}) {
17
+ const opts = config;
18
+ this.port = opts.port ?? DEFAULT_PORT;
19
+ this.timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
20
+ }
21
+ ensureServer() {
22
+ if (this.server !== null)
23
+ return;
24
+ this.server = createServer((req, res) => {
25
+ if (req.method === "GET" && req.url === "/") {
26
+ const pending = Array.from(this.pendingApprovals.entries())
27
+ .map(([id]) => `<li><a href="/approve/${id}">Approve ${id}</a> | <a href="/reject/${id}">Reject ${id}</a></li>`)
28
+ .join("");
29
+ res.writeHead(200, { "Content-Type": "text/html" });
30
+ res.end(`
31
+ <html>
32
+ <body>
33
+ <h1>Guardio - Pending Approvals</h1>
34
+ <ul>${pending || "<li>No pending approvals</li>"}</ul>
35
+ </body>
36
+ </html>
37
+ `);
38
+ }
39
+ else if (req.url?.startsWith("/approve/")) {
40
+ const id = req.url.split("/")[2];
41
+ const resolver = this.pendingApprovals.get(id);
42
+ if (resolver) {
43
+ resolver(true);
44
+ this.pendingApprovals.delete(id);
45
+ res.writeHead(200, { "Content-Type": "text/plain" });
46
+ res.end("Approved!");
47
+ }
48
+ else {
49
+ res.writeHead(404);
50
+ res.end("Not found");
51
+ }
52
+ }
53
+ else if (req.url?.startsWith("/reject/")) {
54
+ const id = req.url.split("/")[2];
55
+ const resolver = this.pendingApprovals.get(id);
56
+ if (resolver) {
57
+ resolver(false);
58
+ this.pendingApprovals.delete(id);
59
+ res.writeHead(200, { "Content-Type": "text/plain" });
60
+ res.end("Rejected!");
61
+ }
62
+ else {
63
+ res.writeHead(404);
64
+ res.end("Not found");
65
+ }
66
+ }
67
+ });
68
+ this.server.listen(this.port, () => {
69
+ console.error(`🔐 Guardio approval server running on http://localhost:${this.port}`);
70
+ });
71
+ }
72
+ act(context) {
73
+ this.ensureServer();
74
+ return new Promise((resolve) => {
75
+ const id = `approval-${++this.approvalCounter}`;
76
+ this.pendingApprovals.set(id, resolve);
77
+ console.error("\n" + "=".repeat(60));
78
+ console.error(`🔔 AI wants to call: ${context.toolName}`);
79
+ console.error(`Arguments: ${JSON.stringify(context.args, null, 2)}`);
80
+ console.error(`Approve at: http://localhost:${this.port}`);
81
+ console.error("=".repeat(60));
82
+ const url = `http://localhost:${this.port}`;
83
+ const cmd = process.platform === "darwin"
84
+ ? "open"
85
+ : process.platform === "win32"
86
+ ? "start"
87
+ : "xdg-open";
88
+ exec(`${cmd} ${url}`);
89
+ setTimeout(() => {
90
+ if (this.pendingApprovals.has(id)) {
91
+ this.pendingApprovals.delete(id);
92
+ console.error("\n⏱️ Approval timed out - rejecting call");
93
+ resolve(false);
94
+ }
95
+ }, this.timeoutMs);
96
+ });
97
+ }
98
+ }
99
+ //# sourceMappingURL=HttpInterventionPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpInterventionPlugin.js","sourceRoot":"","sources":["../../../src/plugins/intervention/HttpInterventionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAI1C,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAOnC;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IACxB,IAAI,GAAG,MAAM,CAAC;IAEN,IAAI,CAAS;IACb,SAAS,CAAS;IAC3B,MAAM,GAA2C,IAAI,CAAC;IAC7C,gBAAgB,GAAG,IAAI,GAAG,EAGxC,CAAC;IACI,eAAe,GAAG,CAAC,CAAC;IAE5B,YAAY,SAAkC,EAAE;QAC9C,MAAM,IAAI,GAAG,MAAsC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,YAAY,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,kBAAkB,CAAC;IACxD,CAAC;IAEO,YAAY;QAClB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO;QAEjC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACtC,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;qBACxD,GAAG,CACF,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,yBAAyB,EAAE,a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KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;YAE9B,MAAM,GAAG,GAAG,oBAAoB,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5C,MAAM,GAAG,GACP,OAAO,CAAC,QAAQ,KAAK,QAAQ;gBAC3B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO;oBAC9B,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC,UAAU,CAAC;YACjB,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;YAEtB,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;oBAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBACjC,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;oBAC3D,OAAO,CAAC,KAAK,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export { DefaultInterventionPlugin } from "./DefaultInterventionPlugin.js";
2
+ export { HttpInterventionPlugin, type HttpInterventionPluginConfig, } from "./HttpInterventionPlugin.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/intervention/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,GAClC,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { DefaultInterventionPlugin } from "./DefaultInterventionPlugin.js";
2
+ export { HttpInterventionPlugin, } from "./HttpInterventionPlugin.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/intervention/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { NotificationPluginInterface } from "../../interfaces/NotificationPluginInterface.js";
2
+ /**
3
+ * Default notification plugin: no-op. Replace with logging, metrics, or alerts.
4
+ */
5
+ export declare class DefaultNotificationPlugin implements NotificationPluginInterface {
6
+ notify(_toolName: string, _args: unknown): void;
7
+ }
8
+ //# sourceMappingURL=DefaultNotificationPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultNotificationPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/notification/DefaultNotificationPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAEnG;;GAEG;AACH,qBAAa,yBAA0B,YAAW,2BAA2B;IAC3E,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAGhD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Default notification plugin: no-op. Replace with logging, metrics, or alerts.
3
+ */
4
+ export class DefaultNotificationPlugin {
5
+ notify(_toolName, _args) {
6
+ // Empty for now
7
+ }
8
+ }
9
+ //# sourceMappingURL=DefaultNotificationPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultNotificationPlugin.js","sourceRoot":"","sources":["../../../src/plugins/notification/DefaultNotificationPlugin.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC,MAAM,CAAC,SAAiB,EAAE,KAAc;QACtC,gBAAgB;IAClB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { DefaultNotificationPlugin } from "./DefaultNotificationPlugin.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { DefaultNotificationPlugin } from "./DefaultNotificationPlugin.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { PolicyPluginInterface, PolicyRequestContext, PolicyResult } from "../../interfaces/index.js";
2
+ export interface DefaultPolicyPluginConfig {
3
+ /** Tool name(s) to block. If the call’s tool name is in this list, it is blocked. */
4
+ blockedTools: string[];
5
+ }
6
+ /**
7
+ * Default policy plugin: block calls by tool name.
8
+ * Config is required: { blockedTools: ["tool_a", "tool_b"] }. No default block list.
9
+ */
10
+ export declare class DefaultPolicyPlugin implements PolicyPluginInterface {
11
+ readonly name = "default";
12
+ private readonly blockedTools;
13
+ constructor(config: Record<string, unknown>);
14
+ evaluate(context: PolicyRequestContext): PolicyResult;
15
+ }
16
+ //# sourceMappingURL=DefaultPolicyPlugin.d.ts.map