rhachet-roles-bhrain 0.3.0 → 0.5.2
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/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.js +16 -5
- package/dist/domain.operations/review/compileReviewPrompt.js.map +1 -1
- package/dist/domain.operations/review/formatReviewOutput.d.ts +15 -6
- package/dist/domain.operations/review/formatReviewOutput.js +15 -17
- package/dist/domain.operations/review/formatReviewOutput.js.map +1 -1
- 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 -4
- package/dist/roles/getRoleRegistry.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/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.js.map +1 -1
- package/dist/roles/reviewer/skills/review/review.ts +12 -3
- package/dist/roles/thinker/getThinkerBrief.d.ts +1 -1
- package/dist/roles/thinker/getThinkerRole.js +8 -8
- package/dist/roles/thinker/getThinkerRole.js.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BrainArch1Context } from './BrainArch1Context';
|
|
2
|
+
import type { BrainArch1MemoryTokenUsage } from './BrainArch1MemoryTokenUsage';
|
|
3
|
+
import type { BrainArch1SessionMessage } from './BrainArch1SessionMessage';
|
|
4
|
+
import type { BrainArch1ToolDefinition } from './BrainArch1ToolDefinition';
|
|
5
|
+
/**
|
|
6
|
+
* .what = plugin interface for llm atom generation
|
|
7
|
+
* .why = enables swappable atoms (claude, qwen, openai) with same brain structure
|
|
8
|
+
*
|
|
9
|
+
* .note = this is a plugin interface - implementations are instantiated with their
|
|
10
|
+
* provider-specific configuration and expose a unified `.generate()` method
|
|
11
|
+
*
|
|
12
|
+
* .todo = support a meta-atom plugin that chooses which model to use based on
|
|
13
|
+
* context, task complexity, cost optimization, etc. Today we only support
|
|
14
|
+
* using one atom for the entire session.
|
|
15
|
+
*/
|
|
16
|
+
export interface BrainArch1Atom {
|
|
17
|
+
/**
|
|
18
|
+
* the platform this atom uses (e.g., 'anthropic', 'openai', 'qwen')
|
|
19
|
+
*/
|
|
20
|
+
platform: string;
|
|
21
|
+
/**
|
|
22
|
+
* the model this atom uses (e.g., 'claude-3-5-sonnet-latest', 'gpt-4o')
|
|
23
|
+
*/
|
|
24
|
+
model: string;
|
|
25
|
+
/**
|
|
26
|
+
* human-readable description of this atom
|
|
27
|
+
*/
|
|
28
|
+
description: string;
|
|
29
|
+
/**
|
|
30
|
+
* generates an llm response using this atom's platform and model
|
|
31
|
+
*/
|
|
32
|
+
generate: (input: {
|
|
33
|
+
messages: BrainArch1SessionMessage[];
|
|
34
|
+
tools: BrainArch1ToolDefinition[];
|
|
35
|
+
maxTokens?: number;
|
|
36
|
+
}, context: BrainArch1Context) => Promise<{
|
|
37
|
+
message: BrainArch1SessionMessage;
|
|
38
|
+
tokenUsage: BrainArch1MemoryTokenUsage;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1Atom.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1Atom.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ContextLogTrail } from 'as-procedure';
|
|
2
|
+
/**
|
|
3
|
+
* .what = runtime context containing provider-keyed credentials for llm apis
|
|
4
|
+
* .why = enables dependency injection of credentials per provider
|
|
5
|
+
*
|
|
6
|
+
* .note = this is not a DomainLiteral because it contains functions (log)
|
|
7
|
+
* and is a runtime dependency injection container, not a serializable value
|
|
8
|
+
*/
|
|
9
|
+
export interface BrainArch1Context extends ContextLogTrail {
|
|
10
|
+
/**
|
|
11
|
+
* provider-keyed credentials for llm api access
|
|
12
|
+
*/
|
|
13
|
+
creds: {
|
|
14
|
+
anthropic: {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
url: string | null;
|
|
17
|
+
};
|
|
18
|
+
openai: {
|
|
19
|
+
apiKey: string;
|
|
20
|
+
url: string | null;
|
|
21
|
+
};
|
|
22
|
+
qwen: {
|
|
23
|
+
apiKey: string;
|
|
24
|
+
url: string | null;
|
|
25
|
+
};
|
|
26
|
+
tavily: {
|
|
27
|
+
apiKey: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1Context.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1Context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
import type { BrainArch1MemoryTokenUsage } from './BrainArch1MemoryTokenUsage';
|
|
3
|
+
/**
|
|
4
|
+
* .what = captures the state and metrics of a single loop iteration
|
|
5
|
+
* .why = enables tracking and observability of each iteration cycle
|
|
6
|
+
*/
|
|
7
|
+
export interface BrainArch1LoopIteration {
|
|
8
|
+
/**
|
|
9
|
+
* iteration number (0-indexed)
|
|
10
|
+
*/
|
|
11
|
+
iterationNumber: number;
|
|
12
|
+
/**
|
|
13
|
+
* whether this iteration generated any tool calls
|
|
14
|
+
*/
|
|
15
|
+
hadToolCalls: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* number of tool calls generated in this iteration
|
|
18
|
+
*/
|
|
19
|
+
toolCallCount: number;
|
|
20
|
+
/**
|
|
21
|
+
* token usage for the llm call in this iteration
|
|
22
|
+
*/
|
|
23
|
+
tokenUsage: BrainArch1MemoryTokenUsage;
|
|
24
|
+
/**
|
|
25
|
+
* timestamp when this iteration started
|
|
26
|
+
*/
|
|
27
|
+
startedAt: string;
|
|
28
|
+
/**
|
|
29
|
+
* timestamp when this iteration completed
|
|
30
|
+
*/
|
|
31
|
+
completedAt: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class BrainArch1LoopIteration extends DomainLiteral<BrainArch1LoopIteration> implements BrainArch1LoopIteration {
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1LoopIteration = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1LoopIteration extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1LoopIteration = BrainArch1LoopIteration;
|
|
8
|
+
//# sourceMappingURL=BrainArch1LoopIteration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1LoopIteration.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1LoopIteration.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAwC/C,MAAa,uBACX,SAAQ,8BAAsC;CACT;AAFvC,0DAEuC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DomainEvent } from 'domain-objects';
|
|
2
|
+
import type { BrainArch1LoopIteration } from './BrainArch1LoopIteration';
|
|
3
|
+
/**
|
|
4
|
+
* .what = event emitted when a loop iteration completes
|
|
5
|
+
* .why = enables observability and logging of iteration progress
|
|
6
|
+
*/
|
|
7
|
+
export interface BrainArch1LoopIterationCompletedEvent {
|
|
8
|
+
/**
|
|
9
|
+
* session uuid this event belongs to
|
|
10
|
+
*/
|
|
11
|
+
sessionUuid: string;
|
|
12
|
+
/**
|
|
13
|
+
* timestamp when this event occurred
|
|
14
|
+
*/
|
|
15
|
+
occurredAt: string;
|
|
16
|
+
/**
|
|
17
|
+
* the completed iteration data
|
|
18
|
+
*/
|
|
19
|
+
iteration: BrainArch1LoopIteration;
|
|
20
|
+
}
|
|
21
|
+
export declare class BrainArch1LoopIterationCompletedEvent extends DomainEvent<BrainArch1LoopIterationCompletedEvent> implements BrainArch1LoopIterationCompletedEvent {
|
|
22
|
+
static unique: readonly ["sessionUuid", "iteration.iterationNumber"];
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1LoopIterationCompletedEvent = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1LoopIterationCompletedEvent extends domain_objects_1.DomainEvent {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1LoopIterationCompletedEvent = BrainArch1LoopIterationCompletedEvent;
|
|
8
|
+
BrainArch1LoopIterationCompletedEvent.unique = ['sessionUuid', 'iteration.iterationNumber'];
|
|
9
|
+
//# sourceMappingURL=BrainArch1LoopIterationCompletedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1LoopIterationCompletedEvent.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAyB7C,MAAa,qCACX,SAAQ,4BAAkD;;AAD5D,sFAKC;AADe,4CAAM,GAAG,CAAC,aAAa,EAAE,2BAA2B,CAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
import type { BrainArch1LoopIteration } from './BrainArch1LoopIteration';
|
|
3
|
+
import type { BrainArch1MemoryTokenUsage } from './BrainArch1MemoryTokenUsage';
|
|
4
|
+
import type { BrainArch1SessionMessage } from './BrainArch1SessionMessage';
|
|
5
|
+
/**
|
|
6
|
+
* .what = reason why the loop terminated
|
|
7
|
+
* .why = enables the caller to understand loop completion state
|
|
8
|
+
*/
|
|
9
|
+
export type BrainArch1LoopTerminationReason = 'NATURAL_COMPLETION' | 'MAX_ITERATIONS' | 'ERROR';
|
|
10
|
+
/**
|
|
11
|
+
* .what = captures the final result of a completed agentic loop
|
|
12
|
+
* .why = enables the caller to receive the brain's output and metrics
|
|
13
|
+
*/
|
|
14
|
+
export interface BrainArch1LoopResult {
|
|
15
|
+
/**
|
|
16
|
+
* why the loop terminated
|
|
17
|
+
*/
|
|
18
|
+
terminationReason: BrainArch1LoopTerminationReason;
|
|
19
|
+
/**
|
|
20
|
+
* final text response from the brain (may be null if error)
|
|
21
|
+
*/
|
|
22
|
+
finalResponse: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* final assistant message (includes tool calls if any)
|
|
25
|
+
*/
|
|
26
|
+
finalMessage: BrainArch1SessionMessage | null;
|
|
27
|
+
/**
|
|
28
|
+
* all messages in the conversation context
|
|
29
|
+
*/
|
|
30
|
+
messages: BrainArch1SessionMessage[];
|
|
31
|
+
/**
|
|
32
|
+
* history of all loop iterations
|
|
33
|
+
*/
|
|
34
|
+
iterations: BrainArch1LoopIteration[];
|
|
35
|
+
/**
|
|
36
|
+
* total number of iterations executed
|
|
37
|
+
*/
|
|
38
|
+
iterationCount: number;
|
|
39
|
+
/**
|
|
40
|
+
* cumulative token usage across all iterations
|
|
41
|
+
*/
|
|
42
|
+
totalTokenUsage: BrainArch1MemoryTokenUsage;
|
|
43
|
+
/**
|
|
44
|
+
* error message if terminated due to error
|
|
45
|
+
*/
|
|
46
|
+
error: string | null;
|
|
47
|
+
}
|
|
48
|
+
export declare class BrainArch1LoopResult extends DomainLiteral<BrainArch1LoopResult> implements BrainArch1LoopResult {
|
|
49
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1LoopResult = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1LoopResult extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1LoopResult = BrainArch1LoopResult;
|
|
8
|
+
//# sourceMappingURL=BrainArch1LoopResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1LoopResult.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1LoopResult.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AA6D/C,MAAa,oBACX,SAAQ,8BAAmC;CACT;AAFpC,oDAEoC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DomainEvent } from 'domain-objects';
|
|
2
|
+
import type { BrainArch1MemoryCompactionResult } from './BrainArch1MemoryCompactionResult';
|
|
3
|
+
/**
|
|
4
|
+
* .what = event emitted when memory compaction completes
|
|
5
|
+
* .why = enables observability and logging of memory optimization
|
|
6
|
+
*/
|
|
7
|
+
export interface BrainArch1MemoryCompactedEvent {
|
|
8
|
+
/**
|
|
9
|
+
* session uuid this event belongs to
|
|
10
|
+
*/
|
|
11
|
+
sessionUuid: string;
|
|
12
|
+
/**
|
|
13
|
+
* iteration number after which compaction occurred
|
|
14
|
+
*/
|
|
15
|
+
afterIterationNumber: number;
|
|
16
|
+
/**
|
|
17
|
+
* timestamp when this event occurred
|
|
18
|
+
*/
|
|
19
|
+
occurredAt: string;
|
|
20
|
+
/**
|
|
21
|
+
* the compaction result
|
|
22
|
+
*/
|
|
23
|
+
result: BrainArch1MemoryCompactionResult;
|
|
24
|
+
/**
|
|
25
|
+
* name of the memory manager that performed compaction
|
|
26
|
+
*/
|
|
27
|
+
managerName: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class BrainArch1MemoryCompactedEvent extends DomainEvent<BrainArch1MemoryCompactedEvent> implements BrainArch1MemoryCompactedEvent {
|
|
30
|
+
static unique: readonly ["sessionUuid", "afterIterationNumber"];
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1MemoryCompactedEvent = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1MemoryCompactedEvent extends domain_objects_1.DomainEvent {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1MemoryCompactedEvent = BrainArch1MemoryCompactedEvent;
|
|
8
|
+
BrainArch1MemoryCompactedEvent.unique = ['sessionUuid', 'afterIterationNumber'];
|
|
9
|
+
//# sourceMappingURL=BrainArch1MemoryCompactedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1MemoryCompactedEvent.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAmC7C,MAAa,8BACX,SAAQ,4BAA2C;;AADrD,wEAKC;AADe,qCAAM,GAAG,CAAC,aAAa,EAAE,sBAAsB,CAAU,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
import type { BrainArch1MemoryTokenUsage } from './BrainArch1MemoryTokenUsage';
|
|
3
|
+
import type { BrainArch1SessionMessage } from './BrainArch1SessionMessage';
|
|
4
|
+
/**
|
|
5
|
+
* .what = captures the result of a memory compaction operation
|
|
6
|
+
* .why = enables the loop to apply compacted context and track token reduction
|
|
7
|
+
*/
|
|
8
|
+
export interface BrainArch1MemoryCompactionResult {
|
|
9
|
+
/**
|
|
10
|
+
* the compacted messages to replace current context
|
|
11
|
+
*/
|
|
12
|
+
messages: BrainArch1SessionMessage[];
|
|
13
|
+
/**
|
|
14
|
+
* token usage before compaction
|
|
15
|
+
*/
|
|
16
|
+
tokensBefore: number;
|
|
17
|
+
/**
|
|
18
|
+
* token usage after compaction
|
|
19
|
+
*/
|
|
20
|
+
tokensAfter: number;
|
|
21
|
+
/**
|
|
22
|
+
* tokens used for the compaction operation itself (e.g., summarization llm call)
|
|
23
|
+
*/
|
|
24
|
+
compactionTokenUsage: BrainArch1MemoryTokenUsage | null;
|
|
25
|
+
}
|
|
26
|
+
export declare class BrainArch1MemoryCompactionResult extends DomainLiteral<BrainArch1MemoryCompactionResult> implements BrainArch1MemoryCompactionResult {
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1MemoryCompactionResult = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1MemoryCompactionResult extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1MemoryCompactionResult = BrainArch1MemoryCompactionResult;
|
|
8
|
+
//# sourceMappingURL=BrainArch1MemoryCompactionResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1MemoryCompactionResult.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AA+B/C,MAAa,gCACX,SAAQ,8BAA+C;CACT;AAFhD,4EAEgD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BrainArch1Context } from './BrainArch1Context';
|
|
2
|
+
import type { BrainArch1MemoryCompactionResult } from './BrainArch1MemoryCompactionResult';
|
|
3
|
+
import type { BrainArch1SessionMessage } from './BrainArch1SessionMessage';
|
|
4
|
+
/**
|
|
5
|
+
* .what = function signature for checking if compaction should occur
|
|
6
|
+
* .why = enables memory managers to decide when to compact based on token usage
|
|
7
|
+
*/
|
|
8
|
+
export type BrainArch1MemoryShouldCompactFn = (input: {
|
|
9
|
+
messages: BrainArch1SessionMessage[];
|
|
10
|
+
currentTokens: number;
|
|
11
|
+
maxTokens: number;
|
|
12
|
+
}, context: BrainArch1Context) => Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* .what = function signature for performing memory compaction
|
|
15
|
+
* .why = enables pluggable compaction strategies (summarize, truncate, etc.)
|
|
16
|
+
*/
|
|
17
|
+
export type BrainArch1MemoryCompactFn = (input: {
|
|
18
|
+
messages: BrainArch1SessionMessage[];
|
|
19
|
+
currentTokens: number;
|
|
20
|
+
targetTokens: number;
|
|
21
|
+
}, context: BrainArch1Context) => Promise<BrainArch1MemoryCompactionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* .what = interface for a memory manager plugin
|
|
24
|
+
* .why = enables pluggable memory strategies to control context window optimization
|
|
25
|
+
*
|
|
26
|
+
* .note = this is an interface, not a DomainLiteral, because it contains functions
|
|
27
|
+
*/
|
|
28
|
+
export interface BrainArch1MemoryManager {
|
|
29
|
+
/**
|
|
30
|
+
* name of this memory manager
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* description of what this manager does
|
|
35
|
+
*/
|
|
36
|
+
description: string;
|
|
37
|
+
/**
|
|
38
|
+
* check whether compaction should occur
|
|
39
|
+
*/
|
|
40
|
+
shouldCompact: BrainArch1MemoryShouldCompactFn;
|
|
41
|
+
/**
|
|
42
|
+
* perform memory compaction
|
|
43
|
+
*/
|
|
44
|
+
compact: BrainArch1MemoryCompactFn;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1MemoryManager.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1MemoryManager.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
/**
|
|
3
|
+
* .what = tracks token consumption for a single llm api call
|
|
4
|
+
* .why = enables monitoring context usage and triggering memory compaction
|
|
5
|
+
*/
|
|
6
|
+
export interface BrainArch1MemoryTokenUsage {
|
|
7
|
+
/**
|
|
8
|
+
* tokens consumed by the input/prompt
|
|
9
|
+
*/
|
|
10
|
+
inputTokens: number;
|
|
11
|
+
/**
|
|
12
|
+
* tokens generated in the output/response
|
|
13
|
+
*/
|
|
14
|
+
outputTokens: number;
|
|
15
|
+
/**
|
|
16
|
+
* total tokens used (input + output)
|
|
17
|
+
*/
|
|
18
|
+
totalTokens: number;
|
|
19
|
+
/**
|
|
20
|
+
* tokens read from cache, if applicable
|
|
21
|
+
*/
|
|
22
|
+
cacheReadTokens: number | null;
|
|
23
|
+
/**
|
|
24
|
+
* tokens written to cache, if applicable
|
|
25
|
+
*/
|
|
26
|
+
cacheWriteTokens: number | null;
|
|
27
|
+
}
|
|
28
|
+
export declare class BrainArch1MemoryTokenUsage extends DomainLiteral<BrainArch1MemoryTokenUsage> implements BrainArch1MemoryTokenUsage {
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1MemoryTokenUsage = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1MemoryTokenUsage extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1MemoryTokenUsage = BrainArch1MemoryTokenUsage;
|
|
8
|
+
//# sourceMappingURL=BrainArch1MemoryTokenUsage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1MemoryTokenUsage.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAiC/C,MAAa,0BACX,SAAQ,8BAAyC;CACT;AAF1C,gEAE0C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
/**
|
|
3
|
+
* .what = possible verdicts from a permission guard
|
|
4
|
+
* .why = enables explicit control over tool execution authorization
|
|
5
|
+
*/
|
|
6
|
+
export type BrainArch1PermissionVerdict = 'allow' | 'deny' | 'prompt';
|
|
7
|
+
/**
|
|
8
|
+
* .what = captures the decision from a permission guard for a tool call
|
|
9
|
+
* .why = enables the brain to understand and react to permission decisions
|
|
10
|
+
*/
|
|
11
|
+
export interface BrainArch1PermissionDecision {
|
|
12
|
+
/**
|
|
13
|
+
* the verdict: allow (proceed), deny (reject), or prompt (ask user)
|
|
14
|
+
*/
|
|
15
|
+
verdict: BrainArch1PermissionVerdict;
|
|
16
|
+
/**
|
|
17
|
+
* reason for the decision (useful for deny/prompt cases)
|
|
18
|
+
*/
|
|
19
|
+
reason: string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare class BrainArch1PermissionDecision extends DomainLiteral<BrainArch1PermissionDecision> implements BrainArch1PermissionDecision {
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1PermissionDecision = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1PermissionDecision extends domain_objects_1.DomainLiteral {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1PermissionDecision = BrainArch1PermissionDecision;
|
|
8
|
+
//# sourceMappingURL=BrainArch1PermissionDecision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1PermissionDecision.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1PermissionDecision.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAwB/C,MAAa,4BACX,SAAQ,8BAA2C;CACT;AAF5C,oEAE4C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BrainArch1Context } from './BrainArch1Context';
|
|
2
|
+
import type { BrainArch1PermissionDecision } from './BrainArch1PermissionDecision';
|
|
3
|
+
import type { BrainArch1ToolCall } from './BrainArch1ToolCall';
|
|
4
|
+
/**
|
|
5
|
+
* .what = function signature for checking permission on a tool call
|
|
6
|
+
* .why = enables pluggable permission policies (allowAll, promptForWrites, denyDangerous)
|
|
7
|
+
*/
|
|
8
|
+
export type BrainArch1PermissionCheckFn = (input: {
|
|
9
|
+
call: BrainArch1ToolCall;
|
|
10
|
+
}, context: BrainArch1Context) => Promise<BrainArch1PermissionDecision>;
|
|
11
|
+
/**
|
|
12
|
+
* .what = interface for a permission guard plugin
|
|
13
|
+
* .why = enables pluggable permission strategies to control tool execution
|
|
14
|
+
*
|
|
15
|
+
* .note = this is an interface, not a DomainLiteral, because it contains functions
|
|
16
|
+
*/
|
|
17
|
+
export interface BrainArch1PermissionGuard {
|
|
18
|
+
/**
|
|
19
|
+
* name of this permission guard
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* description of what this guard does
|
|
24
|
+
*/
|
|
25
|
+
description: string;
|
|
26
|
+
/**
|
|
27
|
+
* check whether a tool call is permitted
|
|
28
|
+
*/
|
|
29
|
+
check: BrainArch1PermissionCheckFn;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1PermissionGuard.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1PermissionGuard.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DomainEntity } from 'domain-objects';
|
|
2
|
+
import type { BrainArch1MemoryTokenUsage } from './BrainArch1MemoryTokenUsage';
|
|
3
|
+
import type { BrainArch1SessionMessage } from './BrainArch1SessionMessage';
|
|
4
|
+
/**
|
|
5
|
+
* .what = status of a brain session
|
|
6
|
+
* .why = enables tracking session lifecycle
|
|
7
|
+
*/
|
|
8
|
+
export type BrainArch1SessionStatus = 'ACTIVE' | 'COMPLETED' | 'TERMINATED';
|
|
9
|
+
/**
|
|
10
|
+
* .what = captures the state of an ongoing brain session
|
|
11
|
+
* .why = enables tracking and managing the execution lifecycle
|
|
12
|
+
*/
|
|
13
|
+
export interface BrainArch1Session {
|
|
14
|
+
/**
|
|
15
|
+
* unique identifier for this session
|
|
16
|
+
*/
|
|
17
|
+
uuid?: string;
|
|
18
|
+
/**
|
|
19
|
+
* current status of the session
|
|
20
|
+
*/
|
|
21
|
+
status: BrainArch1SessionStatus;
|
|
22
|
+
/**
|
|
23
|
+
* number of loop iterations executed so far
|
|
24
|
+
*/
|
|
25
|
+
iterationCount: number;
|
|
26
|
+
/**
|
|
27
|
+
* cumulative token usage across all iterations
|
|
28
|
+
*/
|
|
29
|
+
totalTokenUsage: BrainArch1MemoryTokenUsage;
|
|
30
|
+
/**
|
|
31
|
+
* current conversation context
|
|
32
|
+
*/
|
|
33
|
+
messages: BrainArch1SessionMessage[];
|
|
34
|
+
/**
|
|
35
|
+
* timestamp when session started
|
|
36
|
+
*/
|
|
37
|
+
startedAt: string;
|
|
38
|
+
/**
|
|
39
|
+
* timestamp when session completed (null if still active)
|
|
40
|
+
*/
|
|
41
|
+
completedAt: string | null;
|
|
42
|
+
}
|
|
43
|
+
export declare class BrainArch1Session extends DomainEntity<BrainArch1Session> implements BrainArch1Session {
|
|
44
|
+
static primary: readonly ["uuid"];
|
|
45
|
+
static unique: readonly ["uuid"];
|
|
46
|
+
static updatable: readonly ["status", "iterationCount", "totalTokenUsage", "messages", "completedAt"];
|
|
47
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1Session = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
class BrainArch1Session extends domain_objects_1.DomainEntity {
|
|
6
|
+
}
|
|
7
|
+
exports.BrainArch1Session = BrainArch1Session;
|
|
8
|
+
BrainArch1Session.primary = ['uuid'];
|
|
9
|
+
BrainArch1Session.unique = ['uuid'];
|
|
10
|
+
BrainArch1Session.updatable = [
|
|
11
|
+
'status',
|
|
12
|
+
'iterationCount',
|
|
13
|
+
'totalTokenUsage',
|
|
14
|
+
'messages',
|
|
15
|
+
'completedAt',
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=BrainArch1Session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1Session.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1Session.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAoD9C,MAAa,iBACX,SAAQ,6BAA+B;;AADzC,8CAaC;AATe,yBAAO,GAAG,CAAC,MAAM,CAAU,CAAC;AAC5B,wBAAM,GAAG,CAAC,MAAM,CAAU,CAAC;AAC3B,2BAAS,GAAG;IACxB,QAAQ;IACR,gBAAgB;IAChB,iBAAiB;IACjB,UAAU;IACV,aAAa;CACL,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
import { BrainArch1ToolCall } from './BrainArch1ToolCall';
|
|
3
|
+
/**
|
|
4
|
+
* .what = role of the message sender in the conversation
|
|
5
|
+
* .why = llm apis require role to understand context
|
|
6
|
+
*/
|
|
7
|
+
export type BrainArch1SessionMessageRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
8
|
+
/**
|
|
9
|
+
* .what = captures a single message in the brain's conversation context
|
|
10
|
+
* .why = enables building and managing the conversation history for llm calls
|
|
11
|
+
*/
|
|
12
|
+
export interface BrainArch1SessionMessage {
|
|
13
|
+
/**
|
|
14
|
+
* role of the message sender
|
|
15
|
+
*/
|
|
16
|
+
role: BrainArch1SessionMessageRole;
|
|
17
|
+
/**
|
|
18
|
+
* text content of the message (null if tool-only response)
|
|
19
|
+
*/
|
|
20
|
+
content: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* tool calls generated by assistant (null if no tools called)
|
|
23
|
+
*/
|
|
24
|
+
toolCalls: BrainArch1ToolCall[] | null;
|
|
25
|
+
/**
|
|
26
|
+
* tool result callId this message responds to (only for role=tool)
|
|
27
|
+
*/
|
|
28
|
+
toolCallId: string | null;
|
|
29
|
+
}
|
|
30
|
+
export declare class BrainArch1SessionMessage extends DomainLiteral<BrainArch1SessionMessage> implements BrainArch1SessionMessage {
|
|
31
|
+
static nested: {
|
|
32
|
+
toolCalls: typeof BrainArch1ToolCall;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrainArch1SessionMessage = void 0;
|
|
4
|
+
const domain_objects_1 = require("domain-objects");
|
|
5
|
+
const BrainArch1ToolCall_1 = require("./BrainArch1ToolCall");
|
|
6
|
+
class BrainArch1SessionMessage extends domain_objects_1.DomainLiteral {
|
|
7
|
+
}
|
|
8
|
+
exports.BrainArch1SessionMessage = BrainArch1SessionMessage;
|
|
9
|
+
BrainArch1SessionMessage.nested = {
|
|
10
|
+
toolCalls: BrainArch1ToolCall_1.BrainArch1ToolCall,
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=BrainArch1SessionMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrainArch1SessionMessage.js","sourceRoot":"","sources":["../../../src/domain.objects/BrainArch1/BrainArch1SessionMessage.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAE/C,6DAA0D;AAsC1D,MAAa,wBACX,SAAQ,8BAAuC;;AADjD,4DAOC;AAHe,+BAAM,GAAG;IACrB,SAAS,EAAE,uCAAkB;CAC9B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DomainLiteral } from 'domain-objects';
|
|
2
|
+
/**
|
|
3
|
+
* .what = captures a single tool invocation request from the llm
|
|
4
|
+
* .why = enables routing and execution of tool calls generated by the brain
|
|
5
|
+
*/
|
|
6
|
+
export interface BrainArch1ToolCall {
|
|
7
|
+
/**
|
|
8
|
+
* unique identifier for this tool call (used to match with result)
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* name of the tool to invoke
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* input arguments for the tool (parsed json object)
|
|
17
|
+
*/
|
|
18
|
+
input: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare class BrainArch1ToolCall extends DomainLiteral<BrainArch1ToolCall> implements BrainArch1ToolCall {
|
|
21
|
+
}
|