@wenathlan/saddle 1.8.17 → 1.8.18

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 (219) hide show
  1. package/README.md +38 -13
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/isolation/contracts.d.ts +118 -0
  7. package/dist/isolation/contracts.d.ts.map +1 -0
  8. package/dist/isolation/contracts.js +84 -0
  9. package/dist/isolation/contracts.js.map +1 -0
  10. package/dist/mcp/server.d.ts +2 -2
  11. package/dist/scrape/robots.js +1 -1
  12. package/docs/artifactavailability.md +6 -0
  13. package/docs/releasenotes-1.8.17.md +6 -0
  14. package/docs/releasenotes-1.8.18.md +32 -0
  15. package/docs/research-1.8.18-isolation.md +43 -0
  16. package/docs/saddle.archive.1.8.17.tar.gz.gpg +0 -0
  17. package/docs/todo-1.8.16.md +56 -1
  18. package/docs/todo-1.8.18.md +152 -0
  19. package/extension/manifest.json +1 -1
  20. package/package.json +3 -2
  21. package/docs/logs/.gitkeep +0 -0
  22. package/docs/plans/00.index.md +0 -50
  23. package/docs/plans/01.architecture.md +0 -86
  24. package/docs/plans/02.research.computer.use.md +0 -58
  25. package/docs/plans/03.research.captcha.bypass.md +0 -68
  26. package/docs/plans/04.research.sandbox.ai.md +0 -52
  27. package/docs/plans/05.capture.platform.md +0 -57
  28. package/docs/plans/06.dependencies.md +0 -97
  29. package/docs/plans/07.captcha.test.page.md +0 -41
  30. package/docs/plans/08.production.infra.md +0 -70
  31. package/docs/plans/09.database.schema.md +0 -121
  32. package/docs/plans/10.cloudinary.storage.md +0 -57
  33. package/docs/plans/11.movement.logs.json.md +0 -72
  34. package/docs/plans/12.research.atlas.agent.browser.md +0 -79
  35. package/docs/plans/13.research.anti.detection.md +0 -898
  36. package/docs/plans/14.research.proxy.md +0 -1495
  37. package/docs/plans/15.research.retry.rate.limit.md +0 -1958
  38. package/docs/plans/16.research.crawling.md +0 -1417
  39. package/docs/plans/17.research.caching.md +0 -1610
  40. package/docs/plans/18.research.content.extraction.md +0 -1952
  41. package/docs/plans/19.research.errors.events.md +0 -1523
  42. package/docs/plans/20.research.zod.validation.md +0 -1350
  43. package/docs/plans/21.research.batch.concurrency.md +0 -1888
  44. package/docs/plans/22.research.universal.runtime.md +0 -944
  45. package/docs/plans/23.research.ai.integration.md +0 -1465
  46. package/docs/plans/24.research.memory.persistence.md +0 -1979
  47. package/docs/plans/25.research.server.api.md +0 -342
  48. package/docs/plans/26.research.compilation.md +0 -249
  49. package/docs/plans/27.research.html.parsing.md +0 -251
  50. package/docs/plans/28.action.plan.md +0 -50
  51. package/docs/plans/29.api.reference.md +0 -174
  52. package/docs/plans/30.architecture.plan.md +0 -94
  53. package/docs/plans/31.auditoria.dados.md +0 -163
  54. package/docs/plans/32.bots.automacao.computacional.md +0 -214
  55. package/docs/plans/33.bots.codigo.revisao.md +0 -220
  56. package/docs/plans/34.bots.seguranca.cicd.md +0 -366
  57. package/docs/plans/35.comparativo.concorrencia.md +0 -464
  58. package/docs/plans/36.computational.memory.md +0 -340
  59. package/docs/plans/37.deploystrategy.md +0 -394
  60. package/docs/plans/38.flow.md +0 -155
  61. package/docs/plans/39.multi.platform.bot.md +0 -252
  62. package/docs/plans/40.npm.publish.md +0 -250
  63. package/docs/plans/41.o.que.falta.md +0 -407
  64. package/docs/plans/42.pesquisa.concorrencia.md +0 -721
  65. package/docs/plans/43.plan.universal.architecture.md +0 -496
  66. package/docs/plans/44.reference.md +0 -100
  67. package/docs/plans/45.robotarchitecture.md +0 -237
  68. package/docs/plans/46.scdnintegration.md +0 -284
  69. package/docs/plans/47.multiforge.readme.md +0 -129
  70. package/docs/plans/48.theory.v4.repo.os.md +0 -152
  71. package/docs/plans/49.third.party.infra.md +0 -12
  72. package/docs/plans/50.file.as.compute.md +0 -39
  73. package/docs/plans/51.architecture.virtual.processor.md +0 -80
  74. package/docs/plans/52.manifesto.v8.md +0 -11
  75. package/docs/plans/58.cdn.list.md +0 -23
  76. package/docs/plans/59.sql.frameworks.md +0 -33
  77. package/docs/plans/60.sql.thirdparty.md +0 -26
  78. package/docs/plans/61.objective.multiforge.md +0 -63
  79. package/docs/plans/62.huggingface.upload.md +0 -26
  80. package/docs/plans/63.kaggle.upload.md +0 -24
  81. package/docs/plans/64.npm.storage.md +0 -30
  82. package/docs/plans/65.rclone.terabox.md +0 -32
  83. package/docs/plans/66.buckets.and.models.todo.md +0 -14
  84. package/docs/plans/67.database.todo.md +0 -13
  85. package/docs/plans/68.deploy.packages.todo.md +0 -12
  86. package/docs/plans/69.report.human.operator.md +0 -133
  87. package/docs/plans/70.report.brain2qwerty.ems.md +0 -135
  88. package/docs/plans/71.report.hd.infinito.vram.md +0 -155
  89. package/docs/plans/72.plan.hd.infinito.node.md +0 -146
  90. package/docs/plans/73.plan.scifi.repos.md +0 -125
  91. package/docs/plans/74.000.manifesto.v8.flat.2..md +0 -11
  92. package/docs/plans/README.md +0 -489
  93. package/docs/plans/aggregate_platforms.mjs +0 -146
  94. package/docs/plans/examplesession.json +0 -36
  95. package/docs/plans/missing-facts.md +0 -192
  96. package/docs/plans/models.md +0 -64
  97. package/docs/plans/organize.cjs +0 -270
  98. package/docs/plans/platforms.md +0 -2887
  99. package/docs/plans/sites.md +0 -31322
  100. package/docs/sources/farm.py +0 -117
  101. package/docs/sources/html/saddle1.html +0 -132
  102. package/docs/sources/html/saddle2.html +0 -157
  103. package/docs/sources/html/saddle3.html +0 -119
  104. package/docs/sources/html/saddle4.html +0 -144
  105. package/docs/sources/html/saddle5.html +0 -72
  106. package/docs/sources/html/saddle6.html +0 -171
  107. package/docs/sources/html/saddle7.html +0 -236
  108. package/docs/sources/saddle.ts +0 -74
  109. package/docs/sources/schema.prisma +0 -88
  110. package/docs/sources/script.sh +0 -64
  111. package/docs/sources/workflows.yml +0 -458
  112. package/docs/talks1/_body.txt +0 -14
  113. package/docs/talks1/_index.md +0 -15
  114. package/docs/talks1/_screenshot.png +0 -0
  115. package/docs/talks1/assistant-01.md +0 -5
  116. package/docs/talks1/assistant-02.md +0 -5
  117. package/docs/talks1/assistant-03.md +0 -531
  118. package/docs/talks1/assistant-04.md +0 -26
  119. package/docs/talks1/assistant-05.md +0 -774
  120. package/docs/talks1/assistant-06.md +0 -1718
  121. package/docs/talks1/scrape-share.cjs +0 -185
  122. package/docs/talks1/scrape-share.ts +0 -183
  123. package/docs/talks1/user-01.md +0 -3
  124. package/docs/talks1/user-02.md +0 -3
  125. package/docs/talks1/user-03.md +0 -88
  126. package/docs/talks1/user-04.md +0 -3
  127. package/docs/talks1/user-05.md +0 -3
  128. package/docs/talks1/user-06.md +0 -88
  129. package/docs/talks1/user-07.md +0 -88
  130. package/docs/talks2/_body.txt +0 -14
  131. package/docs/talks2/_index.md +0 -16
  132. package/docs/talks2/_screenshot.png +0 -0
  133. package/docs/talks2/assistant-01.md +0 -5
  134. package/docs/talks2/assistant-02.md +0 -5
  135. package/docs/talks2/assistant-03.md +0 -424
  136. package/docs/talks2/assistant-04.md +0 -598
  137. package/docs/talks2/assistant-05.md +0 -1280
  138. package/docs/talks2/assistant-06.md +0 -1227
  139. package/docs/talks2/assistant-07.md +0 -1252
  140. package/docs/talks2/user-01.md +0 -3
  141. package/docs/talks2/user-02.md +0 -3
  142. package/docs/talks2/user-03.md +0 -88
  143. package/docs/talks2/user-04.md +0 -88
  144. package/docs/talks2/user-05.md +0 -88
  145. package/docs/talks2/user-06.md +0 -88
  146. package/docs/talks2/user-07.md +0 -3
  147. package/docs/talks3/_body.txt +0 -467
  148. package/docs/talks3/_index.md +0 -10
  149. package/docs/talks3/_screenshot.png +0 -0
  150. package/docs/talks3/assistant-01.md +0 -417
  151. package/docs/talks3/assistant-02.md +0 -417
  152. package/docs/talks3/assistant-03.md +0 -29
  153. package/docs/talks3/assistant-04.md +0 -727
  154. package/docs/talks3/user-01.md +0 -88
  155. package/docs/talks3/user-02.md +0 -88
  156. package/docs/talks3/user-03.md +0 -3
  157. package/docs/talks3/user-04.md +0 -3
  158. package/docs/talks4/_body.txt +0 -14
  159. package/docs/talks4/_index.md +0 -12
  160. package/docs/talks4/_screenshot.png +0 -0
  161. package/docs/talks4/assistant-01.md +0 -5
  162. package/docs/talks4/assistant-02.md +0 -5
  163. package/docs/talks4/assistant-03.md +0 -35
  164. package/docs/talks4/assistant-04.md +0 -512
  165. package/docs/talks4/assistant-05.md +0 -599
  166. package/docs/talks4/user-01.md +0 -3
  167. package/docs/talks4/user-02.md +0 -3
  168. package/docs/talks4/user-03.md +0 -88
  169. package/docs/talks4/user-04.md +0 -88
  170. package/docs/talks4/user-05.md +0 -7
  171. package/docs/talks5/_body.txt +0 -14
  172. package/docs/talks5/_index.md +0 -13
  173. package/docs/talks5/_screenshot.png +0 -0
  174. package/docs/talks5/assistant-01.md +0 -5
  175. package/docs/talks5/assistant-02.md +0 -5
  176. package/docs/talks5/assistant-03.md +0 -690
  177. package/docs/talks5/assistant-04.md +0 -758
  178. package/docs/talks5/assistant-05.md +0 -974
  179. package/docs/talks5/user-01.md +0 -3
  180. package/docs/talks5/user-02.md +0 -3
  181. package/docs/talks5/user-03.md +0 -105
  182. package/docs/talks5/user-04.md +0 -105
  183. package/docs/talks5/user-05.md +0 -63
  184. package/docs/talks5/user-06.md +0 -105
  185. package/docs/talks6/_body.txt +0 -14
  186. package/docs/talks6/_index.md +0 -9
  187. package/docs/talks6/_screenshot.png +0 -0
  188. package/docs/talks6/assistant-01.md +0 -5
  189. package/docs/talks6/assistant-02.md +0 -5
  190. package/docs/talks6/assistant-03.md +0 -1499
  191. package/docs/talks6/user-01.md +0 -3
  192. package/docs/talks6/user-02.md +0 -3
  193. package/docs/talks6/user-03.md +0 -88
  194. package/docs/talks6/user-04.md +0 -88
  195. package/docs/talks7/_body.txt +0 -14
  196. package/docs/talks7/_index.md +0 -10
  197. package/docs/talks7/_screenshot.png +0 -0
  198. package/docs/talks7/assistant-01.md +0 -5
  199. package/docs/talks7/assistant-02.md +0 -5
  200. package/docs/talks7/assistant-03.md +0 -523
  201. package/docs/talks7/assistant-04.md +0 -617
  202. package/docs/talks7/user-01.md +0 -3
  203. package/docs/talks7/user-02.md +0 -3
  204. package/docs/talks7/user-03.md +0 -105
  205. package/docs/talks7/user-04.md +0 -67
  206. package/docs/talks8/conversa1.txt +0 -1322
  207. package/docs/talks8/conversa2.txt +0 -237
  208. package/docs/talks9/Beyond the Obvious_ 50 Plataformas Auto-Hospedadas de Forja de C/303/263digo para Al/303/251m de Gitea e GitLab.md" +0 -174
  209. package/docs/talks9/De NPM a Multi-Linguagem_ Uma Arquitetura T/303/251cnica para a Execu/303/247/303/243o Integrada de C/303/263digo no Ecossistema Node.js.md" +0 -59
  210. package/docs/talks9/De NPM a VMs Virtuais_ Uma An/303/241lise Arquitet/303/264nica para a Realiza/303/247/303/243o do Ciclo de Vida do Projeto SADDLE.md" +0 -91
  211. package/docs/talks9/Mapeamento da Engrenagem Computacional_ Uma Arquitetura para Execu/303/247/303/243o Isolada e Persist/303/252ncia em Ambientes Distribu/303/255dos.md" +0 -116
  212. package/docs/talks9/O Cen/303/241rio Pr/303/241tico do SADDLE_ Uma An/303/241lise de Viabilidade e Modelo de Ciclo de Vida Integrado.md" +0 -128
  213. package/docs/talks9/README (2).md +0 -489
  214. package/docs/talks9/README.md +0 -198
  215. package/docs/talks9/Viabilidade do Saddle_ Uma An/303/241lise T/303/251cnica da Transforma/303/247/303/243o de Armazenamento Remoto em Mem/303/263ria Computacional.md" +0 -80
  216. package/docs/talks9/conversa.txt +0 -544
  217. package/docs/talks9/other (2).md +0 -39
  218. package/docs/talks9/other.md +0 -57
  219. package/docs/talks9/outro.txt +0 -24
@@ -1,417 +0,0 @@
1
- # assistant
2
-
3
- [Thinking] The user is asking a very complex and broad question about building a platform with container sandboxes using free infrastructure from various Git hosting services (GitHub, GitLab, Forgejo, Gitea, Codeberg), package registries (npm, PyPI), AI platforms (Hugging Face, Kaggle, ModelScope), and ORM libraries (Drizzle, Prisma, MySQL2). They want to understand:
4
-
5
- How to use free infrastructure from these platforms2. How to set up pipelines, cron jobs, and sandboxes
6
- How to convert storage into RAM-like memory
7
- How to build their own libraries vs use third-party ones
8
- Memory virtualization concepts6. I need to search for relevant open source projects and resources that address these questions, then develop a comprehensive implementation plan for this build phase.
9
-
10
- [Thinking] Now let me search for more specific topics related to what the user is asking about - storage-to-RAM conversion, open source projects for this, and the specific platforms mentioned.
11
-
12
- [Thinking] Now I have enough information to provide a comprehensive implementation plan. Let me synthesize all this research into a clear, actionable plan for the user.
13
- The user wants to:
14
-
15
- Build a sandbox platform similar to z.ai
16
- Use free infrastructure from repos (GitHub, GitLab, Forgejo, Gitea, Codeberg)
17
- Use pipelines, cron jobs
18
- Convert storage to RAM memory
19
- Use WASM runtimes
20
- Use open source libraries and tools
21
- Use npm packages, CDN delivery
22
-
23
- Let me create a comprehensive implementation plan.
24
-
25
- Vou pesquisar sobre projetos, bibliotecas e infraestrutura que podem ajudar nessa implementação.
26
-
27
- Baseado na pesquisa, aqui está a implementação completa do seu projeto:
28
-
29
- Plataforma de Sandbox com Infraestrutura Gratuita
30
- 1. Arquitetura Geral
31
- ┌─────────────────────────────────────────────────────┐
32
- │ SEU PROJETO │
33
- │ (Node.js/TypeScript + WASM) │
34
- ├─────────────────────────────────────────────────────┤
35
- │ │
36
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
37
- │ │ GitHub │ │ GitLab │ │ Forgejo │ │
38
- │ │ Actions │ │ CI/CD │ │ Runner │ │
39
- │ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
40
- │ │ │ │ │
41
- │ ▼ ▼ ▼ │
42
- │ ┌─────────────────────────────────────────┐ │
43
- │ │ MEMORY BRIDGE (zRAM/tmpfs/WASM) │ │
44
- │ │ Storage → Compressed RAM → Virtual FS │ │
45
- │ └─────────────────────────────────────────┘ │
46
- │ │ │ │ │
47
- │ ▼ ▼ ▼ │
48
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
49
- │ │ Hugging │ │ Kaggle │ │ ModelS- │ │
50
- │ │ Face │ │ Notebooks│ │ cope │ │
51
- │ └──────────┘ └──────────┘ └──────────┘ │
52
- │ │
53
- │ ┌─────────────────────────────────────────┐ │
54
- │ │ SANDBOX RUNTIME (WASM/Docker) │ │
55
- │ │ gVisor / Firecracker / WebAssembly │ │
56
- │ └─────────────────────────────────────────┘ │
57
- └─────────────────────────────────────────────────────┘
58
- 2. Conversão Storage → RAM (Memory Bridge)
59
- Projetos open source para usar:
60
-
61
-
62
-
63
- Projeto
64
- URL
65
- O que faz
66
-
67
-
68
-
69
- memfs
70
- npm i memfs
71
- Filesystem in-memory compatível com Node.js fs
72
-
73
-
74
- mmap-io
75
- npm i @riaskov/mmap-io
76
- Memory-mapped files (arquivo → RAM)
77
-
78
-
79
- random-access-memory
80
- npm i random-access-memory
81
- Armazenamento random-access em RAM
82
-
83
-
84
- zRAM
85
- Kernel Linux
86
- Comprime dados em RAM (até 3x mais memória)
87
-
88
-
89
- tmpfs
90
- Kernel Linux
91
- Filesystem virtual em memória
92
-
93
-
94
- Script de setup - Memory Bridge:
95
- #!/bin/bash
96
- # setup-memory-bridge.sh
97
-
98
- # 1. Criar zRAM (comprime RAM)
99
- modprobe zram
100
- zramctl /dev/zram0 --algorithm zstd --size "$(($(grep -Po 'MemTotal:\s*\K\d+' /proc/meminfo)/2))KiB"
101
- mkswap /dev/zram0
102
- swapon --priority 100 /dev/zram0
103
-
104
- # 2. Criar tmpfs para workspace
105
- mkdir -p /mnt/sandbox-ram
106
- mount -t tmpfs -o size=4G,mode=1777 tmpfs /mnt/sandbox-ram
107
-
108
- # 3. Criar loop device de um arquivo (armazenamento → bloco → RAM)
109
- dd if=/dev/zero of=/tmp/ram-disk.img bs=1M count=4096
110
- mkfs.ext4 /tmp/ram-disk.img
111
- mkdir -p /mnt/ram-disk
112
- mount -o loop /tmp/ram-disk.img /mnt/ram-disk
113
- 3. Bibliotecas Node.js Principais
114
- {
115
- "dependencies": {
116
- "memfs": "^4.0.0",
117
- "@riaskov/mmap-io": "^1.7.0",
118
- "random-access-memory": "^6.2.1",
119
- "dockerode": "^3.3.0",
120
- "ws": "^8.16.0",
121
- "express": "^4.18.0",
122
- "drizzle-orm": "^0.28.0",
123
- "@prisma/client": "^5.0.0",
124
- "mysql2": "^3.6.0"
125
- }
126
- }
127
- 4. Runner de Sandbox (usando GitHub Actions grátis)
128
- .github/workflows/sandbox-runner.yml:
129
- name: Sandbox Runner
130
- on:
131
- workflow_dispatch:
132
- inputs:
133
- sandbox_config:
134
- description: 'Sandbox configuration JSON'
135
- required: true
136
-
137
- jobs:
138
- run-sandbox:
139
- runs-on: ubuntu-latest
140
- container:
141
- image: gvisor-runsc:latest
142
- options: --runtime=runsc
143
-
144
- steps:
145
- - uses: actions/checkout@v4
146
-
147
- - name: Setup Memory Bridge
148
- run: |
149
- sudo modprobe zram
150
- sudo zramctl /dev/zram0 --algorithm zstd --size 4G
151
- sudo mkswap /dev/zram0
152
- sudo swapon /dev/zram0
153
- sudo mount -t tmpfs -o size=4G tmpfs /mnt/sandbox
154
-
155
- - name: Run Sandbox
156
- run: |
157
- docker run --rm \
158
- --runtime=runsc \
159
- --memory=8g \
160
- --cpus=4 \
161
- -v /mnt/sandbox:/workspace \
162
- -e SANDBOX_ID=${{ github.run_id }} \
163
- sandbox-image:latest
164
-
165
- - name: Save State
166
- uses: actions/upload-artifact@v4
167
- with:
168
- name: sandbox-state
169
- path: /mnt/sandbox/
170
- retention-days: 1
171
- 5. Runner para Forgejo/Gitea (Grátis e Self-hosted)
172
- forgejo-runner-config.yml:
173
- # Instalar Forgejo Runner
174
- # wget https://code.forgejo.org/forgejo/forgejo-runner/releases/download/v12.10.2/forgejo-runner-12.10.2-linux-amd64
175
-
176
- runners:
177
- - name: sandbox-runner
178
- type: docker
179
- labels:
180
- - "sandbox:docker://node:20-bookworm"
181
- - "linux:docker://ubuntu:22.04"
182
- config:
183
- container:
184
- image: node:20-bookworm
185
- options: |
186
- --memory=8g
187
- --cpus=4
188
- --runtime=runsc
189
- volumes:
190
- - /mnt/sandbox-ram:/workspace
191
- .forgejo/workflows/sandbox.yml:
192
- name: Sandbox Pipeline
193
- on: [push, workflow_dispatch]
194
-
195
- jobs:
196
- sandbox:
197
- runs-on: [self-hosted, sandbox]
198
- container:
199
- image: node:20-bookworm
200
-
201
- steps:
202
- - name: Setup Memory
203
- run: |
204
- mount -t tmpfs -o size=4G tmpfs /workspace/ram
205
- node -e "const fs = require('memfs'); fs.mkdirSync('/workspace/ram/sandbox'); console.log('Memory bridge ready')"
206
-
207
- - name: Execute Code
208
- run: |
209
- cd /workspace/ram/sandbox
210
- node -e "
211
- const { Volume } = require('memfs');
212
- const vol = new Volume();
213
- vol.mkdirSync('/sandbox');
214
- vol.writeFileSync('/sandbox/index.js', 'console.log(\"Sandbox running in RAM!\")');
215
- require('child_process').execSync('node /sandbox/index.js', { cwd: '/sandbox' });
216
- "
217
- 6. Projeto Principal (npm package)
218
- package.json:
219
- {
220
- "name": "@seuorg/sandbox-memory-bridge",
221
- "version": "1.0.0",
222
- "main": "dist/index.js",
223
- "types": "dist/index.d.ts",
224
- "scripts": {
225
- "build": "tsc",
226
- "dev": "tsx watch src/index.ts",
227
- "test": "vitest"
228
- },
229
- "dependencies": {
230
- "memfs": "^4.0.0",
231
- "@riaskov/mmap-io": "^1.7.0",
232
- "dockerode": "^3.3.0",
233
- "drizzle-orm": "^0.28.0",
234
- "ws": "^8.16.0"
235
- }
236
- }
237
- src/memory-bridge.ts:
238
- import { createFsFromVolume, Volume } from 'memfs';
239
-
240
- export class MemoryBridge {
241
- private vol: Volume;
242
- private fs: ReturnType<typeof createFsFromVolume>;
243
-
244
- constructor(private sizeMB: number = 4096) {
245
- this.vol = new Volume();
246
- this.fs = createFsFromVolume(this.vol);
247
- }
248
-
249
- // Converte arquivo do disco para RAM
250
- async storageToRam(diskPath: string, ramPath: string): Promise<void> {
251
- const data = require('fs').readFileSync(diskPath);
252
- this.vol.mkdirSync(require('path').dirname(ramPath), { recursive: true });
253
- this.vol.writeFileSync(ramPath, data);
254
- }
255
-
256
- // Cria sandbox em memória
257
- async createSandbox(id: string): Promise<SandboxInstance> {
258
- const sandboxPath = `/sandbox/${id}`;
259
- this.vol.mkdirSync(sandboxPath, { recursive: true });
260
-
261
- return {
262
- id,
263
- fs: this.fs,
264
- path: sandboxPath,
265
- execute: async (code: string) => {
266
- this.vol.writeFileSync(`${sandboxPath}/index.js`, code);
267
- // Executar via WASM ou child_process isolado
268
- return this.executeInSandbox(sandboxPath, code);
269
- }
270
- };
271
- }
272
-
273
- private async executeInSandbox(path: string, code: string): Promise<string> {
274
- // Usar WASM sandbox ou child_process com limits
275
- const { execSync } = require('child_process');
276
- const result = execSync(`node -e "${code}"`, {
277
- cwd: path,
278
- timeout: 5000,
279
- maxBuffer: 1024 * 1024 * 10 // 10MB
280
- });
281
- return result.toString();
282
- }
283
- }
284
- 7. WASM Sandbox (Browser + Node.js)
285
- src/wasm-sandbox.ts:
286
- // Usar portabox ou webix para WASM sandbox
287
- export class WasmSandbox {
288
- private memory: WebAssembly.Memory;
289
-
290
- constructor() {
291
- this.memory = new WebAssembly.Memory({
292
- initial: 256, // 16MB inicial
293
- maximum: 512, // 32MB máximo
294
- shared: true
295
- });
296
- }
297
-
298
- async init() {
299
- // Carregar WASM module (pode ser baixado de CDN)
300
- const wasmUrl = 'https://cdn.jsdelivr.net/npm/portabox@latest/blinkenlib.wasm';
301
- const response = await fetch(wasmUrl);
302
- const bytes = await response.arrayBuffer();
303
- const module = await WebAssembly.instantiate(bytes, {
304
- env: { memory: this.memory }
305
- });
306
- return module.instance;
307
- }
308
- }
309
- 8. Deploy com Docker
310
- Dockerfile:
311
- FROM node:20-bookworm
312
-
313
- # Instalar dependências do sistema
314
- RUN apt-get update && apt-get install -y \
315
- zram-tools \
316
- e2fsprogs \
317
- docker.io \
318
- && rm -rf /var/lib/apt/lists/*
319
-
320
- # Setup zRAM
321
- RUN modprobe zram && \
322
- zramctl /dev/zram0 --algorithm zstd --size 4G && \
323
- mkswap /dev/zram0 && \
324
- swapon /dev/zram0
325
-
326
- # Setup tmpfs
327
- RUN mkdir -p /mnt/sandbox-ram && \
328
- mount -t tmpfs -o size=4G tmpfs /mnt/sandbox-ram
329
-
330
- WORKDIR /app
331
- COPY package*.json ./
332
- RUN npm ci --production
333
- COPY dist/ ./dist/
334
-
335
- EXPOSE 3000
336
- CMD ["node", "dist/index.js"]
337
- 9. Pipelines Multi-Plataforma
338
- GitHub Actions (grátis para público):
339
-
340
- Repositórios públicos: infinito minutos grátis
341
- Cache: 10GB por repositório
342
- Artifacts: 500MB (free tier)
343
-
344
- GitLab CI (grátis para sempre):
345
-
346
- 400 minutos/mês grátis
347
- Docker runners inclusos
348
-
349
- Forgejo/Gitea (self-hosted = infinito):
350
-
351
- Sem limites de minutos
352
- Sem cobrança
353
- Totalmente controlado
354
-
355
- 10. CDN para Execução Instantânea
356
- // Usar jsDelivr para carregar pacotes sem instalar
357
- const CDN_URLS = {
358
- memfs: 'https://cdn.jsdelivr.net/npm/memfs@4.0.0/+esm',
359
- dockerode: 'https://cdn.jsdelivr.net/npm/dockerode@3.3.0/+esm',
360
- express: 'https://cdn.jsdelivr.net/npm/express@4.18.0/+esm'
361
- };
362
-
363
- // Executar código com dependências da CDN
364
- async function executeWithCDN(code: string) {
365
- const imports = Object.entries(CDN_URLS)
366
- .map(([name, url]) => `import ${name} from '${url}';`)
367
- .join('\n');
368
-
369
- const fullCode = `${imports}\n${code}`;
370
- return eval(fullCode);
371
- }
372
- Resumo - O que Usar
373
-
374
-
375
-
376
- Necessidade
377
- Solução
378
- Custo
379
-
380
-
381
-
382
- Storage → RAM
383
- zRAM + tmpfs + memfs
384
- Grátis
385
-
386
-
387
- Sandbox isolado
388
- gVisor / Firecracker / WASM
389
- Grátis
390
-
391
-
392
- CI/CD Pipeline
393
- GitHub Actions (público) / Forgejo
394
- Grátis
395
-
396
-
397
- ORM
398
- Drizzle + Prisma + MySQL2
399
- Grátis
400
-
401
-
402
- CDN execução
403
- jsDelivr + esm.sh
404
- Grátis
405
-
406
-
407
- Container
408
- Docker + Kubernetes
409
- Grátis (self-hosted)
410
-
411
-
412
- Runner
413
- ephemerd / ez-gh-actions
414
- Grátis (MIT)
415
-
416
-
417
- Quer que eu crie algum desses arquivos ou explique mais alguma parte específica?
@@ -1,29 +0,0 @@
1
- # assistant
2
-
3
- [Thinking] The user wants me to do a very thorough research - at least 10 searches - and provide a detailed step-by-step implementation plan. Let me search extensively for each aspect of their request and then compile everything together.
4
- Let me break down what they need:
5
-
6
- Memory bridge: storage → RAM conversion
7
-
8
- Using infrastructure from repos (GitHub, GitLab, Forgejo, Gitea, Codeberg)
9
-
10
- Pipelines and cron jobs for sandbox creation
11
-
12
- Using free tiers from HuggingFace, Kaggle, ModelScope
13
-
14
- ORMs (Drizzle, Prisma, MySQL2) converted to RAM
15
-
16
- Open source libraries (Node.js, Python, Rust)
17
-
18
- WASM/memory emulators
19
-
20
- Container sandboxes (gVisor, Firecracker, etc.)
21
-
22
- npm packages with CDN delivery
23
-
24
- Two approaches: build own lib + use third-party
25
-
26
-
27
- Now I need to dig into each of these areas systematically to find the best tools, patterns, and implementations.
28
-
29
- Vou fazer mais de 10 pesquisas detalhadas e compilar tudo em um guia passo a passo completo.