@causyne/agent 0.0.0-stage → 1.10.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.
Files changed (274) hide show
  1. package/LICENSE +102 -0
  2. package/README.md +31 -2
  3. package/SECURITY.md +24 -0
  4. package/bin/causyne.js +13 -0
  5. package/docs/ARCHITECTURE.md +63 -0
  6. package/docs/PROVENANCE.md +29 -0
  7. package/docs/SECURITY_REVIEW.md +89 -0
  8. package/docs/THIRD_PARTY_NOTICES.md +49 -0
  9. package/native-skills/ai-engineering/context-window-management/SKILL.md +43 -0
  10. package/native-skills/ai-engineering/llm-evaluation/SKILL.md +46 -0
  11. package/native-skills/ai-engineering/model-cost-and-latency/SKILL.md +46 -0
  12. package/native-skills/ai-engineering/prompt-construction/SKILL.md +42 -0
  13. package/native-skills/ai-engineering/retrieval-augmented-generation/SKILL.md +42 -0
  14. package/native-skills/ai-engineering/structured-output-and-schemas/SKILL.md +45 -0
  15. package/native-skills/ai-engineering/tool-calling-agents/SKILL.md +43 -0
  16. package/native-skills/android/app-performance-profiling/SKILL.md +42 -0
  17. package/native-skills/android/background-work-scheduling/SKILL.md +47 -0
  18. package/native-skills/android/compose-state-and-recomposition/SKILL.md +43 -0
  19. package/native-skills/android/gradle-build-configuration/SKILL.md +41 -0
  20. package/native-skills/android/lifecycle-and-leaks/SKILL.md +46 -0
  21. package/native-skills/android/play-store-release/SKILL.md +43 -0
  22. package/native-skills/android/room-and-persistence/SKILL.md +40 -0
  23. package/native-skills/backend/authentication-and-sessions/SKILL.md +45 -0
  24. package/native-skills/backend/background-jobs-and-queues/SKILL.md +42 -0
  25. package/native-skills/backend/caching-strategy/SKILL.md +44 -0
  26. package/native-skills/backend/graceful-shutdown/SKILL.md +42 -0
  27. package/native-skills/backend/rate-limiting-and-quotas/SKILL.md +40 -0
  28. package/native-skills/backend/rest-api-design/SKILL.md +40 -0
  29. package/native-skills/backend/webhook-delivery-and-receipt/SKILL.md +43 -0
  30. package/native-skills/cloud/cost-optimisation/SKILL.md +46 -0
  31. package/native-skills/cloud/iam-least-privilege/SKILL.md +43 -0
  32. package/native-skills/cloud/infrastructure-as-code/SKILL.md +43 -0
  33. package/native-skills/cloud/multi-region-and-failover/SKILL.md +43 -0
  34. package/native-skills/cloud/serverless-patterns/SKILL.md +47 -0
  35. package/native-skills/data/data-quality-monitoring/SKILL.md +51 -0
  36. package/native-skills/data/etl-pipeline-reliability/SKILL.md +43 -0
  37. package/native-skills/data/exploratory-analysis/SKILL.md +43 -0
  38. package/native-skills/data/metric-definition/SKILL.md +42 -0
  39. package/native-skills/data/notebook-to-production/SKILL.md +43 -0
  40. package/native-skills/database/backup-and-recovery/SKILL.md +43 -0
  41. package/native-skills/database/connection-pooling/SKILL.md +42 -0
  42. package/native-skills/database/data-integrity-and-constraints/SKILL.md +42 -0
  43. package/native-skills/database/query-optimisation/SKILL.md +38 -0
  44. package/native-skills/database/safe-migrations/SKILL.md +47 -0
  45. package/native-skills/database/schema-design/SKILL.md +38 -0
  46. package/native-skills/database/transactions-and-isolation/SKILL.md +41 -0
  47. package/native-skills/design/colour-system-construction/SKILL.md +38 -0
  48. package/native-skills/design/design-direction-brief/SKILL.md +41 -0
  49. package/native-skills/design/motion-and-transitions/SKILL.md +38 -0
  50. package/native-skills/design/responsive-strategy/SKILL.md +39 -0
  51. package/native-skills/design/spacing-and-rhythm/SKILL.md +38 -0
  52. package/native-skills/design/type-scale-and-hierarchy/SKILL.md +39 -0
  53. package/native-skills/design/visual-qa-loop/SKILL.md +42 -0
  54. package/native-skills/devops/docker-multi-stage-builds/SKILL.md +60 -0
  55. package/native-skills/devops/github-actions-ci/SKILL.md +60 -0
  56. package/native-skills/devops/incident-triage/SKILL.md +38 -0
  57. package/native-skills/devops/kubernetes-deployment-hardening/SKILL.md +64 -0
  58. package/native-skills/devops/observability-baseline/SKILL.md +38 -0
  59. package/native-skills/devops/secret-management/SKILL.md +40 -0
  60. package/native-skills/devops/terraform-state-and-modules/SKILL.md +36 -0
  61. package/native-skills/devops/zero-downtime-deploys/SKILL.md +40 -0
  62. package/native-skills/git/bisect-regression-hunt/SKILL.md +43 -0
  63. package/native-skills/git/branch-strategy/SKILL.md +39 -0
  64. package/native-skills/git/commit-hygiene/SKILL.md +41 -0
  65. package/native-skills/git/history-recovery/SKILL.md +44 -0
  66. package/native-skills/git/large-repository-surgery/SKILL.md +46 -0
  67. package/native-skills/git/merge-conflict-resolution/SKILL.md +42 -0
  68. package/native-skills/media/cinematic-3d-shot/SKILL.md +104 -0
  69. package/native-skills/mobile/app-startup-optimisation/SKILL.md +41 -0
  70. package/native-skills/mobile/cross-platform-tradeoffs/SKILL.md +42 -0
  71. package/native-skills/mobile/deep-linking/SKILL.md +39 -0
  72. package/native-skills/mobile/mobile-storage-security/SKILL.md +45 -0
  73. package/native-skills/mobile/offline-first-sync/SKILL.md +42 -0
  74. package/native-skills/mobile/push-notifications/SKILL.md +38 -0
  75. package/native-skills/performance/algorithmic-complexity/SKILL.md +43 -0
  76. package/native-skills/performance/concurrency-and-parallelism/SKILL.md +42 -0
  77. package/native-skills/performance/load-testing/SKILL.md +42 -0
  78. package/native-skills/performance/memory-and-leak-hunting/SKILL.md +41 -0
  79. package/native-skills/performance/network-and-payload-efficiency/SKILL.md +42 -0
  80. package/native-skills/performance/profiling-methodology/SKILL.md +46 -0
  81. package/native-skills/python/async-correctness/SKILL.md +40 -0
  82. package/native-skills/python/cli-tool-construction/SKILL.md +44 -0
  83. package/native-skills/python/data-processing-pipelines/SKILL.md +38 -0
  84. package/native-skills/python/environment-isolation/SKILL.md +41 -0
  85. package/native-skills/python/packaging-and-distribution/SKILL.md +56 -0
  86. package/native-skills/python/pytest-suite-design/SKILL.md +39 -0
  87. package/native-skills/python/type-hints-and-static-checking/SKILL.md +42 -0
  88. package/native-skills/security/authorization-model/SKILL.md +42 -0
  89. package/native-skills/security/crypto-usage/SKILL.md +48 -0
  90. package/native-skills/security/dependency-supply-chain/SKILL.md +42 -0
  91. package/native-skills/security/input-validation-and-injection/SKILL.md +44 -0
  92. package/native-skills/security/secure-file-uploads/SKILL.md +46 -0
  93. package/native-skills/security/security-headers-and-csp/SKILL.md +44 -0
  94. package/native-skills/security/threat-modelling/SKILL.md +46 -0
  95. package/native-skills/testing/end-to-end-test-stability/SKILL.md +42 -0
  96. package/native-skills/testing/property-based-testing/SKILL.md +46 -0
  97. package/native-skills/testing/regression-test-from-a-bug/SKILL.md +41 -0
  98. package/native-skills/testing/snapshot-and-visual-regression/SKILL.md +42 -0
  99. package/native-skills/testing/test-doubles-and-mocking/SKILL.md +43 -0
  100. package/native-skills/testing/test-strategy-and-pyramid/SKILL.md +39 -0
  101. package/native-skills/testing/writing-good-assertions/SKILL.md +42 -0
  102. package/native-skills/web/accessible-components/SKILL.md +45 -0
  103. package/native-skills/web/api-client-resilience/SKILL.md +39 -0
  104. package/native-skills/web/bundle-size-reduction/SKILL.md +38 -0
  105. package/native-skills/web/core-web-vitals/SKILL.md +40 -0
  106. package/native-skills/web/css-layout-systems/SKILL.md +41 -0
  107. package/native-skills/web/form-validation-ux/SKILL.md +39 -0
  108. package/native-skills/web/react-state-architecture/SKILL.md +41 -0
  109. package/native-skills/web/ssr-hydration-correctness/SKILL.md +45 -0
  110. package/package.json +68 -4
  111. package/src/agentLoop.js +2458 -0
  112. package/src/appChannel.js +109 -0
  113. package/src/approvalGrants.js +66 -0
  114. package/src/auditLog.js +52 -0
  115. package/src/autoUpdate.js +12 -0
  116. package/src/capabilities.js +36 -0
  117. package/src/checkpoints.js +1199 -0
  118. package/src/cliMode.js +638 -0
  119. package/src/commands.js +805 -0
  120. package/src/compiledSkills.js +540 -0
  121. package/src/config.js +130 -0
  122. package/src/contextManager.js +498 -0
  123. package/src/cortex/autoCondenser.js +192 -0
  124. package/src/cortex/provisioner.js +27 -0
  125. package/src/cortex/vectorDb.js +447 -0
  126. package/src/designPalettes.js +99 -0
  127. package/src/devMode.js +6 -0
  128. package/src/embodimentSession.js +180 -0
  129. package/src/entrypoint.js +194 -0
  130. package/src/execSafe.js +21 -0
  131. package/src/gitSnapshot.js +378 -0
  132. package/src/mcp/jsonRpc.js +165 -0
  133. package/src/mcp/mcpClient.js +136 -0
  134. package/src/mcp/mcpRegistry.js +207 -0
  135. package/src/memory.js +62 -0
  136. package/src/memoryManager.js +124 -0
  137. package/src/modelCatalogue.js +132 -0
  138. package/src/modelIds.js +42 -0
  139. package/src/modelRouter.js +145 -0
  140. package/src/outputStore.js +246 -0
  141. package/src/perception.js +124 -0
  142. package/src/planCache.js +437 -0
  143. package/src/procSignal.js +32 -0
  144. package/src/providers/anthropic.js +408 -0
  145. package/src/providers/base.js +328 -0
  146. package/src/providers/dashscope-byok.js +86 -0
  147. package/src/providers/deepseek.js +80 -0
  148. package/src/providers/factory.js +37 -0
  149. package/src/providers/gemini.js +346 -0
  150. package/src/providers/moonshot.js +73 -0
  151. package/src/providers/muse.js +169 -0
  152. package/src/providers/ollama.js +104 -0
  153. package/src/providers/openai-compatible.js +84 -0
  154. package/src/providers/openai.js +20 -0
  155. package/src/providers/qwen-byok.js +76 -0
  156. package/src/providers/xai.js +73 -0
  157. package/src/provisioning/capabilityConsent.js +24 -0
  158. package/src/provisioning/capabilityProvisioner.js +271 -0
  159. package/src/provisioning/capabilityTools.js +29 -0
  160. package/src/reporting.js +373 -0
  161. package/src/sandbox.js +529 -0
  162. package/src/sessionStore.js +279 -0
  163. package/src/skillsManager.js +288 -0
  164. package/src/slopDetector.js +307 -0
  165. package/src/taskBuffer.js +45 -0
  166. package/src/taskShape.js +241 -0
  167. package/src/textDiff.js +150 -0
  168. package/src/tokenTracker.js +560 -0
  169. package/src/tool-scripts/ax_snapshot.applescript +39 -0
  170. package/src/tool-scripts/ax_snapshot.ps1 +10 -0
  171. package/src/tool-scripts/desktop_act.applescript +58 -0
  172. package/src/tool-scripts/resolve_automator.py +119 -0
  173. package/src/toolPacks.js +524 -0
  174. package/src/tools/archive.js +63 -0
  175. package/src/tools/astryxOracle.js +78 -0
  176. package/src/tools/axSnapshot.js +165 -0
  177. package/src/tools/blenderAutomator.js +349 -0
  178. package/src/tools/browserAutomator.js +252 -0
  179. package/src/tools/checkSystemSpecs.js +64 -0
  180. package/src/tools/clipboard.js +36 -0
  181. package/src/tools/codeSearchAst.js +101 -0
  182. package/src/tools/codeSearcher.js +230 -0
  183. package/src/tools/codeTools.js +262 -0
  184. package/src/tools/codebaseSearch.js +75 -0
  185. package/src/tools/createSkill.js +129 -0
  186. package/src/tools/deferredMcpSearch.js +246 -0
  187. package/src/tools/desktopAct.js +208 -0
  188. package/src/tools/desktopOpen.js +34 -0
  189. package/src/tools/dynamicLoader.js +44 -0
  190. package/src/tools/executeProceduralMedia.js +93 -0
  191. package/src/tools/fsDelete.js +51 -0
  192. package/src/tools/fsEdit.js +105 -0
  193. package/src/tools/fsFind.js +128 -0
  194. package/src/tools/fsList.js +77 -0
  195. package/src/tools/fsMove.js +57 -0
  196. package/src/tools/fsRead.js +87 -0
  197. package/src/tools/fsSearch.js +198 -0
  198. package/src/tools/fsWrite.js +41 -0
  199. package/src/tools/gameAiBehaviorTree.js +208 -0
  200. package/src/tools/gameAnimationRig.js +194 -0
  201. package/src/tools/gameAssetFetcher.js +372 -0
  202. package/src/tools/gameAssetHarvester.js +210 -0
  203. package/src/tools/gameAudioSynth.js +267 -0
  204. package/src/tools/gameBuilder.js +886 -0
  205. package/src/tools/gameCanvasAudit.js +101 -0
  206. package/src/tools/gameCinematicSequencer.js +151 -0
  207. package/src/tools/gameDataForge.js +124 -0
  208. package/src/tools/gameDialogueTreeGen.js +166 -0
  209. package/src/tools/gameEconomyBalancer.js +161 -0
  210. package/src/tools/gameEntitySpawner.js +207 -0
  211. package/src/tools/gameLoreForge.js +153 -0
  212. package/src/tools/gameQuestArcBuilder.js +152 -0
  213. package/src/tools/gameSceneBuilder.js +158 -0
  214. package/src/tools/gameShaderForge.js +181 -0
  215. package/src/tools/gameTilemapGenerator.js +164 -0
  216. package/src/tools/gameUiHudBuilder.js +292 -0
  217. package/src/tools/gameVfxEmitterGen.js +108 -0
  218. package/src/tools/gameWebRuntimeInspector.js +91 -0
  219. package/src/tools/generateMediaViaApi.js +358 -0
  220. package/src/tools/gitExec.js +54 -0
  221. package/src/tools/godotAutomator.js +437 -0
  222. package/src/tools/manageLocalAiDependencies.js +220 -0
  223. package/src/tools/memoryWrite.js +99 -0
  224. package/src/tools/multiEdit.js +107 -0
  225. package/src/tools/palmierAutomator.js +104 -0
  226. package/src/tools/pdfReader.js +112 -0
  227. package/src/tools/persistentShell.js +148 -0
  228. package/src/tools/printer.js +316 -0
  229. package/src/tools/procTerm.js +91 -0
  230. package/src/tools/processList.js +52 -0
  231. package/src/tools/readNativeSkill.js +39 -0
  232. package/src/tools/registry.js +277 -0
  233. package/src/tools/resolveAutomator.js +102 -0
  234. package/src/tools/screenshot.js +75 -0
  235. package/src/tools/subagentOrchestrator.js +305 -0
  236. package/src/tools/sysRun.js +125 -0
  237. package/src/tools/todoWrite.js +75 -0
  238. package/src/tools/toolDispatch.js +127 -0
  239. package/src/tools/toolForge.js +124 -0
  240. package/src/tools/updatePlan.js +88 -0
  241. package/src/tools/viewImage.js +82 -0
  242. package/src/tools/visionInspector.js +154 -0
  243. package/src/tools/webFetch.js +74 -0
  244. package/src/tools/webSearch.js +82 -0
  245. package/src/tui/ask.js +164 -0
  246. package/src/tui/banner.js +158 -0
  247. package/src/tui/block.js +152 -0
  248. package/src/tui/chatRenderer.js +953 -0
  249. package/src/tui/completion.js +424 -0
  250. package/src/tui/dialogs.js +606 -0
  251. package/src/tui/diff.js +296 -0
  252. package/src/tui/history.js +135 -0
  253. package/src/tui/home.js +217 -0
  254. package/src/tui/invocation.js +105 -0
  255. package/src/tui/keys.js +443 -0
  256. package/src/tui/lineEditor.js +256 -0
  257. package/src/tui/overlay.js +256 -0
  258. package/src/tui/prompt.js +1258 -0
  259. package/src/tui/selectList.js +335 -0
  260. package/src/tui/stage.js +330 -0
  261. package/src/tui/stageSurface.js +609 -0
  262. package/src/tui/statusLine.js +254 -0
  263. package/src/tui/text.js +345 -0
  264. package/src/tui/theme.js +393 -0
  265. package/src/tui/toolDisplay.js +176 -0
  266. package/src/tui/transcript.js +235 -0
  267. package/src/tui/viewport.js +337 -0
  268. package/src/uncertainty.js +271 -0
  269. package/src/userSkills.js +265 -0
  270. package/src/utils/cli_ui.js +0 -0
  271. package/src/utils/inquirer.js +12 -0
  272. package/src/utils/paths.js +37 -0
  273. package/src/version.js +38 -0
  274. package/src/vfeTracker.js +220 -0
@@ -0,0 +1,158 @@
1
+ import fs from 'fs/promises';
2
+ import fsSync from 'fs';
3
+ import path from 'path';
4
+
5
+ export const gameSceneBuilder = {
6
+ schema: {
7
+ name: 'game.scene_build',
8
+ description: 'Programmatically constructs, inspects, and modifies Godot `.tscn` (scene trees) and `.tres` (resources). Formats node hierarchies, attaches scripts (`ExtResource`), binds signals, and sets properties without syntax errors.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ action: {
13
+ type: 'string',
14
+ enum: ['create_scene_tree', 'add_node_to_scene', 'inspect_scene', 'bind_signal'],
15
+ description: 'Action: create_scene_tree (build complete .tscn from structure), add_node_to_scene (append node definitions), inspect_scene (parse scene hierarchy), or bind_signal (add connection header).'
16
+ },
17
+ scenePath: {
18
+ type: 'string',
19
+ description: 'Path to `.tscn` file (`res://scenes/actors/Player.tscn` or absolute path).'
20
+ },
21
+ rootNodeType: {
22
+ type: 'string',
23
+ enum: ['Node2D', 'Node3D', 'Control', 'CharacterBody2D', 'CharacterBody3D', 'RigidBody2D', 'CanvasLayer'],
24
+ description: 'Type of root node when creating a scene tree.'
25
+ },
26
+ rootNodeName: {
27
+ type: 'string',
28
+ description: 'Name of the root node (e.g. `Player`, `MainLevel`, `InventoryGrid`).'
29
+ },
30
+ scriptResPath: {
31
+ type: 'string',
32
+ description: 'Path to GDScript resource (`res://scripts/player/player.gd`).'
33
+ },
34
+ childNodes: {
35
+ type: 'array',
36
+ items: {
37
+ type: 'object',
38
+ properties: {
39
+ name: { type: 'string' },
40
+ type: { type: 'string' },
41
+ parent: { type: 'string' },
42
+ properties: { type: 'object' }
43
+ }
44
+ },
45
+ description: 'Child nodes to append.'
46
+ },
47
+ signalConfig: {
48
+ type: 'object',
49
+ properties: {
50
+ signal_name: { type: 'string' },
51
+ from_node: { type: 'string' },
52
+ to_node: { type: 'string' },
53
+ method_name: { type: 'string' }
54
+ },
55
+ description: 'Signal connection configuration.'
56
+ }
57
+ },
58
+ required: ['action', 'scenePath']
59
+ }
60
+ },
61
+
62
+ async execute(args) {
63
+ try {
64
+ const { action, scenePath, rootNodeType = 'Node2D', rootNodeName = 'Root', scriptResPath, childNodes = [], signalConfig } = args;
65
+
66
+ if (action === 'create_scene_tree') {
67
+ let loadSteps = 1;
68
+ let extResources = '';
69
+ let scriptAttr = '';
70
+
71
+ if (scriptResPath) {
72
+ loadSteps = 2;
73
+ extResources = `[ext_resource type="Script" path="${scriptResPath}" id="1_script"]\n\n`;
74
+ scriptAttr = `script = ExtResource("1_script")\n`;
75
+ }
76
+
77
+ let childBlocks = '';
78
+ for (const child of childNodes) {
79
+ const parentAttr = child.parent ? ` parent="${child.parent}"` : ' parent="."';
80
+ let props = '';
81
+ if (child.properties) {
82
+ for (const [k, v] of Object.entries(child.properties)) {
83
+ props += `${k} = ${typeof v === 'string' ? `"${v}"` : v}\n`;
84
+ }
85
+ }
86
+ childBlocks += `\n[node name="${child.name}" type="${child.type || 'Node'}"${parentAttr}]\n${props}`;
87
+ }
88
+
89
+ const content = `[gd_scene load_steps=${loadSteps} format=3]\n\n${extResources}[node name="${rootNodeName}" type="${rootNodeType}"]\n${scriptAttr}${childBlocks}`;
90
+
91
+ if (scenePath) {
92
+ await fs.mkdir(path.dirname(scenePath), { recursive: true });
93
+ await fs.writeFile(scenePath, content, 'utf8');
94
+ }
95
+
96
+ return {
97
+ success: true,
98
+ output: JSON.stringify({
99
+ status: 'CREATED_SCENE_TREE',
100
+ scene_path: scenePath,
101
+ root_node: rootNodeName,
102
+ root_type: rootNodeType,
103
+ child_count: childNodes.length,
104
+ content_snippet: content.slice(0, 1000)
105
+ }, null, 2)
106
+ };
107
+ }
108
+
109
+ if (action === 'inspect_scene') {
110
+ if (!fsSync.existsSync(scenePath)) {
111
+ return { success: false, error: `Scene file not found: ${scenePath}` };
112
+ }
113
+ const raw = await fs.readFile(scenePath, 'utf8');
114
+ const nodeMatches = [...raw.matchAll(/\[node name="([^"]+)" type="([^"]+)"(?: parent="([^"]+)")?\]/g)];
115
+ const nodes = nodeMatches.map(m => ({
116
+ name: m[1],
117
+ type: m[2],
118
+ parent: m[3] || 'Root'
119
+ }));
120
+
121
+ return {
122
+ success: true,
123
+ output: JSON.stringify({
124
+ status: 'INSPECTED_SCENE',
125
+ scene_path: scenePath,
126
+ total_nodes: nodes.length,
127
+ node_hierarchy: nodes
128
+ }, null, 2)
129
+ };
130
+ }
131
+
132
+ if (action === 'bind_signal') {
133
+ if (!signalConfig || !signalConfig.signal_name) {
134
+ return { success: false, error: 'signalConfig with signal_name, from_node, to_node, and method_name is required.' };
135
+ }
136
+ const connHeader = `\n[connection signal="${signalConfig.signal_name}" from="${signalConfig.from_node}" to="${signalConfig.to_node}" method="${signalConfig.method_name}"]\n`;
137
+
138
+ if (fsSync.existsSync(scenePath)) {
139
+ await fs.appendFile(scenePath, connHeader, 'utf8');
140
+ }
141
+
142
+ return {
143
+ success: true,
144
+ output: JSON.stringify({
145
+ status: 'BOUND_SIGNAL',
146
+ scene_path: scenePath,
147
+ connection: signalConfig,
148
+ snippet: connHeader.trim()
149
+ }, null, 2)
150
+ };
151
+ }
152
+
153
+ return { success: false, error: `Unknown action: ${action}` };
154
+ } catch (e) {
155
+ return { success: false, error: e.message };
156
+ }
157
+ }
158
+ };
@@ -0,0 +1,181 @@
1
+ import fs from 'fs/promises';
2
+ import fsSync from 'fs';
3
+ import path from 'path';
4
+
5
+ export const gameShaderForge = {
6
+ schema: {
7
+ name: 'game.shader_forge',
8
+ description: 'Generates custom visual shaders (`.gdshader`) for Godot 4.x canvas items (2D) and spatial meshes (3D). Includes presets for water ripple, hit damage flash, holographic cyberpunk distortion, magical dissolve/teleport, and high-speed highway blur.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ action: {
13
+ type: 'string',
14
+ enum: ['generate_shader', 'list_presets', 'save_shader'],
15
+ description: 'Action: generate_shader (create gdshader code snippet), list_presets (show available visual shaders), or save_shader (write `.gdshader` file).'
16
+ },
17
+ preset: {
18
+ type: 'string',
19
+ enum: ['water_ripple_2d', 'hit_flash_2d', 'hologram_3d', 'dissolve_burn_3d', 'speed_blur_canvas'],
20
+ description: 'Visual shader preset to generate.'
21
+ },
22
+ shaderType: {
23
+ type: 'string',
24
+ enum: ['canvas_item', 'spatial'],
25
+ description: 'Godot shader type header (`canvas_item` for 2D/UI, `spatial` for 3D meshes).'
26
+ },
27
+ customParameters: {
28
+ type: 'object',
29
+ properties: {
30
+ speed: { type: 'number' },
31
+ strength: { type: 'number' },
32
+ colorHex: { type: 'string' }
33
+ },
34
+ description: 'Uniform tweaks (speed, strength, primary color).'
35
+ },
36
+ outputPath: {
37
+ type: 'string',
38
+ description: 'Absolute or `res://` path to save `.gdshader` file (`res://shaders/hit_flash.gdshader`).'
39
+ }
40
+ },
41
+ required: ['action']
42
+ }
43
+ },
44
+
45
+ async execute(args) {
46
+ try {
47
+ const { action, preset = 'hit_flash_2d', shaderType = 'canvas_item', customParameters = {}, outputPath } = args;
48
+
49
+ if (action === 'list_presets') {
50
+ return {
51
+ success: true,
52
+ output: JSON.stringify({
53
+ status: 'SHADER_PRESETS',
54
+ presets: [
55
+ { name: 'water_ripple_2d', type: 'canvas_item', desc: 'Dynamic wave distortion and reflective shimmer for rivers and lakes.' },
56
+ { name: 'hit_flash_2d', type: 'canvas_item', desc: 'Instant solid white/red color override when character takes damage.' },
57
+ { name: 'hologram_3d', type: 'spatial', desc: 'Cyberpunk scanline transparency with chromatic aberration and glow.' },
58
+ { name: 'dissolve_burn_3d', type: 'spatial', desc: 'Noise-driven disintegration with glowing ember edges for teleportation or death.' },
59
+ { name: 'speed_blur_canvas', type: 'canvas_item', desc: 'Radial speed distortion lines for cyberpunk highway racers.' }
60
+ ]
61
+ }, null, 2)
62
+ };
63
+ }
64
+
65
+ if (action === 'generate_shader' || action === 'save_shader') {
66
+ let code = '';
67
+ const speed = customParameters.speed || 1.0;
68
+ const strength = customParameters.strength || 0.5;
69
+ const color = customParameters.colorHex || '#ffffff';
70
+
71
+ if (preset === 'hit_flash_2d') {
72
+ code = `shader_type canvas_item;
73
+
74
+ // Sovereign Hit Damage Flash Shader
75
+ uniform bool flash_active = false;
76
+ uniform vec4 flash_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);
77
+
78
+ void fragment() {
79
+ \tvec4 tex_color = texture(TEXTURE, UV);
80
+ \tif (flash_active && tex_color.a > 0.0) {
81
+ \t\tCOLOR = mix(tex_color, flash_color, ${strength.toFixed(2)});
82
+ \t} else {
83
+ \t\tCOLOR = tex_color;
84
+ \t}
85
+ }
86
+ `;
87
+ } else if (preset === 'water_ripple_2d') {
88
+ code = `shader_type canvas_item;
89
+
90
+ // Sovereign Water Ripple & Shimmer Shader
91
+ uniform float wave_speed = ${speed.toFixed(2)};
92
+ uniform float wave_frequency = 15.0;
93
+ uniform float wave_amplitude = 0.015;
94
+
95
+ void fragment() {
96
+ \tvec2 uv = UV;
97
+ \tuv.y += sin(uv.x * wave_frequency + TIME * wave_speed) * wave_amplitude;
98
+ \tuv.x += cos(uv.y * wave_frequency + TIME * wave_speed) * wave_amplitude;
99
+ \tCOLOR = texture(TEXTURE, uv);
100
+ }
101
+ `;
102
+ } else if (preset === 'hologram_3d') {
103
+ code = `shader_type spatial;
104
+ render_mode blend_add, unshaded, cull_disabled;
105
+
106
+ // Sovereign Cyberpunk Hologram Shader
107
+ uniform vec4 holo_color : source_color = vec4(0.0, 0.8, 1.0, 0.7);
108
+ uniform float scanline_speed = ${speed.toFixed(2)} * 3.0;
109
+ uniform float scanline_frequency = 50.0;
110
+
111
+ void fragment() {
112
+ \tfloat scanline = sin(UV.y * scanline_frequency + TIME * scanline_speed) * 0.5 + 0.5;
113
+ \tfloat alpha = holo_color.a * (0.4 + 0.6 * scanline);
114
+ \tALBEDO = holo_color.rgb;
115
+ \tALPHA = alpha;
116
+ }
117
+ `;
118
+ } else if (preset === 'dissolve_burn_3d') {
119
+ code = `shader_type spatial;
120
+ render_mode depth_draw_opaque;
121
+
122
+ // Sovereign Magical Dissolve & Ember Burn Shader
123
+ uniform float progress : hint_range(0.0, 1.0) = 0.0;
124
+ uniform vec4 burn_color : source_color = vec4(1.0, 0.3, 0.0, 1.0);
125
+ uniform float burn_width = 0.05;
126
+ uniform sampler2D noise_texture;
127
+
128
+ void fragment() {
129
+ \tfloat noise_val = texture(noise_texture, UV * 3.0).r;
130
+ \tif (noise_val < progress) {
131
+ \t\tdiscard;
132
+ \t}
133
+ \tif (noise_val < progress + burn_width) {
134
+ \t\tALBEDO = burn_color.rgb * 3.0;
135
+ \t\tEMISSION = burn_color.rgb * 5.0;
136
+ \t}
137
+ }
138
+ `;
139
+ } else {
140
+ // speed_blur_canvas
141
+ code = `shader_type canvas_item;
142
+
143
+ // Sovereign Cyberpunk Highway Speed Blur
144
+ uniform float blur_strength = ${strength.toFixed(2)};
145
+ uniform vec2 blur_center = vec2(0.5, 0.5);
146
+
147
+ void fragment() {
148
+ \tvec2 dir = UV - blur_center;
149
+ \tvec4 sum = vec4(0.0);
150
+ \tfor (int i = 0; i < 8; i++) {
151
+ \t\tsum += texture(TEXTURE, UV - dir * blur_strength * float(i) * 0.01);
152
+ \t}
153
+ \tCOLOR = sum / 8.0;
154
+ }
155
+ `;
156
+ }
157
+
158
+ if (outputPath || action === 'save_shader') {
159
+ const finalPath = outputPath || path.join(process.cwd(), '.tmp_causyne_3d', `shader_${preset}.gdshader`);
160
+ await fs.mkdir(path.dirname(finalPath), { recursive: true });
161
+ await fs.writeFile(finalPath, code, 'utf8');
162
+ }
163
+
164
+ return {
165
+ success: true,
166
+ output: JSON.stringify({
167
+ status: 'GENERATED_GDSHADER',
168
+ preset: preset,
169
+ shader_type: shaderType,
170
+ output_file: outputPath || 'Returned in payload',
171
+ code_snippet: code.slice(0, 800)
172
+ }, null, 2)
173
+ };
174
+ }
175
+
176
+ return { success: false, error: `Unknown action: ${action}` };
177
+ } catch (e) {
178
+ return { success: false, error: e.message };
179
+ }
180
+ }
181
+ };
@@ -0,0 +1,164 @@
1
+ import fs from 'fs/promises';
2
+ import fsSync from 'fs';
3
+ import path from 'path';
4
+
5
+ export const gameTilemapGenerator = {
6
+ schema: {
7
+ name: 'game.tilemap_gen',
8
+ description: 'Procedurally generates multi-biome world maps, dungeon rooms, and highway road networks for Godot 4.x (`TileMapLayer` for 2D, `GridMap` / `CSGPolygon3D` for 3D Cyberpunk Racers). Can export `.tscn` scenes and level collision layout maps.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ action: {
13
+ type: 'string',
14
+ enum: ['generate_level', 'generate_highway_track', 'save_tilemap_scene'],
15
+ description: 'Action: generate_level (2D dungeon or village grid layout), generate_highway_track (3D cyberpunk racing road segment network), or save_tilemap_scene (write `.tscn`).'
16
+ },
17
+ levelName: {
18
+ type: 'string',
19
+ description: 'Name of the level (`Level_1_WhisperingVillage`, `Cyberpunk_Highway_SectionA`).'
20
+ },
21
+ mapDimension: {
22
+ type: 'string',
23
+ enum: ['2d', '3d'],
24
+ description: 'Dimension (`2d` or `3d`).'
25
+ },
26
+ width: { type: 'number', description: 'Width of the grid/track in tiles (default 32).' },
27
+ height: { type: 'number', description: 'Height of the grid/track in tiles (default 32).' },
28
+ biome: {
29
+ type: 'string',
30
+ enum: ['whispering_village', 'forgotten_catacombs', 'cyberpunk_highway', 'shadow_sanctuary'],
31
+ description: 'Biome rule set for procedural generation.'
32
+ },
33
+ outputPath: {
34
+ type: 'string',
35
+ description: 'Absolute or `res://` path to save `.tscn` file (`res://scenes/levels/Level1.tscn`).'
36
+ }
37
+ },
38
+ required: ['action', 'levelName']
39
+ }
40
+ },
41
+
42
+ async execute(args) {
43
+ try {
44
+ const { action, levelName, mapDimension = '2d', width = 32, height = 32, biome = 'whispering_village', outputPath } = args;
45
+
46
+ if (action === 'generate_level' || action === 'save_tilemap_scene') {
47
+ if (mapDimension === '2d') {
48
+ // Generate 2D TileMapLayer with boundary walls and internal room layout
49
+ const tiles = [];
50
+ for (let y = 0; y < height; y++) {
51
+ for (let x = 0; x < width; x++) {
52
+ if (x === 0 || x === width - 1 || y === 0 || y === height - 1) {
53
+ tiles.push(`Vector2i(${x}, ${y}): 1`); // Wall tile
54
+ } else if (Math.random() < 0.15) {
55
+ tiles.push(`Vector2i(${x}, ${y}): 2`); // Obstacle/tree tile
56
+ } else {
57
+ tiles.push(`Vector2i(${x}, ${y}): 0`); // Floor tile
58
+ }
59
+ }
60
+ }
61
+
62
+ const tscnContent = `[gd_scene format=3]
63
+
64
+ [node name="${levelName}" type="Node2D"]
65
+
66
+ [node name="TileMapLayer" type="TileMapLayer" parent="."]
67
+ tile_set = null
68
+ # Procedural 2D Grid (${width}x${height}) for ${biome}
69
+ `;
70
+ if (outputPath || action === 'save_tilemap_scene') {
71
+ const finalPath = outputPath || path.join(process.cwd(), '.tmp_causyne_3d', `${levelName}.tscn`);
72
+ await fs.mkdir(path.dirname(finalPath), { recursive: true });
73
+ await fs.writeFile(finalPath, tscnContent, 'utf8');
74
+ }
75
+
76
+ return {
77
+ success: true,
78
+ output: JSON.stringify({
79
+ status: 'GENERATED_2D_LEVEL',
80
+ level_name: levelName,
81
+ biome: biome,
82
+ grid_size: `${width}x${height}`,
83
+ tiles_generated: width * height,
84
+ output_file: outputPath || 'Returned in payload',
85
+ snippet: tscnContent.slice(0, 800)
86
+ }, null, 2)
87
+ };
88
+ } else {
89
+ // 3D Level or Highway track
90
+ const tscn3d = `[gd_scene format=3]
91
+
92
+ [node name="${levelName}" type="Node3D"]
93
+
94
+ [node name="GridMap" type="GridMap" parent="."]
95
+ cell_size = Vector3(2, 2, 2)
96
+
97
+ [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
98
+ transform = Transform3D(0.866, -0.433, 0.25, 0, 0.5, 0.866, -0.5, -0.75, 0.433, 0, 20, 0)
99
+ shadow_enabled = true
100
+ `;
101
+ if (outputPath || action === 'save_tilemap_scene') {
102
+ const finalPath = outputPath || path.join(process.cwd(), '.tmp_causyne_3d', `${levelName}.tscn`);
103
+ await fs.mkdir(path.dirname(finalPath), { recursive: true });
104
+ await fs.writeFile(finalPath, tscn3d, 'utf8');
105
+ }
106
+
107
+ return {
108
+ success: true,
109
+ output: JSON.stringify({
110
+ status: 'GENERATED_3D_LEVEL',
111
+ level_name: levelName,
112
+ biome: biome,
113
+ output_file: outputPath || 'Returned in payload',
114
+ snippet: tscn3d.slice(0, 800)
115
+ }, null, 2)
116
+ };
117
+ }
118
+ }
119
+
120
+ if (action === 'generate_highway_track') {
121
+ const trackContent = `[gd_scene format=3]
122
+
123
+ [node name="${levelName}" type="Node3D"]
124
+
125
+ [node name="HighwayRoad" type="CSGBox3D" parent="."]
126
+ use_collision = true
127
+ size = Vector3(16, 0.5, 200)
128
+
129
+ [node name="BarrierLeft" type="CSGBox3D" parent="HighwayRoad"]
130
+ use_collision = true
131
+ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 1, 0)
132
+ size = Vector3(0.8, 2, 200)
133
+
134
+ [node name="BarrierRight" type="CSGBox3D" parent="HighwayRoad"]
135
+ use_collision = true
136
+ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 1, 0)
137
+ size = Vector3(0.8, 2, 200)
138
+
139
+ [node name="NeonLights" type="Node3D" parent="."]
140
+ `;
141
+ if (outputPath) {
142
+ await fs.mkdir(path.dirname(outputPath), { recursive: true });
143
+ await fs.writeFile(outputPath, trackContent, 'utf8');
144
+ }
145
+
146
+ return {
147
+ success: true,
148
+ output: JSON.stringify({
149
+ status: 'GENERATED_HIGHWAY_TRACK',
150
+ level_name: levelName,
151
+ road_length: 200,
152
+ road_width: 16,
153
+ output_file: outputPath || 'Returned in payload',
154
+ snippet: trackContent.slice(0, 800)
155
+ }, null, 2)
156
+ };
157
+ }
158
+
159
+ return { success: false, error: `Unknown action: ${action}` };
160
+ } catch (e) {
161
+ return { success: false, error: e.message };
162
+ }
163
+ }
164
+ };