@tyvm/knowhow 0.0.89 → 0.0.91
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/.depcheckrc +31 -0
- package/CONFIG.md +52 -0
- package/README.md +344 -29
- package/WORKER.md +169 -334
- package/autodoc/chat-guide.md +540 -0
- package/autodoc/cli-reference.md +765 -0
- package/autodoc/config-reference.md +541 -0
- package/autodoc/embeddings-guide.md +566 -0
- package/autodoc/generate-guide.md +477 -0
- package/autodoc/language-plugin-guide.md +443 -0
- package/autodoc/modules-guide.md +352 -0
- package/autodoc/plugins-guide.md +720 -0
- package/autodoc/quickstart-guide.md +129 -0
- package/autodoc/skills-guide.md +468 -0
- package/autodoc/worker-guide.md +526 -0
- package/bin/knowhow.js +1 -1
- package/package.json +4 -32
- package/src/agents/tools/executeScript/index.ts +5 -0
- package/src/agents/tools/googleSearch.ts +2 -2
- package/src/agents/tools/index.ts +0 -3
- package/src/agents/tools/list.ts +0 -147
- package/src/agents/tools/loadWebpage.ts +3 -113
- package/src/ai.ts +33 -2
- package/src/auth/browserLogin.ts +10 -13
- package/src/cli.ts +63 -3
- package/src/clients/gemini.ts +96 -25
- package/src/clients/http.ts +7 -11
- package/src/clients/pricing/google.ts +122 -26
- package/src/config.ts +28 -4
- package/src/conversion.ts +24 -54
- package/src/index.ts +30 -3
- package/src/login.ts +5 -6
- package/src/plugins/language.ts +0 -4
- package/src/plugins/plugins.ts +0 -14
- package/src/plugins/url.ts +31 -12
- package/src/processors/TokenCompressor.ts +2 -2
- package/src/processors/ToolResponseCache.ts +3 -3
- package/src/processors/tools/grepToolResponse.ts +9 -4
- package/src/processors/tools/jqToolResponse.ts +11 -6
- package/src/processors/tools/listStoredToolResponses.ts +1 -1
- package/src/processors/tools/tailToolResponse.ts +9 -4
- package/src/services/GitHub.ts +2 -2
- package/src/services/KnowhowClient.ts +34 -34
- package/src/{plugins/downloader/downloader.ts → services/MediaProcessorService.ts} +109 -267
- package/src/services/S3.ts +16 -16
- package/src/services/index.ts +4 -4
- package/src/services/modules/index.ts +10 -2
- package/src/services/modules/types.ts +5 -2
- package/src/services/script-execution/ScriptExecutor.ts +29 -10
- package/src/services/script-execution/ScriptPolicy.ts +6 -2
- package/src/types.ts +1 -0
- package/src/utils/http.ts +127 -0
- package/src/workers/auth/PasskeySetup.ts +7 -11
- package/tests/clients/AIClient.test.ts +24 -21
- package/tests/manual/file-edits/figma.test.ts +3 -70
- package/tests/plugins/language/languagePlugin-content-triggers.test.ts +2 -0
- package/tests/plugins/language/languagePlugin.test.ts +2 -0
- package/tests/processors/ToolResponseCache.test.ts +2 -2
- package/tests/test.spec.ts +0 -14
- package/tests/unit/modules/moduleLoading.test.ts +7 -4
- package/tests/unit/plugins/pluginLoading.test.ts +6 -6
- package/ts_build/package.json +4 -32
- package/ts_build/src/agents/tools/ast/astAppendNode.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astAppendNode.js +2 -90
- package/ts_build/src/agents/tools/ast/astAppendNode.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astDeleteNode.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astDeleteNode.js +2 -88
- package/ts_build/src/agents/tools/ast/astDeleteNode.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astEditNode.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astEditNode.js +2 -90
- package/ts_build/src/agents/tools/ast/astEditNode.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astGetPathForLine.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astGetPathForLine.js +2 -72
- package/ts_build/src/agents/tools/ast/astGetPathForLine.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astListPaths.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astListPaths.js +2 -72
- package/ts_build/src/agents/tools/ast/astListPaths.js.map +1 -1
- package/ts_build/src/agents/tools/executeScript/index.d.ts +3 -2
- package/ts_build/src/agents/tools/executeScript/index.js +4 -1
- package/ts_build/src/agents/tools/executeScript/index.js.map +1 -1
- package/ts_build/src/agents/tools/googleSearch.js +2 -2
- package/ts_build/src/agents/tools/googleSearch.js.map +1 -1
- package/ts_build/src/agents/tools/index.d.ts +0 -3
- package/ts_build/src/agents/tools/index.js +0 -3
- package/ts_build/src/agents/tools/index.js.map +1 -1
- package/ts_build/src/agents/tools/list.js +0 -138
- package/ts_build/src/agents/tools/list.js.map +1 -1
- package/ts_build/src/agents/tools/loadWebpage.js +1 -89
- package/ts_build/src/agents/tools/loadWebpage.js.map +1 -1
- package/ts_build/src/agents/tools/textSearch.d.ts +1 -1
- package/ts_build/src/ai.js +18 -1
- package/ts_build/src/ai.js.map +1 -1
- package/ts_build/src/auth/browserLogin.js +7 -7
- package/ts_build/src/auth/browserLogin.js.map +1 -1
- package/ts_build/src/cli.d.ts +1 -1
- package/ts_build/src/cli.js +47 -1
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/gemini.d.ts +1 -73
- package/ts_build/src/clients/gemini.js +57 -19
- package/ts_build/src/clients/gemini.js.map +1 -1
- package/ts_build/src/clients/http.js +5 -9
- package/ts_build/src/clients/http.js.map +1 -1
- package/ts_build/src/clients/pricing/google.d.ts +17 -73
- package/ts_build/src/clients/pricing/google.js +47 -10
- package/ts_build/src/clients/pricing/google.js.map +1 -1
- package/ts_build/src/config.js +17 -2
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/conversion.d.ts +1 -4
- package/ts_build/src/conversion.js +12 -27
- package/ts_build/src/conversion.js.map +1 -1
- package/ts_build/src/index.d.ts +4 -0
- package/ts_build/src/index.js +19 -3
- package/ts_build/src/index.js.map +1 -1
- package/ts_build/src/login.js +5 -4
- package/ts_build/src/login.js.map +1 -1
- package/ts_build/src/plugins/downloader/downloader.js +3 -3
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
- package/ts_build/src/plugins/language.js.map +1 -1
- package/ts_build/src/plugins/plugins.js +0 -14
- package/ts_build/src/plugins/plugins.js.map +1 -1
- package/ts_build/src/plugins/tree-sitter/editor.d.ts +3 -32
- package/ts_build/src/plugins/tree-sitter/editor.js +6 -208
- package/ts_build/src/plugins/tree-sitter/editor.js.map +1 -1
- package/ts_build/src/plugins/tree-sitter/parser.d.ts +19 -54
- package/ts_build/src/plugins/tree-sitter/parser.js +19 -293
- package/ts_build/src/plugins/tree-sitter/parser.js.map +1 -1
- package/ts_build/src/plugins/tree-sitter/simple-paths.d.ts +2 -15
- package/ts_build/src/plugins/tree-sitter/simple-paths.js +2 -324
- package/ts_build/src/plugins/tree-sitter/simple-paths.js.map +1 -1
- package/ts_build/src/plugins/url.js +27 -8
- package/ts_build/src/plugins/url.js.map +1 -1
- package/ts_build/src/processors/TokenCompressor.js +2 -2
- package/ts_build/src/processors/TokenCompressor.js.map +1 -1
- package/ts_build/src/processors/ToolResponseCache.js +3 -3
- package/ts_build/src/processors/ToolResponseCache.js.map +1 -1
- package/ts_build/src/processors/tools/grepToolResponse.d.ts +3 -1
- package/ts_build/src/processors/tools/grepToolResponse.js +8 -2
- package/ts_build/src/processors/tools/grepToolResponse.js.map +1 -1
- package/ts_build/src/processors/tools/jqToolResponse.d.ts +3 -1
- package/ts_build/src/processors/tools/jqToolResponse.js +10 -4
- package/ts_build/src/processors/tools/jqToolResponse.js.map +1 -1
- package/ts_build/src/processors/tools/listStoredToolResponses.js +1 -1
- package/ts_build/src/processors/tools/listStoredToolResponses.js.map +1 -1
- package/ts_build/src/processors/tools/tailToolResponse.d.ts +3 -1
- package/ts_build/src/processors/tools/tailToolResponse.js +8 -2
- package/ts_build/src/processors/tools/tailToolResponse.js.map +1 -1
- package/ts_build/src/services/GitHub.js +2 -2
- package/ts_build/src/services/GitHub.js.map +1 -1
- package/ts_build/src/services/KnowhowClient.d.ts +29 -29
- package/ts_build/src/services/KnowhowClient.js +33 -33
- package/ts_build/src/services/KnowhowClient.js.map +1 -1
- package/ts_build/src/services/MediaProcessorService.d.ts +22 -0
- package/ts_build/src/services/MediaProcessorService.js +215 -0
- package/ts_build/src/services/MediaProcessorService.js.map +1 -0
- package/ts_build/src/services/S3.js +12 -18
- package/ts_build/src/services/S3.js.map +1 -1
- package/ts_build/src/services/index.d.ts +3 -2
- package/ts_build/src/services/index.js +3 -3
- package/ts_build/src/services/index.js.map +1 -1
- package/ts_build/src/services/modules/index.js +10 -2
- package/ts_build/src/services/modules/index.js.map +1 -1
- package/ts_build/src/services/modules/types.d.ts +5 -2
- package/ts_build/src/services/script-execution/ScriptExecutor.js +22 -7
- package/ts_build/src/services/script-execution/ScriptExecutor.js.map +1 -1
- package/ts_build/src/services/script-execution/ScriptPolicy.d.ts +1 -1
- package/ts_build/src/services/script-execution/ScriptPolicy.js +4 -2
- package/ts_build/src/services/script-execution/ScriptPolicy.js.map +1 -1
- package/ts_build/src/types.d.ts +1 -0
- package/ts_build/src/types.js +1 -0
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/src/utils/http.d.ts +27 -0
- package/ts_build/src/utils/http.js +98 -0
- package/ts_build/src/utils/http.js.map +1 -0
- package/ts_build/src/workers/auth/PasskeySetup.js +6 -7
- package/ts_build/src/workers/auth/PasskeySetup.js.map +1 -1
- package/ts_build/tests/clients/AIClient.test.js +11 -14
- package/ts_build/tests/clients/AIClient.test.js.map +1 -1
- package/ts_build/tests/manual/file-edits/figma.test.d.ts +0 -1
- package/ts_build/tests/manual/file-edits/figma.test.js +1 -46
- package/ts_build/tests/manual/file-edits/figma.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js +2 -0
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin.test.js +2 -0
- package/ts_build/tests/plugins/language/languagePlugin.test.js.map +1 -1
- package/ts_build/tests/processors/ToolResponseCache.test.js +2 -2
- package/ts_build/tests/processors/ToolResponseCache.test.js.map +1 -1
- package/ts_build/tests/test.spec.js +0 -14
- package/ts_build/tests/test.spec.js.map +1 -1
- package/ts_build/tests/tree-sitter/tree-sitter.test.d.ts +0 -1
- package/ts_build/tests/tree-sitter/tree-sitter.test.js +2 -183
- package/ts_build/tests/tree-sitter/tree-sitter.test.js.map +1 -1
- package/ts_build/tests/unit/modules/moduleLoading.test.js +6 -4
- package/ts_build/tests/unit/modules/moduleLoading.test.js.map +1 -1
- package/ts_build/tests/unit/plugins/pluginLoading.test.js +4 -4
- package/ts_build/tests/unit/plugins/pluginLoading.test.js.map +1 -1
- package/autodoc/chat.mdx +0 -20
- package/autodoc/cli.mdx +0 -11
- package/autodoc/plugins/asana.mdx +0 -47
- package/autodoc/plugins/downloader/downloader.mdx +0 -38
- package/autodoc/plugins/downloader/plugin.mdx +0 -37
- package/autodoc/plugins/downloader/types.mdx +0 -42
- package/autodoc/plugins/embedding.mdx +0 -41
- package/autodoc/plugins/figma.mdx +0 -45
- package/autodoc/plugins/github.mdx +0 -40
- package/autodoc/plugins/jira.mdx +0 -46
- package/autodoc/plugins/language.mdx +0 -37
- package/autodoc/plugins/linear.mdx +0 -35
- package/autodoc/plugins/notion.mdx +0 -38
- package/autodoc/plugins/plugins.mdx +0 -59
- package/autodoc/plugins/types.mdx +0 -51
- package/autodoc/plugins/vim.mdx +0 -39
- package/autodoc/tools/addInternalTools.mdx +0 -1
- package/autodoc/tools/agentCall.mdx +0 -1
- package/autodoc/tools/asana/definitions.mdx +0 -10
- package/autodoc/tools/asana/index.mdx +0 -12
- package/autodoc/tools/askHuman.mdx +0 -1
- package/autodoc/tools/callPlugin.mdx +0 -1
- package/autodoc/tools/embeddingSearch.mdx +0 -1
- package/autodoc/tools/execCommand.mdx +0 -1
- package/autodoc/tools/fileSearch.mdx +0 -1
- package/autodoc/tools/finalAnswer.mdx +0 -1
- package/autodoc/tools/github/definitions.mdx +0 -6
- package/autodoc/tools/github/index.mdx +0 -8
- package/autodoc/tools/index.mdx +0 -14
- package/autodoc/tools/lintFile.mdx +0 -7
- package/autodoc/tools/list.mdx +0 -16
- package/autodoc/tools/modifyFile.mdx +0 -7
- package/autodoc/tools/patch.mdx +0 -9
- package/autodoc/tools/readBlocks.mdx +0 -1
- package/autodoc/tools/readFile.mdx +0 -1
- package/autodoc/tools/scanFile.mdx +0 -1
- package/autodoc/tools/textSearch.mdx +0 -6
- package/autodoc/tools/types/fileblock.mdx +0 -1
- package/autodoc/tools/visionTool.mdx +0 -1
- package/autodoc/tools/writeFile.mdx +0 -1
- package/benchmarks/.dockerignore +0 -7
- package/benchmarks/README.md +0 -166
- package/benchmarks/docker/Dockerfile +0 -68
- package/benchmarks/example-config.yml +0 -27
- package/benchmarks/jest.config.js +0 -13
- package/benchmarks/package-lock.json +0 -4297
- package/benchmarks/package.json +0 -39
- package/benchmarks/results/27b0a06/2025-09-27/xai/xai-grok-code-fast-1.json +0 -2909
- package/benchmarks/results/4057aed/2025-08-14/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -1671
- package/benchmarks/results/4542435/2025-08-05/lms/lms-openai-gpt-oss-20b.json +0 -2814
- package/benchmarks/results/4542435/2025-08-05/lms/lms-qwen-qwen3-30b-a3b-2507.json +0 -2014
- package/benchmarks/results/4fb9125/2025-08-07/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -3121
- package/benchmarks/results/5766aee/2025-08-02/lms-qwen/qwen3-coder-30b.json +0 -98
- package/benchmarks/results/6d73808/2025-08-07/openai/openai-gpt-5.json +0 -3256
- package/benchmarks/results/77bf0a6/2025-08-02/lms-qwen/qwen3-30b-a3b-2507.json +0 -4298
- package/benchmarks/results/8c0d445/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -3031
- package/benchmarks/results/8c0d445/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +0 -2990
- package/benchmarks/results/ac6b2ab/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -3256
- package/benchmarks/results/ac6b2ab/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +0 -3007
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +0 -3256
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-mini-2025-04-14.json +0 -3036
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-nano-2025-04-14.json +0 -3280
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-30b-a3b-2507.json +0 -1920
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-coder-30b.json +0 -3281
- package/benchmarks/results/b502ed9/2025-08-03/lms-qwen/qwen3-coder-30b.json +0 -2896
- package/benchmarks/results/d1a8129/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +0 -3011
- package/benchmarks/results/e60471c/2025-08-03/lms/qwen3-30b-a3b-2507.json +0 -3003
- package/benchmarks/scripts/build-and-run.sh +0 -47
- package/benchmarks/scripts/clone-exercism.sh +0 -92
- package/benchmarks/scripts/validate.sh +0 -48
- package/benchmarks/src/__tests__/runner.test.ts +0 -27
- package/benchmarks/src/cli.ts +0 -90
- package/benchmarks/src/evaluators/EvaluatorRegistry.ts +0 -64
- package/benchmarks/src/evaluators/JavaScriptEvaluator.ts +0 -183
- package/benchmarks/src/evaluators/index.ts +0 -3
- package/benchmarks/src/evaluators/types.ts +0 -22
- package/benchmarks/src/index.ts +0 -3
- package/benchmarks/src/providers.ts +0 -13
- package/benchmarks/src/runner.ts +0 -824
- package/benchmarks/src/types.ts +0 -63
- package/benchmarks/tsconfig.json +0 -19
- package/leaderboard/README.md +0 -148
- package/leaderboard/app/api/benchmark-data/route.ts +0 -131
- package/leaderboard/app/api/benchmark-detail/route.ts +0 -172
- package/leaderboard/app/details/[model]/[provider]/[language]/page.tsx +0 -501
- package/leaderboard/app/exercise/[model]/[provider]/[language]/[exercise]/page.tsx +0 -375
- package/leaderboard/app/globals.css +0 -27
- package/leaderboard/app/layout.tsx +0 -21
- package/leaderboard/app/page.tsx +0 -170
- package/leaderboard/components/LeaderboardTable.tsx +0 -168
- package/leaderboard/components/PerformanceChart.tsx +0 -109
- package/leaderboard/next-env.d.ts +0 -5
- package/leaderboard/next.config.js +0 -4
- package/leaderboard/package-lock.json +0 -6363
- package/leaderboard/package.json +0 -28
- package/leaderboard/postcss.config.js +0 -6
- package/leaderboard/tailwind.config.js +0 -17
- package/leaderboard/tsconfig.json +0 -28
- package/leaderboard/types/benchmark.ts +0 -67
- package/leaderboard/utils/dataProcessor.ts +0 -33
- package/src/agents/tools/asana/definitions.ts +0 -199
- package/src/agents/tools/asana/index.ts +0 -108
- package/src/agents/tools/ast/astAppendNode.ts +0 -90
- package/src/agents/tools/ast/astDeleteNode.ts +0 -88
- package/src/agents/tools/ast/astEditNode.ts +0 -95
- package/src/agents/tools/ast/astGetPathForLine.ts +0 -73
- package/src/agents/tools/ast/astListPaths.ts +0 -66
- package/src/agents/tools/ast/index.ts +0 -7
- package/src/agents/tools/github/definitions.ts +0 -89
- package/src/agents/tools/github/index.ts +0 -67
- package/src/chat-old.ts +0 -446
- package/src/plugins/asana.ts +0 -146
- package/src/plugins/downloader/plugin.ts +0 -103
- package/src/plugins/downloader/types.ts +0 -92
- package/src/plugins/figma.ts +0 -158
- package/src/plugins/github.ts +0 -219
- package/src/plugins/jira.ts +0 -115
- package/src/plugins/linear.ts +0 -230
- package/src/plugins/notion.ts +0 -179
- package/src/plugins/tree-sitter/editor.ts +0 -369
- package/src/plugins/tree-sitter/lang-packs/index.ts +0 -23
- package/src/plugins/tree-sitter/lang-packs/java.ts +0 -59
- package/src/plugins/tree-sitter/lang-packs/javascript.ts +0 -57
- package/src/plugins/tree-sitter/lang-packs/python.ts +0 -45
- package/src/plugins/tree-sitter/lang-packs/types.ts +0 -79
- package/src/plugins/tree-sitter/lang-packs/typescript.ts +0 -49
- package/src/plugins/tree-sitter/parser.ts +0 -470
- package/src/plugins/tree-sitter/simple-paths.ts +0 -467
- package/test-comprehensive.ts +0 -31
- package/tests/tree-sitter/editor.test.ts +0 -113
- package/tests/tree-sitter/invalid.test.ts +0 -299
- package/tests/tree-sitter/paths/common-edits.test.ts +0 -564
- package/tests/tree-sitter/paths/debug-exact-position.test.ts +0 -44
- package/tests/tree-sitter/paths/debug-line-indexing.test.ts +0 -49
- package/tests/tree-sitter/paths/debug-paths.test.ts +0 -90
- package/tests/tree-sitter/paths/paths.test.ts +0 -170
- package/tests/tree-sitter/paths/simple-paths.test.ts +0 -367
- package/tests/tree-sitter/sample-after.ts +0 -48
- package/tests/tree-sitter/sample-before.ts +0 -25
- package/tests/tree-sitter/test-files/completely-broken.ts +0 -7
- package/tests/tree-sitter/test-files/duplicate-braces.ts +0 -39
- package/tests/tree-sitter/test-files/invalid-nesting.ts +0 -39
- package/tests/tree-sitter/test-files/malformed-signature.ts +0 -39
- package/tests/tree-sitter/test-files/mismatched-parens.ts +0 -39
- package/tests/tree-sitter/test-files/missing-semicolon.ts +0 -39
- package/tests/tree-sitter/test-files/partially-broken.ts +0 -20
- package/tests/tree-sitter/test-files/specific-errors.ts +0 -14
- package/tests/tree-sitter/test-files/unclosed-string.ts +0 -39
- package/tests/tree-sitter/tree-sitter.test.ts +0 -251
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
# Worker System Guide (Knowhow CLI)
|
|
2
|
+
|
|
3
|
+
The **Knowhow worker** is how you expose your **local machine** to the Knowhow cloud so **AI agents running on `knowhow.tyvm.ai`** can call your tools and access your workspace.
|
|
4
|
+
|
|
5
|
+
A worker runs a local **MCP server** and keeps a persistent **WebSocket connection** to the Knowhow cloud. The cloud can then invoke the MCP tools that you explicitly allow.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1) What the worker is
|
|
10
|
+
|
|
11
|
+
A **worker** is a process started by `knowhow worker` that:
|
|
12
|
+
|
|
13
|
+
- Loads the CLI’s tool registry (agent tools + worker tools).
|
|
14
|
+
- Starts a local **MCP server** over WebSockets.
|
|
15
|
+
- Connects to **Knowhow cloud** at `knowhow.tyvm.ai` (via a configured API URL).
|
|
16
|
+
- Advertises only the tools allowed by your `knowhow.json` configuration.
|
|
17
|
+
- Optionally enables:
|
|
18
|
+
- **Sharing/visibility controls**
|
|
19
|
+
- **Tunnel-based port forwarding**
|
|
20
|
+
- **Docker sandbox mode**
|
|
21
|
+
- **Passkey-based locking/unlocking**
|
|
22
|
+
|
|
23
|
+
In `src/worker.ts`, this is implemented by:
|
|
24
|
+
|
|
25
|
+
- Creating an MCP server: `mcpServer.createServer(...).withTools(toolsToUse)`
|
|
26
|
+
- Connecting to the cloud WebSocket endpoint: `new WebSocket(`${API_URL}/ws/worker`, { headers })`
|
|
27
|
+
- Running the MCP-over-WebSocket transport: `mcpServer.runWsServer(ws)`
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 2) `knowhow worker` — starting a worker
|
|
32
|
+
|
|
33
|
+
Command:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
knowhow worker
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
At runtime, the worker does the following (high level):
|
|
40
|
+
|
|
41
|
+
1. **Loads config** from `./.knowhow/knowhow.json` (`getConfig()`).
|
|
42
|
+
2. Handles special flags:
|
|
43
|
+
- `--passkey-reset` clears passkey config and exits.
|
|
44
|
+
- `--passkey` starts a browser-based registration flow and exits.
|
|
45
|
+
3. Decides whether to run in **Docker sandbox mode**:
|
|
46
|
+
- If already inside Docker (`process.env.KNOWHOW_DOCKER === "true"`), it disables sandbox to avoid nested Docker.
|
|
47
|
+
- Otherwise, sandbox selection priority is:
|
|
48
|
+
1. CLI flag `--sandbox` / `--no-sandbox`
|
|
49
|
+
2. `config.worker.sandbox`
|
|
50
|
+
3. default: `false` (host mode)
|
|
51
|
+
4. If in **host mode**:
|
|
52
|
+
- Registers the MCP tools locally by:
|
|
53
|
+
- `Tools.defineTools(includedTools, combinedTools)`
|
|
54
|
+
- `Tools.defineTools(workerTools.definitions, workerTools.tools)`
|
|
55
|
+
- `await Mcp.addTools(Tools)`
|
|
56
|
+
- Ensures `worker.allowedTools` exists:
|
|
57
|
+
- If `config.worker?.allowedTools` is missing, it auto-generates:
|
|
58
|
+
- `allowedTools: Tools.getToolNames()`
|
|
59
|
+
- saves it to config
|
|
60
|
+
- prints a message and **returns early** (so you can edit allowed tools before running again)
|
|
61
|
+
5. If **registration** is enabled (`--register`):
|
|
62
|
+
- Calls `registerWorkerPath(process.cwd())` and exits.
|
|
63
|
+
6. If **passkey auth** is enabled in config:
|
|
64
|
+
- Starts in a **locked** state.
|
|
65
|
+
- Wraps each allowed tool to block calls while locked, returning:
|
|
66
|
+
- `error: "WORKER_LOCKED"`
|
|
67
|
+
- a message instructing the caller to use `unlock`.
|
|
68
|
+
- Registers special auth tools:
|
|
69
|
+
- `unlock` (two-step flow)
|
|
70
|
+
- `lock`
|
|
71
|
+
7. Connects to the cloud via WebSockets:
|
|
72
|
+
- `API_URL/ws/worker` for the MCP tool channel
|
|
73
|
+
- Optional `API_URL/ws/tunnel` for the tunnel system
|
|
74
|
+
8. Loops forever, pinging every ~5 seconds, and reconnecting on disconnect.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 3) CLI flags
|
|
79
|
+
|
|
80
|
+
These flags are defined under the `worker` command in `src/cli.ts`.
|
|
81
|
+
|
|
82
|
+
### `--share` / `--unshare` (visibility control)
|
|
83
|
+
|
|
84
|
+
- `--share` makes the worker accessible to your organization.
|
|
85
|
+
- `--unshare` makes it private to you.
|
|
86
|
+
|
|
87
|
+
Implementation detail (`src/worker.ts`): the worker sets a WebSocket header:
|
|
88
|
+
|
|
89
|
+
- `headers.Shared = "true"` when `--share` is used
|
|
90
|
+
- `headers.Shared = "false"` when `--unshare` is used
|
|
91
|
+
- otherwise: “Worker is private (only you can use it)”
|
|
92
|
+
|
|
93
|
+
### `--sandbox` / `--no-sandbox` (Docker sandbox mode)
|
|
94
|
+
|
|
95
|
+
- `--sandbox` runs the worker inside Docker for isolation.
|
|
96
|
+
- `--no-sandbox` runs it on the host.
|
|
97
|
+
|
|
98
|
+
Sandbox selection priority is:
|
|
99
|
+
|
|
100
|
+
1. CLI flags
|
|
101
|
+
2. `config.worker.sandbox`
|
|
102
|
+
3. default: `false`
|
|
103
|
+
|
|
104
|
+
Implementation detail:
|
|
105
|
+
- When `shouldUseSandbox` is true, the worker calls `runWorkerInSandbox(...)`.
|
|
106
|
+
- If Docker isn’t available, sandbox mode exits with an error.
|
|
107
|
+
- Sandbox always rebuilds the worker image:
|
|
108
|
+
- `Docker.buildWorkerImage()`
|
|
109
|
+
|
|
110
|
+
### `--register` (register worker path)
|
|
111
|
+
|
|
112
|
+
Registers the current directory as a worker in the local worker registry:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
knowhow worker --register
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Implementation detail: `registerWorkerPath(process.cwd())`.
|
|
119
|
+
|
|
120
|
+
### `--passkey` / `--passkey-reset` (passkey security setup)
|
|
121
|
+
|
|
122
|
+
- `--passkey` starts the passkey registration flow (requires you to be logged in).
|
|
123
|
+
- `--passkey-reset` removes passkey requirement from config.
|
|
124
|
+
|
|
125
|
+
Implementation detail:
|
|
126
|
+
- `--passkey` uses `PasskeySetupService.setup(jwt)`
|
|
127
|
+
- `--passkey-reset` uses `PasskeySetupService.reset()`
|
|
128
|
+
- If you’re not logged in, `--passkey` errors and tells you to run `knowhow login`.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 4) `worker.allowedTools` — configuring which tools to expose
|
|
133
|
+
|
|
134
|
+
### How the initial list is created (first run)
|
|
135
|
+
|
|
136
|
+
When running in host mode:
|
|
137
|
+
|
|
138
|
+
- If `config.worker.allowedTools` is **missing**, the worker:
|
|
139
|
+
- auto-generates it as:
|
|
140
|
+
- `allowedTools: Tools.getToolNames()`
|
|
141
|
+
- writes it to `.knowhow/knowhow.json`
|
|
142
|
+
- prints:
|
|
143
|
+
> “Worker tools configured! Update knowhow.json to adjust which tools are allowed by the worker.”
|
|
144
|
+
- then **exits early** (so you can edit the list before actually serving tools)
|
|
145
|
+
|
|
146
|
+
So the typical workflow is:
|
|
147
|
+
|
|
148
|
+
1. Start worker once
|
|
149
|
+
2. Edit `worker.allowedTools`
|
|
150
|
+
3. Start worker again
|
|
151
|
+
|
|
152
|
+
### Tool naming (including MCP tools)
|
|
153
|
+
|
|
154
|
+
The guide expects the following naming convention for MCP tool exposure:
|
|
155
|
+
|
|
156
|
+
- **MCP tools** appear as:
|
|
157
|
+
- `mcp_0_<server>_<toolname>`
|
|
158
|
+
|
|
159
|
+
The worker’s tool registry can include both:
|
|
160
|
+
- built-in worker/tools
|
|
161
|
+
- agent tools
|
|
162
|
+
- configured MCP tools (for example browser automation)
|
|
163
|
+
|
|
164
|
+
### Example `allowedTools` list
|
|
165
|
+
|
|
166
|
+
Example (illustrative):
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"worker": {
|
|
171
|
+
"allowedTools": [
|
|
172
|
+
"readFile",
|
|
173
|
+
"writeFile",
|
|
174
|
+
"searchFiles",
|
|
175
|
+
"exec",
|
|
176
|
+
"mcp_0_browser_navigate",
|
|
177
|
+
"mcp_0_browser_click"
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
> Tip: Keep this list tight. Tools are gated by your explicit configuration, and (optionally) by passkey locking.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 5) Connecting to the cloud
|
|
188
|
+
|
|
189
|
+
After you run:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
knowhow login
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
the worker retrieves your JWT token (`loadJwt()`) and connects to Knowhow cloud using WebSockets:
|
|
196
|
+
|
|
197
|
+
- **MCP/tool channel**:
|
|
198
|
+
- `ws://${API_URL}/ws/worker` (API URL is derived from `KNOWHOW_API_URL`)
|
|
199
|
+
- Optional **tunnel channel**:
|
|
200
|
+
- `ws://${API_URL}/ws/tunnel`
|
|
201
|
+
|
|
202
|
+
Headers sent with the WebSocket connection include:
|
|
203
|
+
|
|
204
|
+
- `Authorization: Bearer <jwt>`
|
|
205
|
+
- `User-Agent: knowhow-worker/1.1.1/<hostname>`
|
|
206
|
+
- `Root: <workspace root path representation>`
|
|
207
|
+
- `Shared: "true"` or `"false"` if share/unshare flags are used
|
|
208
|
+
|
|
209
|
+
Reconnect behavior:
|
|
210
|
+
- If the worker WebSocket closes, it logs and reconnects.
|
|
211
|
+
- The worker also periodically pings (`await connection.ws.ping()`), and will reconnect if ping fails.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 6) Sharing the worker
|
|
216
|
+
|
|
217
|
+
- By default (no `--share` / `--unshare`):
|
|
218
|
+
- the worker is treated as **private**.
|
|
219
|
+
- With `--share`:
|
|
220
|
+
- the worker advertises `Shared: "true"` and is accessible to others in your organization.
|
|
221
|
+
- With `--unshare`:
|
|
222
|
+
- the worker advertises `Shared: "false"` (explicitly private).
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 7) Tunnel system (`worker.tunnel`)
|
|
227
|
+
|
|
228
|
+
The worker can also forward inbound requests to **your local ports** through the Knowhow cloud using a tunnel.
|
|
229
|
+
|
|
230
|
+
### Enable it
|
|
231
|
+
|
|
232
|
+
In `knowhow.json`:
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"worker": {
|
|
237
|
+
"tunnel": {
|
|
238
|
+
"enabled": true
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### `allowedPorts`
|
|
245
|
+
|
|
246
|
+
When tunnel is enabled, you must configure which ports the tunnel will be allowed to forward:
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"worker": {
|
|
251
|
+
"tunnel": {
|
|
252
|
+
"enabled": true,
|
|
253
|
+
"allowedPorts": [3000, 5432]
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
If tunnel is enabled but `allowedPorts` is empty, the worker warns:
|
|
260
|
+
|
|
261
|
+
> “Tunnel enabled but no allowedPorts configured. Add tunnel.allowedPorts to knowhow.json”
|
|
262
|
+
|
|
263
|
+
### Other tunnel config (from code)
|
|
264
|
+
|
|
265
|
+
The worker also reads (optional) tunnel settings:
|
|
266
|
+
|
|
267
|
+
- `worker.tunnel.localHost`
|
|
268
|
+
- If not set:
|
|
269
|
+
- inside Docker: uses `host.docker.internal`
|
|
270
|
+
- otherwise: uses `127.0.0.1`
|
|
271
|
+
- `worker.tunnel.portMapping`
|
|
272
|
+
- Logged as “Container port → Host port”
|
|
273
|
+
- `worker.tunnel.maxConcurrentStreams` (default 50)
|
|
274
|
+
- `worker.tunnel.enableUrlRewriting` (default enabled)
|
|
275
|
+
- `worker.tunnel.enableUrlRewriting !== false` enables URL rewriting
|
|
276
|
+
- Tunnel URL rewriting is based on either a `secret` or `workerId` in tunnel metadata
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 8) Docker sandbox mode
|
|
281
|
+
|
|
282
|
+
Sandbox mode runs the worker in Docker for isolation.
|
|
283
|
+
|
|
284
|
+
### Enable it
|
|
285
|
+
|
|
286
|
+
Either:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
knowhow worker --sandbox
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
or in config:
|
|
293
|
+
|
|
294
|
+
```json
|
|
295
|
+
{
|
|
296
|
+
"worker": {
|
|
297
|
+
"sandbox": true
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Configuration: `worker.volumes`
|
|
303
|
+
|
|
304
|
+
When sandboxing, you typically need to mount your workspace and any other resources into the container.
|
|
305
|
+
|
|
306
|
+
This guide documents the expected config keys passed into the Docker runner:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"worker": {
|
|
311
|
+
"sandbox": true,
|
|
312
|
+
"volumes": [
|
|
313
|
+
{ "host": ".", "container": "/workspace" }
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
> The worker code passes the entire `config` into `Docker.runWorkerContainer(...)`, so `worker.volumes` is expected to be consumed by the Docker layer.
|
|
320
|
+
|
|
321
|
+
### Configuration: `worker.envFile`
|
|
322
|
+
|
|
323
|
+
Similarly, you can pass environment variables into the sandboxed container using a file path:
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
{
|
|
327
|
+
"worker": {
|
|
328
|
+
"sandbox": true,
|
|
329
|
+
"envFile": ".knowhow/worker.env"
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
> As above, the worker passes `config` through to the Docker runner.
|
|
335
|
+
|
|
336
|
+
### Notes specific to nested containers
|
|
337
|
+
|
|
338
|
+
If you run the worker inside an environment where:
|
|
339
|
+
|
|
340
|
+
- `KNOWHOW_DOCKER=true`
|
|
341
|
+
|
|
342
|
+
then the worker automatically disables sandbox mode (prevents “nested Docker”).
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## 9) Passkey security
|
|
347
|
+
|
|
348
|
+
Passkey auth protects your worker by requiring a **hardware passkey** to unlock tool access.
|
|
349
|
+
|
|
350
|
+
### Setup and reset
|
|
351
|
+
|
|
352
|
+
- Register/enable passkey auth:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
knowhow worker --passkey
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
- Remove passkey requirement:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
knowhow worker --passkey-reset
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### What happens at startup
|
|
365
|
+
|
|
366
|
+
If config contains passkey credentials:
|
|
367
|
+
|
|
368
|
+
- `config.worker.auth.passkey.publicKey`
|
|
369
|
+
- `config.worker.auth.passkey.credentialId`
|
|
370
|
+
|
|
371
|
+
then the worker:
|
|
372
|
+
|
|
373
|
+
- enables passkey auth
|
|
374
|
+
- starts **locked**
|
|
375
|
+
- wraps each configured allowed tool so that when locked it returns:
|
|
376
|
+
|
|
377
|
+
```json
|
|
378
|
+
{
|
|
379
|
+
"error": "WORKER_LOCKED",
|
|
380
|
+
"message": "Worker is locked. Call the `unlock` tool with your passkey assertion to unlock it first."
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### How unlocking works (tools)
|
|
385
|
+
|
|
386
|
+
When passkey auth is enabled, the worker registers these tools:
|
|
387
|
+
|
|
388
|
+
- `getChallenge` (returns a challenge string)
|
|
389
|
+
- `unlock` (two-step tool)
|
|
390
|
+
- **Call without assertion fields** → returns a challenge
|
|
391
|
+
- **Call with assertion fields** → verifies assertion and unlocks
|
|
392
|
+
- `lock` (re-locks the worker)
|
|
393
|
+
|
|
394
|
+
**Important behavior:** the wrapper gating applies to your *configured allowed tools*, while the auth tools (`unlock`, `lock`, and the unlock flow challenge) are added so callers can regain access.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## 10) Worker in production (systemd / background)
|
|
399
|
+
|
|
400
|
+
The worker runs an infinite loop that reconnects automatically, so it’s well-suited for a supervisor.
|
|
401
|
+
|
|
402
|
+
### systemd example
|
|
403
|
+
|
|
404
|
+
Create `/etc/systemd/system/knowhow-worker.service`:
|
|
405
|
+
|
|
406
|
+
```ini
|
|
407
|
+
[Unit]
|
|
408
|
+
Description=Knowhow Worker
|
|
409
|
+
After=network-online.target
|
|
410
|
+
Wants=network-online.target
|
|
411
|
+
|
|
412
|
+
[Service]
|
|
413
|
+
Type=simple
|
|
414
|
+
WorkingDirectory=/path/to/your/worker-directory
|
|
415
|
+
ExecStart=/usr/local/bin/knowhow worker --register --share --sandbox
|
|
416
|
+
Restart=always
|
|
417
|
+
RestartSec=5
|
|
418
|
+
Environment=NODE_ENV=production
|
|
419
|
+
|
|
420
|
+
# Optional: load environment variables
|
|
421
|
+
# EnvironmentFile=/path/to/your/envfile
|
|
422
|
+
|
|
423
|
+
[Install]
|
|
424
|
+
WantedBy=multi-user.target
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Then:
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
sudo systemctl daemon-reload
|
|
431
|
+
sudo systemctl enable --now knowhow-worker
|
|
432
|
+
sudo journalctl -u knowhow-worker -f
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Background process example
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
nohup knowhow worker --share > /var/log/knowhow-worker.log 2>&1 &
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## Example `knowhow.json` worker configuration
|
|
444
|
+
|
|
445
|
+
Place this in `./.knowhow/knowhow.json` (the worker edits/reads it).
|
|
446
|
+
|
|
447
|
+
```json
|
|
448
|
+
{
|
|
449
|
+
"worker": {
|
|
450
|
+
"allowedTools": [
|
|
451
|
+
"exec",
|
|
452
|
+
"readFile",
|
|
453
|
+
"writeFile",
|
|
454
|
+
"mcp_0_browser_navigate",
|
|
455
|
+
"mcp_0_browser_click"
|
|
456
|
+
],
|
|
457
|
+
"sandbox": false,
|
|
458
|
+
"tunnel": {
|
|
459
|
+
"enabled": true,
|
|
460
|
+
"allowedPorts": [3000, 5432]
|
|
461
|
+
},
|
|
462
|
+
"auth": {
|
|
463
|
+
"passkey": {
|
|
464
|
+
"publicKey": "-----BEGIN PUBLIC KEY-----...",
|
|
465
|
+
"credentialId": "base64url-credential-id"
|
|
466
|
+
},
|
|
467
|
+
"sessionDurationHours": 3
|
|
468
|
+
},
|
|
469
|
+
"volumes": [],
|
|
470
|
+
"envFile": ".knowhow/worker.env"
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Example workflows
|
|
478
|
+
|
|
479
|
+
### Workflow A: Configure allowed tools (safe first run)
|
|
480
|
+
|
|
481
|
+
1. Run once to auto-generate `worker.allowedTools`:
|
|
482
|
+
```bash
|
|
483
|
+
knowhow worker
|
|
484
|
+
```
|
|
485
|
+
2. Edit `.knowhow/knowhow.json` and narrow `worker.allowedTools`.
|
|
486
|
+
3. Run again:
|
|
487
|
+
```bash
|
|
488
|
+
knowhow worker --share
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Workflow B: Expose a local web app through the tunnel
|
|
492
|
+
|
|
493
|
+
1. Enable tunnel and allow the port:
|
|
494
|
+
```json
|
|
495
|
+
{
|
|
496
|
+
"worker": {
|
|
497
|
+
"tunnel": { "enabled": true, "allowedPorts": [3000] }
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
```
|
|
501
|
+
2. Start the worker:
|
|
502
|
+
```bash
|
|
503
|
+
knowhow worker --share
|
|
504
|
+
```
|
|
505
|
+
3. Your cloud agent can then reach forwarded services via tunnel-generated subdomains (URL rewriting enabled by default).
|
|
506
|
+
|
|
507
|
+
### Workflow C: Secure the worker with passkey locking
|
|
508
|
+
|
|
509
|
+
1. Log in:
|
|
510
|
+
```bash
|
|
511
|
+
knowhow login
|
|
512
|
+
```
|
|
513
|
+
2. Register the passkey:
|
|
514
|
+
```bash
|
|
515
|
+
knowhow worker --passkey
|
|
516
|
+
```
|
|
517
|
+
3. Edit `worker.allowedTools` to include only what you want agents to do.
|
|
518
|
+
4. Start the worker normally (it starts locked):
|
|
519
|
+
```bash
|
|
520
|
+
knowhow worker
|
|
521
|
+
```
|
|
522
|
+
5. The agent must call `unlock` using the challenge + WebAuthn assertion to use the other tools.
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
If you want, paste your current `./.knowhow/knowhow.json` worker block and I can suggest a minimal `allowedTools` list and a safe tunnel configuration for your use case.
|
package/bin/knowhow.js
CHANGED
|
@@ -10,7 +10,7 @@ if (!process.execArgv.includes("--no-node-snapshot")) {
|
|
|
10
10
|
|
|
11
11
|
const result = spawnSync(
|
|
12
12
|
process.execPath,
|
|
13
|
-
["--no-node-snapshot", cliEntrypoint, ...process.argv.slice(2)],
|
|
13
|
+
["--no-node-snapshot", "--enable-source-maps", cliEntrypoint, ...process.argv.slice(2)],
|
|
14
14
|
{
|
|
15
15
|
stdio: "inherit",
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tyvm/knowhow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.91",
|
|
4
4
|
"description": "ai cli with plugins and agents",
|
|
5
5
|
"main": "ts_build/src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"dataset:diffs:generate": "ts-node src/dataset/diffs/generate.ts",
|
|
15
15
|
"dataset:diffs:jsonl": "ts-node src/dataset/diffs/jsonl.ts",
|
|
16
16
|
"prepublishOnly": "npm run compile",
|
|
17
|
-
"lint": "tslint ./src/**/*.ts"
|
|
17
|
+
"lint": "tslint ./src/**/*.ts",
|
|
18
|
+
"lint:deps": "depcheck --config=.depcheckrc",
|
|
19
|
+
"lint:all": "npm run lint && npm run lint:deps"
|
|
18
20
|
},
|
|
19
21
|
"keywords": [],
|
|
20
22
|
"author": "Micah Riggan",
|
|
21
23
|
"license": "MIT",
|
|
22
24
|
"devDependencies": {
|
|
23
25
|
"@babel/preset-typescript": "^7.23.3",
|
|
24
|
-
"@types/asana": "^0.18.16",
|
|
25
26
|
"@types/diff": "^5.2.1",
|
|
26
27
|
"@types/express": "^4.17.13",
|
|
27
28
|
"@types/jest": "^29.5.13",
|
|
28
|
-
"@types/jira-client": "^7.1.9",
|
|
29
29
|
"@types/mocha": "^10.0.8",
|
|
30
30
|
"@types/node": "^20.6.3",
|
|
31
31
|
"@types/pdf-parse": "^1.1.4",
|
|
@@ -42,52 +42,24 @@
|
|
|
42
42
|
"@aws-sdk/client-s3": "^3.588.0",
|
|
43
43
|
"@google/genai": "^0.14.1",
|
|
44
44
|
"@inquirer/editor": "^4.2.18",
|
|
45
|
-
"@linear/sdk": "^12.0.0",
|
|
46
45
|
"@modelcontextprotocol/sdk": "^1.13.3",
|
|
47
|
-
"@notionhq/client": "^2.2.14",
|
|
48
|
-
"@octokit/rest": "^20.0.2",
|
|
49
46
|
"@simplewebauthn/server": "^13.3.0",
|
|
50
|
-
"@types/react": "^19.1.8",
|
|
51
47
|
"@tyvm/knowhow-tunnel": "0.0.4",
|
|
52
|
-
"asana": "^3.0.16",
|
|
53
|
-
"axios": "^1.5.0",
|
|
54
|
-
"cheerio": "^1.0.0",
|
|
55
48
|
"commander": "^14.0.0",
|
|
56
49
|
"diff": "^5.2.0",
|
|
57
|
-
"esbuild": "^0.25.8",
|
|
58
50
|
"express": "^4.19.2",
|
|
59
|
-
"figma-js": "^1.16.1-0",
|
|
60
51
|
"gitignore-to-glob": "^0.3.0",
|
|
61
52
|
"glob": "11.0.3",
|
|
62
|
-
"ink": "^6.0.1",
|
|
63
53
|
"isolated-vm": "^5.0.4",
|
|
64
|
-
"jira-client": "^8.2.2",
|
|
65
54
|
"jiti": "^2.6.1",
|
|
66
55
|
"marked": "^10.0.0",
|
|
67
56
|
"marked-terminal": "^6.2.0",
|
|
68
57
|
"minimatch": "^10.1.2",
|
|
69
|
-
"morgan": "^1.10.0",
|
|
70
|
-
"node-fetch": "^3.2.3",
|
|
71
58
|
"node-jq": "^6.0.1",
|
|
72
|
-
"node-pty": "^1.0.0",
|
|
73
|
-
"node-record-lpcm16": "^1.0.1",
|
|
74
59
|
"openai": "4.89.1",
|
|
75
|
-
"ora": "^5.4.1",
|
|
76
|
-
"parse-diff": "^0.11.1",
|
|
77
60
|
"pdf-parse": "^1.1.1",
|
|
78
|
-
"playwright": "^1.52.0",
|
|
79
|
-
"playwright-extra": "^4.3.6",
|
|
80
|
-
"progress-estimator": "^0.3.1",
|
|
81
|
-
"puppeteer": "^24.4.0",
|
|
82
|
-
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
83
|
-
"react": "^19.1.0",
|
|
84
|
-
"source-map-support": "^0.5.21",
|
|
85
|
-
"tree-sitter": "^0.21.1",
|
|
86
|
-
"tree-sitter-javascript": "^0.23.1",
|
|
87
|
-
"tree-sitter-typescript": "^0.23.1",
|
|
88
61
|
"typescript": "^4.6.3",
|
|
89
62
|
"ws": "^8.18.1",
|
|
90
|
-
"youtube-dl-exec": "^2.5.5",
|
|
91
63
|
"zod": "^3.24.2"
|
|
92
64
|
},
|
|
93
65
|
"directories": {
|
|
@@ -12,12 +12,14 @@ export async function executeScript({
|
|
|
12
12
|
maxTokens,
|
|
13
13
|
maxExecutionTimeMs,
|
|
14
14
|
maxCostUsd,
|
|
15
|
+
allowNetworkAccess,
|
|
15
16
|
}: {
|
|
16
17
|
script: string;
|
|
17
18
|
maxToolCalls?: number;
|
|
18
19
|
maxTokens?: number;
|
|
19
20
|
maxExecutionTimeMs?: number;
|
|
20
21
|
maxCostUsd?: number;
|
|
22
|
+
allowNetworkAccess?: boolean;
|
|
21
23
|
}) {
|
|
22
24
|
try {
|
|
23
25
|
// Get context from bound ToolsService
|
|
@@ -44,6 +46,9 @@ export async function executeScript({
|
|
|
44
46
|
maxCostUsd: maxCostUsd || 1.0,
|
|
45
47
|
maxMemoryMb: 100,
|
|
46
48
|
},
|
|
49
|
+
policy: {
|
|
50
|
+
allowNetworkAccess: allowNetworkAccess ?? false,
|
|
51
|
+
},
|
|
47
52
|
});
|
|
48
53
|
|
|
49
54
|
// If there were policy violations, include them in the response
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import http from "../../utils/http";
|
|
2
2
|
import { Tool } from "../../clients/types";
|
|
3
3
|
|
|
4
4
|
interface GoogleSearchParams {
|
|
@@ -180,7 +180,7 @@ export async function googleSearch(params: GoogleSearchParams) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
try {
|
|
183
|
-
const response = await
|
|
183
|
+
const response = await http.get<GoogleSearchResponse>(url.toString());
|
|
184
184
|
return transformGoogleSearchResponseForLLM(response.data);
|
|
185
185
|
} catch (error) {
|
|
186
186
|
console.error("Error performing Google search:", error);
|
|
@@ -14,8 +14,6 @@ export * from "./scanFile";
|
|
|
14
14
|
export * from "./textSearch";
|
|
15
15
|
export * from "./visionTool";
|
|
16
16
|
export * from "./writeFile";
|
|
17
|
-
export * from "./asana";
|
|
18
|
-
export * from "./github";
|
|
19
17
|
export * from "./fileSearch";
|
|
20
18
|
export * from "./language";
|
|
21
19
|
export * from "./askHuman";
|
|
@@ -24,7 +22,6 @@ export * from "./googleSearch";
|
|
|
24
22
|
export * from "./loadWebpage";
|
|
25
23
|
export * from "./stringReplace";
|
|
26
24
|
export * from "./executeScript";
|
|
27
|
-
export * from "./ast";
|
|
28
25
|
export * from "./startAgentTask";
|
|
29
26
|
export * from "./ycmd";
|
|
30
27
|
export * from "./mcp";
|