open-multi-agent-kit 0.90.0 → 0.90.4
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 +56 -0
- package/README.md +22 -31
- package/dist/cli/args.d.ts +0 -2
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -7
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts +3 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +27 -19
- package/dist/config.js.map +1 -1
- package/dist/core/adaptorch-bridge.d.ts +257 -0
- package/dist/core/adaptorch-bridge.d.ts.map +1 -0
- package/dist/core/adaptorch-bridge.js +473 -0
- package/dist/core/adaptorch-bridge.js.map +1 -0
- package/dist/core/agent-session.d.ts +132 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +327 -5
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bang-skill-invocation.d.ts +26 -0
- package/dist/core/bang-skill-invocation.d.ts.map +1 -0
- package/dist/core/bang-skill-invocation.js +208 -0
- package/dist/core/bang-skill-invocation.js.map +1 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +15 -2
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/compactor.d.ts.map +1 -1
- package/dist/core/compactor.js +0 -3
- package/dist/core/compactor.js.map +1 -1
- package/dist/core/context-budget-governor-v2.d.ts +2 -1
- package/dist/core/context-budget-governor-v2.d.ts.map +1 -1
- package/dist/core/context-budget-governor-v2.js +1 -0
- package/dist/core/context-budget-governor-v2.js.map +1 -1
- package/dist/core/context-budget-headroom-types.d.ts +8 -0
- package/dist/core/context-budget-headroom-types.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-types.js.map +1 -1
- package/dist/core/context-budget-headroom.d.ts +1 -1
- package/dist/core/context-budget-headroom.d.ts.map +1 -1
- package/dist/core/context-budget-headroom.js +17 -4
- package/dist/core/context-budget-headroom.js.map +1 -1
- package/dist/core/context-budget-system-prompt.d.ts +2 -1
- package/dist/core/context-budget-system-prompt.d.ts.map +1 -1
- package/dist/core/context-budget-system-prompt.js +6 -1
- package/dist/core/context-budget-system-prompt.js.map +1 -1
- package/dist/core/context-budget-v2-cache-hash.d.ts +3 -0
- package/dist/core/context-budget-v2-cache-hash.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-hash.js +16 -0
- package/dist/core/context-budget-v2-cache-hash.js.map +1 -0
- package/dist/core/context-budget-v2-cache-keys.d.ts +58 -0
- package/dist/core/context-budget-v2-cache-keys.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-keys.js +128 -0
- package/dist/core/context-budget-v2-cache-keys.js.map +1 -0
- package/dist/core/context-budget-v2-cache-provider.d.ts +23 -0
- package/dist/core/context-budget-v2-cache-provider.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-provider.js +29 -0
- package/dist/core/context-budget-v2-cache-provider.js.map +1 -0
- package/dist/core/context-budget-v2-cache-telemetry.d.ts +36 -0
- package/dist/core/context-budget-v2-cache-telemetry.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-telemetry.js +64 -0
- package/dist/core/context-budget-v2-cache-telemetry.js.map +1 -0
- package/dist/core/context-budget-v2-cache-validation.d.ts +36 -0
- package/dist/core/context-budget-v2-cache-validation.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-validation.js +98 -0
- package/dist/core/context-budget-v2-cache-validation.js.map +1 -0
- package/dist/core/context-budget-v2-cache.d.ts +36 -0
- package/dist/core/context-budget-v2-cache.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache.js +50 -0
- package/dist/core/context-budget-v2-cache.js.map +1 -0
- package/dist/core/context-budget-v2-plan-cache-keys.d.ts +16 -0
- package/dist/core/context-budget-v2-plan-cache-keys.d.ts.map +1 -0
- package/dist/core/context-budget-v2-plan-cache-keys.js +49 -0
- package/dist/core/context-budget-v2-plan-cache-keys.js.map +1 -0
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +55 -2
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-representation-cache.d.ts +27 -0
- package/dist/core/context-budget-v2-representation-cache.d.ts.map +1 -0
- package/dist/core/context-budget-v2-representation-cache.js +173 -0
- package/dist/core/context-budget-v2-representation-cache.js.map +1 -0
- package/dist/core/context-budget-v2-selection.d.ts +2 -0
- package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
- package/dist/core/context-budget-v2-selection.js +12 -2
- package/dist/core/context-budget-v2-selection.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +107 -1
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/domain-loadouts.d.ts.map +1 -1
- package/dist/core/domain-loadouts.js +1 -1
- package/dist/core/domain-loadouts.js.map +1 -1
- package/dist/core/headroom.d.ts.map +1 -1
- package/dist/core/headroom.js +0 -4
- package/dist/core/headroom.js.map +1 -1
- package/dist/core/hook-inventory.d.ts.map +1 -1
- package/dist/core/hook-inventory.js +6 -0
- package/dist/core/hook-inventory.js.map +1 -1
- package/dist/core/mcp-computer-use-presets.d.ts +64 -0
- package/dist/core/mcp-computer-use-presets.d.ts.map +1 -0
- package/dist/core/mcp-computer-use-presets.js +158 -0
- package/dist/core/mcp-computer-use-presets.js.map +1 -0
- package/dist/core/mcp-public-presets.d.ts +578 -0
- package/dist/core/mcp-public-presets.d.ts.map +1 -0
- package/dist/core/mcp-public-presets.js +647 -0
- package/dist/core/mcp-public-presets.js.map +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +1 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/pi-package-intake-candidates.d.ts +14 -1
- package/dist/core/pi-package-intake-candidates.d.ts.map +1 -1
- package/dist/core/pi-package-intake-candidates.js +182 -0
- package/dist/core/pi-package-intake-candidates.js.map +1 -1
- package/dist/core/pi-package-intake.d.ts +8 -1
- package/dist/core/pi-package-intake.d.ts.map +1 -1
- package/dist/core/pi-package-intake.js +14 -4
- package/dist/core/pi-package-intake.js.map +1 -1
- package/dist/core/reasoning-router-bias.d.ts +119 -0
- package/dist/core/reasoning-router-bias.d.ts.map +1 -0
- package/dist/core/reasoning-router-bias.js +287 -0
- package/dist/core/reasoning-router-bias.js.map +1 -0
- package/dist/core/reasoning-router-v2.d.ts +94 -0
- package/dist/core/reasoning-router-v2.d.ts.map +1 -0
- package/dist/core/reasoning-router-v2.js +288 -0
- package/dist/core/reasoning-router-v2.js.map +1 -0
- package/dist/core/reasoning-router-v3.d.ts +15 -0
- package/dist/core/reasoning-router-v3.d.ts.map +1 -0
- package/dist/core/reasoning-router-v3.js +193 -0
- package/dist/core/reasoning-router-v3.js.map +1 -0
- package/dist/core/reasoning-router-v4-weights.d.ts +124 -0
- package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -0
- package/dist/core/reasoning-router-v4-weights.js +112 -0
- package/dist/core/reasoning-router-v4-weights.js.map +1 -0
- package/dist/core/reasoning-router-v4.d.ts +163 -0
- package/dist/core/reasoning-router-v4.d.ts.map +1 -0
- package/dist/core/reasoning-router-v4.js +683 -0
- package/dist/core/reasoning-router-v4.js.map +1 -0
- package/dist/core/reasoning-router-weights.d.ts +155 -0
- package/dist/core/reasoning-router-weights.d.ts.map +1 -0
- package/dist/core/reasoning-router-weights.js +204 -0
- package/dist/core/reasoning-router-weights.js.map +1 -0
- package/dist/core/reasoning-router.d.ts +44 -0
- package/dist/core/reasoning-router.d.ts.map +1 -0
- package/dist/core/reasoning-router.js +138 -0
- package/dist/core/reasoning-router.js.map +1 -0
- package/dist/core/reverse-skill.d.ts +2 -0
- package/dist/core/reverse-skill.d.ts.map +1 -0
- package/dist/core/reverse-skill.js +7 -0
- package/dist/core/reverse-skill.js.map +1 -0
- package/dist/core/router-feedback-collector.d.ts +101 -0
- package/dist/core/router-feedback-collector.d.ts.map +1 -0
- package/dist/core/router-feedback-collector.js +239 -0
- package/dist/core/router-feedback-collector.js.map +1 -0
- package/dist/core/settings-manager.d.ts +31 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +16 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts +2 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +58 -5
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations.d.ts +19 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +39 -15
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-box.d.ts +3 -3
- package/dist/modes/interactive/components/control-panel-box.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-box.js +10 -10
- package/dist/modes/interactive/components/control-panel-box.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient-motion.js +2 -1
- package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.d.ts +15 -1
- package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.js +212 -68
- package/dist/modes/interactive/components/control-panel-layout.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +15 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-runtime-status.js +105 -5
- package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-sparkles.d.ts +27 -0
- package/dist/modes/interactive/components/control-panel-sparkles.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-sparkles.js +42 -0
- package/dist/modes/interactive/components/control-panel-sparkles.js.map +1 -0
- package/dist/modes/interactive/components/control-panel.d.ts +8 -0
- package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel.js +40 -8
- package/dist/modes/interactive/components/control-panel.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +2 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +2 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +206 -32
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +2 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/docs/loadout-domains/README.md +8 -6
- package/docs/loadout-domains/ai-agent-ops.md +3 -2
- package/docs/loadout-domains/backend-api.md +3 -2
- package/docs/loadout-domains/data-science.md +3 -2
- package/docs/loadout-domains/devops-infra.md +2 -1
- package/docs/loadout-domains/docs-writing.md +7 -2
- package/docs/loadout-domains/frontend-ui.md +42 -11
- package/docs/loadout-domains/korean-document.md +83 -0
- package/docs/loadout-domains/mobile.md +1 -1
- package/docs/loadout-domains/qa-testing.md +4 -2
- package/docs/loadout-domains/security-audit.md +2 -1
- package/docs/loadout-domains/visual-qa.md +94 -0
- package/docs/skills.md +11 -4
- package/docs/usage.md +39 -4
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +27 -34
- package/package.json +5 -5
- package/dist/agents/jailbreak/index.d.ts +0 -7
- package/dist/agents/jailbreak/index.d.ts.map +0 -1
- package/dist/agents/jailbreak/index.js +0 -7
- package/dist/agents/jailbreak/index.js.map +0 -1
- package/dist/agents/jailbreak/subagent-f.d.ts +0 -44
- package/dist/agents/jailbreak/subagent-f.d.ts.map +0 -1
- package/dist/agents/jailbreak/subagent-f.js +0 -60
- package/dist/agents/jailbreak/subagent-f.js.map +0 -1
- package/dist/cli/jailbreak-args.d.ts +0 -26
- package/dist/cli/jailbreak-args.d.ts.map +0 -1
- package/dist/cli/jailbreak-args.js +0 -86
- package/dist/cli/jailbreak-args.js.map +0 -1
- package/dist/commands/jailbreak.d.ts +0 -49
- package/dist/commands/jailbreak.d.ts.map +0 -1
- package/dist/commands/jailbreak.js +0 -201
- package/dist/commands/jailbreak.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -6
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -6
- package/dist/encoding/index.js.map +0 -1
- package/dist/encoding/l4-encoder.d.ts +0 -96
- package/dist/encoding/l4-encoder.d.ts.map +0 -1
- package/dist/encoding/l4-encoder.js +0 -474
- package/dist/encoding/l4-encoder.js.map +0 -1
- package/dist/fuzzing/index.d.ts +0 -6
- package/dist/fuzzing/index.d.ts.map +0 -1
- package/dist/fuzzing/index.js +0 -6
- package/dist/fuzzing/index.js.map +0 -1
- package/dist/fuzzing/mutation-engine.d.ts +0 -93
- package/dist/fuzzing/mutation-engine.d.ts.map +0 -1
- package/dist/fuzzing/mutation-engine.js +0 -244
- package/dist/fuzzing/mutation-engine.js.map +0 -1
- package/dist/jailbreak-extension.d.ts +0 -48
- package/dist/jailbreak-extension.d.ts.map +0 -1
- package/dist/jailbreak-extension.js +0 -47
- package/dist/jailbreak-extension.js.map +0 -1
- package/dist/modules/index.d.ts +0 -8
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/modules/index.js +0 -7
- package/dist/modules/index.js.map +0 -1
- package/dist/modules/lrl-bypass.d.ts +0 -40
- package/dist/modules/lrl-bypass.d.ts.map +0 -1
- package/dist/modules/lrl-bypass.js +0 -84
- package/dist/modules/lrl-bypass.js.map +0 -1
- package/dist/modules/lrl-deps.d.ts +0 -38
- package/dist/modules/lrl-deps.d.ts.map +0 -1
- package/dist/modules/lrl-deps.js +0 -128
- package/dist/modules/lrl-deps.js.map +0 -1
- package/dist/multiturn/easl-chain.d.ts +0 -113
- package/dist/multiturn/easl-chain.d.ts.map +0 -1
- package/dist/multiturn/easl-chain.js +0 -351
- package/dist/multiturn/easl-chain.js.map +0 -1
- package/dist/multiturn/index.d.ts +0 -6
- package/dist/multiturn/index.d.ts.map +0 -1
- package/dist/multiturn/index.js +0 -6
- package/dist/multiturn/index.js.map +0 -1
- package/dist/routing/fallback-router.d.ts +0 -123
- package/dist/routing/fallback-router.d.ts.map +0 -1
- package/dist/routing/fallback-router.js +0 -355
- package/dist/routing/fallback-router.js.map +0 -1
- package/dist/routing/index.d.ts +0 -6
- package/dist/routing/index.d.ts.map +0 -1
- package/dist/routing/index.js +0 -6
- package/dist/routing/index.js.map +0 -1
- package/dist/types/jailbreak.d.ts +0 -246
- package/dist/types/jailbreak.d.ts.map +0 -1
- package/dist/types/jailbreak.js +0 -8
- package/dist/types/jailbreak.js.map +0 -1
- package/dist/utils/jailbreak/common.d.ts +0 -63
- package/dist/utils/jailbreak/common.d.ts.map +0 -1
- package/dist/utils/jailbreak/common.js +0 -130
- package/dist/utils/jailbreak/common.js.map +0 -1
- package/dist/utils/jailbreak/index.d.ts +0 -7
- package/dist/utils/jailbreak/index.d.ts.map +0 -1
- package/dist/utils/jailbreak/index.js +0 -7
- package/dist/utils/jailbreak/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-inventory.d.ts","sourceRoot":"","sources":["../../src/core/hook-inventory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;CACjC;AAMD,eAAO,MAAM,aAAa,EAAE,SAAS,cAAc,
|
|
1
|
+
{"version":3,"file":"hook-inventory.d.ts","sourceRoot":"","sources":["../../src/core/hook-inventory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;CACjC;AAMD,eAAO,MAAM,aAAa,EAAE,SAAS,cAAc,EA+ElD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAsBlE","sourcesContent":["/**\n * Minimal hook inventory for the loadout runtime.\n *\n * The external harness resolves `scriptPath` to an actual shell script.\n * This module provides canonical names plus safe policy metadata so the\n * loadout layer can validate selectors without executing hooks.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { HookPolicyMetadata } from \"./hooks/index.ts\";\nimport { DEFAULT_HOOK_POLICY, sanitizeHookPolicy } from \"./hooks/index.ts\";\n\nexport interface HookDescriptor {\n\tname: string;\n\tscriptPath?: string;\n\tbuiltin: boolean;\n\tpolicy: HookPolicyMetadata;\n}\n\nexport interface HookInventory {\n\thooks: readonly HookDescriptor[];\n}\n\nfunction builtinHook(name: string, policy: HookPolicyMetadata): HookDescriptor {\n\treturn { name, builtin: true, policy: sanitizeHookPolicy(policy) };\n}\n\nexport const BUILTIN_HOOKS: readonly HookDescriptor[] = [\n\tbuiltinHook(\"pre-shell-guard\", {\n\t\tstages: [\"tool_call\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 3_000,\n\t}),\n\tbuiltinHook(\"protect-secrets\", {\n\t\tstages: [\"tool_call\", \"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"session-context\", {\n\t\tstages: [\"session_start\"],\n\t\teffects: [\"mutator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"precompact-checkpoint\", {\n\t\tstages: [\"pre_compact\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"typecheck-after-edit\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"stop-verify\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"subagent-stop-audit\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n\tbuiltinHook(\"npm-audit-summary\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"notify-sound-on-stop\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"bounded-evidence\", {\n\t\tstages: [\"tool_result\", \"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n\tbuiltinHook(\"document-artifact-guard\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"component-spec-before-build\", {\n\t\tstages: [\"tool_call\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"visual-diff-after-edit\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n];\n\n/**\n * Load the hook inventory. Builtin hooks are always present; if an agent\n * directory is provided and its `hooks` subdirectory exists, any shell scripts\n * discovered there are appended as non-builtin descriptors.\n */\nexport function loadHookInventory(agentDir?: string): HookInventory {\n\tconst hooks: HookDescriptor[] = [...BUILTIN_HOOKS];\n\tif (agentDir) {\n\t\ttry {\n\t\t\tconst hooksDir = path.join(agentDir, \"hooks\");\n\t\t\tconst entries = fs.readdirSync(hooksDir).sort();\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (!entry.endsWith(\".sh\")) continue;\n\t\t\t\tconst name = entry.slice(0, -3);\n\t\t\t\tif (hooks.some((h) => h.name === name)) continue;\n\t\t\t\thooks.push({\n\t\t\t\t\tname,\n\t\t\t\t\tscriptPath: path.join(hooksDir, entry),\n\t\t\t\t\tbuiltin: false,\n\t\t\t\t\tpolicy: sanitizeHookPolicy(DEFAULT_HOOK_POLICY),\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {\n\t\t\t// Hooks directory may be absent; builtin inventory is sufficient.\n\t\t}\n\t}\n\treturn { hooks };\n}\n"]}
|
|
@@ -60,6 +60,12 @@ export const BUILTIN_HOOKS = [
|
|
|
60
60
|
failureMode: "fail-closed",
|
|
61
61
|
timeoutMs: 30_000,
|
|
62
62
|
}),
|
|
63
|
+
builtinHook("notify-sound-on-stop", {
|
|
64
|
+
stages: ["session_stop"],
|
|
65
|
+
effects: ["observer"],
|
|
66
|
+
failureMode: "fail-closed",
|
|
67
|
+
timeoutMs: 5_000,
|
|
68
|
+
}),
|
|
63
69
|
builtinHook("bounded-evidence", {
|
|
64
70
|
stages: ["tool_result", "session_stop"],
|
|
65
71
|
effects: ["validator"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-inventory.js","sourceRoot":"","sources":["../../src/core/hook-inventory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAa3E,SAAS,WAAW,CAAC,IAAY,EAAE,MAA0B,EAAkB;IAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AAAA,CACnE;AAED,MAAM,CAAC,MAAM,aAAa,GAA8B;IACvD,WAAW,CAAC,iBAAiB,EAAE;QAC9B,MAAM,EAAE,CAAC,WAAW,CAAC;QACrB,OAAO,EAAE,CAAC,WAAW,CAAC;QAC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K,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;oBAAE,SAAS;gBACjD,KAAK,CAAC,IAAI,CAAC;oBACV,IAAI;oBACJ,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;oBACtC,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,kBAAkB,CAAC,mBAAmB,CAAC;iBAC/C,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,kEAAkE;QACnE,CAAC;IACF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC;AAAA,CACjB","sourcesContent":["/**\n * Minimal hook inventory for the loadout runtime.\n *\n * The external harness resolves `scriptPath` to an actual shell script.\n * This module provides canonical names plus safe policy metadata so the\n * loadout layer can validate selectors without executing hooks.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { HookPolicyMetadata } from \"./hooks/index.ts\";\nimport { DEFAULT_HOOK_POLICY, sanitizeHookPolicy } from \"./hooks/index.ts\";\n\nexport interface HookDescriptor {\n\tname: string;\n\tscriptPath?: string;\n\tbuiltin: boolean;\n\tpolicy: HookPolicyMetadata;\n}\n\nexport interface HookInventory {\n\thooks: readonly HookDescriptor[];\n}\n\nfunction builtinHook(name: string, policy: HookPolicyMetadata): HookDescriptor {\n\treturn { name, builtin: true, policy: sanitizeHookPolicy(policy) };\n}\n\nexport const BUILTIN_HOOKS: readonly HookDescriptor[] = [\n\tbuiltinHook(\"pre-shell-guard\", {\n\t\tstages: [\"tool_call\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 3_000,\n\t}),\n\tbuiltinHook(\"protect-secrets\", {\n\t\tstages: [\"tool_call\", \"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"session-context\", {\n\t\tstages: [\"session_start\"],\n\t\teffects: [\"mutator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"precompact-checkpoint\", {\n\t\tstages: [\"pre_compact\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"typecheck-after-edit\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"stop-verify\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"subagent-stop-audit\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n\tbuiltinHook(\"npm-audit-summary\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"bounded-evidence\", {\n\t\tstages: [\"tool_result\", \"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n\tbuiltinHook(\"document-artifact-guard\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"component-spec-before-build\", {\n\t\tstages: [\"tool_call\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"visual-diff-after-edit\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n];\n\n/**\n * Load the hook inventory. Builtin hooks are always present; if an agent\n * directory is provided and its `hooks` subdirectory exists, any shell scripts\n * discovered there are appended as non-builtin descriptors.\n */\nexport function loadHookInventory(agentDir?: string): HookInventory {\n\tconst hooks: HookDescriptor[] = [...BUILTIN_HOOKS];\n\tif (agentDir) {\n\t\ttry {\n\t\t\tconst hooksDir = path.join(agentDir, \"hooks\");\n\t\t\tconst entries = fs.readdirSync(hooksDir).sort();\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (!entry.endsWith(\".sh\")) continue;\n\t\t\t\tconst name = entry.slice(0, -3);\n\t\t\t\tif (hooks.some((h) => h.name === name)) continue;\n\t\t\t\thooks.push({\n\t\t\t\t\tname,\n\t\t\t\t\tscriptPath: path.join(hooksDir, entry),\n\t\t\t\t\tbuiltin: false,\n\t\t\t\t\tpolicy: sanitizeHookPolicy(DEFAULT_HOOK_POLICY),\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {\n\t\t\t// Hooks directory may be absent; builtin inventory is sufficient.\n\t\t}\n\t}\n\treturn { hooks };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hook-inventory.js","sourceRoot":"","sources":["../../src/core/hook-inventory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAa3E,SAAS,WAAW,CAAC,IAAY,EAAE,MAA0B,EAAkB;IAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AAAA,CACnE;AAED,MAAM,CAAC,MAAM,aAAa,GAA8B;IACvD,WAAW,CAAC,iBAAiB,EAAE;QAC9B,MAAM,EAAE,CAAC,WAAW,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MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;oBAAE,SAAS;gBACrC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAChC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;oBAAE,SAAS;gBACjD,KAAK,CAAC,IAAI,CAAC;oBACV,IAAI;oBACJ,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;oBACtC,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,kBAAkB,CAAC,mBAAmB,CAAC;iBAC/C,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,kEAAkE;QACnE,CAAC;IACF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC;AAAA,CACjB","sourcesContent":["/**\n * Minimal hook inventory for the loadout runtime.\n *\n * The external harness resolves `scriptPath` to an actual shell script.\n * This module provides canonical names plus safe policy metadata so the\n * loadout layer can validate selectors without executing hooks.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { HookPolicyMetadata } from \"./hooks/index.ts\";\nimport { DEFAULT_HOOK_POLICY, sanitizeHookPolicy } from \"./hooks/index.ts\";\n\nexport interface HookDescriptor {\n\tname: string;\n\tscriptPath?: string;\n\tbuiltin: boolean;\n\tpolicy: HookPolicyMetadata;\n}\n\nexport interface HookInventory {\n\thooks: readonly HookDescriptor[];\n}\n\nfunction builtinHook(name: string, policy: HookPolicyMetadata): HookDescriptor {\n\treturn { name, builtin: true, policy: sanitizeHookPolicy(policy) };\n}\n\nexport const BUILTIN_HOOKS: readonly HookDescriptor[] = [\n\tbuiltinHook(\"pre-shell-guard\", {\n\t\tstages: [\"tool_call\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 3_000,\n\t}),\n\tbuiltinHook(\"protect-secrets\", {\n\t\tstages: [\"tool_call\", \"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"session-context\", {\n\t\tstages: [\"session_start\"],\n\t\teffects: [\"mutator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"precompact-checkpoint\", {\n\t\tstages: [\"pre_compact\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"typecheck-after-edit\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"stop-verify\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"subagent-stop-audit\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n\tbuiltinHook(\"npm-audit-summary\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 30_000,\n\t}),\n\tbuiltinHook(\"notify-sound-on-stop\", {\n\t\tstages: [\"session_stop\"],\n\t\teffects: [\"observer\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"bounded-evidence\", {\n\t\tstages: [\"tool_result\", \"session_stop\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n\tbuiltinHook(\"document-artifact-guard\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"component-spec-before-build\", {\n\t\tstages: [\"tool_call\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 5_000,\n\t}),\n\tbuiltinHook(\"visual-diff-after-edit\", {\n\t\tstages: [\"tool_result\"],\n\t\teffects: [\"validator\"],\n\t\tfailureMode: \"fail-closed\",\n\t\ttimeoutMs: 10_000,\n\t}),\n];\n\n/**\n * Load the hook inventory. Builtin hooks are always present; if an agent\n * directory is provided and its `hooks` subdirectory exists, any shell scripts\n * discovered there are appended as non-builtin descriptors.\n */\nexport function loadHookInventory(agentDir?: string): HookInventory {\n\tconst hooks: HookDescriptor[] = [...BUILTIN_HOOKS];\n\tif (agentDir) {\n\t\ttry {\n\t\t\tconst hooksDir = path.join(agentDir, \"hooks\");\n\t\t\tconst entries = fs.readdirSync(hooksDir).sort();\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (!entry.endsWith(\".sh\")) continue;\n\t\t\t\tconst name = entry.slice(0, -3);\n\t\t\t\tif (hooks.some((h) => h.name === name)) continue;\n\t\t\t\thooks.push({\n\t\t\t\t\tname,\n\t\t\t\t\tscriptPath: path.join(hooksDir, entry),\n\t\t\t\t\tbuiltin: false,\n\t\t\t\t\tpolicy: sanitizeHookPolicy(DEFAULT_HOOK_POLICY),\n\t\t\t\t});\n\t\t\t}\n\t\t} catch {\n\t\t\t// Hooks directory may be absent; builtin inventory is sufficient.\n\t\t}\n\t}\n\treturn { hooks };\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const OMK_COMPUTER_USE_DEFAULT_PRESET_ID = "playwright-computer-use";
|
|
2
|
+
export type ComputerUsePresetKey = "browserUseAgent" | "playwrightComputerUse";
|
|
3
|
+
export type ComputerUsePresetId = "browser-use-agent" | "playwright-computer-use";
|
|
4
|
+
export type ComputerUseRisk = "R3";
|
|
5
|
+
export type ComputerUseEngine = "mcp" | "python-rust-sidecar";
|
|
6
|
+
export type ComputerUseBrowser = "chrome" | "firefox" | "msedge" | "webkit";
|
|
7
|
+
export type ComputerUseCookieMode = "existing-browser-session" | "isolated-storage-state" | "managed-profile" | "none";
|
|
8
|
+
export type ComputerUseCredentialScope = "none" | "session" | "workspace";
|
|
9
|
+
export type ComputerUseLaunchOption = "browser" | "cdp-endpoint" | "extension" | "storage-state" | "user-data-dir";
|
|
10
|
+
export interface ComputerUseTransport {
|
|
11
|
+
readonly args: readonly string[];
|
|
12
|
+
readonly command: string;
|
|
13
|
+
readonly packageName?: string;
|
|
14
|
+
readonly type: "stdio";
|
|
15
|
+
}
|
|
16
|
+
export interface ComputerUseBrowserMode {
|
|
17
|
+
readonly argsExtra?: readonly string[];
|
|
18
|
+
readonly browser?: ComputerUseBrowser;
|
|
19
|
+
readonly browserLimit?: "chrome-edge-only";
|
|
20
|
+
readonly cookieMode: ComputerUseCookieMode;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly id: "existing-chrome-session" | "isolated-storage-state" | "managed-chrome-profile" | "managed-firefox-profile";
|
|
23
|
+
readonly profileDir?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ComputerUsePolicy {
|
|
26
|
+
readonly allowedDomainsRequired?: boolean;
|
|
27
|
+
readonly allowedOriginsSecurityBoundary?: boolean;
|
|
28
|
+
readonly blockMetadataIp: boolean;
|
|
29
|
+
readonly blockPrivateNetwork: boolean;
|
|
30
|
+
readonly credentialScopes: readonly ComputerUseCredentialScope[];
|
|
31
|
+
readonly denyNoSandbox: boolean;
|
|
32
|
+
readonly descriptorHashPinned: boolean;
|
|
33
|
+
readonly evidenceLedger: boolean;
|
|
34
|
+
readonly maxActions: number;
|
|
35
|
+
readonly maxOutputBytes?: number;
|
|
36
|
+
readonly noManualProfileShellScript?: boolean;
|
|
37
|
+
readonly noUnrestrictedFileAccess: boolean;
|
|
38
|
+
readonly originAllowlistRequiredForCredentialedMode: boolean;
|
|
39
|
+
readonly outputGuard: boolean;
|
|
40
|
+
readonly profileBrokerOnly?: boolean;
|
|
41
|
+
readonly requiresExplicitPostconditions: boolean;
|
|
42
|
+
readonly requiresRequestInterception: boolean;
|
|
43
|
+
readonly sandboxRequired: boolean;
|
|
44
|
+
readonly secretBrokerOnly: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ComputerUsePreset {
|
|
47
|
+
readonly browserModes: readonly ComputerUseBrowserMode[];
|
|
48
|
+
readonly defaultEnabled: boolean;
|
|
49
|
+
readonly engine: ComputerUseEngine;
|
|
50
|
+
readonly id: ComputerUsePresetId;
|
|
51
|
+
readonly key: ComputerUsePresetKey;
|
|
52
|
+
readonly label: string;
|
|
53
|
+
readonly notes: readonly string[];
|
|
54
|
+
readonly policy: ComputerUsePolicy;
|
|
55
|
+
readonly risk: ComputerUseRisk;
|
|
56
|
+
readonly sourceUrls: readonly string[];
|
|
57
|
+
readonly supportedLaunchOptions: readonly ComputerUseLaunchOption[];
|
|
58
|
+
readonly transport?: ComputerUseTransport;
|
|
59
|
+
}
|
|
60
|
+
export declare const COMPUTER_USE_PRESETS: Record<ComputerUsePresetKey, ComputerUsePreset>;
|
|
61
|
+
export declare function listComputerUsePresets(): ComputerUsePreset[];
|
|
62
|
+
export declare function getComputerUsePreset(id: string): ComputerUsePreset | undefined;
|
|
63
|
+
export declare function requiresCredentialedOriginAllowlist(cookieMode: ComputerUseCookieMode): boolean;
|
|
64
|
+
//# sourceMappingURL=mcp-computer-use-presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-computer-use-presets.d.ts","sourceRoot":"","sources":["../../src/core/mcp-computer-use-presets.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,4BAA4B,CAAC;AAE5E,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,uBAAuB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C,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,sBAAsB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAC1C;AA6HD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,iBAAiB,CAGvE,CAAC;AAEX,wBAAgB,sBAAsB,IAAI,iBAAiB,EAAE,CAE5D;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAG9E;AAED,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAE9F","sourcesContent":["export const OMK_COMPUTER_USE_DEFAULT_PRESET_ID = \"playwright-computer-use\";\n\nexport type ComputerUsePresetKey = \"browserUseAgent\" | \"playwrightComputerUse\";\nexport type ComputerUsePresetId = \"browser-use-agent\" | \"playwright-computer-use\";\nexport type ComputerUseRisk = \"R3\";\nexport type ComputerUseEngine = \"mcp\" | \"python-rust-sidecar\";\nexport type ComputerUseBrowser = \"chrome\" | \"firefox\" | \"msedge\" | \"webkit\";\nexport type ComputerUseCookieMode = \"existing-browser-session\" | \"isolated-storage-state\" | \"managed-profile\" | \"none\";\nexport type ComputerUseCredentialScope = \"none\" | \"session\" | \"workspace\";\nexport type ComputerUseLaunchOption = \"browser\" | \"cdp-endpoint\" | \"extension\" | \"storage-state\" | \"user-data-dir\";\n\nexport interface ComputerUseTransport {\n\treadonly args: readonly string[];\n\treadonly command: string;\n\treadonly packageName?: string;\n\treadonly type: \"stdio\";\n}\n\nexport interface ComputerUseBrowserMode {\n\treadonly argsExtra?: readonly string[];\n\treadonly browser?: ComputerUseBrowser;\n\treadonly browserLimit?: \"chrome-edge-only\";\n\treadonly cookieMode: ComputerUseCookieMode;\n\treadonly description: string;\n\treadonly id:\n\t\t| \"existing-chrome-session\"\n\t\t| \"isolated-storage-state\"\n\t\t| \"managed-chrome-profile\"\n\t\t| \"managed-firefox-profile\";\n\treadonly profileDir?: string;\n}\n\nexport interface ComputerUsePolicy {\n\treadonly allowedDomainsRequired?: boolean;\n\treadonly allowedOriginsSecurityBoundary?: boolean;\n\treadonly blockMetadataIp: boolean;\n\treadonly blockPrivateNetwork: boolean;\n\treadonly credentialScopes: readonly ComputerUseCredentialScope[];\n\treadonly denyNoSandbox: boolean;\n\treadonly descriptorHashPinned: boolean;\n\treadonly evidenceLedger: boolean;\n\treadonly maxActions: number;\n\treadonly maxOutputBytes?: number;\n\treadonly noManualProfileShellScript?: boolean;\n\treadonly noUnrestrictedFileAccess: boolean;\n\treadonly originAllowlistRequiredForCredentialedMode: boolean;\n\treadonly outputGuard: boolean;\n\treadonly profileBrokerOnly?: boolean;\n\treadonly requiresExplicitPostconditions: boolean;\n\treadonly requiresRequestInterception: boolean;\n\treadonly sandboxRequired: boolean;\n\treadonly secretBrokerOnly: boolean;\n}\n\nexport interface ComputerUsePreset {\n\treadonly browserModes: readonly ComputerUseBrowserMode[];\n\treadonly defaultEnabled: boolean;\n\treadonly engine: ComputerUseEngine;\n\treadonly id: ComputerUsePresetId;\n\treadonly key: ComputerUsePresetKey;\n\treadonly label: string;\n\treadonly notes: readonly string[];\n\treadonly policy: ComputerUsePolicy;\n\treadonly risk: ComputerUseRisk;\n\treadonly sourceUrls: readonly string[];\n\treadonly supportedLaunchOptions: readonly ComputerUseLaunchOption[];\n\treadonly transport?: ComputerUseTransport;\n}\n\nconst PLAYWRIGHT_BROWSER_MODES: readonly ComputerUseBrowserMode[] = [\n\t{\n\t\tbrowser: \"chrome\",\n\t\tcookieMode: \"managed-profile\",\n\t\tdescription: \"OMK-managed Chrome profile with project-scoped persistent cookies and local storage.\",\n\t\tid: \"managed-chrome-profile\",\n\t\tprofileDir: \".omk/browser-profiles/chrome\",\n\t},\n\t{\n\t\tbrowser: \"firefox\",\n\t\tcookieMode: \"managed-profile\",\n\t\tdescription: \"OMK-managed Firefox profile; avoids attaching to the user's real Firefox profile.\",\n\t\tid: \"managed-firefox-profile\",\n\t\tprofileDir: \".omk/browser-profiles/firefox\",\n\t},\n\t{\n\t\targsExtra: [\"--isolated\", \"--storage-state\", \"<storageStatePath>\"],\n\t\tcookieMode: \"isolated-storage-state\",\n\t\tdescription: \"Loads cookies and local storage from an explicit Playwright storage-state file.\",\n\t\tid: \"isolated-storage-state\",\n\t},\n\t{\n\t\targsExtra: [\"--extension\"],\n\t\tbrowser: \"chrome\",\n\t\tbrowserLimit: \"chrome-edge-only\",\n\t\tcookieMode: \"existing-browser-session\",\n\t\tdescription: \"Connects to an existing Chrome or Edge session through the Playwright extension.\",\n\t\tid: \"existing-chrome-session\",\n\t},\n];\n\nconst PLAYWRIGHT_COMPUTER_USE_PRESET: ComputerUsePreset = {\n\tbrowserModes: PLAYWRIGHT_BROWSER_MODES,\n\tdefaultEnabled: true,\n\tengine: \"mcp\",\n\tid: \"playwright-computer-use\",\n\tkey: \"playwrightComputerUse\",\n\tlabel: \"Playwright Computer Use\",\n\tnotes: [\n\t\t\"Default computer-use preset built on Microsoft Playwright MCP accessibility-tree automation.\",\n\t\t\"Credentialed browser sessions must go through SecureComputerUseBroker preflight and request interception.\",\n\t\t\"Playwright allowed-origins are recorded as advisory only; OMK policy remains the security boundary.\",\n\t],\n\tpolicy: {\n\t\tallowedOriginsSecurityBoundary: false,\n\t\tblockMetadataIp: true,\n\t\tblockPrivateNetwork: true,\n\t\tcredentialScopes: [\"none\", \"session\", \"workspace\"],\n\t\tdenyNoSandbox: true,\n\t\tdescriptorHashPinned: true,\n\t\tevidenceLedger: true,\n\t\tmaxActions: 40,\n\t\tmaxOutputBytes: 25_000_000,\n\t\tnoUnrestrictedFileAccess: true,\n\t\toriginAllowlistRequiredForCredentialedMode: true,\n\t\toutputGuard: true,\n\t\trequiresExplicitPostconditions: true,\n\t\trequiresRequestInterception: true,\n\t\tsandboxRequired: true,\n\t\tsecretBrokerOnly: true,\n\t},\n\trisk: \"R3\",\n\tsourceUrls: [\"https://github.com/microsoft/playwright-mcp\"],\n\tsupportedLaunchOptions: [\"browser\", \"user-data-dir\", \"storage-state\", \"extension\", \"cdp-endpoint\"],\n\ttransport: {\n\t\targs: [\n\t\t\t\"-y\",\n\t\t\t\"@playwright/mcp@0.0.76\",\n\t\t\t\"--browser\",\n\t\t\t\"<browser>\",\n\t\t\t\"--user-data-dir\",\n\t\t\t\"<profileDir>\",\n\t\t\t\"--output-dir\",\n\t\t\t\"<outputDir>\",\n\t\t\t\"--output-mode\",\n\t\t\t\"file\",\n\t\t\t\"--block-service-workers\",\n\t\t\t\"--timeout-action\",\n\t\t\t\"5000\",\n\t\t\t\"--timeout-navigation\",\n\t\t\t\"60000\",\n\t\t],\n\t\tcommand: \"npx\",\n\t\tpackageName: \"@playwright/mcp\",\n\t\ttype: \"stdio\",\n\t},\n};\n\nconst BROWSER_USE_AGENT_PRESET: ComputerUsePreset = {\n\tbrowserModes: [],\n\tdefaultEnabled: false,\n\tengine: \"python-rust-sidecar\",\n\tid: \"browser-use-agent\",\n\tkey: \"browserUseAgent\",\n\tlabel: \"Browser Use Agent\",\n\tnotes: [\n\t\t\"Optional advanced runner for agentic browser tasks that need recovery loops or custom tools.\",\n\t\t\"Profiles and secrets must be injected through OMK brokers instead of manual shell profile scripts.\",\n\t],\n\tpolicy: {\n\t\tallowedDomainsRequired: true,\n\t\tblockMetadataIp: true,\n\t\tblockPrivateNetwork: true,\n\t\tcredentialScopes: [\"none\", \"session\", \"workspace\"],\n\t\tdenyNoSandbox: true,\n\t\tdescriptorHashPinned: true,\n\t\tevidenceLedger: true,\n\t\tmaxActions: 60,\n\t\tnoManualProfileShellScript: true,\n\t\tnoUnrestrictedFileAccess: true,\n\t\toriginAllowlistRequiredForCredentialedMode: true,\n\t\toutputGuard: true,\n\t\tprofileBrokerOnly: true,\n\t\trequiresExplicitPostconditions: true,\n\t\trequiresRequestInterception: true,\n\t\tsandboxRequired: true,\n\t\tsecretBrokerOnly: true,\n\t},\n\trisk: \"R3\",\n\tsourceUrls: [\"https://github.com/browser-use/browser-use\"],\n\tsupportedLaunchOptions: [],\n};\n\nexport const COMPUTER_USE_PRESETS: Record<ComputerUsePresetKey, ComputerUsePreset> = {\n\tplaywrightComputerUse: PLAYWRIGHT_COMPUTER_USE_PRESET,\n\tbrowserUseAgent: BROWSER_USE_AGENT_PRESET,\n} as const;\n\nexport function listComputerUsePresets(): ComputerUsePreset[] {\n\treturn Object.values(COMPUTER_USE_PRESETS).map((preset) => cloneComputerUsePreset(preset));\n}\n\nexport function getComputerUsePreset(id: string): ComputerUsePreset | undefined {\n\tconst preset = Object.values(COMPUTER_USE_PRESETS).find((candidate) => candidate.id === id);\n\treturn preset ? cloneComputerUsePreset(preset) : undefined;\n}\n\nexport function requiresCredentialedOriginAllowlist(cookieMode: ComputerUseCookieMode): boolean {\n\treturn cookieMode !== \"none\";\n}\n\nfunction cloneComputerUsePreset(preset: ComputerUsePreset): ComputerUsePreset {\n\treturn {\n\t\t...preset,\n\t\tbrowserModes: preset.browserModes.map((mode) => ({\n\t\t\t...mode,\n\t\t\targsExtra: mode.argsExtra ? [...mode.argsExtra] : undefined,\n\t\t})),\n\t\tnotes: [...preset.notes],\n\t\tpolicy: {\n\t\t\t...preset.policy,\n\t\t\tcredentialScopes: [...preset.policy.credentialScopes],\n\t\t},\n\t\tsourceUrls: [...preset.sourceUrls],\n\t\tsupportedLaunchOptions: [...preset.supportedLaunchOptions],\n\t\ttransport: preset.transport\n\t\t\t? {\n\t\t\t\t\t...preset.transport,\n\t\t\t\t\targs: [...preset.transport.args],\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n}\n"]}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export const OMK_COMPUTER_USE_DEFAULT_PRESET_ID = "playwright-computer-use";
|
|
2
|
+
const PLAYWRIGHT_BROWSER_MODES = [
|
|
3
|
+
{
|
|
4
|
+
browser: "chrome",
|
|
5
|
+
cookieMode: "managed-profile",
|
|
6
|
+
description: "OMK-managed Chrome profile with project-scoped persistent cookies and local storage.",
|
|
7
|
+
id: "managed-chrome-profile",
|
|
8
|
+
profileDir: ".omk/browser-profiles/chrome",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
browser: "firefox",
|
|
12
|
+
cookieMode: "managed-profile",
|
|
13
|
+
description: "OMK-managed Firefox profile; avoids attaching to the user's real Firefox profile.",
|
|
14
|
+
id: "managed-firefox-profile",
|
|
15
|
+
profileDir: ".omk/browser-profiles/firefox",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
argsExtra: ["--isolated", "--storage-state", "<storageStatePath>"],
|
|
19
|
+
cookieMode: "isolated-storage-state",
|
|
20
|
+
description: "Loads cookies and local storage from an explicit Playwright storage-state file.",
|
|
21
|
+
id: "isolated-storage-state",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
argsExtra: ["--extension"],
|
|
25
|
+
browser: "chrome",
|
|
26
|
+
browserLimit: "chrome-edge-only",
|
|
27
|
+
cookieMode: "existing-browser-session",
|
|
28
|
+
description: "Connects to an existing Chrome or Edge session through the Playwright extension.",
|
|
29
|
+
id: "existing-chrome-session",
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
const PLAYWRIGHT_COMPUTER_USE_PRESET = {
|
|
33
|
+
browserModes: PLAYWRIGHT_BROWSER_MODES,
|
|
34
|
+
defaultEnabled: true,
|
|
35
|
+
engine: "mcp",
|
|
36
|
+
id: "playwright-computer-use",
|
|
37
|
+
key: "playwrightComputerUse",
|
|
38
|
+
label: "Playwright Computer Use",
|
|
39
|
+
notes: [
|
|
40
|
+
"Default computer-use preset built on Microsoft Playwright MCP accessibility-tree automation.",
|
|
41
|
+
"Credentialed browser sessions must go through SecureComputerUseBroker preflight and request interception.",
|
|
42
|
+
"Playwright allowed-origins are recorded as advisory only; OMK policy remains the security boundary.",
|
|
43
|
+
],
|
|
44
|
+
policy: {
|
|
45
|
+
allowedOriginsSecurityBoundary: false,
|
|
46
|
+
blockMetadataIp: true,
|
|
47
|
+
blockPrivateNetwork: true,
|
|
48
|
+
credentialScopes: ["none", "session", "workspace"],
|
|
49
|
+
denyNoSandbox: true,
|
|
50
|
+
descriptorHashPinned: true,
|
|
51
|
+
evidenceLedger: true,
|
|
52
|
+
maxActions: 40,
|
|
53
|
+
maxOutputBytes: 25_000_000,
|
|
54
|
+
noUnrestrictedFileAccess: true,
|
|
55
|
+
originAllowlistRequiredForCredentialedMode: true,
|
|
56
|
+
outputGuard: true,
|
|
57
|
+
requiresExplicitPostconditions: true,
|
|
58
|
+
requiresRequestInterception: true,
|
|
59
|
+
sandboxRequired: true,
|
|
60
|
+
secretBrokerOnly: true,
|
|
61
|
+
},
|
|
62
|
+
risk: "R3",
|
|
63
|
+
sourceUrls: ["https://github.com/microsoft/playwright-mcp"],
|
|
64
|
+
supportedLaunchOptions: ["browser", "user-data-dir", "storage-state", "extension", "cdp-endpoint"],
|
|
65
|
+
transport: {
|
|
66
|
+
args: [
|
|
67
|
+
"-y",
|
|
68
|
+
"@playwright/mcp@0.0.76",
|
|
69
|
+
"--browser",
|
|
70
|
+
"<browser>",
|
|
71
|
+
"--user-data-dir",
|
|
72
|
+
"<profileDir>",
|
|
73
|
+
"--output-dir",
|
|
74
|
+
"<outputDir>",
|
|
75
|
+
"--output-mode",
|
|
76
|
+
"file",
|
|
77
|
+
"--block-service-workers",
|
|
78
|
+
"--timeout-action",
|
|
79
|
+
"5000",
|
|
80
|
+
"--timeout-navigation",
|
|
81
|
+
"60000",
|
|
82
|
+
],
|
|
83
|
+
command: "npx",
|
|
84
|
+
packageName: "@playwright/mcp",
|
|
85
|
+
type: "stdio",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const BROWSER_USE_AGENT_PRESET = {
|
|
89
|
+
browserModes: [],
|
|
90
|
+
defaultEnabled: false,
|
|
91
|
+
engine: "python-rust-sidecar",
|
|
92
|
+
id: "browser-use-agent",
|
|
93
|
+
key: "browserUseAgent",
|
|
94
|
+
label: "Browser Use Agent",
|
|
95
|
+
notes: [
|
|
96
|
+
"Optional advanced runner for agentic browser tasks that need recovery loops or custom tools.",
|
|
97
|
+
"Profiles and secrets must be injected through OMK brokers instead of manual shell profile scripts.",
|
|
98
|
+
],
|
|
99
|
+
policy: {
|
|
100
|
+
allowedDomainsRequired: true,
|
|
101
|
+
blockMetadataIp: true,
|
|
102
|
+
blockPrivateNetwork: true,
|
|
103
|
+
credentialScopes: ["none", "session", "workspace"],
|
|
104
|
+
denyNoSandbox: true,
|
|
105
|
+
descriptorHashPinned: true,
|
|
106
|
+
evidenceLedger: true,
|
|
107
|
+
maxActions: 60,
|
|
108
|
+
noManualProfileShellScript: true,
|
|
109
|
+
noUnrestrictedFileAccess: true,
|
|
110
|
+
originAllowlistRequiredForCredentialedMode: true,
|
|
111
|
+
outputGuard: true,
|
|
112
|
+
profileBrokerOnly: true,
|
|
113
|
+
requiresExplicitPostconditions: true,
|
|
114
|
+
requiresRequestInterception: true,
|
|
115
|
+
sandboxRequired: true,
|
|
116
|
+
secretBrokerOnly: true,
|
|
117
|
+
},
|
|
118
|
+
risk: "R3",
|
|
119
|
+
sourceUrls: ["https://github.com/browser-use/browser-use"],
|
|
120
|
+
supportedLaunchOptions: [],
|
|
121
|
+
};
|
|
122
|
+
export const COMPUTER_USE_PRESETS = {
|
|
123
|
+
playwrightComputerUse: PLAYWRIGHT_COMPUTER_USE_PRESET,
|
|
124
|
+
browserUseAgent: BROWSER_USE_AGENT_PRESET,
|
|
125
|
+
};
|
|
126
|
+
export function listComputerUsePresets() {
|
|
127
|
+
return Object.values(COMPUTER_USE_PRESETS).map((preset) => cloneComputerUsePreset(preset));
|
|
128
|
+
}
|
|
129
|
+
export function getComputerUsePreset(id) {
|
|
130
|
+
const preset = Object.values(COMPUTER_USE_PRESETS).find((candidate) => candidate.id === id);
|
|
131
|
+
return preset ? cloneComputerUsePreset(preset) : undefined;
|
|
132
|
+
}
|
|
133
|
+
export function requiresCredentialedOriginAllowlist(cookieMode) {
|
|
134
|
+
return cookieMode !== "none";
|
|
135
|
+
}
|
|
136
|
+
function cloneComputerUsePreset(preset) {
|
|
137
|
+
return {
|
|
138
|
+
...preset,
|
|
139
|
+
browserModes: preset.browserModes.map((mode) => ({
|
|
140
|
+
...mode,
|
|
141
|
+
argsExtra: mode.argsExtra ? [...mode.argsExtra] : undefined,
|
|
142
|
+
})),
|
|
143
|
+
notes: [...preset.notes],
|
|
144
|
+
policy: {
|
|
145
|
+
...preset.policy,
|
|
146
|
+
credentialScopes: [...preset.policy.credentialScopes],
|
|
147
|
+
},
|
|
148
|
+
sourceUrls: [...preset.sourceUrls],
|
|
149
|
+
supportedLaunchOptions: [...preset.supportedLaunchOptions],
|
|
150
|
+
transport: preset.transport
|
|
151
|
+
? {
|
|
152
|
+
...preset.transport,
|
|
153
|
+
args: [...preset.transport.args],
|
|
154
|
+
}
|
|
155
|
+
: undefined,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=mcp-computer-use-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-computer-use-presets.js","sourceRoot":"","sources":["../../src/core/mcp-computer-use-presets.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC;AAqE5E,MAAM,wBAAwB,GAAsC;IACnE;QACC,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,sFAAsF;QACnG,EAAE,EAAE,wBAAwB;QAC5B,UAAU,EAAE,8BAA8B;KAC1C;IACD;QACC,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,mFAAmF;QAChG,EAAE,EAAE,yBAAyB;QAC7B,UAAU,EAAE,+BAA+B;KAC3C;IACD;QAC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C;gBACA,GAAG,MAAM,CAAC,SAAS;gBACnB,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;aAChC;YACF,CAAC,CAAC,SAAS;KACZ,CAAC;AAAA,CACF","sourcesContent":["export const OMK_COMPUTER_USE_DEFAULT_PRESET_ID = \"playwright-computer-use\";\n\nexport type ComputerUsePresetKey = \"browserUseAgent\" | \"playwrightComputerUse\";\nexport type ComputerUsePresetId = \"browser-use-agent\" | \"playwright-computer-use\";\nexport type ComputerUseRisk = \"R3\";\nexport type ComputerUseEngine = \"mcp\" | \"python-rust-sidecar\";\nexport type ComputerUseBrowser = \"chrome\" | \"firefox\" | \"msedge\" | \"webkit\";\nexport type ComputerUseCookieMode = \"existing-browser-session\" | \"isolated-storage-state\" | \"managed-profile\" | \"none\";\nexport type ComputerUseCredentialScope = \"none\" | \"session\" | \"workspace\";\nexport type ComputerUseLaunchOption = \"browser\" | \"cdp-endpoint\" | \"extension\" | \"storage-state\" | \"user-data-dir\";\n\nexport interface ComputerUseTransport {\n\treadonly args: readonly string[];\n\treadonly command: string;\n\treadonly packageName?: string;\n\treadonly type: \"stdio\";\n}\n\nexport interface ComputerUseBrowserMode {\n\treadonly argsExtra?: readonly string[];\n\treadonly browser?: ComputerUseBrowser;\n\treadonly browserLimit?: \"chrome-edge-only\";\n\treadonly cookieMode: ComputerUseCookieMode;\n\treadonly description: string;\n\treadonly id:\n\t\t| \"existing-chrome-session\"\n\t\t| \"isolated-storage-state\"\n\t\t| \"managed-chrome-profile\"\n\t\t| \"managed-firefox-profile\";\n\treadonly profileDir?: string;\n}\n\nexport interface ComputerUsePolicy {\n\treadonly allowedDomainsRequired?: boolean;\n\treadonly allowedOriginsSecurityBoundary?: boolean;\n\treadonly blockMetadataIp: boolean;\n\treadonly blockPrivateNetwork: boolean;\n\treadonly credentialScopes: readonly ComputerUseCredentialScope[];\n\treadonly denyNoSandbox: boolean;\n\treadonly descriptorHashPinned: boolean;\n\treadonly evidenceLedger: boolean;\n\treadonly maxActions: number;\n\treadonly maxOutputBytes?: number;\n\treadonly noManualProfileShellScript?: boolean;\n\treadonly noUnrestrictedFileAccess: boolean;\n\treadonly originAllowlistRequiredForCredentialedMode: boolean;\n\treadonly outputGuard: boolean;\n\treadonly profileBrokerOnly?: boolean;\n\treadonly requiresExplicitPostconditions: boolean;\n\treadonly requiresRequestInterception: boolean;\n\treadonly sandboxRequired: boolean;\n\treadonly secretBrokerOnly: boolean;\n}\n\nexport interface ComputerUsePreset {\n\treadonly browserModes: readonly ComputerUseBrowserMode[];\n\treadonly defaultEnabled: boolean;\n\treadonly engine: ComputerUseEngine;\n\treadonly id: ComputerUsePresetId;\n\treadonly key: ComputerUsePresetKey;\n\treadonly label: string;\n\treadonly notes: readonly string[];\n\treadonly policy: ComputerUsePolicy;\n\treadonly risk: ComputerUseRisk;\n\treadonly sourceUrls: readonly string[];\n\treadonly supportedLaunchOptions: readonly ComputerUseLaunchOption[];\n\treadonly transport?: ComputerUseTransport;\n}\n\nconst PLAYWRIGHT_BROWSER_MODES: readonly ComputerUseBrowserMode[] = [\n\t{\n\t\tbrowser: \"chrome\",\n\t\tcookieMode: \"managed-profile\",\n\t\tdescription: \"OMK-managed Chrome profile with project-scoped persistent cookies and local storage.\",\n\t\tid: \"managed-chrome-profile\",\n\t\tprofileDir: \".omk/browser-profiles/chrome\",\n\t},\n\t{\n\t\tbrowser: \"firefox\",\n\t\tcookieMode: \"managed-profile\",\n\t\tdescription: \"OMK-managed Firefox profile; avoids attaching to the user's real Firefox profile.\",\n\t\tid: \"managed-firefox-profile\",\n\t\tprofileDir: \".omk/browser-profiles/firefox\",\n\t},\n\t{\n\t\targsExtra: [\"--isolated\", \"--storage-state\", \"<storageStatePath>\"],\n\t\tcookieMode: \"isolated-storage-state\",\n\t\tdescription: \"Loads cookies and local storage from an explicit Playwright storage-state file.\",\n\t\tid: \"isolated-storage-state\",\n\t},\n\t{\n\t\targsExtra: [\"--extension\"],\n\t\tbrowser: \"chrome\",\n\t\tbrowserLimit: \"chrome-edge-only\",\n\t\tcookieMode: \"existing-browser-session\",\n\t\tdescription: \"Connects to an existing Chrome or Edge session through the Playwright extension.\",\n\t\tid: \"existing-chrome-session\",\n\t},\n];\n\nconst PLAYWRIGHT_COMPUTER_USE_PRESET: ComputerUsePreset = {\n\tbrowserModes: PLAYWRIGHT_BROWSER_MODES,\n\tdefaultEnabled: true,\n\tengine: \"mcp\",\n\tid: \"playwright-computer-use\",\n\tkey: \"playwrightComputerUse\",\n\tlabel: \"Playwright Computer Use\",\n\tnotes: [\n\t\t\"Default computer-use preset built on Microsoft Playwright MCP accessibility-tree automation.\",\n\t\t\"Credentialed browser sessions must go through SecureComputerUseBroker preflight and request interception.\",\n\t\t\"Playwright allowed-origins are recorded as advisory only; OMK policy remains the security boundary.\",\n\t],\n\tpolicy: {\n\t\tallowedOriginsSecurityBoundary: false,\n\t\tblockMetadataIp: true,\n\t\tblockPrivateNetwork: true,\n\t\tcredentialScopes: [\"none\", \"session\", \"workspace\"],\n\t\tdenyNoSandbox: true,\n\t\tdescriptorHashPinned: true,\n\t\tevidenceLedger: true,\n\t\tmaxActions: 40,\n\t\tmaxOutputBytes: 25_000_000,\n\t\tnoUnrestrictedFileAccess: true,\n\t\toriginAllowlistRequiredForCredentialedMode: true,\n\t\toutputGuard: true,\n\t\trequiresExplicitPostconditions: true,\n\t\trequiresRequestInterception: true,\n\t\tsandboxRequired: true,\n\t\tsecretBrokerOnly: true,\n\t},\n\trisk: \"R3\",\n\tsourceUrls: [\"https://github.com/microsoft/playwright-mcp\"],\n\tsupportedLaunchOptions: [\"browser\", \"user-data-dir\", \"storage-state\", \"extension\", \"cdp-endpoint\"],\n\ttransport: {\n\t\targs: [\n\t\t\t\"-y\",\n\t\t\t\"@playwright/mcp@0.0.76\",\n\t\t\t\"--browser\",\n\t\t\t\"<browser>\",\n\t\t\t\"--user-data-dir\",\n\t\t\t\"<profileDir>\",\n\t\t\t\"--output-dir\",\n\t\t\t\"<outputDir>\",\n\t\t\t\"--output-mode\",\n\t\t\t\"file\",\n\t\t\t\"--block-service-workers\",\n\t\t\t\"--timeout-action\",\n\t\t\t\"5000\",\n\t\t\t\"--timeout-navigation\",\n\t\t\t\"60000\",\n\t\t],\n\t\tcommand: \"npx\",\n\t\tpackageName: \"@playwright/mcp\",\n\t\ttype: \"stdio\",\n\t},\n};\n\nconst BROWSER_USE_AGENT_PRESET: ComputerUsePreset = {\n\tbrowserModes: [],\n\tdefaultEnabled: false,\n\tengine: \"python-rust-sidecar\",\n\tid: \"browser-use-agent\",\n\tkey: \"browserUseAgent\",\n\tlabel: \"Browser Use Agent\",\n\tnotes: [\n\t\t\"Optional advanced runner for agentic browser tasks that need recovery loops or custom tools.\",\n\t\t\"Profiles and secrets must be injected through OMK brokers instead of manual shell profile scripts.\",\n\t],\n\tpolicy: {\n\t\tallowedDomainsRequired: true,\n\t\tblockMetadataIp: true,\n\t\tblockPrivateNetwork: true,\n\t\tcredentialScopes: [\"none\", \"session\", \"workspace\"],\n\t\tdenyNoSandbox: true,\n\t\tdescriptorHashPinned: true,\n\t\tevidenceLedger: true,\n\t\tmaxActions: 60,\n\t\tnoManualProfileShellScript: true,\n\t\tnoUnrestrictedFileAccess: true,\n\t\toriginAllowlistRequiredForCredentialedMode: true,\n\t\toutputGuard: true,\n\t\tprofileBrokerOnly: true,\n\t\trequiresExplicitPostconditions: true,\n\t\trequiresRequestInterception: true,\n\t\tsandboxRequired: true,\n\t\tsecretBrokerOnly: true,\n\t},\n\trisk: \"R3\",\n\tsourceUrls: [\"https://github.com/browser-use/browser-use\"],\n\tsupportedLaunchOptions: [],\n};\n\nexport const COMPUTER_USE_PRESETS: Record<ComputerUsePresetKey, ComputerUsePreset> = {\n\tplaywrightComputerUse: PLAYWRIGHT_COMPUTER_USE_PRESET,\n\tbrowserUseAgent: BROWSER_USE_AGENT_PRESET,\n} as const;\n\nexport function listComputerUsePresets(): ComputerUsePreset[] {\n\treturn Object.values(COMPUTER_USE_PRESETS).map((preset) => cloneComputerUsePreset(preset));\n}\n\nexport function getComputerUsePreset(id: string): ComputerUsePreset | undefined {\n\tconst preset = Object.values(COMPUTER_USE_PRESETS).find((candidate) => candidate.id === id);\n\treturn preset ? cloneComputerUsePreset(preset) : undefined;\n}\n\nexport function requiresCredentialedOriginAllowlist(cookieMode: ComputerUseCookieMode): boolean {\n\treturn cookieMode !== \"none\";\n}\n\nfunction cloneComputerUsePreset(preset: ComputerUsePreset): ComputerUsePreset {\n\treturn {\n\t\t...preset,\n\t\tbrowserModes: preset.browserModes.map((mode) => ({\n\t\t\t...mode,\n\t\t\targsExtra: mode.argsExtra ? [...mode.argsExtra] : undefined,\n\t\t})),\n\t\tnotes: [...preset.notes],\n\t\tpolicy: {\n\t\t\t...preset.policy,\n\t\t\tcredentialScopes: [...preset.policy.credentialScopes],\n\t\t},\n\t\tsourceUrls: [...preset.sourceUrls],\n\t\tsupportedLaunchOptions: [...preset.supportedLaunchOptions],\n\t\ttransport: preset.transport\n\t\t\t? {\n\t\t\t\t\t...preset.transport,\n\t\t\t\t\targs: [...preset.transport.args],\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n}\n"]}
|