clawsec 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.
- package/README.md +560 -0
- package/dist/bin/clawsec.d.ts +7 -0
- package/dist/bin/clawsec.d.ts.map +1 -0
- package/dist/bin/clawsec.js +12 -0
- package/dist/bin/clawsec.js.map +1 -0
- package/dist/src/actions/block.d.ts +22 -0
- package/dist/src/actions/block.d.ts.map +1 -0
- package/dist/src/actions/block.js +83 -0
- package/dist/src/actions/block.js.map +1 -0
- package/dist/src/actions/confirm.d.ts +35 -0
- package/dist/src/actions/confirm.d.ts.map +1 -0
- package/dist/src/actions/confirm.js +156 -0
- package/dist/src/actions/confirm.js.map +1 -0
- package/dist/src/actions/executor.d.ts +64 -0
- package/dist/src/actions/executor.d.ts.map +1 -0
- package/dist/src/actions/executor.js +114 -0
- package/dist/src/actions/executor.js.map +1 -0
- package/dist/src/actions/index.d.ts +13 -0
- package/dist/src/actions/index.d.ts.map +1 -0
- package/dist/src/actions/index.js +15 -0
- package/dist/src/actions/index.js.map +1 -0
- package/dist/src/actions/log.d.ts +19 -0
- package/dist/src/actions/log.d.ts.map +1 -0
- package/dist/src/actions/log.js +63 -0
- package/dist/src/actions/log.js.map +1 -0
- package/dist/src/actions/types.d.ts +85 -0
- package/dist/src/actions/types.d.ts.map +1 -0
- package/dist/src/actions/types.js +78 -0
- package/dist/src/actions/types.js.map +1 -0
- package/dist/src/actions/warn.d.ts +22 -0
- package/dist/src/actions/warn.d.ts.map +1 -0
- package/dist/src/actions/warn.js +84 -0
- package/dist/src/actions/warn.js.map +1 -0
- package/dist/src/approval/agent-confirm.d.ts +104 -0
- package/dist/src/approval/agent-confirm.d.ts.map +1 -0
- package/dist/src/approval/agent-confirm.js +173 -0
- package/dist/src/approval/agent-confirm.js.map +1 -0
- package/dist/src/approval/index.d.ts +14 -0
- package/dist/src/approval/index.d.ts.map +1 -0
- package/dist/src/approval/index.js +9 -0
- package/dist/src/approval/index.js.map +1 -0
- package/dist/src/approval/native.d.ts +56 -0
- package/dist/src/approval/native.d.ts.map +1 -0
- package/dist/src/approval/native.js +196 -0
- package/dist/src/approval/native.js.map +1 -0
- package/dist/src/approval/store.d.ts +88 -0
- package/dist/src/approval/store.d.ts.map +1 -0
- package/dist/src/approval/store.js +192 -0
- package/dist/src/approval/store.js.map +1 -0
- package/dist/src/approval/types.d.ts +119 -0
- package/dist/src/approval/types.d.ts.map +1 -0
- package/dist/src/approval/types.js +6 -0
- package/dist/src/approval/types.js.map +1 -0
- package/dist/src/approval/webhook.d.ts +170 -0
- package/dist/src/approval/webhook.d.ts.map +1 -0
- package/dist/src/approval/webhook.js +362 -0
- package/dist/src/approval/webhook.js.map +1 -0
- package/dist/src/cli/commands/audit.d.ts +43 -0
- package/dist/src/cli/commands/audit.d.ts.map +1 -0
- package/dist/src/cli/commands/audit.js +115 -0
- package/dist/src/cli/commands/audit.js.map +1 -0
- package/dist/src/cli/commands/feedback.d.ts +27 -0
- package/dist/src/cli/commands/feedback.d.ts.map +1 -0
- package/dist/src/cli/commands/feedback.js +228 -0
- package/dist/src/cli/commands/feedback.js.map +1 -0
- package/dist/src/cli/commands/index.d.ts +11 -0
- package/dist/src/cli/commands/index.d.ts.map +1 -0
- package/dist/src/cli/commands/index.js +13 -0
- package/dist/src/cli/commands/index.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +20 -0
- package/dist/src/cli/commands/status.d.ts.map +1 -0
- package/dist/src/cli/commands/status.js +122 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/commands/test.d.ts +23 -0
- package/dist/src/cli/commands/test.d.ts.map +1 -0
- package/dist/src/cli/commands/test.js +134 -0
- package/dist/src/cli/commands/test.js.map +1 -0
- package/dist/src/cli/commands/types.d.ts +81 -0
- package/dist/src/cli/commands/types.d.ts.map +1 -0
- package/dist/src/cli/commands/types.js +6 -0
- package/dist/src/cli/commands/types.js.map +1 -0
- package/dist/src/cli/index.d.ts +17 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +267 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/config/defaults.d.ts +20 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +123 -0
- package/dist/src/config/defaults.js.map +1 -0
- package/dist/src/config/index.d.ts +8 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +41 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/loader.d.ts +99 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +242 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/config/schema.d.ts +627 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +585 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/detectors/destructive/cloud-detector.d.ts +51 -0
- package/dist/src/detectors/destructive/cloud-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/cloud-detector.js +556 -0
- package/dist/src/detectors/destructive/cloud-detector.js.map +1 -0
- package/dist/src/detectors/destructive/code-detector.d.ts +59 -0
- package/dist/src/detectors/destructive/code-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/code-detector.js +558 -0
- package/dist/src/detectors/destructive/code-detector.js.map +1 -0
- package/dist/src/detectors/destructive/index.d.ts +54 -0
- package/dist/src/detectors/destructive/index.d.ts.map +1 -0
- package/dist/src/detectors/destructive/index.js +168 -0
- package/dist/src/detectors/destructive/index.js.map +1 -0
- package/dist/src/detectors/destructive/shell-detector.d.ts +43 -0
- package/dist/src/detectors/destructive/shell-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/shell-detector.js +302 -0
- package/dist/src/detectors/destructive/shell-detector.js.map +1 -0
- package/dist/src/detectors/destructive/types.d.ts +143 -0
- package/dist/src/detectors/destructive/types.d.ts.map +1 -0
- package/dist/src/detectors/destructive/types.js +6 -0
- package/dist/src/detectors/destructive/types.js.map +1 -0
- package/dist/src/detectors/exfiltration/cloud-detector.d.ts +51 -0
- package/dist/src/detectors/exfiltration/cloud-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/cloud-detector.js +427 -0
- package/dist/src/detectors/exfiltration/cloud-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/http-detector.d.ts +47 -0
- package/dist/src/detectors/exfiltration/http-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/http-detector.js +429 -0
- package/dist/src/detectors/exfiltration/http-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/index.d.ts +44 -0
- package/dist/src/detectors/exfiltration/index.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/index.js +118 -0
- package/dist/src/detectors/exfiltration/index.js.map +1 -0
- package/dist/src/detectors/exfiltration/network-detector.d.ts +55 -0
- package/dist/src/detectors/exfiltration/network-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/network-detector.js +504 -0
- package/dist/src/detectors/exfiltration/network-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/types.d.ts +139 -0
- package/dist/src/detectors/exfiltration/types.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/types.js +6 -0
- package/dist/src/detectors/exfiltration/types.js.map +1 -0
- package/dist/src/detectors/purchase/domain-detector.d.ts +44 -0
- package/dist/src/detectors/purchase/domain-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/domain-detector.js +296 -0
- package/dist/src/detectors/purchase/domain-detector.js.map +1 -0
- package/dist/src/detectors/purchase/form-detector.d.ts +27 -0
- package/dist/src/detectors/purchase/form-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/form-detector.js +344 -0
- package/dist/src/detectors/purchase/form-detector.js.map +1 -0
- package/dist/src/detectors/purchase/index.d.ts +65 -0
- package/dist/src/detectors/purchase/index.d.ts.map +1 -0
- package/dist/src/detectors/purchase/index.js +216 -0
- package/dist/src/detectors/purchase/index.js.map +1 -0
- package/dist/src/detectors/purchase/spend-tracker.d.ts +132 -0
- package/dist/src/detectors/purchase/spend-tracker.d.ts.map +1 -0
- package/dist/src/detectors/purchase/spend-tracker.js +313 -0
- package/dist/src/detectors/purchase/spend-tracker.js.map +1 -0
- package/dist/src/detectors/purchase/types.d.ts +139 -0
- package/dist/src/detectors/purchase/types.d.ts.map +1 -0
- package/dist/src/detectors/purchase/types.js +6 -0
- package/dist/src/detectors/purchase/types.js.map +1 -0
- package/dist/src/detectors/purchase/url-detector.d.ts +31 -0
- package/dist/src/detectors/purchase/url-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/url-detector.js +292 -0
- package/dist/src/detectors/purchase/url-detector.js.map +1 -0
- package/dist/src/detectors/secrets/api-key-detector.d.ts +30 -0
- package/dist/src/detectors/secrets/api-key-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/api-key-detector.js +297 -0
- package/dist/src/detectors/secrets/api-key-detector.js.map +1 -0
- package/dist/src/detectors/secrets/index.d.ts +43 -0
- package/dist/src/detectors/secrets/index.d.ts.map +1 -0
- package/dist/src/detectors/secrets/index.js +261 -0
- package/dist/src/detectors/secrets/index.js.map +1 -0
- package/dist/src/detectors/secrets/pii-detector.d.ts +54 -0
- package/dist/src/detectors/secrets/pii-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/pii-detector.js +286 -0
- package/dist/src/detectors/secrets/pii-detector.js.map +1 -0
- package/dist/src/detectors/secrets/token-detector.d.ts +51 -0
- package/dist/src/detectors/secrets/token-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/token-detector.js +233 -0
- package/dist/src/detectors/secrets/token-detector.js.map +1 -0
- package/dist/src/detectors/secrets/types.d.ts +157 -0
- package/dist/src/detectors/secrets/types.d.ts.map +1 -0
- package/dist/src/detectors/secrets/types.js +6 -0
- package/dist/src/detectors/secrets/types.js.map +1 -0
- package/dist/src/detectors/website/category-detector.d.ts +22 -0
- package/dist/src/detectors/website/category-detector.d.ts.map +1 -0
- package/dist/src/detectors/website/category-detector.js +162 -0
- package/dist/src/detectors/website/category-detector.js.map +1 -0
- package/dist/src/detectors/website/index.d.ts +53 -0
- package/dist/src/detectors/website/index.d.ts.map +1 -0
- package/dist/src/detectors/website/index.js +232 -0
- package/dist/src/detectors/website/index.js.map +1 -0
- package/dist/src/detectors/website/pattern-matcher.d.ts +33 -0
- package/dist/src/detectors/website/pattern-matcher.d.ts.map +1 -0
- package/dist/src/detectors/website/pattern-matcher.js +121 -0
- package/dist/src/detectors/website/pattern-matcher.js.map +1 -0
- package/dist/src/detectors/website/types.d.ts +105 -0
- package/dist/src/detectors/website/types.d.ts.map +1 -0
- package/dist/src/detectors/website/types.js +6 -0
- package/dist/src/detectors/website/types.js.map +1 -0
- package/dist/src/engine/analyzer.d.ts +87 -0
- package/dist/src/engine/analyzer.d.ts.map +1 -0
- package/dist/src/engine/analyzer.js +427 -0
- package/dist/src/engine/analyzer.js.map +1 -0
- package/dist/src/engine/cache.d.ts +80 -0
- package/dist/src/engine/cache.d.ts.map +1 -0
- package/dist/src/engine/cache.js +167 -0
- package/dist/src/engine/cache.js.map +1 -0
- package/dist/src/engine/index.d.ts +11 -0
- package/dist/src/engine/index.d.ts.map +1 -0
- package/dist/src/engine/index.js +11 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/engine/llm-client.d.ts +210 -0
- package/dist/src/engine/llm-client.d.ts.map +1 -0
- package/dist/src/engine/llm-client.js +506 -0
- package/dist/src/engine/llm-client.js.map +1 -0
- package/dist/src/engine/types.d.ts +163 -0
- package/dist/src/engine/types.d.ts.map +1 -0
- package/dist/src/engine/types.js +21 -0
- package/dist/src/engine/types.js.map +1 -0
- package/dist/src/feedback/index.d.ts +9 -0
- package/dist/src/feedback/index.d.ts.map +1 -0
- package/dist/src/feedback/index.js +8 -0
- package/dist/src/feedback/index.js.map +1 -0
- package/dist/src/feedback/learner.d.ts +222 -0
- package/dist/src/feedback/learner.d.ts.map +1 -0
- package/dist/src/feedback/learner.js +401 -0
- package/dist/src/feedback/learner.js.map +1 -0
- package/dist/src/feedback/store.d.ts +113 -0
- package/dist/src/feedback/store.d.ts.map +1 -0
- package/dist/src/feedback/store.js +228 -0
- package/dist/src/feedback/store.js.map +1 -0
- package/dist/src/feedback/types.d.ts +126 -0
- package/dist/src/feedback/types.d.ts.map +1 -0
- package/dist/src/feedback/types.js +6 -0
- package/dist/src/feedback/types.js.map +1 -0
- package/dist/src/hooks/before-agent-start/handler.d.ts +37 -0
- package/dist/src/hooks/before-agent-start/handler.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/handler.js +109 -0
- package/dist/src/hooks/before-agent-start/handler.js.map +1 -0
- package/dist/src/hooks/before-agent-start/index.d.ts +8 -0
- package/dist/src/hooks/before-agent-start/index.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/index.js +7 -0
- package/dist/src/hooks/before-agent-start/index.js.map +1 -0
- package/dist/src/hooks/before-agent-start/prompts.d.ts +48 -0
- package/dist/src/hooks/before-agent-start/prompts.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/prompts.js +103 -0
- package/dist/src/hooks/before-agent-start/prompts.js.map +1 -0
- package/dist/src/hooks/before-tool-call/handler.d.ts +42 -0
- package/dist/src/hooks/before-tool-call/handler.d.ts.map +1 -0
- package/dist/src/hooks/before-tool-call/handler.js +226 -0
- package/dist/src/hooks/before-tool-call/handler.js.map +1 -0
- package/dist/src/hooks/before-tool-call/index.d.ts +7 -0
- package/dist/src/hooks/before-tool-call/index.d.ts.map +1 -0
- package/dist/src/hooks/before-tool-call/index.js +6 -0
- package/dist/src/hooks/before-tool-call/index.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/filter.d.ts +72 -0
- package/dist/src/hooks/tool-result-persist/filter.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/filter.js +305 -0
- package/dist/src/hooks/tool-result-persist/filter.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/handler.d.ts +49 -0
- package/dist/src/hooks/tool-result-persist/handler.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/handler.js +217 -0
- package/dist/src/hooks/tool-result-persist/handler.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/index.d.ts +11 -0
- package/dist/src/hooks/tool-result-persist/index.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/index.js +11 -0
- package/dist/src/hooks/tool-result-persist/index.js.map +1 -0
- package/dist/src/index.d.ts +256 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +222 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/notifications/discord.d.ts +10 -0
- package/dist/src/notifications/discord.d.ts.map +1 -0
- package/dist/src/notifications/discord.js +218 -0
- package/dist/src/notifications/discord.js.map +1 -0
- package/dist/src/notifications/index.d.ts +37 -0
- package/dist/src/notifications/index.d.ts.map +1 -0
- package/dist/src/notifications/index.js +68 -0
- package/dist/src/notifications/index.js.map +1 -0
- package/dist/src/notifications/slack.d.ts +10 -0
- package/dist/src/notifications/slack.d.ts.map +1 -0
- package/dist/src/notifications/slack.js +218 -0
- package/dist/src/notifications/slack.js.map +1 -0
- package/dist/src/notifications/telegram.d.ts +10 -0
- package/dist/src/notifications/telegram.d.ts.map +1 -0
- package/dist/src/notifications/telegram.js +242 -0
- package/dist/src/notifications/telegram.js.map +1 -0
- package/dist/src/notifications/types.d.ts +119 -0
- package/dist/src/notifications/types.d.ts.map +1 -0
- package/dist/src/notifications/types.js +6 -0
- package/dist/src/notifications/types.js.map +1 -0
- package/dist/src/proxy/index.d.ts +8 -0
- package/dist/src/proxy/index.d.ts.map +1 -0
- package/dist/src/proxy/index.js +9 -0
- package/dist/src/proxy/index.js.map +1 -0
- package/dist/src/proxy/middleware.d.ts +55 -0
- package/dist/src/proxy/middleware.d.ts.map +1 -0
- package/dist/src/proxy/middleware.js +215 -0
- package/dist/src/proxy/middleware.js.map +1 -0
- package/dist/src/proxy/server.d.ts +57 -0
- package/dist/src/proxy/server.d.ts.map +1 -0
- package/dist/src/proxy/server.js +298 -0
- package/dist/src/proxy/server.js.map +1 -0
- package/dist/src/proxy/types.d.ts +136 -0
- package/dist/src/proxy/types.d.ts.map +1 -0
- package/dist/src/proxy/types.js +6 -0
- package/dist/src/proxy/types.js.map +1 -0
- package/dist/src/sanitization/index.d.ts +10 -0
- package/dist/src/sanitization/index.d.ts.map +1 -0
- package/dist/src/sanitization/index.js +9 -0
- package/dist/src/sanitization/index.js.map +1 -0
- package/dist/src/sanitization/patterns.d.ts +51 -0
- package/dist/src/sanitization/patterns.d.ts.map +1 -0
- package/dist/src/sanitization/patterns.js +266 -0
- package/dist/src/sanitization/patterns.js.map +1 -0
- package/dist/src/sanitization/scanner.d.ts +29 -0
- package/dist/src/sanitization/scanner.d.ts.map +1 -0
- package/dist/src/sanitization/scanner.js +328 -0
- package/dist/src/sanitization/scanner.js.map +1 -0
- package/dist/src/sanitization/types.d.ts +57 -0
- package/dist/src/sanitization/types.d.ts.map +1 -0
- package/dist/src/sanitization/types.js +5 -0
- package/dist/src/sanitization/types.js.map +1 -0
- package/openclaw.plugin.json +114 -0
- package/package.json +63 -0
- package/rules/builtin/README.md +139 -0
- package/rules/builtin/ai-services.yaml +70 -0
- package/rules/builtin/api-keys.yaml +64 -0
- package/rules/builtin/authentication.yaml +56 -0
- package/rules/builtin/aws-security.yaml +57 -0
- package/rules/builtin/azure-security.yaml +58 -0
- package/rules/builtin/cicd-security.yaml +64 -0
- package/rules/builtin/cloud-storage.yaml +64 -0
- package/rules/builtin/container-registry.yaml +55 -0
- package/rules/builtin/crypto-wallets.yaml +71 -0
- package/rules/builtin/database-nosql.yaml +58 -0
- package/rules/builtin/database-sql.yaml +62 -0
- package/rules/builtin/development-env.yaml +67 -0
- package/rules/builtin/docker.yaml +57 -0
- package/rules/builtin/filesystem.yaml +71 -0
- package/rules/builtin/financial-pci.yaml +61 -0
- package/rules/builtin/gcp-security.yaml +57 -0
- package/rules/builtin/git-operations.yaml +68 -0
- package/rules/builtin/healthcare-hipaa.yaml +64 -0
- package/rules/builtin/kubernetes.yaml +60 -0
- package/rules/builtin/messaging-services.yaml +53 -0
- package/rules/builtin/minimal.yaml +47 -0
- package/rules/builtin/mobile-development.yaml +61 -0
- package/rules/builtin/monitoring.yaml +63 -0
- package/rules/builtin/network-security.yaml +57 -0
- package/rules/builtin/package-managers.yaml +74 -0
- package/rules/builtin/payment-processing.yaml +66 -0
- package/rules/builtin/pii-protection.yaml +48 -0
- package/rules/builtin/production-strict.yaml +55 -0
- package/rules/builtin/secrets-management.yaml +63 -0
- package/rules/builtin/serverless.yaml +74 -0
- package/rules/builtin/ssh-security.yaml +66 -0
- package/rules/builtin/terraform.yaml +51 -0
- package/rules/builtin/web-security.yaml +62 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native Approval Handler
|
|
3
|
+
* Handles the /approve and /deny commands for OpenClaw native approval flow
|
|
4
|
+
*/
|
|
5
|
+
import { getDefaultApprovalStore } from './store.js';
|
|
6
|
+
/**
|
|
7
|
+
* Default implementation of the native approval handler
|
|
8
|
+
*/
|
|
9
|
+
export class DefaultNativeApprovalHandler {
|
|
10
|
+
store;
|
|
11
|
+
constructor(config = {}) {
|
|
12
|
+
this.store = config.store ?? getDefaultApprovalStore();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Handle an /approve command
|
|
16
|
+
*/
|
|
17
|
+
handleApprove(id, userId) {
|
|
18
|
+
// Validate ID format
|
|
19
|
+
if (!id || typeof id !== 'string' || id.trim() === '') {
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
message: 'Invalid approval ID: ID cannot be empty',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const trimmedId = id.trim();
|
|
26
|
+
// Get the record
|
|
27
|
+
const record = this.store.get(trimmedId);
|
|
28
|
+
if (!record) {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
message: `Approval not found: No pending approval with ID "${trimmedId}"`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Check status
|
|
35
|
+
if (record.status === 'expired') {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
message: `Approval expired: The approval "${trimmedId}" has expired`,
|
|
39
|
+
record,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (record.status === 'approved') {
|
|
43
|
+
return {
|
|
44
|
+
success: false,
|
|
45
|
+
message: `Already approved: The approval "${trimmedId}" was already approved`,
|
|
46
|
+
record,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (record.status === 'denied') {
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
message: `Already denied: The approval "${trimmedId}" was already denied`,
|
|
53
|
+
record,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Attempt to approve
|
|
57
|
+
const success = this.store.approve(trimmedId, userId);
|
|
58
|
+
if (!success) {
|
|
59
|
+
// This shouldn't happen if our logic is correct, but handle it gracefully
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
message: `Failed to approve: Unable to approve "${trimmedId}"`,
|
|
63
|
+
record: this.store.get(trimmedId),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Get the updated record
|
|
67
|
+
const approvedRecord = this.store.get(trimmedId);
|
|
68
|
+
return {
|
|
69
|
+
success: true,
|
|
70
|
+
message: this.formatApprovalMessage(approvedRecord),
|
|
71
|
+
record: approvedRecord,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Handle a deny/reject command
|
|
76
|
+
*/
|
|
77
|
+
handleDeny(id) {
|
|
78
|
+
// Validate ID format
|
|
79
|
+
if (!id || typeof id !== 'string' || id.trim() === '') {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
message: 'Invalid approval ID: ID cannot be empty',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const trimmedId = id.trim();
|
|
86
|
+
// Get the record
|
|
87
|
+
const record = this.store.get(trimmedId);
|
|
88
|
+
if (!record) {
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
message: `Approval not found: No pending approval with ID "${trimmedId}"`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Check status
|
|
95
|
+
if (record.status === 'expired') {
|
|
96
|
+
return {
|
|
97
|
+
success: false,
|
|
98
|
+
message: `Approval expired: The approval "${trimmedId}" has expired`,
|
|
99
|
+
record,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (record.status === 'approved') {
|
|
103
|
+
return {
|
|
104
|
+
success: false,
|
|
105
|
+
message: `Already approved: The approval "${trimmedId}" was already approved and cannot be denied`,
|
|
106
|
+
record,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (record.status === 'denied') {
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
message: `Already denied: The approval "${trimmedId}" was already denied`,
|
|
113
|
+
record,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// Attempt to deny
|
|
117
|
+
const success = this.store.deny(trimmedId);
|
|
118
|
+
if (!success) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
message: `Failed to deny: Unable to deny "${trimmedId}"`,
|
|
122
|
+
record: this.store.get(trimmedId),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// Get the updated record
|
|
126
|
+
const deniedRecord = this.store.get(trimmedId);
|
|
127
|
+
return {
|
|
128
|
+
success: true,
|
|
129
|
+
message: `Denied: The action for tool "${deniedRecord.toolCall.toolName}" has been denied`,
|
|
130
|
+
record: deniedRecord,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if a specific approval has been granted
|
|
135
|
+
*/
|
|
136
|
+
isApproved(id) {
|
|
137
|
+
if (!id || typeof id !== 'string') {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
const record = this.store.get(id.trim());
|
|
141
|
+
return record?.status === 'approved';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get all pending approval records
|
|
145
|
+
*/
|
|
146
|
+
getPendingApprovals() {
|
|
147
|
+
return this.store.getPending();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Format a success message for an approved action
|
|
151
|
+
*/
|
|
152
|
+
formatApprovalMessage(record) {
|
|
153
|
+
const toolName = record.toolCall.toolName;
|
|
154
|
+
const category = this.formatCategory(record.detection.category);
|
|
155
|
+
return `Approved: You may now retry the ${category.toLowerCase()} action using tool "${toolName}"`;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Format a threat category for display
|
|
159
|
+
*/
|
|
160
|
+
formatCategory(category) {
|
|
161
|
+
const categoryNames = {
|
|
162
|
+
purchase: 'Purchase/Payment',
|
|
163
|
+
website: 'Website Access',
|
|
164
|
+
destructive: 'Destructive Command',
|
|
165
|
+
secrets: 'Secrets/PII',
|
|
166
|
+
exfiltration: 'Data Transfer',
|
|
167
|
+
};
|
|
168
|
+
return categoryNames[category] || category;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create a native approval handler with the given configuration
|
|
173
|
+
*/
|
|
174
|
+
export function createNativeApprovalHandler(config) {
|
|
175
|
+
return new DefaultNativeApprovalHandler(config);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Default singleton handler instance
|
|
179
|
+
*/
|
|
180
|
+
let defaultHandler = null;
|
|
181
|
+
/**
|
|
182
|
+
* Get the default native approval handler singleton
|
|
183
|
+
*/
|
|
184
|
+
export function getDefaultNativeApprovalHandler() {
|
|
185
|
+
if (!defaultHandler) {
|
|
186
|
+
defaultHandler = createNativeApprovalHandler();
|
|
187
|
+
}
|
|
188
|
+
return defaultHandler;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Reset the default handler (mainly for testing)
|
|
192
|
+
*/
|
|
193
|
+
export function resetDefaultNativeApprovalHandler() {
|
|
194
|
+
defaultHandler = null;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/approval/native.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAUrD;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAC/B,KAAK,CAAgB;IAE7B,YAAY,SAAsC,EAAE;QAClD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,uBAAuB,EAAE,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,EAAU,EAAE,MAAe;QACvC,qBAAqB;QACrB,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACtD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,yCAAyC;aACnD,CAAC;QACJ,CAAC;QAED,MAAM,SAAS,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;QAE5B,iBAAiB;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,oDAAoD,SAAS,GAAG;aAC1E,CAAC;QACJ,CAAC;QAED,eAAe;QACf,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,mCAAmC,SAAS,eAAe;gBACpE,MAAM;aACP,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,mCAAmC,SAAS,wBAAwB;gBAC7E,M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88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-Memory Approval Store
|
|
3
|
+
* Stores and manages pending approval records with TTL and auto-cleanup
|
|
4
|
+
*/
|
|
5
|
+
import type { ApprovalStore, PendingApprovalRecord, PendingApprovalInput } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for the approval store
|
|
8
|
+
*/
|
|
9
|
+
export interface ApprovalStoreConfig {
|
|
10
|
+
/** Interval in milliseconds for automatic cleanup (0 to disable) */
|
|
11
|
+
cleanupIntervalMs?: number;
|
|
12
|
+
/** Whether to remove expired entries on cleanup (vs just marking them expired) */
|
|
13
|
+
removeOnExpiry?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* In-memory implementation of the approval store
|
|
17
|
+
*/
|
|
18
|
+
export declare class InMemoryApprovalStore implements ApprovalStore {
|
|
19
|
+
private records;
|
|
20
|
+
private cleanupTimer;
|
|
21
|
+
private removeOnExpiry;
|
|
22
|
+
constructor(config?: ApprovalStoreConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Start the periodic cleanup timer
|
|
25
|
+
*/
|
|
26
|
+
private startCleanupTimer;
|
|
27
|
+
/**
|
|
28
|
+
* Stop the cleanup timer (useful for testing)
|
|
29
|
+
*/
|
|
30
|
+
stopCleanupTimer(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Add a new pending approval record
|
|
33
|
+
*/
|
|
34
|
+
add(record: PendingApprovalInput): void;
|
|
35
|
+
/**
|
|
36
|
+
* Get an approval record by ID
|
|
37
|
+
* Also checks and updates expiration status
|
|
38
|
+
*/
|
|
39
|
+
get(id: string): PendingApprovalRecord | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Mark an approval as approved
|
|
42
|
+
* Only works if the approval is still pending and not expired
|
|
43
|
+
*/
|
|
44
|
+
approve(id: string, approvedBy?: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Mark an approval as denied
|
|
47
|
+
* Only works if the approval is still pending and not expired
|
|
48
|
+
*/
|
|
49
|
+
deny(id: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Remove an approval record
|
|
52
|
+
*/
|
|
53
|
+
remove(id: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Clean up expired entries
|
|
56
|
+
* Updates status of expired entries and optionally removes them
|
|
57
|
+
*/
|
|
58
|
+
cleanup(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get all pending approval records
|
|
61
|
+
* Checks expiration before returning
|
|
62
|
+
*/
|
|
63
|
+
getPending(): PendingApprovalRecord[];
|
|
64
|
+
/**
|
|
65
|
+
* Get the total number of records in the store
|
|
66
|
+
* Useful for testing
|
|
67
|
+
*/
|
|
68
|
+
size(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Clear all records from the store
|
|
71
|
+
* Useful for testing
|
|
72
|
+
*/
|
|
73
|
+
clear(): void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create an in-memory approval store with the given configuration
|
|
77
|
+
*/
|
|
78
|
+
export declare function createApprovalStore(config?: ApprovalStoreConfig): InMemoryApprovalStore;
|
|
79
|
+
/**
|
|
80
|
+
* Get the default approval store singleton
|
|
81
|
+
* Creates it on first call
|
|
82
|
+
*/
|
|
83
|
+
export declare function getDefaultApprovalStore(): InMemoryApprovalStore;
|
|
84
|
+
/**
|
|
85
|
+
* Reset the default store (mainly for testing)
|
|
86
|
+
*/
|
|
87
|
+
export declare function resetDefaultApprovalStore(): void;
|
|
88
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/approval/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAKD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,OAAO,CAAiD;IAChE,OAAO,CAAC,YAAY,CAA+C;IACnE,OAAO,CAAC,cAAc,CAAU;gBAEpB,MAAM,GAAE,mBAAwB;IAS5C;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;OAEG;IACI,gBAAgB,IAAI,IAAI;IAO/B;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;IAQvC;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAclD;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO;IAiBjD;;;OAGG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAezB;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIxB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAqBf;;;OAGG;IACH,UAAU,IAAI,qBAAqB,EAAE;IAkBrC;;;OAGG;IACH,IAAI,IAAI,MAAM;IAId;;;OAGG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,qBAAqB,CAEvF;AAQD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,qBAAqB,CAK/D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAMhD"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-Memory Approval Store
|
|
3
|
+
* Stores and manages pending approval records with TTL and auto-cleanup
|
|
4
|
+
*/
|
|
5
|
+
/** Default cleanup interval: 60 seconds */
|
|
6
|
+
const DEFAULT_CLEANUP_INTERVAL_MS = 60_000;
|
|
7
|
+
/**
|
|
8
|
+
* In-memory implementation of the approval store
|
|
9
|
+
*/
|
|
10
|
+
export class InMemoryApprovalStore {
|
|
11
|
+
records = new Map();
|
|
12
|
+
cleanupTimer = null;
|
|
13
|
+
removeOnExpiry;
|
|
14
|
+
constructor(config = {}) {
|
|
15
|
+
this.removeOnExpiry = config.removeOnExpiry ?? false;
|
|
16
|
+
const cleanupInterval = config.cleanupIntervalMs ?? DEFAULT_CLEANUP_INTERVAL_MS;
|
|
17
|
+
if (cleanupInterval > 0) {
|
|
18
|
+
this.startCleanupTimer(cleanupInterval);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Start the periodic cleanup timer
|
|
23
|
+
*/
|
|
24
|
+
startCleanupTimer(intervalMs) {
|
|
25
|
+
this.cleanupTimer = setInterval(() => {
|
|
26
|
+
this.cleanup();
|
|
27
|
+
}, intervalMs);
|
|
28
|
+
// Unref the timer so it doesn't keep the process alive
|
|
29
|
+
if (this.cleanupTimer.unref) {
|
|
30
|
+
this.cleanupTimer.unref();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Stop the cleanup timer (useful for testing)
|
|
35
|
+
*/
|
|
36
|
+
stopCleanupTimer() {
|
|
37
|
+
if (this.cleanupTimer) {
|
|
38
|
+
clearInterval(this.cleanupTimer);
|
|
39
|
+
this.cleanupTimer = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Add a new pending approval record
|
|
44
|
+
*/
|
|
45
|
+
add(record) {
|
|
46
|
+
const fullRecord = {
|
|
47
|
+
...record,
|
|
48
|
+
status: 'pending',
|
|
49
|
+
};
|
|
50
|
+
this.records.set(record.id, fullRecord);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get an approval record by ID
|
|
54
|
+
* Also checks and updates expiration status
|
|
55
|
+
*/
|
|
56
|
+
get(id) {
|
|
57
|
+
const record = this.records.get(id);
|
|
58
|
+
if (!record) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
// Check if expired and update status
|
|
62
|
+
if (record.status === 'pending' && Date.now() > record.expiresAt) {
|
|
63
|
+
record.status = 'expired';
|
|
64
|
+
}
|
|
65
|
+
return record;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Mark an approval as approved
|
|
69
|
+
* Only works if the approval is still pending and not expired
|
|
70
|
+
*/
|
|
71
|
+
approve(id, approvedBy) {
|
|
72
|
+
const record = this.get(id);
|
|
73
|
+
if (!record) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
// Can only approve pending records
|
|
77
|
+
if (record.status !== 'pending') {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
record.status = 'approved';
|
|
81
|
+
record.approvedBy = approvedBy;
|
|
82
|
+
record.approvedAt = Date.now();
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Mark an approval as denied
|
|
87
|
+
* Only works if the approval is still pending and not expired
|
|
88
|
+
*/
|
|
89
|
+
deny(id) {
|
|
90
|
+
const record = this.get(id);
|
|
91
|
+
if (!record) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
// Can only deny pending records
|
|
95
|
+
if (record.status !== 'pending') {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
record.status = 'denied';
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Remove an approval record
|
|
103
|
+
*/
|
|
104
|
+
remove(id) {
|
|
105
|
+
this.records.delete(id);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Clean up expired entries
|
|
109
|
+
* Updates status of expired entries and optionally removes them
|
|
110
|
+
*/
|
|
111
|
+
cleanup() {
|
|
112
|
+
const now = Date.now();
|
|
113
|
+
const toRemove = [];
|
|
114
|
+
for (const [id, record] of this.records) {
|
|
115
|
+
// Mark expired pending records
|
|
116
|
+
if (record.status === 'pending' && now > record.expiresAt) {
|
|
117
|
+
record.status = 'expired';
|
|
118
|
+
}
|
|
119
|
+
// Optionally remove expired/processed records
|
|
120
|
+
if (this.removeOnExpiry && record.status !== 'pending') {
|
|
121
|
+
toRemove.push(id);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const id of toRemove) {
|
|
125
|
+
this.records.delete(id);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get all pending approval records
|
|
130
|
+
* Checks expiration before returning
|
|
131
|
+
*/
|
|
132
|
+
getPending() {
|
|
133
|
+
const now = Date.now();
|
|
134
|
+
const pending = [];
|
|
135
|
+
for (const record of this.records.values()) {
|
|
136
|
+
// Update expired status first
|
|
137
|
+
if (record.status === 'pending' && now > record.expiresAt) {
|
|
138
|
+
record.status = 'expired';
|
|
139
|
+
}
|
|
140
|
+
if (record.status === 'pending') {
|
|
141
|
+
pending.push(record);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return pending;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the total number of records in the store
|
|
148
|
+
* Useful for testing
|
|
149
|
+
*/
|
|
150
|
+
size() {
|
|
151
|
+
return this.records.size;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Clear all records from the store
|
|
155
|
+
* Useful for testing
|
|
156
|
+
*/
|
|
157
|
+
clear() {
|
|
158
|
+
this.records.clear();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Create an in-memory approval store with the given configuration
|
|
163
|
+
*/
|
|
164
|
+
export function createApprovalStore(config) {
|
|
165
|
+
return new InMemoryApprovalStore(config);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Default singleton store instance
|
|
169
|
+
* Use this for the main application flow
|
|
170
|
+
*/
|
|
171
|
+
let defaultStore = null;
|
|
172
|
+
/**
|
|
173
|
+
* Get the default approval store singleton
|
|
174
|
+
* Creates it on first call
|
|
175
|
+
*/
|
|
176
|
+
export function getDefaultApprovalStore() {
|
|
177
|
+
if (!defaultStore) {
|
|
178
|
+
defaultStore = createApprovalStore();
|
|
179
|
+
}
|
|
180
|
+
return defaultStore;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Reset the default store (mainly for testing)
|
|
184
|
+
*/
|
|
185
|
+
export function resetDefaultApprovalStore() {
|
|
186
|
+
if (defaultStore) {
|
|
187
|
+
defaultStore.stopCleanupTimer();
|
|
188
|
+
defaultStore.clear();
|
|
189
|
+
defaultStore = null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/approval/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,2CAA2C;AAC3C,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACxB,OAAO,GAAuC,IAAI,GAAG,EAAE,CAAC;IACxD,YAAY,GAA0C,IAAI,CAAC;IAC3D,cAAc,CAAU;IAEhC,YAAY,SAA8B,EAAE;QAC1C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,KAAK,CAAC;QAErD,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,IAAI,2BAA2B,CAAC;QAChF,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,UAAkB;QAC1C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;YACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,EAAE,UAAU,CAAC,CAAC;QAEf,uDAAuD;QACvD,IAAI,IAAI,CAAC,YAAY,CAAC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|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Definitions for Approval System
|
|
3
|
+
* Handles pending approval records and approval operations
|
|
4
|
+
*/
|
|
5
|
+
import type { Detection, ToolCallContext } from '../engine/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Status of a pending approval record
|
|
8
|
+
*/
|
|
9
|
+
export type ApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired';
|
|
10
|
+
/**
|
|
11
|
+
* A pending approval record storing all context needed for approval
|
|
12
|
+
*/
|
|
13
|
+
export interface PendingApprovalRecord {
|
|
14
|
+
/** Unique identifier for this approval */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Timestamp when the approval was created (ms since epoch) */
|
|
17
|
+
createdAt: number;
|
|
18
|
+
/** Timestamp when the approval expires (ms since epoch) */
|
|
19
|
+
expiresAt: number;
|
|
20
|
+
/** The detection that triggered this approval request */
|
|
21
|
+
detection: Detection;
|
|
22
|
+
/** The tool call context that requires approval */
|
|
23
|
+
toolCall: ToolCallContext;
|
|
24
|
+
/** Current status of the approval */
|
|
25
|
+
status: ApprovalStatus;
|
|
26
|
+
/** Who approved the action (if approved) */
|
|
27
|
+
approvedBy?: string;
|
|
28
|
+
/** Timestamp when the approval was granted (ms since epoch) */
|
|
29
|
+
approvedAt?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Input for creating a new approval record (status is set automatically)
|
|
33
|
+
*/
|
|
34
|
+
export type PendingApprovalInput = Omit<PendingApprovalRecord, 'status'>;
|
|
35
|
+
/**
|
|
36
|
+
* Interface for the approval store
|
|
37
|
+
*/
|
|
38
|
+
export interface ApprovalStore {
|
|
39
|
+
/**
|
|
40
|
+
* Add a new pending approval record
|
|
41
|
+
* @param record - The approval record (without status, which defaults to 'pending')
|
|
42
|
+
*/
|
|
43
|
+
add(record: PendingApprovalInput): void;
|
|
44
|
+
/**
|
|
45
|
+
* Get an approval record by ID
|
|
46
|
+
* @param id - The approval ID
|
|
47
|
+
* @returns The approval record or undefined if not found
|
|
48
|
+
*/
|
|
49
|
+
get(id: string): PendingApprovalRecord | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Mark an approval as approved
|
|
52
|
+
* @param id - The approval ID
|
|
53
|
+
* @param approvedBy - Optional identifier for who approved
|
|
54
|
+
* @returns true if successful, false if not found or already processed
|
|
55
|
+
*/
|
|
56
|
+
approve(id: string, approvedBy?: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Mark an approval as denied
|
|
59
|
+
* @param id - The approval ID
|
|
60
|
+
* @returns true if successful, false if not found or already processed
|
|
61
|
+
*/
|
|
62
|
+
deny(id: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Remove an approval record
|
|
65
|
+
* @param id - The approval ID
|
|
66
|
+
*/
|
|
67
|
+
remove(id: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Clean up expired entries
|
|
70
|
+
* Updates status of expired entries and optionally removes them
|
|
71
|
+
*/
|
|
72
|
+
cleanup(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Get all pending approval records
|
|
75
|
+
* @returns Array of pending approval records
|
|
76
|
+
*/
|
|
77
|
+
getPending(): PendingApprovalRecord[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Result of an approval operation
|
|
81
|
+
*/
|
|
82
|
+
export interface ApprovalResult {
|
|
83
|
+
/** Whether the operation succeeded */
|
|
84
|
+
success: boolean;
|
|
85
|
+
/** Human-readable message about the operation */
|
|
86
|
+
message: string;
|
|
87
|
+
/** The approval record (if found) */
|
|
88
|
+
record?: PendingApprovalRecord;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Interface for the native approval handler
|
|
92
|
+
*/
|
|
93
|
+
export interface NativeApprovalHandler {
|
|
94
|
+
/**
|
|
95
|
+
* Handle an /approve command
|
|
96
|
+
* @param id - The approval ID
|
|
97
|
+
* @param userId - Optional identifier for who is approving
|
|
98
|
+
* @returns Result of the approval operation
|
|
99
|
+
*/
|
|
100
|
+
handleApprove(id: string, userId?: string): ApprovalResult;
|
|
101
|
+
/**
|
|
102
|
+
* Handle a deny/reject command
|
|
103
|
+
* @param id - The approval ID
|
|
104
|
+
* @returns Result of the deny operation
|
|
105
|
+
*/
|
|
106
|
+
handleDeny(id: string): ApprovalResult;
|
|
107
|
+
/**
|
|
108
|
+
* Check if a specific approval has been granted
|
|
109
|
+
* @param id - The approval ID
|
|
110
|
+
* @returns true if the approval exists and is approved
|
|
111
|
+
*/
|
|
112
|
+
isApproved(id: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Get all pending approval records
|
|
115
|
+
* @returns Array of pending approval records
|
|
116
|
+
*/
|
|
117
|
+
getPendingApprovals(): PendingApprovalRecord[];
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/approval/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,SAAS,EAAE,SAAS,CAAC;IACrB,mDAAmD;IACnD,QAAQ,EAAE,eAAe,CAAC;IAC1B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MA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