@causyne/agent 0.0.0-stage → 1.10.0
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/LICENSE +102 -0
- package/README.md +31 -2
- package/SECURITY.md +24 -0
- package/bin/causyne.js +13 -0
- package/docs/ARCHITECTURE.md +63 -0
- package/docs/PROVENANCE.md +29 -0
- package/docs/SECURITY_REVIEW.md +89 -0
- package/docs/THIRD_PARTY_NOTICES.md +49 -0
- package/native-skills/ai-engineering/context-window-management/SKILL.md +43 -0
- package/native-skills/ai-engineering/llm-evaluation/SKILL.md +46 -0
- package/native-skills/ai-engineering/model-cost-and-latency/SKILL.md +46 -0
- package/native-skills/ai-engineering/prompt-construction/SKILL.md +42 -0
- package/native-skills/ai-engineering/retrieval-augmented-generation/SKILL.md +42 -0
- package/native-skills/ai-engineering/structured-output-and-schemas/SKILL.md +45 -0
- package/native-skills/ai-engineering/tool-calling-agents/SKILL.md +43 -0
- package/native-skills/android/app-performance-profiling/SKILL.md +42 -0
- package/native-skills/android/background-work-scheduling/SKILL.md +47 -0
- package/native-skills/android/compose-state-and-recomposition/SKILL.md +43 -0
- package/native-skills/android/gradle-build-configuration/SKILL.md +41 -0
- package/native-skills/android/lifecycle-and-leaks/SKILL.md +46 -0
- package/native-skills/android/play-store-release/SKILL.md +43 -0
- package/native-skills/android/room-and-persistence/SKILL.md +40 -0
- package/native-skills/backend/authentication-and-sessions/SKILL.md +45 -0
- package/native-skills/backend/background-jobs-and-queues/SKILL.md +42 -0
- package/native-skills/backend/caching-strategy/SKILL.md +44 -0
- package/native-skills/backend/graceful-shutdown/SKILL.md +42 -0
- package/native-skills/backend/rate-limiting-and-quotas/SKILL.md +40 -0
- package/native-skills/backend/rest-api-design/SKILL.md +40 -0
- package/native-skills/backend/webhook-delivery-and-receipt/SKILL.md +43 -0
- package/native-skills/cloud/cost-optimisation/SKILL.md +46 -0
- package/native-skills/cloud/iam-least-privilege/SKILL.md +43 -0
- package/native-skills/cloud/infrastructure-as-code/SKILL.md +43 -0
- package/native-skills/cloud/multi-region-and-failover/SKILL.md +43 -0
- package/native-skills/cloud/serverless-patterns/SKILL.md +47 -0
- package/native-skills/data/data-quality-monitoring/SKILL.md +51 -0
- package/native-skills/data/etl-pipeline-reliability/SKILL.md +43 -0
- package/native-skills/data/exploratory-analysis/SKILL.md +43 -0
- package/native-skills/data/metric-definition/SKILL.md +42 -0
- package/native-skills/data/notebook-to-production/SKILL.md +43 -0
- package/native-skills/database/backup-and-recovery/SKILL.md +43 -0
- package/native-skills/database/connection-pooling/SKILL.md +42 -0
- package/native-skills/database/data-integrity-and-constraints/SKILL.md +42 -0
- package/native-skills/database/query-optimisation/SKILL.md +38 -0
- package/native-skills/database/safe-migrations/SKILL.md +47 -0
- package/native-skills/database/schema-design/SKILL.md +38 -0
- package/native-skills/database/transactions-and-isolation/SKILL.md +41 -0
- package/native-skills/design/colour-system-construction/SKILL.md +38 -0
- package/native-skills/design/design-direction-brief/SKILL.md +41 -0
- package/native-skills/design/motion-and-transitions/SKILL.md +38 -0
- package/native-skills/design/responsive-strategy/SKILL.md +39 -0
- package/native-skills/design/spacing-and-rhythm/SKILL.md +38 -0
- package/native-skills/design/type-scale-and-hierarchy/SKILL.md +39 -0
- package/native-skills/design/visual-qa-loop/SKILL.md +42 -0
- package/native-skills/devops/docker-multi-stage-builds/SKILL.md +60 -0
- package/native-skills/devops/github-actions-ci/SKILL.md +60 -0
- package/native-skills/devops/incident-triage/SKILL.md +38 -0
- package/native-skills/devops/kubernetes-deployment-hardening/SKILL.md +64 -0
- package/native-skills/devops/observability-baseline/SKILL.md +38 -0
- package/native-skills/devops/secret-management/SKILL.md +40 -0
- package/native-skills/devops/terraform-state-and-modules/SKILL.md +36 -0
- package/native-skills/devops/zero-downtime-deploys/SKILL.md +40 -0
- package/native-skills/git/bisect-regression-hunt/SKILL.md +43 -0
- package/native-skills/git/branch-strategy/SKILL.md +39 -0
- package/native-skills/git/commit-hygiene/SKILL.md +41 -0
- package/native-skills/git/history-recovery/SKILL.md +44 -0
- package/native-skills/git/large-repository-surgery/SKILL.md +46 -0
- package/native-skills/git/merge-conflict-resolution/SKILL.md +42 -0
- package/native-skills/media/cinematic-3d-shot/SKILL.md +104 -0
- package/native-skills/mobile/app-startup-optimisation/SKILL.md +41 -0
- package/native-skills/mobile/cross-platform-tradeoffs/SKILL.md +42 -0
- package/native-skills/mobile/deep-linking/SKILL.md +39 -0
- package/native-skills/mobile/mobile-storage-security/SKILL.md +45 -0
- package/native-skills/mobile/offline-first-sync/SKILL.md +42 -0
- package/native-skills/mobile/push-notifications/SKILL.md +38 -0
- package/native-skills/performance/algorithmic-complexity/SKILL.md +43 -0
- package/native-skills/performance/concurrency-and-parallelism/SKILL.md +42 -0
- package/native-skills/performance/load-testing/SKILL.md +42 -0
- package/native-skills/performance/memory-and-leak-hunting/SKILL.md +41 -0
- package/native-skills/performance/network-and-payload-efficiency/SKILL.md +42 -0
- package/native-skills/performance/profiling-methodology/SKILL.md +46 -0
- package/native-skills/python/async-correctness/SKILL.md +40 -0
- package/native-skills/python/cli-tool-construction/SKILL.md +44 -0
- package/native-skills/python/data-processing-pipelines/SKILL.md +38 -0
- package/native-skills/python/environment-isolation/SKILL.md +41 -0
- package/native-skills/python/packaging-and-distribution/SKILL.md +56 -0
- package/native-skills/python/pytest-suite-design/SKILL.md +39 -0
- package/native-skills/python/type-hints-and-static-checking/SKILL.md +42 -0
- package/native-skills/security/authorization-model/SKILL.md +42 -0
- package/native-skills/security/crypto-usage/SKILL.md +48 -0
- package/native-skills/security/dependency-supply-chain/SKILL.md +42 -0
- package/native-skills/security/input-validation-and-injection/SKILL.md +44 -0
- package/native-skills/security/secure-file-uploads/SKILL.md +46 -0
- package/native-skills/security/security-headers-and-csp/SKILL.md +44 -0
- package/native-skills/security/threat-modelling/SKILL.md +46 -0
- package/native-skills/testing/end-to-end-test-stability/SKILL.md +42 -0
- package/native-skills/testing/property-based-testing/SKILL.md +46 -0
- package/native-skills/testing/regression-test-from-a-bug/SKILL.md +41 -0
- package/native-skills/testing/snapshot-and-visual-regression/SKILL.md +42 -0
- package/native-skills/testing/test-doubles-and-mocking/SKILL.md +43 -0
- package/native-skills/testing/test-strategy-and-pyramid/SKILL.md +39 -0
- package/native-skills/testing/writing-good-assertions/SKILL.md +42 -0
- package/native-skills/web/accessible-components/SKILL.md +45 -0
- package/native-skills/web/api-client-resilience/SKILL.md +39 -0
- package/native-skills/web/bundle-size-reduction/SKILL.md +38 -0
- package/native-skills/web/core-web-vitals/SKILL.md +40 -0
- package/native-skills/web/css-layout-systems/SKILL.md +41 -0
- package/native-skills/web/form-validation-ux/SKILL.md +39 -0
- package/native-skills/web/react-state-architecture/SKILL.md +41 -0
- package/native-skills/web/ssr-hydration-correctness/SKILL.md +45 -0
- package/package.json +68 -4
- package/src/agentLoop.js +2458 -0
- package/src/appChannel.js +109 -0
- package/src/approvalGrants.js +66 -0
- package/src/auditLog.js +52 -0
- package/src/autoUpdate.js +12 -0
- package/src/capabilities.js +36 -0
- package/src/checkpoints.js +1199 -0
- package/src/cliMode.js +638 -0
- package/src/commands.js +805 -0
- package/src/compiledSkills.js +540 -0
- package/src/config.js +130 -0
- package/src/contextManager.js +498 -0
- package/src/cortex/autoCondenser.js +192 -0
- package/src/cortex/provisioner.js +27 -0
- package/src/cortex/vectorDb.js +447 -0
- package/src/designPalettes.js +99 -0
- package/src/devMode.js +6 -0
- package/src/embodimentSession.js +180 -0
- package/src/entrypoint.js +194 -0
- package/src/execSafe.js +21 -0
- package/src/gitSnapshot.js +378 -0
- package/src/mcp/jsonRpc.js +165 -0
- package/src/mcp/mcpClient.js +136 -0
- package/src/mcp/mcpRegistry.js +207 -0
- package/src/memory.js +62 -0
- package/src/memoryManager.js +124 -0
- package/src/modelCatalogue.js +132 -0
- package/src/modelIds.js +42 -0
- package/src/modelRouter.js +145 -0
- package/src/outputStore.js +246 -0
- package/src/perception.js +124 -0
- package/src/planCache.js +437 -0
- package/src/procSignal.js +32 -0
- package/src/providers/anthropic.js +408 -0
- package/src/providers/base.js +328 -0
- package/src/providers/dashscope-byok.js +86 -0
- package/src/providers/deepseek.js +80 -0
- package/src/providers/factory.js +37 -0
- package/src/providers/gemini.js +346 -0
- package/src/providers/moonshot.js +73 -0
- package/src/providers/muse.js +169 -0
- package/src/providers/ollama.js +104 -0
- package/src/providers/openai-compatible.js +84 -0
- package/src/providers/openai.js +20 -0
- package/src/providers/qwen-byok.js +76 -0
- package/src/providers/xai.js +73 -0
- package/src/provisioning/capabilityConsent.js +24 -0
- package/src/provisioning/capabilityProvisioner.js +271 -0
- package/src/provisioning/capabilityTools.js +29 -0
- package/src/reporting.js +373 -0
- package/src/sandbox.js +529 -0
- package/src/sessionStore.js +279 -0
- package/src/skillsManager.js +288 -0
- package/src/slopDetector.js +307 -0
- package/src/taskBuffer.js +45 -0
- package/src/taskShape.js +241 -0
- package/src/textDiff.js +150 -0
- package/src/tokenTracker.js +560 -0
- package/src/tool-scripts/ax_snapshot.applescript +39 -0
- package/src/tool-scripts/ax_snapshot.ps1 +10 -0
- package/src/tool-scripts/desktop_act.applescript +58 -0
- package/src/tool-scripts/resolve_automator.py +119 -0
- package/src/toolPacks.js +524 -0
- package/src/tools/archive.js +63 -0
- package/src/tools/astryxOracle.js +78 -0
- package/src/tools/axSnapshot.js +165 -0
- package/src/tools/blenderAutomator.js +349 -0
- package/src/tools/browserAutomator.js +252 -0
- package/src/tools/checkSystemSpecs.js +64 -0
- package/src/tools/clipboard.js +36 -0
- package/src/tools/codeSearchAst.js +101 -0
- package/src/tools/codeSearcher.js +230 -0
- package/src/tools/codeTools.js +262 -0
- package/src/tools/codebaseSearch.js +75 -0
- package/src/tools/createSkill.js +129 -0
- package/src/tools/deferredMcpSearch.js +246 -0
- package/src/tools/desktopAct.js +208 -0
- package/src/tools/desktopOpen.js +34 -0
- package/src/tools/dynamicLoader.js +44 -0
- package/src/tools/executeProceduralMedia.js +93 -0
- package/src/tools/fsDelete.js +51 -0
- package/src/tools/fsEdit.js +105 -0
- package/src/tools/fsFind.js +128 -0
- package/src/tools/fsList.js +77 -0
- package/src/tools/fsMove.js +57 -0
- package/src/tools/fsRead.js +87 -0
- package/src/tools/fsSearch.js +198 -0
- package/src/tools/fsWrite.js +41 -0
- package/src/tools/gameAiBehaviorTree.js +208 -0
- package/src/tools/gameAnimationRig.js +194 -0
- package/src/tools/gameAssetFetcher.js +372 -0
- package/src/tools/gameAssetHarvester.js +210 -0
- package/src/tools/gameAudioSynth.js +267 -0
- package/src/tools/gameBuilder.js +886 -0
- package/src/tools/gameCanvasAudit.js +101 -0
- package/src/tools/gameCinematicSequencer.js +151 -0
- package/src/tools/gameDataForge.js +124 -0
- package/src/tools/gameDialogueTreeGen.js +166 -0
- package/src/tools/gameEconomyBalancer.js +161 -0
- package/src/tools/gameEntitySpawner.js +207 -0
- package/src/tools/gameLoreForge.js +153 -0
- package/src/tools/gameQuestArcBuilder.js +152 -0
- package/src/tools/gameSceneBuilder.js +158 -0
- package/src/tools/gameShaderForge.js +181 -0
- package/src/tools/gameTilemapGenerator.js +164 -0
- package/src/tools/gameUiHudBuilder.js +292 -0
- package/src/tools/gameVfxEmitterGen.js +108 -0
- package/src/tools/gameWebRuntimeInspector.js +91 -0
- package/src/tools/generateMediaViaApi.js +358 -0
- package/src/tools/gitExec.js +54 -0
- package/src/tools/godotAutomator.js +437 -0
- package/src/tools/manageLocalAiDependencies.js +220 -0
- package/src/tools/memoryWrite.js +99 -0
- package/src/tools/multiEdit.js +107 -0
- package/src/tools/palmierAutomator.js +104 -0
- package/src/tools/pdfReader.js +112 -0
- package/src/tools/persistentShell.js +148 -0
- package/src/tools/printer.js +316 -0
- package/src/tools/procTerm.js +91 -0
- package/src/tools/processList.js +52 -0
- package/src/tools/readNativeSkill.js +39 -0
- package/src/tools/registry.js +277 -0
- package/src/tools/resolveAutomator.js +102 -0
- package/src/tools/screenshot.js +75 -0
- package/src/tools/subagentOrchestrator.js +305 -0
- package/src/tools/sysRun.js +125 -0
- package/src/tools/todoWrite.js +75 -0
- package/src/tools/toolDispatch.js +127 -0
- package/src/tools/toolForge.js +124 -0
- package/src/tools/updatePlan.js +88 -0
- package/src/tools/viewImage.js +82 -0
- package/src/tools/visionInspector.js +154 -0
- package/src/tools/webFetch.js +74 -0
- package/src/tools/webSearch.js +82 -0
- package/src/tui/ask.js +164 -0
- package/src/tui/banner.js +158 -0
- package/src/tui/block.js +152 -0
- package/src/tui/chatRenderer.js +953 -0
- package/src/tui/completion.js +424 -0
- package/src/tui/dialogs.js +606 -0
- package/src/tui/diff.js +296 -0
- package/src/tui/history.js +135 -0
- package/src/tui/home.js +217 -0
- package/src/tui/invocation.js +105 -0
- package/src/tui/keys.js +443 -0
- package/src/tui/lineEditor.js +256 -0
- package/src/tui/overlay.js +256 -0
- package/src/tui/prompt.js +1258 -0
- package/src/tui/selectList.js +335 -0
- package/src/tui/stage.js +330 -0
- package/src/tui/stageSurface.js +609 -0
- package/src/tui/statusLine.js +254 -0
- package/src/tui/text.js +345 -0
- package/src/tui/theme.js +393 -0
- package/src/tui/toolDisplay.js +176 -0
- package/src/tui/transcript.js +235 -0
- package/src/tui/viewport.js +337 -0
- package/src/uncertainty.js +271 -0
- package/src/userSkills.js +265 -0
- package/src/utils/cli_ui.js +0 -0
- package/src/utils/inquirer.js +12 -0
- package/src/utils/paths.js +37 -0
- package/src/version.js +38 -0
- package/src/vfeTracker.js +220 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { sysRun, sysRunBg } from './sysRun.js';
|
|
2
|
+
import { fsRead } from './fsRead.js';
|
|
3
|
+
import { fsWrite } from './fsWrite.js';
|
|
4
|
+
import { fsEdit } from './fsEdit.js';
|
|
5
|
+
import { fsSearch } from './fsSearch.js';
|
|
6
|
+
import { fsFind } from './fsFind.js';
|
|
7
|
+
import { fsList } from './fsList.js';
|
|
8
|
+
import { fsMove } from './fsMove.js';
|
|
9
|
+
import { fsDelete } from './fsDelete.js';
|
|
10
|
+
import { gitExec } from './gitExec.js';
|
|
11
|
+
import { processList } from './processList.js';
|
|
12
|
+
import { procTerm } from './procTerm.js';
|
|
13
|
+
import { webFetch } from './webFetch.js';
|
|
14
|
+
import { desktopOpen } from './desktopOpen.js';
|
|
15
|
+
import { todoWrite } from './todoWrite.js';
|
|
16
|
+
import { multiEdit } from './multiEdit.js';
|
|
17
|
+
import { codebaseSearch } from './codebaseSearch.js';
|
|
18
|
+
import { browserAct } from './browserAutomator.js';
|
|
19
|
+
import { blenderAct } from './blenderAutomator.js';
|
|
20
|
+
import { resolveAutomator } from './resolveAutomator.js';
|
|
21
|
+
import { palmierAutomator } from './palmierAutomator.js';
|
|
22
|
+
import { viewImage } from './viewImage.js';
|
|
23
|
+
import { webSearch } from './webSearch.js';
|
|
24
|
+
import { updatePlan } from './updatePlan.js';
|
|
25
|
+
import { clipboard } from './clipboard.js';
|
|
26
|
+
import { screenshot } from './screenshot.js';
|
|
27
|
+
import { axSnapshot } from './axSnapshot.js';
|
|
28
|
+
import { desktopAct } from './desktopAct.js';
|
|
29
|
+
import { archive } from './archive.js';
|
|
30
|
+
import { checkSystemSpecs } from './checkSystemSpecs.js';
|
|
31
|
+
import { executeProceduralMedia } from './executeProceduralMedia.js';
|
|
32
|
+
import { manageLocalAiDependencies } from './manageLocalAiDependencies.js';
|
|
33
|
+
import { generateMediaViaApi } from './generateMediaViaApi.js';
|
|
34
|
+
import { memoryWrite } from './memoryWrite.js';
|
|
35
|
+
import { printerPrint, printerList, printerStatus } from './printer.js';
|
|
36
|
+
import { toolForgeTool } from './toolForge.js';
|
|
37
|
+
import { astryxOracle } from './astryxOracle.js';
|
|
38
|
+
import { pdfRead } from './pdfReader.js';
|
|
39
|
+
import { codeVerifySyntax, codeListSymbols } from './codeTools.js';
|
|
40
|
+
import { codeSearcher } from './codeSearcher.js';
|
|
41
|
+
import { codeSearchAst } from './codeSearchAst.js';
|
|
42
|
+
import { persistentShell } from './persistentShell.js';
|
|
43
|
+
import { subagentOrchestrator } from './subagentOrchestrator.js';
|
|
44
|
+
import { deferredMcpSearch } from './deferredMcpSearch.js';
|
|
45
|
+
import { visionInspector } from './visionInspector.js';
|
|
46
|
+
import { godotAutomator } from './godotAutomator.js';
|
|
47
|
+
import { gameBuilder } from './gameBuilder.js';
|
|
48
|
+
import { gameAssetFetcher } from './gameAssetFetcher.js';
|
|
49
|
+
import { gameLoreForge } from './gameLoreForge.js';
|
|
50
|
+
import { gameDialogueTreeGen } from './gameDialogueTreeGen.js';
|
|
51
|
+
import { gameQuestArcBuilder } from './gameQuestArcBuilder.js';
|
|
52
|
+
import { gameAnimationRig } from './gameAnimationRig.js';
|
|
53
|
+
import { gameAiBehaviorTree } from './gameAiBehaviorTree.js';
|
|
54
|
+
import { gameCinematicSequencer } from './gameCinematicSequencer.js';
|
|
55
|
+
import { gameAssetHarvester } from './gameAssetHarvester.js';
|
|
56
|
+
import { gameAudioSynth } from './gameAudioSynth.js';
|
|
57
|
+
import { gameVfxEmitterGen } from './gameVfxEmitterGen.js';
|
|
58
|
+
import { gameShaderForge } from './gameShaderForge.js';
|
|
59
|
+
import { gameSceneBuilder } from './gameSceneBuilder.js';
|
|
60
|
+
import { gameEntitySpawner } from './gameEntitySpawner.js';
|
|
61
|
+
import { gameTilemapGenerator } from './gameTilemapGenerator.js';
|
|
62
|
+
import { gameUiHudBuilder } from './gameUiHudBuilder.js';
|
|
63
|
+
import { gameEconomyBalancer } from './gameEconomyBalancer.js';
|
|
64
|
+
import { gameDataForge } from './gameDataForge.js';
|
|
65
|
+
import { gameWebRuntimeInspector } from './gameWebRuntimeInspector.js';
|
|
66
|
+
import { gameCanvasAudit } from './gameCanvasAudit.js';
|
|
67
|
+
import readNativeSkill from './readNativeSkill.js';
|
|
68
|
+
import { createSkill } from './createSkill.js';
|
|
69
|
+
import { resolveActiveTools } from '../toolPacks.js';
|
|
70
|
+
import fs from 'fs';
|
|
71
|
+
import path from 'path';
|
|
72
|
+
import os from 'os';
|
|
73
|
+
import { discoverTools, resolveMcpTool, isMcpToolName } from '../mcp/mcpRegistry.js';
|
|
74
|
+
import { causyneHome } from '../utils/paths.js';
|
|
75
|
+
|
|
76
|
+
// Phase 6 AGI Upgrade: Schema Validation Hook
|
|
77
|
+
function validateSchema(schema) {
|
|
78
|
+
if (!schema || !schema.name || !schema.description) {
|
|
79
|
+
console.error(`[REGISTRY WARNING] Tool schema missing required name or description:`, schema);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The one place a tool name is canonicalised. Schemas are authored with dots
|
|
87
|
+
* (`fs.read`) because that reads well; every provider's function-name grammar
|
|
88
|
+
* only allows [a-zA-Z0-9_-], so the wire name is always the underscored form.
|
|
89
|
+
*
|
|
90
|
+
* Every lookup — the agent loop, the sandbox, the pack resolver — must go
|
|
91
|
+
* through this, or the two namespaces drift apart again.
|
|
92
|
+
*/
|
|
93
|
+
// MCP is imported lazily-safe: this module is on the hot path of every LLM
|
|
94
|
+
// call, and mcpRegistry only touches config until a server is actually granted.
|
|
95
|
+
export function normalizeToolName(name) {
|
|
96
|
+
return String(name || '').replace(/\./g, '_');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// SINGLE SOURCE OF TRUTH.
|
|
100
|
+
//
|
|
101
|
+
// TOOL_DEFINITIONS (what the model is told exists) and toolRegistry (what can
|
|
102
|
+
// actually run) are both derived from this one list, so a tool can never be
|
|
103
|
+
// advertised without being executable. The previous design kept a separate
|
|
104
|
+
// hand-written registry map, and four tools had silently drifted out of it:
|
|
105
|
+
// fs_find (a CORE tool, in context on every task), proc_term, palmier_act and
|
|
106
|
+
// code_search_ast. Every model on every provider got "Tool does not exist".
|
|
107
|
+
const TOOL_MODULES = [
|
|
108
|
+
sysRun, sysRunBg, fsRead, fsWrite,
|
|
109
|
+
fsEdit, fsFind, fsSearch, fsList, fsMove,
|
|
110
|
+
fsDelete, gitExec, processList, procTerm,
|
|
111
|
+
webFetch, desktopOpen, todoWrite, multiEdit,
|
|
112
|
+
codebaseSearch, browserAct, viewImage, webSearch,
|
|
113
|
+
updatePlan, clipboard, screenshot, axSnapshot, desktopAct, archive,
|
|
114
|
+
checkSystemSpecs, executeProceduralMedia, manageLocalAiDependencies,
|
|
115
|
+
generateMediaViaApi, memoryWrite, printerPrint, printerList, printerStatus, toolForgeTool,
|
|
116
|
+
astryxOracle, pdfRead, codeVerifySyntax, codeListSymbols, blenderAct, resolveAutomator, palmierAutomator,
|
|
117
|
+
codeSearchAst, codeSearcher, persistentShell, subagentOrchestrator, deferredMcpSearch, visionInspector,
|
|
118
|
+
godotAutomator, gameBuilder, gameAssetFetcher,
|
|
119
|
+
gameLoreForge, gameDialogueTreeGen, gameQuestArcBuilder,
|
|
120
|
+
gameAnimationRig, gameAiBehaviorTree, gameCinematicSequencer,
|
|
121
|
+
gameAssetHarvester, gameAudioSynth, gameVfxEmitterGen,
|
|
122
|
+
gameShaderForge, gameSceneBuilder, gameEntitySpawner,
|
|
123
|
+
gameTilemapGenerator, gameUiHudBuilder, gameEconomyBalancer,
|
|
124
|
+
gameDataForge, gameWebRuntimeInspector, gameCanvasAudit, readNativeSkill, createSkill
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
// Base static definitions (backwards compatible). Order is preserved from the
|
|
128
|
+
// list above because every provider's prompt cache binds on the tool array, and
|
|
129
|
+
// reshuffling it invalidates the cached prefix mid-task.
|
|
130
|
+
export const TOOL_DEFINITIONS = [];
|
|
131
|
+
export const toolRegistry = {};
|
|
132
|
+
|
|
133
|
+
for (const module of TOOL_MODULES) {
|
|
134
|
+
if (!module || !validateSchema(module.schema)) continue;
|
|
135
|
+
|
|
136
|
+
const name = normalizeToolName(module.schema.name);
|
|
137
|
+
if (typeof module.execute !== 'function') {
|
|
138
|
+
console.error(`[REGISTRY WARNING] Tool "${name}" has no execute() and cannot run — skipping.`);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
TOOL_DEFINITIONS.push({ ...module.schema, name });
|
|
143
|
+
toolRegistry[name] = module;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Names that older releases (and any chat history persisted under them) used for
|
|
147
|
+
// a tool whose canonical schema name is different. Resolved only at execution
|
|
148
|
+
// time — never advertised, so they cost no context.
|
|
149
|
+
const TOOL_ALIASES = {
|
|
150
|
+
manage_local_ai_dependencies: 'manage_local_dependencies',
|
|
151
|
+
procTerm: 'proc_term',
|
|
152
|
+
gitExec: 'gitOp',
|
|
153
|
+
// Renamed once a real MCP client existed: this tool searches Causyne's own
|
|
154
|
+
// registry and never spoke the protocol its old name advertised. The alias
|
|
155
|
+
// stays so a model that learned the old name still resolves.
|
|
156
|
+
tool_deferred_mcp_search: 'tool_search'
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/** Resolve a name the model produced to a runnable tool, following aliases. */
|
|
160
|
+
export function resolveTool(name) {
|
|
161
|
+
const normalized = normalizeToolName(name);
|
|
162
|
+
const native = toolRegistry[normalized] || toolRegistry[TOOL_ALIASES[normalized]] || null;
|
|
163
|
+
if (native) return native;
|
|
164
|
+
// MCP tools are namespaced `mcp__server__tool`, so they can never shadow a
|
|
165
|
+
// native name — the native lookup always wins above.
|
|
166
|
+
if (isMcpToolName(name)) return resolveMcpTool(name);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** The canonical catalogue name for anything the model might call it. */
|
|
171
|
+
export function canonicalToolName(name) {
|
|
172
|
+
const normalized = normalizeToolName(name);
|
|
173
|
+
if (toolRegistry[normalized]) return normalized;
|
|
174
|
+
return TOOL_ALIASES[normalized] || normalized;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Forged tools are hot-reloadable, but re-importing them with a cache-busting
|
|
178
|
+
// query string on every single agent step leaked one ES module per step and
|
|
179
|
+
// changed the tool ordering between requests, which silently defeats OpenAI and
|
|
180
|
+
// DeepSeek automatic prompt caching. We reload only when a file actually
|
|
181
|
+
// changes, keyed on path + mtime.
|
|
182
|
+
const forgedModuleCache = new Map();
|
|
183
|
+
|
|
184
|
+
async function loadForgedTools() {
|
|
185
|
+
const CUSTOM_TOOLS_DIR = path.join(causyneHome(), 'custom_tools');
|
|
186
|
+
if (!fs.existsSync(CUSTOM_TOOLS_DIR)) return [];
|
|
187
|
+
|
|
188
|
+
const forged = [];
|
|
189
|
+
// Sorted so the resulting schema order is identical across requests.
|
|
190
|
+
const files = fs.readdirSync(CUSTOM_TOOLS_DIR).filter(f => f.endsWith('.js')).sort();
|
|
191
|
+
|
|
192
|
+
for (const file of files) {
|
|
193
|
+
const fullPath = path.join(CUSTOM_TOOLS_DIR, file);
|
|
194
|
+
try {
|
|
195
|
+
const mtime = fs.statSync(fullPath).mtimeMs;
|
|
196
|
+
const cached = forgedModuleCache.get(fullPath);
|
|
197
|
+
let imported;
|
|
198
|
+
|
|
199
|
+
if (cached && cached.mtime === mtime) {
|
|
200
|
+
imported = cached.module;
|
|
201
|
+
} else {
|
|
202
|
+
imported = await import(`file://${fullPath}?v=${mtime}`);
|
|
203
|
+
forgedModuleCache.set(fullPath, { mtime, module: imported });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
for (const key of Object.keys(imported)) {
|
|
207
|
+
if (imported[key] && imported[key].schema) {
|
|
208
|
+
const normalizedName = imported[key].schema.name.replace(/\./g, '_');
|
|
209
|
+
forged.push({ ...imported[key].schema, name: normalizedName });
|
|
210
|
+
if (!toolRegistry[normalizedName]) {
|
|
211
|
+
toolRegistry[normalizedName] = imported[key];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
} catch (e) {
|
|
216
|
+
console.error(`[TOOL FORGE] Failed to load custom tool ${file}:`, e.message);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return forged;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Phase 6 AGI Upgrade & V5 Cortex: Dynamic Tool Culling and Hot-Reloading Engine
|
|
224
|
+
//
|
|
225
|
+
// options.unlockedPacks / options.unlockedTools drive Sovereign Progressive
|
|
226
|
+
// Disclosure (see src/toolPacks.js). No tool is ever removed from the catalogue
|
|
227
|
+
// — deferred schemas simply stay out of the context window until the agent
|
|
228
|
+
// pre-warms or searches for them. options.grantAllTools restores the legacy
|
|
229
|
+
// behaviour of loading all 69 schemas up front.
|
|
230
|
+
export async function getDynamicTools(autonomyMode = 'C', supportsVision = true, options = {}) {
|
|
231
|
+
const forged = await loadForgedTools();
|
|
232
|
+
// Tools from user-configured MCP servers, appended last so the native
|
|
233
|
+
// schema order — which the provider prompt caches depend on — never shifts.
|
|
234
|
+
let mcp = [];
|
|
235
|
+
try {
|
|
236
|
+
mcp = await discoverTools();
|
|
237
|
+
} catch (e) { /* a broken third-party server must not take the catalogue down */ }
|
|
238
|
+
let tools = [...TOOL_DEFINITIONS, ...forged, ...mcp];
|
|
239
|
+
|
|
240
|
+
if (!options.grantAllTools) {
|
|
241
|
+
tools = resolveActiveTools(tools, options.unlockedPacks, options.unlockedTools, options.unlockOrder, {
|
|
242
|
+
residentOnly: options.residentOnly === true
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Vision Toggle Culling
|
|
247
|
+
if (!supportsVision) {
|
|
248
|
+
// Phase 6 Fix: Do not hide view_image. Allow it to serve as a Text-Only OCR Fallback for blind LLMs.
|
|
249
|
+
tools = tools.filter(t => t.name !== 'screenshot' && t.name !== 'vision_inspect_ui');
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Capability Culling (finding D-6).
|
|
253
|
+
//
|
|
254
|
+
// A tool the user has explicitly DECLINED can never run, so showing its
|
|
255
|
+
// schema only invites the model to spend a step discovering that. A tool that
|
|
256
|
+
// is merely un-granted stays visible: calling it is how the model learns to
|
|
257
|
+
// ask for the capability, which is the intended flow.
|
|
258
|
+
try {
|
|
259
|
+
const { declinedToolNames } = await import('../provisioning/capabilityTools.js');
|
|
260
|
+
const declined = declinedToolNames();
|
|
261
|
+
if (declined.size > 0) tools = tools.filter(t => !declined.has(t.name));
|
|
262
|
+
} catch (e) { /* provisioning unavailable: show everything rather than hide capability */ }
|
|
263
|
+
|
|
264
|
+
// Autonomy Mode Culling (Save tokens and prevent hallucinations on Mode A).
|
|
265
|
+
// Names here are canonical catalogue names — the legacy dotted/camelCase
|
|
266
|
+
// variants that used to pad these sets never matched a schema name and so
|
|
267
|
+
// culled nothing.
|
|
268
|
+
if (autonomyMode === 'A') {
|
|
269
|
+
const dangerousTools = new Set(['proc_term', 'gitOp', 'fs_delete', 'sysRun', 'sysRunBg', 'terminal_persistent_shell', 'manage_local_dependencies']);
|
|
270
|
+
tools = tools.filter(t => !dangerousTools.has(t.name));
|
|
271
|
+
} else if (autonomyMode === 'B') {
|
|
272
|
+
const dangerousTools = new Set(['proc_term', 'manage_local_dependencies']);
|
|
273
|
+
tools = tools.filter(t => !dangerousTools.has(t.name));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return tools;
|
|
277
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const MAC_RESOLVE_API = "/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting";
|
|
7
|
+
const MAC_RESOLVE_LIB = "/Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const PYTHON_SCRIPT = readFileSync(new URL('../tool-scripts/resolve_automator.py', import.meta.url), 'utf8');
|
|
11
|
+
|
|
12
|
+
export const resolveAutomator = {
|
|
13
|
+
schema: {
|
|
14
|
+
name: 'resolve.act',
|
|
15
|
+
description: 'Automate DaVinci Resolve Studio for native Cinema Workflows. Requires Resolve to be running with External Scripting: Local enabled.',
|
|
16
|
+
parameters: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
action: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
enum: ['checkConnection', 'setupColorManagement', 'importAndAssemble']
|
|
22
|
+
},
|
|
23
|
+
mediaPath: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Absolute path to media directory to import'
|
|
26
|
+
},
|
|
27
|
+
color_space_mode: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['automatic', 'custom'],
|
|
30
|
+
description: 'Use automatic (Resolve auto-detects based on metadata) or custom.'
|
|
31
|
+
},
|
|
32
|
+
fps: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Timeline framerate (e.g. 23.976) or "auto" to detect from clip metadata'
|
|
35
|
+
},
|
|
36
|
+
resolution_x: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'Timeline width or "auto"'
|
|
39
|
+
},
|
|
40
|
+
resolution_y: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Timeline height or "auto"'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
required: ['action']
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
async execute(args) {
|
|
49
|
+
if (os.platform() !== 'darwin') {
|
|
50
|
+
return { success: false, error: "Currently, only macOS is fully supported for this Resolve script pipeline." };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const payload = JSON.stringify(args);
|
|
54
|
+
|
|
55
|
+
return new Promise((resolvePromise) => {
|
|
56
|
+
const env = {
|
|
57
|
+
...process.env,
|
|
58
|
+
RESOLVE_SCRIPT_API: MAC_RESOLVE_API,
|
|
59
|
+
RESOLVE_SCRIPT_LIB: MAC_RESOLVE_LIB,
|
|
60
|
+
PYTHONPATH: `${process.env.PYTHONPATH || ''}:${MAC_RESOLVE_API}/Modules/`
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const pyBin = "python3";
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const child = spawn(pyBin, ['-', payload], { env });
|
|
68
|
+
|
|
69
|
+
let outputData = '';
|
|
70
|
+
let errorData = '';
|
|
71
|
+
|
|
72
|
+
child.stdout.on('data', (data) => {
|
|
73
|
+
outputData += data.toString();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
child.stderr.on('data', (data) => {
|
|
77
|
+
errorData += data.toString();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
child.on('close', (code) => {
|
|
81
|
+
if (outputData.trim()) {
|
|
82
|
+
try {
|
|
83
|
+
const lines = outputData.trim().split('\n');
|
|
84
|
+
const jsonLine = lines.find(l => l.trim().startsWith('{') && l.trim().endsWith('}'));
|
|
85
|
+
if (jsonLine) {
|
|
86
|
+
resolvePromise(JSON.parse(jsonLine));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
} catch (e) {}
|
|
90
|
+
}
|
|
91
|
+
resolvePromise({
|
|
92
|
+
success: false,
|
|
93
|
+
error: errorData.trim() || outputData.trim() || `Python process exited with code ${code}`
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const decodedScript = PYTHON_SCRIPT;
|
|
98
|
+
child.stdin.write(decodedScript);
|
|
99
|
+
child.stdin.end();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import { ensureCapability, loadCapabilityPackage } from '../provisioning/capabilityProvisioner.js';
|
|
5
|
+
|
|
6
|
+
export const screenshot = {
|
|
7
|
+
schema: {
|
|
8
|
+
name: 'screenshot',
|
|
9
|
+
description: 'Visual Spatial Coordinator. Captures the screen and uses OCR to extract Bounding Box (X,Y) coordinates of UI elements, allowing AGI to "see" the OS.',
|
|
10
|
+
parameters: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
analyzeText: { type: 'boolean', description: 'If true, runs OCR to map text coordinates.' }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
async execute(args) {
|
|
18
|
+
try {
|
|
19
|
+
const vision = await ensureCapability('vision');
|
|
20
|
+
if (!vision.ok) return { success: false, error: vision.reason, requiresConsent: vision.requiresConsent };
|
|
21
|
+
const screenshotDesktop = await loadCapabilityPackage('screenshot-desktop');
|
|
22
|
+
|
|
23
|
+
const tempDir = path.join(os.tmpdir(), 'causyne_vision');
|
|
24
|
+
await fs.mkdir(tempDir, { recursive: true });
|
|
25
|
+
const dest = path.join(tempDir, `vision_${Date.now()}.png`);
|
|
26
|
+
|
|
27
|
+
// Phase 5 AGI Upgrade: Cross-Platform Native Capture
|
|
28
|
+
await screenshotDesktop({ filename: dest });
|
|
29
|
+
|
|
30
|
+
if (!args.analyzeText) {
|
|
31
|
+
return { success: true, output: `Screenshot saved to ${dest}` };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Phase 5 AGI Upgrade: OCR Bounding Box Integration
|
|
35
|
+
const ocr = await ensureCapability('ocr');
|
|
36
|
+
if (!ocr.ok) {
|
|
37
|
+
await fs.unlink(dest);
|
|
38
|
+
return { success: false, error: ocr.reason, requiresConsent: ocr.requiresConsent };
|
|
39
|
+
}
|
|
40
|
+
const Tesseract = await loadCapabilityPackage('tesseract.js');
|
|
41
|
+
|
|
42
|
+
// Tesseract runs in its own Worker thread automatically
|
|
43
|
+
const worker = await Tesseract.createWorker('eng');
|
|
44
|
+
const { data: { words } } = await worker.recognize(dest);
|
|
45
|
+
await worker.terminate();
|
|
46
|
+
|
|
47
|
+
// Delete temporary image to protect privacy
|
|
48
|
+
await fs.unlink(dest);
|
|
49
|
+
|
|
50
|
+
if (!words || words.length === 0) {
|
|
51
|
+
return { success: true, output: "Screenshot taken, but no readable text found on screen." };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let markdownMap = `👁️ OS Visual Spatial Map:\n\n`;
|
|
55
|
+
// We'll return the top 50 most confident words to prevent context overload
|
|
56
|
+
const confidentWords = words.filter(w => w.confidence > 75).slice(0, 50);
|
|
57
|
+
|
|
58
|
+
for (const w of confidentWords) {
|
|
59
|
+
const { x0, y0, x1, y1 } = w.bbox;
|
|
60
|
+
const centerX = Math.floor((x0 + x1) / 2);
|
|
61
|
+
const centerY = Math.floor((y0 + y1) / 2);
|
|
62
|
+
markdownMap += `- Text: "${w.text}" | Center Coordinates: X:${centerX}, Y:${centerY} | Confidence: ${w.confidence.toFixed(1)}%\n`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (words.length > 50) {
|
|
66
|
+
markdownMap += `\n[... Truncated ${words.length - 50} elements to protect AGI Context ...]`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return { success: true, output: markdownMap };
|
|
70
|
+
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return { success: false, error: `Vision Error: ${e.message}` };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|