rhachet-roles-bhrain 0.2.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.test/getContextOpenAI.js +1 -1
- package/dist/.test/getContextOpenAI.js.map +1 -1
- package/dist/access/sdk/sdkOpenAi.d.ts +25 -0
- package/dist/access/sdk/sdkOpenAi.js +122 -0
- package/dist/access/sdk/sdkOpenAi.js.map +1 -1
- package/dist/access/sdks/anthropic/sdkAnthropic.d.ts +31 -0
- package/dist/access/sdks/anthropic/sdkAnthropic.js +151 -0
- package/dist/access/sdks/anthropic/sdkAnthropic.js.map +1 -0
- package/dist/access/sdks/qwen/sdkQwen.d.ts +31 -0
- package/dist/access/sdks/qwen/sdkQwen.js +134 -0
- package/dist/access/sdks/qwen/sdkQwen.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Actor.d.ts +67 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Actor.js +12 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Actor.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Atom.d.ts +40 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Atom.js +3 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Atom.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Context.d.ts +30 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Context.js +3 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Context.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.d.ts +34 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.d.ts +23 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.js +9 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.d.ts +49 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.d.ts +31 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.js +9 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.d.ts +27 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.d.ts +45 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.js +3 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.d.ts +29 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.d.ts +22 -0
- package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.d.ts +30 -0
- package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.js +3 -0
- package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Session.d.ts +47 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Session.js +17 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Session.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.d.ts +34 -0
- package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.js +12 -0
- package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.d.ts +21 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.d.ts +54 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.js +20 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.d.ts +36 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.js +9 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.d.ts +25 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.js +8 -0
- package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.js.map +1 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.d.ts +31 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.js +3 -0
- package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.js.map +1 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectManifest.d.ts +44 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectManifest.js +8 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectManifest.js.map +1 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.d.ts +30 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.js +35 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.js.map +1 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.d.ts +89 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.js +8 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.js.map +1 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.d.ts +43 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.js +8 -0
- package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.js.map +1 -0
- package/dist/domain.operations/artifact/genLoopFeedback.js +1 -1
- package/dist/domain.operations/artifact/genLoopFeedback.js.map +1 -1
- package/dist/domain.operations/artifact/genStepGrabCallerFeedbackToArtifact.d.ts +1 -1
- package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.d.ts +13 -0
- package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.js +106 -0
- package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.d.ts +18 -0
- package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.js +16 -0
- package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.d.ts +30 -0
- package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.js +71 -0
- package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.d.ts +20 -0
- package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.js +90 -0
- package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.d.ts +8 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.js +31 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.d.ts +3 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.js +10 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.d.ts +8 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.js +31 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.d.ts +8 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.js +32 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.d.ts +6 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.js +80 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.d.ts +6 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.js +14 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.d.ts +8 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.js +52 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.d.ts +8 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.js +38 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.d.ts +33 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.js +100 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.d.ts +6 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.js +26 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.d.ts +41 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.js +107 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.d.ts +33 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.js +68 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.d.ts +41 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.js +97 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.d.ts +6 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.js +65 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.d.ts +37 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.js +96 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.d.ts +33 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.js +81 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.d.ts +33 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.js +113 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.d.ts +6 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.js +36 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.d.ts +36 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.js +101 -0
- package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.d.ts +14 -0
- package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.js +45 -0
- package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.js.map +1 -0
- package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.d.ts +19 -0
- package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.js +35 -0
- package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.js.map +1 -0
- package/dist/domain.operations/git/genGitHubFileUrl.d.ts +9 -0
- package/dist/domain.operations/git/genGitHubFileUrl.js +55 -0
- package/dist/domain.operations/git/genGitHubFileUrl.js.map +1 -0
- package/dist/domain.operations/git/getGitRemoteUrl.d.ts +7 -0
- package/dist/domain.operations/git/getGitRemoteUrl.js +40 -0
- package/dist/domain.operations/git/getGitRemoteUrl.js.map +1 -0
- package/dist/domain.operations/hooks/getInvokeHooks.js +1 -1
- package/dist/domain.operations/hooks/getInvokeHooks.js.map +1 -1
- package/dist/domain.operations/reflect/createDraftDirectory.d.ts +11 -0
- package/dist/domain.operations/reflect/createDraftDirectory.js +46 -0
- package/dist/domain.operations/reflect/createDraftDirectory.js.map +1 -0
- package/dist/domain.operations/reflect/enumFeedbackFiles.d.ts +7 -0
- package/dist/domain.operations/reflect/enumFeedbackFiles.js +69 -0
- package/dist/domain.operations/reflect/enumFeedbackFiles.js.map +1 -0
- package/dist/domain.operations/reflect/extractJsonFromResultText.d.ts +7 -0
- package/dist/domain.operations/reflect/extractJsonFromResultText.js +19 -0
- package/dist/domain.operations/reflect/extractJsonFromResultText.js.map +1 -0
- package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.d.ts +46 -0
- package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.js +120 -0
- package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.js.map +1 -0
- package/dist/domain.operations/reflect/metrics/computeMetricsExpected.d.ts +12 -0
- package/dist/domain.operations/reflect/metrics/computeMetricsExpected.js +28 -0
- package/dist/domain.operations/reflect/metrics/computeMetricsExpected.js.map +1 -0
- package/dist/domain.operations/reflect/metrics/computeMetricsRealized.d.ts +26 -0
- package/dist/domain.operations/reflect/metrics/computeMetricsRealized.js +66 -0
- package/dist/domain.operations/reflect/metrics/computeMetricsRealized.js.map +1 -0
- package/dist/domain.operations/reflect/metrics/writeLogArtifact.d.ts +17 -0
- package/dist/domain.operations/reflect/metrics/writeLogArtifact.js +93 -0
- package/dist/domain.operations/reflect/metrics/writeLogArtifact.js.map +1 -0
- package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.d.ts +8 -0
- package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.js +28 -0
- package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.js.map +1 -0
- package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.d.ts +14 -0
- package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.js +93 -0
- package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.js.map +1 -0
- package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.d.ts +18 -0
- package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.js +208 -0
- package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.js.map +1 -0
- package/dist/domain.operations/reflect/step2/executeManifestOperations.d.ts +17 -0
- package/dist/domain.operations/reflect/step2/executeManifestOperations.js +189 -0
- package/dist/domain.operations/reflect/step2/executeManifestOperations.js.map +1 -0
- package/dist/domain.operations/reflect/step2/parseManifestOperations.d.ts +8 -0
- package/dist/domain.operations/reflect/step2/parseManifestOperations.js +73 -0
- package/dist/domain.operations/reflect/step2/parseManifestOperations.js.map +1 -0
- package/dist/domain.operations/reflect/validateSourceDirectory.d.ts +9 -0
- package/dist/domain.operations/reflect/validateSourceDirectory.js +63 -0
- package/dist/domain.operations/reflect/validateSourceDirectory.js.map +1 -0
- package/dist/domain.operations/reflect/validateTargetDirectory.d.ts +10 -0
- package/dist/domain.operations/reflect/validateTargetDirectory.js +59 -0
- package/dist/domain.operations/reflect/validateTargetDirectory.js.map +1 -0
- package/dist/domain.operations/review/compileReviewPrompt.d.ts +22 -0
- package/dist/domain.operations/review/compileReviewPrompt.js +95 -0
- package/dist/domain.operations/review/compileReviewPrompt.js.map +1 -0
- package/dist/domain.operations/review/enumFilesFromDiffs.d.ts +8 -0
- package/dist/domain.operations/review/enumFilesFromDiffs.js +74 -0
- package/dist/domain.operations/review/enumFilesFromDiffs.js.map +1 -0
- package/dist/domain.operations/review/enumFilesFromGlob.d.ts +8 -0
- package/dist/domain.operations/review/enumFilesFromGlob.js +31 -0
- package/dist/domain.operations/review/enumFilesFromGlob.js.map +1 -0
- package/dist/domain.operations/review/estimateTokenCount.d.ts +9 -0
- package/dist/domain.operations/review/estimateTokenCount.js +20 -0
- package/dist/domain.operations/review/estimateTokenCount.js.map +1 -0
- package/dist/domain.operations/review/formatReviewOutput.d.ts +14 -0
- package/dist/domain.operations/review/formatReviewOutput.js +42 -0
- package/dist/domain.operations/review/formatReviewOutput.js.map +1 -0
- package/dist/domain.operations/review/genTokenBreakdownMarkdown.d.ts +19 -0
- package/dist/domain.operations/review/genTokenBreakdownMarkdown.js +110 -0
- package/dist/domain.operations/review/genTokenBreakdownMarkdown.js.map +1 -0
- package/dist/domain.operations/review/genTokenBreakdownReport.d.ts +24 -0
- package/dist/domain.operations/review/genTokenBreakdownReport.js +64 -0
- package/dist/domain.operations/review/genTokenBreakdownReport.js.map +1 -0
- package/dist/domain.operations/review/invokeClaudeCode.d.ts +22 -0
- package/dist/domain.operations/review/invokeClaudeCode.js +92 -0
- package/dist/domain.operations/review/invokeClaudeCode.js.map +1 -0
- package/dist/domain.operations/review/writeInputArtifacts.d.ts +27 -0
- package/dist/domain.operations/review/writeInputArtifacts.js +50 -0
- package/dist/domain.operations/review/writeInputArtifacts.js.map +1 -0
- package/dist/domain.operations/review/writeOutputArtifacts.d.ts +12 -0
- package/dist/domain.operations/review/writeOutputArtifacts.js +46 -0
- package/dist/domain.operations/review/writeOutputArtifacts.js.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/roles/architect/getArchitectRole.d.ts +6 -0
- package/dist/roles/architect/getArchitectRole.js +31 -0
- package/dist/roles/architect/getArchitectRole.js.map +1 -0
- package/dist/roles/brain/getBrainRole.d.ts +6 -0
- package/dist/roles/brain/getBrainRole.js +28 -0
- package/dist/roles/brain/getBrainRole.js.map +1 -0
- package/dist/roles/brain/skills/act/skillAct.d.ts +5 -0
- package/dist/roles/brain/skills/act/skillAct.js +147 -0
- package/dist/roles/brain/skills/act/skillAct.js.map +1 -0
- package/dist/roles/brain/skills/act/skillAct.ts +186 -0
- package/dist/roles/brain/skills/act/stepAct.d.ts +27 -0
- package/dist/roles/brain/skills/act/stepAct.js +95 -0
- package/dist/roles/brain/skills/act/stepAct.js.map +1 -0
- package/dist/roles/brain/skills/act/stepAct.ts +123 -0
- package/dist/roles/getRoleRegistry.js +5 -3
- package/dist/roles/getRoleRegistry.js.map +1 -1
- package/dist/roles/getRoleRegistry.readme.js +6 -0
- package/dist/roles/getRoleRegistry.readme.js.map +1 -1
- package/dist/roles/reviewer/briefs/on.rules/rules101.[article].md +41 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.citations.[article].md +88 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.collocated.[article].md +97 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.content.[article].md +228 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].forbid.failhide.md +87 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].forbid.gerunds.md +85 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].require.failfast.md +73 -0
- package/dist/roles/reviewer/briefs/on.rules/rules101.structure.[article].md +70 -0
- package/dist/roles/reviewer/briefs/review.tactics.md +60 -0
- package/dist/roles/reviewer/getReviewerRole.d.ts +6 -0
- package/dist/roles/reviewer/getReviewerRole.js +80 -0
- package/dist/roles/reviewer/getReviewerRole.js.map +1 -0
- package/dist/roles/reviewer/skills/reflect/reflect.d.ts +30 -0
- package/dist/roles/reviewer/skills/reflect/reflect.js +305 -0
- package/dist/roles/reviewer/skills/reflect/reflect.js.map +1 -0
- package/dist/roles/reviewer/skills/reflect/reflect.sh +38 -0
- package/dist/roles/reviewer/skills/reflect/reflect.ts +356 -0
- package/dist/roles/reviewer/skills/review/review.d.ts +57 -0
- package/dist/roles/reviewer/skills/review/review.js +445 -0
- package/dist/roles/reviewer/skills/review/review.js.map +1 -0
- package/dist/roles/reviewer/skills/review/review.sh +21 -0
- package/dist/roles/reviewer/skills/review/review.ts +575 -0
- package/dist/roles/thinker/getThinkerBrief.d.ts +1 -1
- package/dist/roles/thinker/getThinkerRole.js +9 -9
- package/dist/roles/thinker/getThinkerRole.js.map +1 -1
- package/dist/roles/thinker/skills/brief.articulate/.demo/article.vision.v2025_08_19..i1.via_chatgpt.md +47 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/article.vision.v2025_08_19.i2.via_rhachet.md +60 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/diverge.v2025_08_17.i1.md +62 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/diverge.v2025_08_17.i1.with_feedback.md +89 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/diverge.v2025_08_17.i2.md +47 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/joke.v2025_08_15.i1.md +44 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/joke.v2025_08_15.i2.md +63 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/joke.v2025_08_15.i3.md +51 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/user-journey.v2025_08_17.i1.md +62 -0
- package/dist/roles/thinker/skills/brief.articulate/.demo/user-journey.v2025_08_17.i2.md +49 -0
- package/dist/roles/thinker/skills/brief.articulate/.readme.md +0 -0
- package/dist/roles/thinker/skills/brief.articulate/stepArticulate.skill.js +1 -1
- package/dist/roles/thinker/skills/brief.articulate/stepArticulate.skill.js.map +1 -1
- package/dist/roles/thinker/skills/brief.articulate/stepArticulate.skill.ts +168 -0
- package/dist/roles/thinker/skills/brief.articulate/stepArticulate.ts +157 -0
- package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_08_28.i1.md +93 -0
- package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_08_28.i2.md +84 -0
- package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_09_28.i1.no_focus_context.md +8 -0
- package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_09_28.i2.md +54 -0
- package/dist/roles/thinker/skills/brief.catalogize/.demo/persona.usecases.v2025_08_28.i1.md +62 -0
- package/dist/roles/thinker/skills/brief.catalogize/.demo/persona.usecases.v2025_08_28.i2.md +64 -0
- package/dist/roles/thinker/skills/brief.catalogize/.readme.md +5 -0
- package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.skill.js +1 -1
- package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.skill.js.map +1 -1
- package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.skill.ts +173 -0
- package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.ts +132 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.i4.md +3 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.i5.md +3 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.i6.md +3 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.md +3 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i1.md +52 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i2.md +51 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i3.md +47 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i4.md +62 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i5.md +47 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i6.md +53 -0
- package/dist/roles/thinker/skills/brief.demonstrate/.readme +3 -0
- package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.skill.js +1 -1
- package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.skill.js.map +1 -1
- package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.skill.ts +190 -0
- package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.ts +164 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i1.md +72 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i2.md +53 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i3.which_objectives.md +58 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i5.which_personas.md +64 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input2.cluster.v2025_08_17.i1.md +67 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input2.cluster.v2025_08_17.i2.md +49 -0
- package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input2.cluster.v2025_08_17.i3.md +59 -0
- package/dist/roles/thinker/skills/khue.cluster/.readme.md +0 -0
- package/dist/roles/thinker/skills/khue.cluster/stepCluster.skill.js +1 -1
- package/dist/roles/thinker/skills/khue.cluster/stepCluster.skill.js.map +1 -1
- package/dist/roles/thinker/skills/khue.cluster/stepCluster.skill.ts +174 -0
- package/dist/roles/thinker/skills/khue.cluster/stepCluster.ts +150 -0
- package/dist/roles/thinker/skills/khue.decompose/.readme.md +9 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/joke.examples.v2025_08_17.i2.md +23 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/joke.examples.v2025_08_17.i3.md +23 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/joke.varieties.v2025_08_17.i1.md +23 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i1.md +9 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i2.md +9 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i3.md +23 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i4.folksy.md +9 -0
- package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i5.folksy.md +23 -0
- package/dist/roles/thinker/skills/khue.diverge/.readme.md +0 -0
- package/dist/roles/thinker/skills/khue.diverge/stepDiverge.skill.js +1 -1
- package/dist/roles/thinker/skills/khue.diverge/stepDiverge.skill.js.map +1 -1
- package/dist/roles/thinker/skills/khue.diverge/stepDiverge.skill.ts +149 -0
- package/dist/roles/thinker/skills/khue.diverge/stepDiverge.ts +151 -0
- package/dist/roles/thinker/skills/khue.encompose/.readme.md +7 -0
- package/dist/roles/thinker/skills/khue.instantiate/.readme.md +14 -0
- package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.skill.js +1 -1
- package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.skill.js.map +1 -1
- package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.skill.ts +190 -0
- package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.ts +132 -0
- package/dist/roles/thinker/skills/khue.triage/.demo/laughs.v2025_08_18.i1.md +29 -0
- package/dist/roles/thinker/skills/khue.triage/.demo/user.journeys.v2025_08_17.i1.md +86 -0
- package/dist/roles/thinker/skills/khue.triage/.demo/user.journeys.v2025_08_17.i2.md +68 -0
- package/dist/roles/thinker/skills/khue.triage/.readme.md +0 -0
- package/dist/roles/thinker/skills/khue.triage/stepTriage.skill.js +1 -1
- package/dist/roles/thinker/skills/khue.triage/stepTriage.skill.js.map +1 -1
- package/dist/roles/thinker/skills/khue.triage/stepTriage.skill.ts +174 -0
- package/dist/roles/thinker/skills/khue.triage/stepTriage.ts +153 -0
- package/package.json +11 -8
- package/readme.md +55 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeToolGrep = exports.toolDefinitionGrep = exports.schemaGrepInput = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const BrainArch1ToolDefinition_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition");
|
|
8
|
+
const BrainArch1ToolResult_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolResult");
|
|
9
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
10
|
+
/**
|
|
11
|
+
* .what = zod schema for grep tool input
|
|
12
|
+
* .why = enables type-safe validation and json schema generation
|
|
13
|
+
*/
|
|
14
|
+
exports.schemaGrepInput = zod_1.z.object({
|
|
15
|
+
pattern: zod_1.z.string().describe('The regex pattern to search for'),
|
|
16
|
+
path: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('The file or directory to search in. Defaults to current directory.'),
|
|
20
|
+
glob: zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Optional glob pattern to filter files (e.g., "*.ts")'),
|
|
24
|
+
case_insensitive: zod_1.z
|
|
25
|
+
.boolean()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('If true, perform case-insensitive search'),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* .what = tool definition for searching file contents by pattern
|
|
31
|
+
* .why = enables the brain to search for text patterns in files
|
|
32
|
+
*/
|
|
33
|
+
exports.toolDefinitionGrep = new BrainArch1ToolDefinition_1.BrainArch1ToolDefinition({
|
|
34
|
+
name: 'grep',
|
|
35
|
+
description: 'Searches for a regex pattern in files. Returns matching lines with file paths.',
|
|
36
|
+
schema: {
|
|
37
|
+
input: (0, BrainArch1ToolDefinition_1.toJsonSchema)(exports.schemaGrepInput),
|
|
38
|
+
},
|
|
39
|
+
strict: false,
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* .what = executes the grep tool
|
|
43
|
+
* .why = performs the actual content search operation
|
|
44
|
+
*/
|
|
45
|
+
const executeToolGrep = async (input) => {
|
|
46
|
+
try {
|
|
47
|
+
// build rg command
|
|
48
|
+
const args = ['rg'];
|
|
49
|
+
// add pattern
|
|
50
|
+
args.push('--regexp', input.args.pattern);
|
|
51
|
+
// add case insensitive flag
|
|
52
|
+
if (input.args.case_insensitive) {
|
|
53
|
+
args.push('-i');
|
|
54
|
+
}
|
|
55
|
+
// add glob filter
|
|
56
|
+
if (input.args.glob) {
|
|
57
|
+
args.push('--glob', input.args.glob);
|
|
58
|
+
}
|
|
59
|
+
// add line numbers
|
|
60
|
+
args.push('-n');
|
|
61
|
+
// add path
|
|
62
|
+
args.push(input.args.path ?? '.');
|
|
63
|
+
// execute ripgrep
|
|
64
|
+
const { stdout } = await execAsync(args.join(' '), {
|
|
65
|
+
maxBuffer: 1024 * 1024 * 10, // 10MB
|
|
66
|
+
cwd: process.cwd(),
|
|
67
|
+
});
|
|
68
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
69
|
+
callId: input.callId,
|
|
70
|
+
success: true,
|
|
71
|
+
output: stdout.trim() || 'no matches found',
|
|
72
|
+
error: null,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
// ripgrep returns exit code 1 when no matches found
|
|
77
|
+
if (err instanceof Error &&
|
|
78
|
+
'code' in err &&
|
|
79
|
+
err.code === '1') {
|
|
80
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
81
|
+
callId: input.callId,
|
|
82
|
+
success: true,
|
|
83
|
+
output: 'no matches found',
|
|
84
|
+
error: null,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
88
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
89
|
+
callId: input.callId,
|
|
90
|
+
success: false,
|
|
91
|
+
output: '',
|
|
92
|
+
error: `failed to grep: ${error}`,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.executeToolGrep = executeToolGrep;
|
|
97
|
+
//# sourceMappingURL=grep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../../../../src/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AACrC,+BAAiC;AACjC,6BAAwB;AAExB,sGAGiE;AACjE,8FAA2F;AAE3F,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC;;;GAGG;AACU,QAAA,eAAe,GAAG,OAAC,C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|
+
import type { BrainArch1Toolbox } from '../../../../../domain.objects/BrainArch1/BrainArch1Toolbox';
|
|
2
|
+
/**
|
|
3
|
+
* .what = files toolbox providing read, write, edit, glob, and grep tools
|
|
4
|
+
* .why = enables the brain to interact with the filesystem
|
|
5
|
+
*/
|
|
6
|
+
export declare const toolboxFiles: BrainArch1Toolbox;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolboxFiles = void 0;
|
|
4
|
+
const BrainArch1ToolResult_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolResult");
|
|
5
|
+
const edit_1 = require("./edit");
|
|
6
|
+
const glob_1 = require("./glob");
|
|
7
|
+
const grep_1 = require("./grep");
|
|
8
|
+
const read_1 = require("./read");
|
|
9
|
+
const write_1 = require("./write");
|
|
10
|
+
/**
|
|
11
|
+
* .what = files toolbox providing read, write, edit, glob, and grep tools
|
|
12
|
+
* .why = enables the brain to interact with the filesystem
|
|
13
|
+
*/
|
|
14
|
+
exports.toolboxFiles = {
|
|
15
|
+
name: 'files',
|
|
16
|
+
definitions: [
|
|
17
|
+
read_1.toolDefinitionRead,
|
|
18
|
+
write_1.toolDefinitionWrite,
|
|
19
|
+
edit_1.toolDefinitionEdit,
|
|
20
|
+
glob_1.toolDefinitionGlob,
|
|
21
|
+
grep_1.toolDefinitionGrep,
|
|
22
|
+
],
|
|
23
|
+
execute: async (input, _context) => {
|
|
24
|
+
const { call } = input;
|
|
25
|
+
// route to correct executor based on tool name
|
|
26
|
+
if (call.name === 'read') {
|
|
27
|
+
return (0, read_1.executeToolRead)({
|
|
28
|
+
callId: call.id,
|
|
29
|
+
args: call.input,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (call.name === 'write') {
|
|
33
|
+
return (0, write_1.executeToolWrite)({
|
|
34
|
+
callId: call.id,
|
|
35
|
+
args: call.input,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (call.name === 'edit') {
|
|
39
|
+
return (0, edit_1.executeToolEdit)({
|
|
40
|
+
callId: call.id,
|
|
41
|
+
args: call.input,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (call.name === 'glob') {
|
|
45
|
+
return (0, glob_1.executeToolGlob)({
|
|
46
|
+
callId: call.id,
|
|
47
|
+
args: call.input,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (call.name === 'grep') {
|
|
51
|
+
return (0, grep_1.executeToolGrep)({
|
|
52
|
+
callId: call.id,
|
|
53
|
+
args: call.input,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// unknown tool
|
|
57
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
58
|
+
callId: call.id,
|
|
59
|
+
success: false,
|
|
60
|
+
output: '',
|
|
61
|
+
error: `unknown tool: ${call.name}`,
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.ts"],"names":[],"mappings":";;;AAGA,8FAA2F;AAE3F,iCAA6D;AAC7D,iCAA6D;AAC7D,iCAA6D;AAC7D,iCAA6D;AAC7D,mCAAgE;AAEhE;;;GAGG;AACU,QAAA,YAAY,GAAsB;IAC7C,IAAI,EAAE,OAAO;IACb,WAAW,EAAE;QACX,yBAAkB;QAClB,2BAAmB;QACnB,yBAAkB;QAClB,yBAAkB;QAClB,yBAAkB;KACnB;IACD,OAAO,EAAE,KAAK,EACZ,KAAmC,EACnC,QAA2B,EACI,EAAE;QACjC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QAEvB,+CAA+C;QAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,IAAA,sBAAe,EAAC;gBACrB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAA0D;aACtE,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC1B,OAAO,IAAA,wBAAgB,EAAC;gBACtB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAA0C;aACtD,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,IAAA,sBAAe,EAAC;gBACrB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAKV;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,IAAA,sBAAe,EAAC;gBACrB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAA0C;aACtD,CAAC,CAAC;QACL,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,IAAA,sBAAe,EAAC;gBACrB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAKV;aACF,CAAC,CAAC;QACL,CAAC;QAED,eAAe;QACf,OAAO,IAAI,2CAAoB,CAAC;YAC9B,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,iBAAiB,IAAI,CAAC,IAAI,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BrainArch1ToolDefinition } from '../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition';
|
|
3
|
+
import { BrainArch1ToolResult } from '../../../../../domain.objects/BrainArch1/BrainArch1ToolResult';
|
|
4
|
+
/**
|
|
5
|
+
* .what = zod schema for read tool input
|
|
6
|
+
* .why = enables type-safe validation and json schema generation
|
|
7
|
+
*/
|
|
8
|
+
export declare const schemaReadInput: z.ZodObject<{
|
|
9
|
+
path: z.ZodString;
|
|
10
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
path: string;
|
|
14
|
+
offset?: number | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
path: string;
|
|
18
|
+
offset?: number | undefined;
|
|
19
|
+
limit?: number | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* .what = tool definition for reading file contents
|
|
23
|
+
* .why = enables the brain to read files from the filesystem
|
|
24
|
+
*/
|
|
25
|
+
export declare const toolDefinitionRead: BrainArch1ToolDefinition;
|
|
26
|
+
/**
|
|
27
|
+
* .what = executes the read tool
|
|
28
|
+
* .why = performs the actual file read operation
|
|
29
|
+
*/
|
|
30
|
+
export declare const executeToolRead: (input: {
|
|
31
|
+
callId: string;
|
|
32
|
+
args: {
|
|
33
|
+
path: string;
|
|
34
|
+
offset?: number;
|
|
35
|
+
limit?: number;
|
|
36
|
+
};
|
|
37
|
+
}) => Promise<BrainArch1ToolResult>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.executeToolRead = exports.toolDefinitionRead = exports.schemaReadInput = void 0;
|
|
27
|
+
const fs = __importStar(require("fs/promises"));
|
|
28
|
+
const zod_1 = require("zod");
|
|
29
|
+
const BrainArch1ToolDefinition_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition");
|
|
30
|
+
const BrainArch1ToolResult_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolResult");
|
|
31
|
+
/**
|
|
32
|
+
* .what = zod schema for read tool input
|
|
33
|
+
* .why = enables type-safe validation and json schema generation
|
|
34
|
+
*/
|
|
35
|
+
exports.schemaReadInput = zod_1.z.object({
|
|
36
|
+
path: zod_1.z.string().describe('The absolute path to the file to read'),
|
|
37
|
+
offset: zod_1.z
|
|
38
|
+
.number()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Optional line number to start reading from (1-indexed). Defaults to 1.'),
|
|
41
|
+
limit: zod_1.z
|
|
42
|
+
.number()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Optional maximum number of lines to read. Defaults to all lines.'),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* .what = tool definition for reading file contents
|
|
48
|
+
* .why = enables the brain to read files from the filesystem
|
|
49
|
+
*/
|
|
50
|
+
exports.toolDefinitionRead = new BrainArch1ToolDefinition_1.BrainArch1ToolDefinition({
|
|
51
|
+
name: 'read',
|
|
52
|
+
description: 'Reads the contents of a file at the specified path. Returns the file contents as a string.',
|
|
53
|
+
schema: {
|
|
54
|
+
input: (0, BrainArch1ToolDefinition_1.toJsonSchema)(exports.schemaReadInput),
|
|
55
|
+
},
|
|
56
|
+
strict: false,
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* .what = executes the read tool
|
|
60
|
+
* .why = performs the actual file read operation
|
|
61
|
+
*/
|
|
62
|
+
const executeToolRead = async (input) => {
|
|
63
|
+
try {
|
|
64
|
+
// read file contents
|
|
65
|
+
const content = await fs.readFile(input.args.path, 'utf-8');
|
|
66
|
+
// handle offset and limit
|
|
67
|
+
const lines = content.split('\n');
|
|
68
|
+
const offset = input.args.offset ?? 1;
|
|
69
|
+
const startIndex = Math.max(0, offset - 1);
|
|
70
|
+
const endIndex = input.args.limit
|
|
71
|
+
? startIndex + input.args.limit
|
|
72
|
+
: lines.length;
|
|
73
|
+
const selectedLines = lines.slice(startIndex, endIndex);
|
|
74
|
+
// format output with line numbers
|
|
75
|
+
const output = selectedLines
|
|
76
|
+
.map((line, i) => `${String(startIndex + i + 1).padStart(6)}→${line}`)
|
|
77
|
+
.join('\n');
|
|
78
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
79
|
+
callId: input.callId,
|
|
80
|
+
success: true,
|
|
81
|
+
output,
|
|
82
|
+
error: null,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
87
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
88
|
+
callId: input.callId,
|
|
89
|
+
success: false,
|
|
90
|
+
output: '',
|
|
91
|
+
error: `failed to read file: ${error}`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.executeToolRead = executeToolRead;
|
|
96
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../../../src/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,6BAAwB;AAExB,sGAGiE;AACjE,8FAA2F;AAE3F;;;GAGG;AACU,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAClE,MAAM,EAAE,OAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,wEAAwE,CACzE;IACH,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,kEAAkE,CACnE;CACJ,CAAC,CAAC;AAEH;;;GAGG;AACU,QAAA,kBAAkB,GAAG,IAAI,mDAAwB,CAAC;IAC7D,IAAI,EAAE,MAAM;IACZ,WAAW,EACT,4FAA4F;IAC9F,MAAM,EAAE;QACN,KAAK,EAAE,IAAA,uCAAY,EAAC,uBAAe,CAAC;KACrC;IACD,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAEH;;;GAGG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,KAGrC,EAAiC,EAAE;IAClC,IAAI,CAAC;QACH,qBAAqB;QACrB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE5D,0BAA0B;QAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CA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efinition } from '../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition';
|
|
3
|
+
import { BrainArch1ToolResult } from '../../../../../domain.objects/BrainArch1/BrainArch1ToolResult';
|
|
4
|
+
/**
|
|
5
|
+
* .what = zod schema for write tool input
|
|
6
|
+
* .why = enables type-safe validation and json schema generation
|
|
7
|
+
*/
|
|
8
|
+
export declare const schemaWriteInput: z.ZodObject<{
|
|
9
|
+
path: z.ZodString;
|
|
10
|
+
content: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
content: string;
|
|
14
|
+
}, {
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* .what = tool definition for writing file contents
|
|
20
|
+
* .why = enables the brain to create or overwrite files
|
|
21
|
+
*/
|
|
22
|
+
export declare const toolDefinitionWrite: BrainArch1ToolDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* .what = executes the write tool
|
|
25
|
+
* .why = performs the actual file write operation
|
|
26
|
+
*/
|
|
27
|
+
export declare const executeToolWrite: (input: {
|
|
28
|
+
callId: string;
|
|
29
|
+
args: {
|
|
30
|
+
path: string;
|
|
31
|
+
content: string;
|
|
32
|
+
};
|
|
33
|
+
}) => Promise<BrainArch1ToolResult>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.executeToolWrite = exports.toolDefinitionWrite = exports.schemaWriteInput = void 0;
|
|
27
|
+
const fs = __importStar(require("fs/promises"));
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const zod_1 = require("zod");
|
|
30
|
+
const BrainArch1ToolDefinition_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition");
|
|
31
|
+
const BrainArch1ToolResult_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolResult");
|
|
32
|
+
/**
|
|
33
|
+
* .what = zod schema for write tool input
|
|
34
|
+
* .why = enables type-safe validation and json schema generation
|
|
35
|
+
*/
|
|
36
|
+
exports.schemaWriteInput = zod_1.z.object({
|
|
37
|
+
path: zod_1.z.string().describe('The absolute path to the file to write'),
|
|
38
|
+
content: zod_1.z.string().describe('The content to write to the file'),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* .what = tool definition for writing file contents
|
|
42
|
+
* .why = enables the brain to create or overwrite files
|
|
43
|
+
*/
|
|
44
|
+
exports.toolDefinitionWrite = new BrainArch1ToolDefinition_1.BrainArch1ToolDefinition({
|
|
45
|
+
name: 'write',
|
|
46
|
+
description: 'Writes content to a file at the specified path. Creates parent directories if needed. Overwrites existing files.',
|
|
47
|
+
schema: {
|
|
48
|
+
input: (0, BrainArch1ToolDefinition_1.toJsonSchema)(exports.schemaWriteInput),
|
|
49
|
+
},
|
|
50
|
+
strict: false,
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* .what = executes the write tool
|
|
54
|
+
* .why = performs the actual file write operation
|
|
55
|
+
*/
|
|
56
|
+
const executeToolWrite = async (input) => {
|
|
57
|
+
try {
|
|
58
|
+
// ensure parent directory exists
|
|
59
|
+
const dir = path.dirname(input.args.path);
|
|
60
|
+
await fs.mkdir(dir, { recursive: true });
|
|
61
|
+
// write file contents
|
|
62
|
+
await fs.writeFile(input.args.path, input.args.content, 'utf-8');
|
|
63
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
64
|
+
callId: input.callId,
|
|
65
|
+
success: true,
|
|
66
|
+
output: `successfully wrote ${input.args.content.length} bytes to ${input.args.path}`,
|
|
67
|
+
error: null,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
72
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
73
|
+
callId: input.callId,
|
|
74
|
+
success: false,
|
|
75
|
+
output: '',
|
|
76
|
+
error: `failed to write file: ${error}`,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.executeToolWrite = executeToolWrite;
|
|
81
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../../../src/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAA6B;AAC7B,6BAAwB;AAExB,sGAGiE;AACjE,8FAA2F;AAE3F;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAC,CAAC,MA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AAC,CAAC;QAC/D,OAAO,IAAI,2CAAoB,CAAC;YAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,yBAAyB,KAAK,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AA3BW,QAAA,gBAAgB,oBA2B3B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BrainArch1ToolDefinition } from '../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition';
|
|
3
|
+
import { BrainArch1ToolResult } from '../../../../../domain.objects/BrainArch1/BrainArch1ToolResult';
|
|
4
|
+
/**
|
|
5
|
+
* .what = zod schema for webfetch tool input
|
|
6
|
+
* .why = enables type-safe validation and json schema generation
|
|
7
|
+
*/
|
|
8
|
+
export declare const schemaWebfetchInput: z.ZodObject<{
|
|
9
|
+
url: z.ZodString;
|
|
10
|
+
max_length: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
url: string;
|
|
13
|
+
max_length?: number | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
url: string;
|
|
16
|
+
max_length?: number | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* .what = tool definition for fetching web page content
|
|
20
|
+
* .why = enables the brain to read content from URLs for research
|
|
21
|
+
*/
|
|
22
|
+
export declare const toolDefinitionFetch: BrainArch1ToolDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* .what = fetches and extracts text content from a URL
|
|
25
|
+
* .why = enables reading web page content for research
|
|
26
|
+
*/
|
|
27
|
+
export declare const executeToolFetch: (input: {
|
|
28
|
+
callId: string;
|
|
29
|
+
args: {
|
|
30
|
+
url: string;
|
|
31
|
+
max_length?: number;
|
|
32
|
+
};
|
|
33
|
+
}) => Promise<BrainArch1ToolResult>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeToolFetch = exports.toolDefinitionFetch = exports.schemaWebfetchInput = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const BrainArch1ToolDefinition_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolDefinition");
|
|
6
|
+
const BrainArch1ToolResult_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolResult");
|
|
7
|
+
/**
|
|
8
|
+
* .what = zod schema for webfetch tool input
|
|
9
|
+
* .why = enables type-safe validation and json schema generation
|
|
10
|
+
*/
|
|
11
|
+
exports.schemaWebfetchInput = zod_1.z.object({
|
|
12
|
+
url: zod_1.z.string().describe('The URL to fetch content from'),
|
|
13
|
+
max_length: zod_1.z
|
|
14
|
+
.number()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Maximum characters to return (default: 10000, max: 50000)'),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* .what = tool definition for fetching web page content
|
|
20
|
+
* .why = enables the brain to read content from URLs for research
|
|
21
|
+
*/
|
|
22
|
+
exports.toolDefinitionFetch = new BrainArch1ToolDefinition_1.BrainArch1ToolDefinition({
|
|
23
|
+
name: 'webfetch',
|
|
24
|
+
description: 'Fetch and read content from a URL. Returns the text content of the page. Use this to read articles, documentation, or other web pages after finding them via websearch.',
|
|
25
|
+
schema: {
|
|
26
|
+
input: (0, BrainArch1ToolDefinition_1.toJsonSchema)(exports.schemaWebfetchInput),
|
|
27
|
+
},
|
|
28
|
+
strict: false,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* .what = fetches and extracts text content from a URL
|
|
32
|
+
* .why = enables reading web page content for research
|
|
33
|
+
*/
|
|
34
|
+
const executeToolFetch = async (input) => {
|
|
35
|
+
const { callId, args } = input;
|
|
36
|
+
const maxLength = Math.min(args.max_length ?? 10000, 50000);
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(args.url, {
|
|
39
|
+
headers: {
|
|
40
|
+
'User-Agent': 'Mozilla/5.0 (compatible; BrainArch1/1.0; +https://github.com/ehmpathy)',
|
|
41
|
+
Accept: 'text/html,application/xhtml+xml,text/plain',
|
|
42
|
+
},
|
|
43
|
+
redirect: 'follow',
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok)
|
|
46
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
47
|
+
callId,
|
|
48
|
+
success: false,
|
|
49
|
+
output: '',
|
|
50
|
+
error: `fetch failed: ${response.status} ${response.statusText}`,
|
|
51
|
+
});
|
|
52
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
53
|
+
const html = await response.text();
|
|
54
|
+
// extract text content from HTML
|
|
55
|
+
const text = extractTextContent(html, contentType);
|
|
56
|
+
const truncated = text.length > maxLength
|
|
57
|
+
? text.slice(0, maxLength) + '\n\n[truncated]'
|
|
58
|
+
: text;
|
|
59
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
60
|
+
callId,
|
|
61
|
+
success: true,
|
|
62
|
+
output: `Content from ${args.url}:\n\n${truncated}`,
|
|
63
|
+
error: null,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
68
|
+
callId,
|
|
69
|
+
success: false,
|
|
70
|
+
output: '',
|
|
71
|
+
error: `fetch failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.executeToolFetch = executeToolFetch;
|
|
76
|
+
/**
|
|
77
|
+
* .what = extracts readable text from HTML content
|
|
78
|
+
* .why = removes HTML tags and scripts to get clean text
|
|
79
|
+
*/
|
|
80
|
+
const extractTextContent = (html, contentType) => {
|
|
81
|
+
// if plain text, return as-is
|
|
82
|
+
if (contentType.includes('text/plain'))
|
|
83
|
+
return html;
|
|
84
|
+
// remove script and style tags with their content
|
|
85
|
+
let text = html
|
|
86
|
+
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
|
|
87
|
+
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
|
88
|
+
.replace(/<nav[^>]*>[\s\S]*?<\/nav>/gi, '')
|
|
89
|
+
.replace(/<footer[^>]*>[\s\S]*?<\/footer>/gi, '')
|
|
90
|
+
.replace(/<header[^>]*>[\s\S]*?<\/header>/gi, '');
|
|
91
|
+
// replace common block elements with newlines
|
|
92
|
+
text = text
|
|
93
|
+
.replace(/<(p|div|br|h[1-6]|li|tr)[^>]*>/gi, '\n')
|
|
94
|
+
.replace(/<\/?(ul|ol|table|tbody)[^>]*>/gi, '\n');
|
|
95
|
+
// remove remaining HTML tags
|
|
96
|
+
text = text.replace(/<[^>]+>/g, ' ');
|
|
97
|
+
// decode HTML entities
|
|
98
|
+
text = text
|
|
99
|
+
.replace(/ /g, ' ')
|
|
100
|
+
.replace(/&/g, '&')
|
|
101
|
+
.replace(/</g, '<')
|
|
102
|
+
.replace(/>/g, '>')
|
|
103
|
+
.replace(/"/g, '"')
|
|
104
|
+
.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(Number(code)));
|
|
105
|
+
// clean up whitespace
|
|
106
|
+
text = text
|
|
107
|
+
.replace(/\s+/g, ' ')
|
|
108
|
+
.replace(/\n\s+/g, '\n')
|
|
109
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
110
|
+
.trim();
|
|
111
|
+
return text;
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,sGAGiE;AACjE,8FAA2F;AAE3F;;;GAGG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,GAAG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;SACR,OAAO,CAAC,kCAAkC,EAAE,IAAI,CAAC;SACjD,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;IAEpD,6BAA6B;IAC7B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAErC,uBAAuB;IACvB,IAAI,GAAG,IAAI;SACR,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAExE,sBAAsB;IACtB,IAAI,GAAG,IAAI;SACR,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;SACvB,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,IAAI,EAAE,CAAC;IAEV,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrainArch1Toolbox } from '../../../../../domain.objects/BrainArch1/BrainArch1Toolbox';
|
|
2
|
+
/**
|
|
3
|
+
* .what = web toolbox providing search and fetch capabilities
|
|
4
|
+
* .why = enables the brain to research topics on the web
|
|
5
|
+
*/
|
|
6
|
+
export declare const toolboxWeb: BrainArch1Toolbox;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolboxWeb = void 0;
|
|
4
|
+
const BrainArch1ToolResult_1 = require("../../../../../domain.objects/BrainArch1/BrainArch1ToolResult");
|
|
5
|
+
const fetch_1 = require("./fetch");
|
|
6
|
+
const search_1 = require("./search");
|
|
7
|
+
/**
|
|
8
|
+
* .what = web toolbox providing search and fetch capabilities
|
|
9
|
+
* .why = enables the brain to research topics on the web
|
|
10
|
+
*/
|
|
11
|
+
exports.toolboxWeb = {
|
|
12
|
+
name: 'web',
|
|
13
|
+
definitions: [search_1.toolDefinitionSearch, fetch_1.toolDefinitionFetch],
|
|
14
|
+
execute: async (input, _context) => {
|
|
15
|
+
const { call } = input;
|
|
16
|
+
// route to correct executor based on tool name
|
|
17
|
+
if (call.name === 'websearch')
|
|
18
|
+
return (0, search_1.executeToolSearch)({
|
|
19
|
+
callId: call.id,
|
|
20
|
+
args: call.input,
|
|
21
|
+
}, _context);
|
|
22
|
+
if (call.name === 'webfetch')
|
|
23
|
+
return (0, fetch_1.executeToolFetch)({
|
|
24
|
+
callId: call.id,
|
|
25
|
+
args: call.input,
|
|
26
|
+
});
|
|
27
|
+
// unknown tool
|
|
28
|
+
return new BrainArch1ToolResult_1.BrainArch1ToolResult({
|
|
29
|
+
callId: call.id,
|
|
30
|
+
success: false,
|
|
31
|
+
output: '',
|
|
32
|
+
error: `unknown web tool '${call.name}'`,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.ts"],"names":[],"mappings":";;;AAGA,8FAA2F;AAE3F,mCAAgE;AAChE,qCAAmE;AAEnE;;;GAGG;AACU,QAAA,UAAU,GAAsB;IAC3C,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,CAAC,6BAAoB,EAAE,2BAAmB,CAAC;IACxD,OAAO,EAAE,KAAK,EACZ,KAAmC,EACnC,QAA2B,EACI,EAAE;QACjC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QAEvB,+CAA+C;QAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW;YAC3B,OAAO,IAAA,0BAAiB,EACtB;gBACE,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAAgD;aAC5D,EACD,QAAQ,CACT,CAAC;QAEJ,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;YAC1B,OAAO,IAAA,wBAAgB,EAAC;gBACtB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,KAA6C;aACzD,CAAC,CAAC;QAEL,eAAe;QACf,OAAO,IAAI,2CAAoB,CAAC;YAC9B,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,qBAAqB,IAAI,CAAC,IAAI,GAAG;SACzC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|