@agentwares/agentguard 0.1.6 → 0.1.9
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/CHANGELOG.md +89 -0
- package/README.md +223 -16
- package/dist/audit-2YCMHMCP.js +17 -0
- package/dist/audit-2YCMHMCP.js.map +1 -0
- package/dist/chunk-3O6KWT3E.js +345 -0
- package/dist/chunk-3O6KWT3E.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/chunk-6S7LYVOC.js +1033 -0
- package/dist/chunk-6S7LYVOC.js.map +1 -0
- package/dist/chunk-6TUQD666.js +828 -0
- package/dist/chunk-6TUQD666.js.map +1 -0
- package/dist/chunk-BKXXTWIS.js +119 -0
- package/dist/chunk-BKXXTWIS.js.map +1 -0
- package/dist/chunk-D66U3PVB.js +529 -0
- package/dist/chunk-D66U3PVB.js.map +1 -0
- package/dist/chunk-HPYZ3JDX.js +206 -0
- package/dist/chunk-HPYZ3JDX.js.map +1 -0
- package/dist/chunk-KRKZGAJ3.js +769 -0
- package/dist/chunk-KRKZGAJ3.js.map +1 -0
- package/dist/chunk-SUXQTT3X.js +1268 -0
- package/dist/chunk-SUXQTT3X.js.map +1 -0
- package/dist/chunk-TW5KJREH.js +190 -0
- package/dist/chunk-TW5KJREH.js.map +1 -0
- package/dist/chunk-VQWQ5TOM.js +113 -0
- package/dist/chunk-VQWQ5TOM.js.map +1 -0
- package/dist/chunk-X4M7YWQA.js +270 -0
- package/dist/chunk-X4M7YWQA.js.map +1 -0
- package/dist/chunk-ZSLWPKXI.js +1144 -0
- package/dist/chunk-ZSLWPKXI.js.map +1 -0
- package/dist/cli.js +8 -4725
- package/dist/cli.js.map +1 -1
- package/dist/fixtures/crm-server.js +6 -1272
- package/dist/fixtures/crm-server.js.map +1 -1
- package/dist/fixtures/demo-agent.js +4 -115
- package/dist/fixtures/demo-agent.js.map +1 -1
- package/dist/index.d.ts +76 -10
- package/dist/index.js +246 -5087
- package/dist/index.js.map +1 -1
- package/dist/init-CWROGV5I.js +15 -0
- package/dist/init-CWROGV5I.js.map +1 -0
- package/dist/proxy-3Z5YEZ4R.js +154 -0
- package/dist/proxy-3Z5YEZ4R.js.map +1 -0
- package/dist/tools-3LLDG3XQ.js +15 -0
- package/dist/tools-3LLDG3XQ.js.map +1 -0
- package/llms.txt +4 -0
- package/package.json +9 -3
- package/server.json +2 -2
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>;
|
|
@@ -211,6 +241,13 @@ declare class ProxyRuntime {
|
|
|
211
241
|
private wire;
|
|
212
242
|
private pickSession;
|
|
213
243
|
private broadcast;
|
|
244
|
+
/**
|
|
245
|
+
* Re-read an upstream's tools, every page (mcp-kit's `readAllPages`): at most 20 requests, each
|
|
246
|
+
* under the upstream's `timeout_ms`, ending at a cursor already followed. It used to follow
|
|
247
|
+
* `nextCursor` with no bound, so an upstream that echoed its cursor kept the proxy asking for
|
|
248
|
+
* the same page forever. A refresh that fails, or stops at the 20-page / 2,000-tool ceiling,
|
|
249
|
+
* changes nothing: the agent keeps the last good list, and the log says why.
|
|
250
|
+
*/
|
|
214
251
|
private refreshTools;
|
|
215
252
|
private rebuildExposed;
|
|
216
253
|
listTools(agent?: AgentScope | null): ExposedTool[];
|
|
@@ -253,6 +290,15 @@ declare function toCallToolResult(result: GuardResult, tool: ExposedTool | undef
|
|
|
253
290
|
/** Build the per-session MCP server. */
|
|
254
291
|
declare function createDownstreamServer(runtime: ProxyRuntime, opts?: DownstreamOptions): McpServer;
|
|
255
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
|
+
|
|
256
302
|
interface HttpProxyOptions {
|
|
257
303
|
runtime: ProxyRuntime;
|
|
258
304
|
port?: number;
|
|
@@ -268,14 +314,7 @@ interface HttpProxy {
|
|
|
268
314
|
token: string;
|
|
269
315
|
close(): Promise<void>;
|
|
270
316
|
}
|
|
271
|
-
|
|
272
|
-
url: string;
|
|
273
|
-
baseUrl: string;
|
|
274
|
-
token: string;
|
|
275
|
-
pid: number;
|
|
276
|
-
startedAt: string;
|
|
277
|
-
}
|
|
278
|
-
declare function registrationPath(stateDir: string): string;
|
|
317
|
+
|
|
279
318
|
declare function startHttpProxy(opts: HttpProxyOptions): Promise<HttpProxy>;
|
|
280
319
|
|
|
281
320
|
/** Tiny argv parser: `--flag value`, `--flag=value`, `--bool`, `--no-bool`, repeated flags → arrays. */
|
|
@@ -292,6 +331,8 @@ interface Io {
|
|
|
292
331
|
env: NodeJS.ProcessEnv;
|
|
293
332
|
/** false when stdout is a pipe — an MCP client spawned us and wants a server, not the help text */
|
|
294
333
|
tty?: boolean;
|
|
334
|
+
/** everything on stdin (hook mode reads the harness's JSON from it) */
|
|
335
|
+
stdin?: () => Promise<string>;
|
|
295
336
|
}
|
|
296
337
|
declare function loadPolicyFor(args: ParsedArgs, io: Io, opts?: {
|
|
297
338
|
allowMissingEnv?: boolean;
|
|
@@ -490,7 +531,32 @@ interface DemoOptions {
|
|
|
490
531
|
/** Drive a connected client through the scripted scenario. Returns every step's outcome. */
|
|
491
532
|
declare function runDemoAgent(client: Client, opts?: DemoOptions): Promise<DemoStep[]>;
|
|
492
533
|
|
|
493
|
-
declare const
|
|
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 = "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 hooks install [--project|--user] [--client claude|codex|gemini|all]\n check a coding agent's own shell commands and file edits against agentguard.yaml (dry-run first);\n irreversible commands (push, merge, publish, send, rm outside the repo) only on a turn a person typed\n agentguard hooks uninstall | status\n agentguard hook pre-tool-use what the installed hook runs (reads the harness's JSON on stdin)\n\n agentguard audit [--since 7d|30d|all] [--client claude|codex|all] [--json]\n which rules in CLAUDE.md / AGENTS.md / GEMINI.md / .cursor/rules your coding agents broke,\n from this machine's Claude Code and Codex sessions in this repo (nothing is sent anywhere)\n agentguard audit --enforce [--preview]\n write the checkable rules into agentguard.yaml as hook rules, in dry-run, and install the hook\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";
|
|
494
560
|
declare function main(argv: readonly string[], io?: Io): Promise<number>;
|
|
495
561
|
|
|
496
|
-
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 };
|