@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
package/WORKER.md
CHANGED
|
@@ -1,373 +1,235 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `knowhow worker` — what it is
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `knowhow worker` command starts a **Knowhow Worker process** that exposes an **MCP (Model Context Protocol) server** backed by a curated set of **tools**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
At a high level (from `src/worker.ts` + CLI wiring):
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. Loads `knowhow.json` via `getConfig()`.
|
|
8
|
+
2. Optionally runs **passkey setup / reset** flows (browser-based), then exits.
|
|
9
|
+
3. Chooses an execution mode:
|
|
10
|
+
- **Host mode** (default), or
|
|
11
|
+
- **Docker sandbox mode** (`--sandbox`)
|
|
12
|
+
4. In host mode, it connects to Knowhow’s API over **WebSockets** and serves MCP tools.
|
|
13
|
+
5. In sandbox mode, it verifies Docker, rebuilds the worker image, then runs the worker inside Docker and forwards logs.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
> The CLI entry point (e.g. in `src/cli.ts`) mainly defines the subcommand surface and ensures shared services are initialized; the runtime behavior and config handling are implemented in `src/worker.ts`.
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
---
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
knowhow login
|
|
15
|
-
```
|
|
19
|
+
## What the worker exposes
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
In **host mode**, the worker:
|
|
22
|
+
- Starts an **MCP server** (`clientName = "knowhow-worker"`, `clientVersion = "1.1.1"`).
|
|
23
|
+
- Registers the enabled tool set (see `worker.allowedTools` below).
|
|
24
|
+
- Connects to the Knowhow backend WebSocket endpoint(s) so the backend can drive tool usage.
|
|
25
|
+
- Reconnects continuously if the WebSocket connection drops.
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
Key connection endpoints (host mode):
|
|
28
|
+
- Worker WS: `${API_URL}/ws/worker`
|
|
29
|
+
- Optional tunnel WS: `${API_URL}/ws/tunnel`
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
WebSocket headers include:
|
|
32
|
+
- `Authorization: Bearer <jwt>` (from `loadJwt()`)
|
|
33
|
+
- `User-Agent: knowhow-worker/1.1.1/<hostname>`
|
|
34
|
+
- `Root: <computed from WORKER_ROOT or cwd>`
|
|
35
|
+
- Optional share visibility:
|
|
36
|
+
- `Shared: "true"` with `--share`
|
|
37
|
+
- `Shared: "false"` with `--unshare`
|
|
38
|
+
- no `Shared` header if neither flag is provided
|
|
22
39
|
|
|
23
|
-
|
|
24
|
-
knowhow worker
|
|
25
|
-
```
|
|
40
|
+
---
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
- Generate a `worker` configuration block in your `knowhow.json`
|
|
29
|
-
- Display available tools that can be exposed
|
|
30
|
-
- Create a secure connection to the Knowhow platform
|
|
42
|
+
# CLI arguments supported by `knowhow worker`
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
These flags are handled by the exported worker launcher in `src/worker.ts` (and exposed by the `worker` subcommand wiring).
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
| Flag | Type | Effect |
|
|
47
|
+
|------|------|--------|
|
|
48
|
+
| `--register` | boolean | Registers the current directory as a worker path (`registerWorkerPath(process.cwd())`) and then exits. |
|
|
49
|
+
| `--share` | boolean | Sets `Shared: "true"` header when connecting to the API (marks worker as shared). |
|
|
50
|
+
| `--unshare` | boolean | Sets `Shared: "false"` header when connecting to the API (marks worker as private/unshared). |
|
|
51
|
+
| `--sandbox` | boolean | Runs worker in Docker sandbox mode; persists `worker.sandbox = true` into config. |
|
|
52
|
+
| `--no-sandbox` | boolean | Forces host mode; persists `worker.sandbox = false` into config. |
|
|
53
|
+
| `--passkey` | boolean | Runs browser-based passkey setup (`PasskeySetupService().setup(jwt)`) and exits. |
|
|
54
|
+
| `--passkey-reset` | boolean | Clears stored passkey credentials (`PasskeySetupService().reset()`) and exits. |
|
|
35
55
|
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
"worker": {
|
|
39
|
-
"allowedTools": [
|
|
40
|
-
"readFile",
|
|
41
|
-
"writeFileChunk",
|
|
42
|
-
"patchFile",
|
|
43
|
-
"execCommand",
|
|
44
|
-
"textSearch",
|
|
45
|
-
"fileSearch",
|
|
46
|
-
"embeddingSearch"
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
56
|
+
## Sandbox selection priority (important)
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
When not already inside Docker, sandbox mode is selected by this priority:
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
1. `--sandbox` / `--no-sandbox` CLI flags (highest priority)
|
|
61
|
+
2. `knowhow.json` config: `config.worker.sandbox`
|
|
62
|
+
3. Default: `false` (host mode)
|
|
55
63
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
### Special case: already inside Docker
|
|
65
|
+
If `process.env.KNOWHOW_DOCKER === "true"`, the worker forces:
|
|
66
|
+
- `options.sandbox = false`
|
|
67
|
+
- `options.noSandbox = true`
|
|
59
68
|
|
|
60
|
-
|
|
69
|
+
This prevents nested Docker execution.
|
|
61
70
|
|
|
62
71
|
---
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
# `knowhow.json` config options supported (as used by `src/worker.ts`)
|
|
65
74
|
|
|
66
|
-
|
|
75
|
+
The worker primarily reads/writes under `config.worker.*`.
|
|
67
76
|
|
|
68
|
-
|
|
77
|
+
## 1) `worker.sandbox` (boolean)
|
|
78
|
+
Controls which mode runs **when no CLI sandbox flags are provided**.
|
|
69
79
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
|
|
80
|
+
- Updated by:
|
|
81
|
+
- `--sandbox` → `worker.sandbox = true`
|
|
82
|
+
- `--no-sandbox` → `worker.sandbox = false`
|
|
83
|
+
|
|
84
|
+
---
|
|
74
85
|
|
|
75
|
-
|
|
86
|
+
## 2) `worker.allowedTools` (string[])
|
|
87
|
+
Controls which tools are exposed to the MCP server.
|
|
76
88
|
|
|
77
|
-
|
|
89
|
+
Behavior:
|
|
90
|
+
- If missing, the worker:
|
|
91
|
+
1. populates it with `Tools.getToolNames()`
|
|
92
|
+
2. saves it back to `knowhow.json`
|
|
93
|
+
3. then exits early (so you can edit/curate the allowlist)
|
|
78
94
|
|
|
79
|
-
|
|
80
|
-
- **Parameter Validation**: Ensures proper argument types and requirements
|
|
81
|
-
- **Error Handling**: Provides detailed error messages for debugging
|
|
82
|
-
- **Response Formatting**: Standardizes tool outputs for agent consumption
|
|
95
|
+
So: first run creates an allowlist; subsequent runs enforce it.
|
|
83
96
|
|
|
84
97
|
---
|
|
85
98
|
|
|
86
|
-
##
|
|
99
|
+
## 3) Passkey auth: `worker.auth.passkey`
|
|
100
|
+
If configured, the worker starts in a **locked** state and wraps tool execution so tools fail unless unlocked.
|
|
87
101
|
|
|
88
|
-
|
|
102
|
+
The code implies an expected shape like:
|
|
89
103
|
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"readFile",
|
|
95
|
-
"writeFileChunk",
|
|
96
|
-
"patchFile",
|
|
97
|
-
"lintFile",
|
|
98
|
-
"execCommand",
|
|
99
|
-
"textSearch",
|
|
100
|
-
"fileSearch",
|
|
101
|
-
"embeddingSearch"
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
104
|
+
```ts
|
|
105
|
+
config.worker.auth.passkey.publicKey
|
|
106
|
+
config.worker.auth.passkey.credentialId
|
|
107
|
+
config.worker.auth.sessionDurationHours // optional; defaults to ~3
|
|
105
108
|
```
|
|
106
109
|
|
|
107
|
-
|
|
110
|
+
Effects when enabled:
|
|
111
|
+
- `WorkerPasskeyAuthService` is created.
|
|
112
|
+
- Tool functions are wrapped:
|
|
113
|
+
- When locked: return an error object like `WORKER_LOCKED` / “unlock first”.
|
|
114
|
+
- When unlocked: execute the original tool function.
|
|
115
|
+
- The worker registers additional auth tools:
|
|
116
|
+
- `unlock` (`makeUnlockTool`)
|
|
117
|
+
- `lock` (`makeLockTool`)
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
"worker": {
|
|
112
|
-
"allowedTools": [
|
|
113
|
-
"readFile",
|
|
114
|
-
"writeFileChunk",
|
|
115
|
-
"patchFile",
|
|
116
|
-
"lintFile",
|
|
117
|
-
"execCommand",
|
|
118
|
-
"textSearch",
|
|
119
|
-
"fileSearch",
|
|
120
|
-
"embeddingSearch",
|
|
121
|
-
"createAiCompletion",
|
|
122
|
-
"listAllModels",
|
|
123
|
-
"callPlugin"
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
119
|
+
> Exact error message/response format depends on the auth service implementation, but the lock/unlock gating is explicit.
|
|
128
120
|
|
|
129
121
|
---
|
|
130
122
|
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
### File Operations
|
|
123
|
+
## 4) Tunnel configuration: `worker.tunnel.*`
|
|
124
|
+
If enabled, the worker also opens a second WebSocket (`/ws/tunnel`) so the backend can reach allowed local services.
|
|
134
125
|
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
- **`patchFile`** - Apply unified diff patches to files
|
|
139
|
-
- **`readBlocks`** - Read specific blocks from files
|
|
126
|
+
### `worker.tunnel.enabled` (boolean)
|
|
127
|
+
- `true` → tunnel WS created
|
|
128
|
+
- `false` / missing → tunneling disabled
|
|
140
129
|
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
- **`embeddingSearch`** - Semantic search using embeddings
|
|
130
|
+
### `worker.tunnel.allowedPorts` (number[])
|
|
131
|
+
- Restricts which ports can be used through the tunnel.
|
|
132
|
+
- If tunnel is enabled but this list is empty, the worker logs a warning.
|
|
145
133
|
|
|
146
|
-
###
|
|
134
|
+
### `worker.tunnel.localHost` (string, optional)
|
|
135
|
+
Hostname for reaching local services.
|
|
147
136
|
|
|
148
|
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
137
|
+
- If not set:
|
|
138
|
+
- inside Docker (`KNOWHOW_DOCKER === "true"`): `host.docker.internal`
|
|
139
|
+
- otherwise: `127.0.0.1`
|
|
151
140
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- **`listAllModels`** - List available AI models
|
|
155
|
-
- **`listAllProviders`** - List available AI providers
|
|
141
|
+
### `worker.tunnel.portMapping` (object/map)
|
|
142
|
+
The code treats it as a mapping:
|
|
156
143
|
|
|
157
|
-
|
|
158
|
-
- **`callPlugin`** - Execute plugin functions
|
|
159
|
-
- **`addLanguageTerm`** - Add language terms for context loading
|
|
160
|
-
- **`getAllLanguageTerms`** - Retrieve all configured language terms
|
|
161
|
-
- **`lookupLanguageTerm`** - Look up specific language terms
|
|
144
|
+
- `config.worker.tunnel.portMapping[containerPort] = hostPort`
|
|
162
145
|
|
|
163
|
-
|
|
146
|
+
It logs these mappings and passes them to the tunnel handler.
|
|
164
147
|
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
- **`getRunLogs`** - Retrieve GitHub Actions run logs
|
|
169
|
-
- **`getPullRequestBuildFailureLogs`** - Get failure logs from PR builds
|
|
148
|
+
### `worker.tunnel.maxConcurrentStreams` (number, optional)
|
|
149
|
+
- Passed to tunnel config
|
|
150
|
+
- Default used in `src/worker.ts`: `50`
|
|
170
151
|
|
|
171
|
-
###
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```json
|
|
176
|
-
{
|
|
177
|
-
"mcps": [
|
|
178
|
-
{
|
|
179
|
-
"name": "browser",
|
|
180
|
-
"command": "npx",
|
|
181
|
-
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
|
|
182
|
-
}
|
|
183
|
-
],
|
|
184
|
-
"worker": {
|
|
185
|
-
"allowedTools": [
|
|
186
|
-
"mcp_0_browser_navigate",
|
|
187
|
-
"mcp_0_browser_screenshot",
|
|
188
|
-
"mcp_0_browser_click",
|
|
189
|
-
"mcp_0_browser_fill",
|
|
190
|
-
"mcp_0_browser_select"
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
```
|
|
152
|
+
### `worker.tunnel.enableUrlRewriting` (boolean, optional)
|
|
153
|
+
- Passed to tunnel config as:
|
|
154
|
+
- `config.worker.tunnel.enableUrlRewriting !== false`
|
|
155
|
+
- So URL rewriting defaults to **enabled** unless explicitly set to `false`.
|
|
195
156
|
|
|
196
157
|
---
|
|
197
158
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
159
|
+
# Execution modes (host vs Docker sandbox)
|
|
160
|
+
|
|
161
|
+
## Host mode (default)
|
|
162
|
+
Key responsibilities:
|
|
163
|
+
- Connect to `${API_URL}/ws/worker` using the JWT and headers (including optional `Shared`).
|
|
164
|
+
- Optionally connect to `${API_URL}/ws/tunnel`.
|
|
165
|
+
- Serve MCP tools via `mcpServer.createServer(...).withTools(toolsToUse)`.
|
|
166
|
+
- If the worker WS reconnects:
|
|
167
|
+
- it resets MCP server state and re-registers the tool set.
|
|
168
|
+
|
|
169
|
+
## Docker sandbox mode (`--sandbox`)
|
|
170
|
+
When sandbox mode is selected:
|
|
171
|
+
1. Check Docker availability.
|
|
172
|
+
2. Build the worker Docker image.
|
|
173
|
+
3. Load JWT.
|
|
174
|
+
4. Run the worker in Docker (`Docker.runWorkerContainer(...)`) with:
|
|
175
|
+
- `workspaceDir: process.cwd()`
|
|
176
|
+
- `jwt`
|
|
177
|
+
- `apiUrl: API_URL`
|
|
178
|
+
- `config` passed into container
|
|
179
|
+
- `share` / `unshare` options
|
|
180
|
+
5. Forward container logs and stop the container on exit.
|
|
201
181
|
|
|
202
|
-
|
|
182
|
+
---
|
|
203
183
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
184
|
+
# Summary checklist
|
|
185
|
+
|
|
186
|
+
- **Use `knowhow worker` to**: run a Knowhow Worker that exposes an MCP server and a filtered tool allowlist.
|
|
187
|
+
- **Common CLI flags**:
|
|
188
|
+
- `--register`, `--share`, `--unshare`
|
|
189
|
+
- `--sandbox` / `--no-sandbox`
|
|
190
|
+
- `--passkey` / `--passkey-reset`
|
|
191
|
+
- **Key config fields**:
|
|
192
|
+
- `worker.sandbox`
|
|
193
|
+
- `worker.allowedTools` (auto-populated on first run if missing)
|
|
194
|
+
- `worker.auth.passkey.*` (enables lock/unlock tool gating)
|
|
195
|
+
- `worker.tunnel.enabled`, `worker.tunnel.allowedPorts`, `worker.tunnel.localHost`, `worker.tunnel.portMapping`, `worker.tunnel.maxConcurrentStreams`, `worker.tunnel.enableUrlRewriting`
|
|
214
196
|
```
|
|
215
197
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
Workers respect the project directory boundaries:
|
|
219
|
-
- **Limited Scope**: Only files within the project directory are accessible
|
|
220
|
-
- **Path Validation**: Prevents directory traversal attacks
|
|
221
|
-
- **Permission Checks**: Respects file system permissions
|
|
222
|
-
|
|
223
|
-
### Command Execution
|
|
224
|
-
|
|
225
|
-
When `execCommand` is enabled:
|
|
226
|
-
- **Timeout Protection**: Commands have configurable timeouts
|
|
227
|
-
- **Process Isolation**: Commands run in separate processes
|
|
228
|
-
- **Error Handling**: Captures both stdout and stderr
|
|
229
|
-
- **Security Warning**: Be cautious with command execution in untrusted environments
|
|
230
|
-
|
|
231
|
-
### Network Security
|
|
198
|
+
If you paste `src/worker.ts` (or the exact relevant portions) and `src/cli.ts`, I can tighten any remaining ambiguities (e.g., exact auth config field names and the precise tool/error response shapes).
|
|
199
|
+
# Knowhow Workers Guide
|
|
232
200
|
|
|
233
|
-
|
|
234
|
-
- **Authentication Required**: Valid Knowhow credentials required
|
|
235
|
-
- **Session Management**: Automatic session expiration and renewal
|
|
201
|
+
Knowhow workers allow you to expose your local tools and development environment to the Knowhow platform, enabling remote agents to execute commands, access files, and leverage your local setup through a secure WebSocket connection.
|
|
236
202
|
|
|
237
203
|
---
|
|
238
204
|
|
|
239
|
-
##
|
|
240
|
-
|
|
241
|
-
### Creating Worker-Enabled Behaviors
|
|
242
|
-
|
|
243
|
-
Behaviors can leverage worker tools through the Knowhow platform:
|
|
244
|
-
|
|
245
|
-
```json
|
|
246
|
-
{
|
|
247
|
-
"name": "Code Reviewer",
|
|
248
|
-
"description": "Reviews code changes and provides feedback",
|
|
249
|
-
"instructions": "Use readFile to examine code, textSearch to find patterns, and writeFileChunk to create review comments",
|
|
250
|
-
"tools": ["worker_0_readFile", "worker_0_textSearch", "worker_0_writeFileChunk"],
|
|
251
|
-
"workers": ["worker_connection_id"]
|
|
252
|
-
}
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Tool Usage in Agents
|
|
256
|
-
|
|
257
|
-
Agents can call worker tools directly:
|
|
258
|
-
|
|
259
|
-
```javascript
|
|
260
|
-
// Agent can read local files
|
|
261
|
-
const fileContent = await callTool('readFile', {
|
|
262
|
-
filePath: './src/components/Header.tsx'
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
// Search for patterns in codebase
|
|
266
|
-
const searchResults = await callTool('textSearch', {
|
|
267
|
-
searchTerm: 'useState'
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
// Apply code changes
|
|
271
|
-
await callTool('patchFile', {
|
|
272
|
-
filePath: './src/utils/helpers.ts',
|
|
273
|
-
patch: `--- a/src/utils/helpers.ts
|
|
274
|
-
+++ b/src/utils/helpers.ts
|
|
275
|
-
@@ -10,6 +10,7 @@
|
|
276
|
-
export function formatDate(date: Date): string {
|
|
277
|
-
+ if (!date) return '';
|
|
278
|
-
return date.toISOString().split('T')[0];
|
|
279
|
-
}`
|
|
280
|
-
});
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
---
|
|
205
|
+
## Quick Start
|
|
284
206
|
|
|
285
|
-
|
|
207
|
+
### 1. Initial Setup
|
|
286
208
|
|
|
287
|
-
|
|
209
|
+
First, authenticate with the Knowhow platform:
|
|
288
210
|
|
|
289
211
|
```bash
|
|
290
|
-
# Authenticate with Knowhow
|
|
291
212
|
knowhow login
|
|
292
|
-
|
|
293
|
-
# Generate worker configuration
|
|
294
|
-
knowhow worker
|
|
295
|
-
|
|
296
|
-
# Start worker with default config
|
|
297
|
-
knowhow worker
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Environment Variables
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## Troubleshooting
|
|
305
|
-
|
|
306
|
-
### Common Issues
|
|
307
|
-
|
|
308
|
-
#### Connection Problems
|
|
309
|
-
|
|
310
|
-
**Issue**: Worker fails to connect
|
|
311
|
-
```
|
|
312
|
-
Error: WebSocket connection failed
|
|
313
213
|
```
|
|
314
214
|
|
|
315
|
-
|
|
316
|
-
1. Check internet connection
|
|
317
|
-
2. Verify authentication: `knowhow login`
|
|
318
|
-
3. Check firewall settings for WebSocket connections
|
|
319
|
-
|
|
320
|
-
#### Authentication Errors
|
|
321
|
-
|
|
322
|
-
**Issue**: Authentication failed
|
|
323
|
-
```
|
|
324
|
-
Error: Invalid credentials
|
|
325
|
-
```
|
|
215
|
+
This will open your browser and guide you through the authentication process.
|
|
326
216
|
|
|
327
|
-
|
|
328
|
-
1. Re-authenticate: `knowhow login`
|
|
329
|
-
2. Check token expiration
|
|
330
|
-
3. Verify organization permissions
|
|
217
|
+
### 2. Generate Worker Configuration
|
|
331
218
|
|
|
332
|
-
|
|
219
|
+
Run the worker command to generate the initial configuration:
|
|
333
220
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
Error: Function readFile not enabled
|
|
221
|
+
```bash
|
|
222
|
+
knowhow worker
|
|
337
223
|
```
|
|
338
224
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
## Best Practices
|
|
345
|
-
|
|
346
|
-
### Security
|
|
347
|
-
|
|
348
|
-
1. **Principle of Least Privilege**: Only expose necessary tools
|
|
349
|
-
2. **Regular Audits**: Review `allowedTools` periodically
|
|
350
|
-
3. **Environment Separation**: Use different configurations for dev/prod
|
|
351
|
-
4. **Command Restrictions**: Be cautious with `execCommand` permissions
|
|
352
|
-
|
|
353
|
-
### Development Workflow
|
|
354
|
-
|
|
355
|
-
1. **Version Control**: Include `knowhow.json` in version control
|
|
356
|
-
2. **Team Coordination**: Document tool requirements for team members
|
|
357
|
-
3. **Testing**: Test worker configuration before deploying behaviors
|
|
358
|
-
4. **Documentation**: Document custom tools and their usage
|
|
359
|
-
|
|
360
|
-
### Maintenance
|
|
361
|
-
1. **Regular Updates**: Keep Knowhow CLI updated
|
|
362
|
-
2. **Log Monitoring**: Review worker logs for issues
|
|
363
|
-
3. **Configuration Backup**: Backup working configurations
|
|
364
|
-
4. **Health Checks**: Implement monitoring for worker connectivity
|
|
365
|
-
|
|
366
|
-
---
|
|
225
|
+
This will:
|
|
226
|
+
- Generate a `worker` configuration block in your `knowhow.json`
|
|
227
|
+
- Display available tools that can be exposed
|
|
228
|
+
- Create a secure connection to the Knowhow platform
|
|
367
229
|
|
|
368
|
-
|
|
230
|
+
### 3. Configure Allowed Tools
|
|
369
231
|
|
|
370
|
-
|
|
232
|
+
Edit your `knowhow.json` to specify which tools you want to expose:
|
|
371
233
|
|
|
372
234
|
```json
|
|
373
235
|
{
|
|
@@ -376,30 +238,7 @@ Error: Function readFile not enabled
|
|
|
376
238
|
"readFile",
|
|
377
239
|
"writeFileChunk",
|
|
378
240
|
"patchFile",
|
|
379
|
-
"textSearch",
|
|
380
|
-
"fileSearch",
|
|
381
|
-
"embeddingSearch",
|
|
382
241
|
"execCommand",
|
|
383
|
-
"lintFile"
|
|
384
|
-
]
|
|
385
|
-
},
|
|
386
|
-
"mcps": [
|
|
387
|
-
{
|
|
388
|
-
"name": "browser",
|
|
389
|
-
"command": "npx",
|
|
390
|
-
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
|
|
391
|
-
}
|
|
392
|
-
]
|
|
393
|
-
}
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### Production Environment (Restricted)
|
|
397
|
-
|
|
398
|
-
```json
|
|
399
|
-
{
|
|
400
|
-
"worker": {
|
|
401
|
-
"allowedTools": [
|
|
402
|
-
"readFile",
|
|
403
242
|
"textSearch",
|
|
404
243
|
"fileSearch",
|
|
405
244
|
"embeddingSearch"
|
|
@@ -408,18 +247,14 @@ Error: Function readFile not enabled
|
|
|
408
247
|
}
|
|
409
248
|
```
|
|
410
249
|
|
|
411
|
-
###
|
|
250
|
+
### 4. Start the Worker
|
|
412
251
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
"readFile",
|
|
418
|
-
"textSearch",
|
|
419
|
-
"getPullRequest",
|
|
420
|
-
"getPullRequestBuildStatuses",
|
|
421
|
-
"lintFile"
|
|
422
|
-
]
|
|
423
|
-
}
|
|
424
|
-
}
|
|
252
|
+
Run the worker again to start the connection:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
knowhow worker
|
|
425
256
|
```
|
|
257
|
+
|
|
258
|
+
Your local tools are now available to Knowhow behaviors and agents!
|
|
259
|
+
|
|
260
|
+
|