@agentwares/agentguard 0.1.7 → 0.1.10

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 (52) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/README.md +223 -16
  3. package/dist/audit-5LUDXZLG.js +18 -0
  4. package/dist/audit-5LUDXZLG.js.map +1 -0
  5. package/dist/chunk-2QDPPTPY.js +179 -0
  6. package/dist/chunk-2QDPPTPY.js.map +1 -0
  7. package/dist/chunk-4WTFMFRY.js +1270 -0
  8. package/dist/chunk-4WTFMFRY.js.map +1 -0
  9. package/dist/chunk-5WRI5ZAA.js +31 -0
  10. package/dist/chunk-5WRI5ZAA.js.map +1 -0
  11. package/dist/chunk-DEVXG3IB.js +113 -0
  12. package/dist/chunk-DEVXG3IB.js.map +1 -0
  13. package/dist/chunk-F73VDY3W.js +202 -0
  14. package/dist/chunk-F73VDY3W.js.map +1 -0
  15. package/dist/chunk-IEJK7N3B.js +275 -0
  16. package/dist/chunk-IEJK7N3B.js.map +1 -0
  17. package/dist/chunk-IS3DAHZI.js +1698 -0
  18. package/dist/chunk-IS3DAHZI.js.map +1 -0
  19. package/dist/chunk-JSELR4SG.js +780 -0
  20. package/dist/chunk-JSELR4SG.js.map +1 -0
  21. package/dist/chunk-OM5L7A32.js +199 -0
  22. package/dist/chunk-OM5L7A32.js.map +1 -0
  23. package/dist/chunk-SWZQMPDG.js +206 -0
  24. package/dist/chunk-SWZQMPDG.js.map +1 -0
  25. package/dist/chunk-TJXZBOHL.js +529 -0
  26. package/dist/chunk-TJXZBOHL.js.map +1 -0
  27. package/dist/chunk-XOBFANL4.js +119 -0
  28. package/dist/chunk-XOBFANL4.js.map +1 -0
  29. package/dist/chunk-XPNBYSIN.js +23 -0
  30. package/dist/chunk-XPNBYSIN.js.map +1 -0
  31. package/dist/chunk-YBVD6HTT.js +1036 -0
  32. package/dist/chunk-YBVD6HTT.js.map +1 -0
  33. package/dist/chunk-ZG4LGUJE.js +847 -0
  34. package/dist/chunk-ZG4LGUJE.js.map +1 -0
  35. package/dist/cli.js +10 -4775
  36. package/dist/cli.js.map +1 -1
  37. package/dist/fixtures/crm-server.js +6 -1272
  38. package/dist/fixtures/crm-server.js.map +1 -1
  39. package/dist/fixtures/demo-agent.js +4 -115
  40. package/dist/fixtures/demo-agent.js.map +1 -1
  41. package/dist/index.d.ts +73 -14
  42. package/dist/index.js +247 -5138
  43. package/dist/index.js.map +1 -1
  44. package/dist/init-MKPQU2JG.js +17 -0
  45. package/dist/init-MKPQU2JG.js.map +1 -0
  46. package/dist/proxy-6GP63TLD.js +146 -0
  47. package/dist/proxy-6GP63TLD.js.map +1 -0
  48. package/dist/tools-XS7PMTLT.js +15 -0
  49. package/dist/tools-XS7PMTLT.js.map +1 -0
  50. package/llms.txt +10 -4
  51. package/package.json +16 -4
  52. package/server.json +9 -9
package/dist/index.d.ts CHANGED
@@ -195,6 +195,11 @@ declare class ProxyRuntime {
195
195
  redact: boolean;
196
196
  include_results: boolean;
197
197
  max_chars: number;
198
+ rules: {
199
+ check: string | string[];
200
+ id?: string | undefined;
201
+ text?: string | undefined;
202
+ }[];
198
203
  };
199
204
  alerts: {
200
205
  on: ("KILLED" | "APPROVAL_REQUIRED" | "LOOP_DETECTED" | "CAP_EXCEEDED" | "TOOL_DENIED")[];
@@ -204,6 +209,31 @@ declare class ProxyRuntime {
204
209
  state: {
205
210
  dir: string;
206
211
  };
212
+ hooks: {
213
+ mode: "dry-run" | "enforce";
214
+ shell: {
215
+ deny: string[];
216
+ approval: string[];
217
+ };
218
+ paths: {
219
+ deny: string[];
220
+ approval: string[];
221
+ };
222
+ irreversible: {
223
+ builtins: boolean | ("git-push" | "merge" | "tag-delete" | "rm-outside-workspace" | "publish" | "send" | "guard-config")[];
224
+ rules: {
225
+ name: string;
226
+ shell: string[];
227
+ paths: string[];
228
+ tools: string[];
229
+ mentions: string[];
230
+ }[];
231
+ window_s: number;
232
+ require_mention: boolean;
233
+ require_origin: boolean;
234
+ mentions: Record<string, string[]>;
235
+ };
236
+ };
207
237
  allow?: string[] | undefined;
208
238
  };
209
239
  start(): Promise<void>;
@@ -260,6 +290,15 @@ declare function toCallToolResult(result: GuardResult, tool: ExposedTool | undef
260
290
  /** Build the per-session MCP server. */
261
291
  declare function createDownstreamServer(runtime: ProxyRuntime, opts?: DownstreamOptions): McpServer;
262
292
 
293
+ interface HttpRegistration {
294
+ url: string;
295
+ baseUrl: string;
296
+ token: string;
297
+ pid: number;
298
+ startedAt: string;
299
+ }
300
+ declare function registrationPath(stateDir: string): string;
301
+
263
302
  interface HttpProxyOptions {
264
303
  runtime: ProxyRuntime;
265
304
  port?: number;
@@ -275,14 +314,7 @@ interface HttpProxy {
275
314
  token: string;
276
315
  close(): Promise<void>;
277
316
  }
278
- interface HttpRegistration {
279
- url: string;
280
- baseUrl: string;
281
- token: string;
282
- pid: number;
283
- startedAt: string;
284
- }
285
- declare function registrationPath(stateDir: string): string;
317
+
286
318
  declare function startHttpProxy(opts: HttpProxyOptions): Promise<HttpProxy>;
287
319
 
288
320
  /** Tiny argv parser: `--flag value`, `--flag=value`, `--bool`, `--no-bool`, repeated flags → arrays. */
@@ -299,6 +331,8 @@ interface Io {
299
331
  env: NodeJS.ProcessEnv;
300
332
  /** false when stdout is a pipe — an MCP client spawned us and wants a server, not the help text */
301
333
  tty?: boolean;
334
+ /** everything on stdin (hook mode reads the harness's JSON from it) */
335
+ stdin?: () => Promise<string>;
302
336
  }
303
337
  declare function loadPolicyFor(args: ParsedArgs, io: Io, opts?: {
304
338
  allowMissingEnv?: boolean;
@@ -381,11 +415,11 @@ declare function rewriteClientConfig(file: ClientConfigFile, policyPath: string,
381
415
  backup: string;
382
416
  replaced: string[];
383
417
  };
384
- /** `agentguard init --undo`: restore the backup. */
418
+ /** `okgate init --undo`: restore the backup. */
385
419
  declare function restoreClientConfig(file: ClientConfigFile): boolean;
386
420
 
387
421
  /**
388
- * `agentguard tools` — connect to every upstream and print the tools the agent will see,
422
+ * `okgate tools` — connect to every upstream and print the tools the agent will see,
389
423
  * with their class and why. Also the probe `init` uses to seed the policy.
390
424
  */
391
425
 
@@ -473,9 +507,9 @@ declare function createCrmMcpServer(state?: CrmState): McpServer;
473
507
  /**
474
508
  * A scripted "agent" that misbehaves on purpose: reads, then writes, then loops, then bursts
475
509
  * writes past the cap. Run it against the proxy to see dry-run diffs, LOOP_DETECTED and
476
- * CAP_EXCEEDED in `agentguard report`.
510
+ * CAP_EXCEEDED in `okgate report`.
477
511
  *
478
- * node dist/fixtures/demo-agent.js --config agentguard.yaml # spawns `agentguard proxy` over stdio
512
+ * node dist/fixtures/demo-agent.js --config okgate.yaml # spawns `okgate proxy` over stdio
479
513
  */
480
514
 
481
515
  interface DemoStep {
@@ -497,7 +531,32 @@ interface DemoOptions {
497
531
  /** Drive a connected client through the scripted scenario. Returns every step's outcome. */
498
532
  declare function runDemoAgent(client: Client, opts?: DemoOptions): Promise<DemoStep[]>;
499
533
 
500
- declare const HELP = "agentguard \u2014 MCP policy proxy for agents that touch production\n\n npx @agentwares/agentguard init read your MCP config, write agentguard.yaml (dry-run), route every server through the proxy\n agentguard report [--run id|--all] what this run did / would have destroyed / spent, where it was halted\n agentguard diff [--run id] record-by-record mutation diff from a dry run\n agentguard verify [audit.jsonl] prove the hash-chained audit log was not edited\n agentguard connect <key> [--write] point this machine at your hosted proxy (paid tiers)\n\n agentguard proxy [--http --port 8788] [--agent name] [--run-id id] [--mode dry-run|enforce]\n agentguard tools [--json] the tools your agent will see, with class and why\n agentguard status [--run id] counters vs caps, kill state, pending approvals\n\n agentguard kill [reason] halt every run now (file + running HTTP proxy); agentguard resume\n agentguard approvals [--all] pending approvals; agentguard approve <id> | deny <id> [--note text]\n agentguard key create <agent> [--allow 'crm_get_*']... [--deny p] [--writes n] [--spend n] [--mode m]\n agentguard key list | revoke <agent>\n agentguard permission-diff [--base ref] [--head ref] [--paths a,b] [--format markdown|json] [--fail-on-widen]\n\nOptions: --config <agentguard.yaml> (or AGENTGUARD_CONFIG), --json, --help, --version\nDocs: https://github.com/agentwares/agentguard/tree/main/apps/agentguard-cli";
534
+ declare const AUDIT_CANARIES: readonly ["CANARY-PROMPT-7d1e", "CANARY-ASSISTANT-3b9a", "CANARY-COMMIT-MESSAGE-5c2f", "CANARY-OUTPUT-8e4d", "CANARY-PATH-2a6b", "CANARY-CONTENT-9f0c"];
535
+ interface SyntheticAuditOptions {
536
+ /** the repository: rule files are written here */
537
+ repo: string;
538
+ /** stands in for ~/.claude/projects */
539
+ claudeDir: string;
540
+ /** stands in for ~/.codex/sessions */
541
+ codexDir: string;
542
+ now?: Date;
543
+ }
544
+ interface SyntheticAuditHistory {
545
+ /** sessions in the repository in the last 7 days (5 Claude Code, 1 Codex) */
546
+ sessionsLast7d: number;
547
+ /** and with the one 20 days old */
548
+ sessionsAll: number;
549
+ }
550
+ /** Write the rule files and the transcripts. */
551
+ declare function writeSyntheticAuditHistory(opts: SyntheticAuditOptions): SyntheticAuditHistory;
552
+
553
+ /** The willingness-to-pay test: a page that says what the team view would be, and one button. */
554
+ declare const TEAM_HISTORY_URL = "https://agentwares-agentguard.vercel.app/team-history";
555
+ /** `7d`, `30d`, `24h`, `all`, or a date. Undefined: all history. */
556
+ declare function parseSince(value: string | undefined, now: Date): number | undefined;
557
+ declare function auditCommand(args: ParsedArgs, io: Io): Promise<number>;
558
+
559
+ declare const HELP: string;
501
560
  declare function main(argv: readonly string[], io?: Io): Promise<number>;
502
561
 
503
- export { type CallContext, type ClientConfigFile, type CrmState, DEFAULT_PERMISSION_PATHS, type DemoOptions, type DemoStep, type DownstreamOptions, type DownstreamSession, type ExposedTool, type FileGuard, HELP, type HttpProxy, type HttpProxyOptions, type HttpRegistration, type Io, type PermissionDiffResult, type ProbeResult, type ProbedTool, ProxyRuntime, type RuntimeOptions, type ServerEntry, type UpstreamStatus, approvalSlackMessage, candidateConfigs, createAlerter, createCrmMcpServer, createDownstreamServer, createFileGuard, crmTools, detectClientConfigs, haltSlackMessage, loadPolicyFor, main, probeUpstreams, proxyEntry, readRegistration, readServers, registrationPath, renderStarterPolicy, restoreClientConfig, rewriteClientConfig, runDemoAgent, runIdFor, runPermissionDiff, seedState, serversToUpstreams, startHttpProxy, toCallToolResult };
562
+ export { AUDIT_CANARIES, type CallContext, type ClientConfigFile, type CrmState, DEFAULT_PERMISSION_PATHS, type DemoOptions, type DemoStep, type DownstreamOptions, type DownstreamSession, type ExposedTool, type FileGuard, HELP, type HttpProxy, type HttpProxyOptions, type HttpRegistration, type Io, type PermissionDiffResult, type ProbeResult, type ProbedTool, ProxyRuntime, type RuntimeOptions, type ServerEntry, type SyntheticAuditHistory, type SyntheticAuditOptions, TEAM_HISTORY_URL, type UpstreamStatus, approvalSlackMessage, auditCommand, candidateConfigs, createAlerter, createCrmMcpServer, createDownstreamServer, createFileGuard, crmTools, detectClientConfigs, haltSlackMessage, loadPolicyFor, main, parseSince, probeUpstreams, proxyEntry, readRegistration, readServers, registrationPath, renderStarterPolicy, restoreClientConfig, rewriteClientConfig, runDemoAgent, runIdFor, runPermissionDiff, seedState, serversToUpstreams, startHttpProxy, toCallToolResult, writeSyntheticAuditHistory };