Ferrell Synthetic Intelligence commited on
Commit
9057700
·
1 Parent(s): b269533

Add production file workflow and desktop release project

Browse files
.github/FUNDING.yml ADDED
@@ -0,0 +1 @@
 
 
1
+ github: anonymousnomad
.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Report a reproducible problem
4
+ title: "bug: "
5
+ labels: bug
6
+ ---
7
+
8
+ ## What happened?
9
+
10
+ ## Reproduction
11
+
12
+ ## Environment
13
+
14
+ - AIDE version/commit:
15
+ - OS and architecture:
16
+ - Runtime/model pack:
17
+ - Offline mode enabled:
18
+
19
+ ## Logs
20
+
21
+ Remove secrets, tokens, private source, and private CaseFile content before posting.
.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Propose a useful improvement
4
+ title: "feature: "
5
+ labels: enhancement
6
+ ---
7
+
8
+ ## Problem
9
+
10
+ ## Proposed workflow
11
+
12
+ ## Offline and privacy impact
13
+
14
+ ## Verification plan
.github/pull_request_template.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Change
2
+
3
+ ## Verification
4
+
5
+ - [ ] `npm test`
6
+ - [ ] `npm run check`
7
+ - [ ] `npm run veritas`
8
+ - [ ] No credentials, weights, checkpoints, or private CaseFiles included
9
+ - [ ] Model/license/attribution changes documented
10
+
11
+ ## Notes and limitations
.github/workflows/ci.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: AIDE CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ verify:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-node@v4
13
+ with:
14
+ node-version: 22
15
+ cache: npm
16
+ - run: npm ci
17
+ - run: npm test
18
+ - run: npm run check
19
+ - run: npm run veritas
.gitignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules/
2
+ desktop/frontend/
3
+ desktop/target/
4
+ models/*.gguf
5
+ models/*.safetensors
6
+ *.log
7
+ .DS_Store
8
+ .env
9
+ .env.*
10
+ !.env.example
11
+ community/store.local.json
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # AIDE Community Code
2
+
3
+ Participants must be respectful, constructive, and honest about evidence, capability, and limitations. Do not harass contributors, expose private information, submit malicious artifacts, or use the project to facilitate unauthorized access or harm.
4
+
5
+ Maintainers may remove content or restrict participation when necessary to protect users and the project.
CONTRIBUTING.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to AIDE
2
+
3
+ AIDE is a local-first, offline-capable development workbench. Contributions should preserve user control, reproducibility, and honest capability reporting.
4
+
5
+ ## Before A Change
6
+
7
+ - Open an issue for substantial features or protocol changes.
8
+ - Keep model weights, tokens, credentials, private CaseFiles, and training checkpoints out of Git.
9
+ - Prefer existing protocols such as LSP, DAP, Git, JSON-RPC, and OpenAI-compatible local APIs.
10
+ - Add a test and update the relevant manifest or documentation.
11
+
12
+ ## Required Checks
13
+
14
+ ```bash
15
+ npm test
16
+ npm run check
17
+ npm run veritas
18
+ ```
19
+
20
+ For desktop work, also run `npm run desktop:prepare` and `npm run desktop:build` on a supported desktop host.
21
+
22
+ ## Model Contributions
23
+
24
+ Every model pack must include its upstream license, source revision, tokenizer/template details, checksum, hardware estimate, benchmark results, and limitations. A model is not `ready` merely because it loads.
GITHUB_SETUP.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GitHub Repository Setup
2
+
3
+ Recommended repository name: `aide-sovereign-workbench`.
4
+
5
+ Recommended settings:
6
+
7
+ - Public repository
8
+ - Description: `A local-first sovereign development workbench with model packs, Veritas verification, and offline community tools.`
9
+ - Topics: `offline-ide`, `local-ai`, `developer-tools`, `llama-cpp`, `lsp`, `dap`, `privacy`, `open-source`, `software-engineering`
10
+ - Enable Issues and Discussions
11
+ - Protect `main` with CI required before merge
12
+ - Disable force pushes and branch deletion on `main`
13
+ - Enable secret scanning and push protection when available
14
+ - Add the Apache-2.0 license
15
+ - Do not commit model weights, tokens, checkpoints, or private CaseFiles
16
+
17
+ The Hugging Face repository remains the model/package mirror. GitHub should be the code, issue, discussion, and contributor home.
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md CHANGED
@@ -12,6 +12,10 @@ pipeline_tag: text-generation
12
 
13
  # AIDE Sovereign Workbench
14
 
 
 
 
 
15
  AIDE is a local-first development workbench with a compact security-tool layout, angular panel structure, and an original Matrix-neon visual system. It combines an editor, terminal, Git-oriented workflows, model adapters, and bounded multi-model collaboration while keeping model execution on the user's device.
16
 
17
  ## Current Model Strategy
 
12
 
13
  # AIDE Sovereign Workbench
14
 
15
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/anonymousnomad?style=flat&logo=github)](https://github.com/sponsors/anonymousnomad)
16
+
17
+ If AIDE helps your local development or privacy work, sponsorship supports continued offline tooling, model evaluation, and community infrastructure.
18
+
19
  AIDE is a local-first development workbench with a compact security-tool layout, angular panel structure, and an original Matrix-neon visual system. It combines an editor, terminal, Git-oriented workflows, model adapters, and bounded multi-model collaboration while keeping model execution on the user's device.
20
 
21
  ## Current Model Strategy
SECURITY.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Security Policy
2
+
3
+ ## Scope
4
+
5
+ Report vulnerabilities in the daemon, model manager, patch application, community store, CaseFile handling, LSP/DAP process boundaries, or release tooling.
6
+
7
+ ## Do Not Publish
8
+
9
+ Never include access tokens, private keys, credentials, private source, unredacted CaseFiles, model training data, or local checkpoint paths in issues or pull requests.
10
+
11
+ ## Design Requirements
12
+
13
+ - Bind local services to loopback by default.
14
+ - Allowlist commands, model paths, language servers, and debugger adapters.
15
+ - Keep private community data local unless the user explicitly changes its boundary.
16
+ - Treat model output, plugins, dependencies, and imported artifacts as untrusted.
17
+ - Require diff review and user approval before writes or publication.
app.js CHANGED
@@ -1,4 +1,4 @@
1
- const state = { manifest: null, node: null, selected: null, casefile: null, files: {
2
  'agent.ts': `import { ChatMessage, ModelAdapter } from './types';
3
  import { LocalModelRouter } from './router';
4
 
@@ -46,11 +46,26 @@ const esc = value => String(value).replace(/[&<>"']/g, char => ({ '&':'&amp;', '
46
 
47
  function openFile(name) {
48
  const text = state.files[name] || state.files['agent.ts'];
 
49
  $('#code').textContent = text;
50
  $('#line-numbers').textContent = text.split('\n').map((_, index) => index + 1).join('\n');
51
  document.querySelectorAll('[data-file]').forEach(button => button.classList.toggle('active', button.dataset.file === name));
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  function renderModels() {
55
  const list = $('#model-list');
56
  const lanes = $('#lane-grid');
@@ -294,6 +309,7 @@ async function boot() {
294
  openFile('agent.ts');
295
  document.querySelectorAll('[data-file]').forEach(button => button.onclick = () => openFile(button.dataset.file));
296
  $('#review-button').onclick = runReview;
 
297
  $('#connection-button').onclick = startRuntime;
298
  $('#send-button').onclick = sendChat;
299
  $('#node-button').onclick = () => { localNodeId(); renderNode(); appendLog('NODE', 'Local identity created. No network connection or private data was shared.'); };
 
1
+ const state = { manifest: null, node: null, selected: null, casefile: null, activeFile: 'src/agent.ts', files: {
2
  'agent.ts': `import { ChatMessage, ModelAdapter } from './types';
3
  import { LocalModelRouter } from './router';
4
 
 
46
 
47
  function openFile(name) {
48
  const text = state.files[name] || state.files['agent.ts'];
49
+ state.activeFile = `src/${name}`;
50
  $('#code').textContent = text;
51
  $('#line-numbers').textContent = text.split('\n').map((_, index) => index + 1).join('\n');
52
  document.querySelectorAll('[data-file]').forEach(button => button.classList.toggle('active', button.dataset.file === name));
53
  }
54
 
55
+ async function saveFile() {
56
+ try {
57
+ const response = await fetch('http://127.0.0.1:4777/api/file/write', {
58
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
59
+ body: JSON.stringify({ path: state.activeFile, content: $('#code').textContent, approved: true })
60
+ });
61
+ const result = await response.json();
62
+ if (!response.ok) throw new Error(result.error || 'file write rejected');
63
+ appendLog('WORKSPACE', `${result.path} saved atomically after explicit approval.`);
64
+ } catch (error) {
65
+ appendLog('WORKSPACE', `Save blocked: ${error.message}. Start the local daemon and open a trusted workspace.`, 'warning');
66
+ }
67
+ }
68
+
69
  function renderModels() {
70
  const list = $('#model-list');
71
  const lanes = $('#lane-grid');
 
309
  openFile('agent.ts');
310
  document.querySelectorAll('[data-file]').forEach(button => button.onclick = () => openFile(button.dataset.file));
311
  $('#review-button').onclick = runReview;
312
+ $('#save-file').onclick = saveFile;
313
  $('#connection-button').onclick = startRuntime;
314
  $('#send-button').onclick = sendChat;
315
  $('#node-button').onclick = () => { localNodeId(); renderNode(); appendLog('NODE', 'Local identity created. No network connection or private data was shared.'); };
daemon/server.mjs CHANGED
@@ -6,6 +6,7 @@ import { ModelManager } from './model-manager.mjs';
6
  import { CommunityStore } from '../community/store.mjs';
7
  import { LspManager } from './lsp-manager.mjs';
8
  import { DapManager } from './dap-manager.mjs';
 
9
 
10
  const HOST = '127.0.0.1';
11
  const PORT = Number(process.env.AIDE_DAEMON_PORT || 4777);
@@ -20,6 +21,7 @@ const lspManager = new LspManager({ manifestPath: path.join(WORKSPACE, 'language
20
  await lspManager.load().catch(() => {});
21
  const dapManager = new DapManager({ manifestPath: path.join(WORKSPACE, 'debuggers', 'manifest.json'), workspace: WORKSPACE });
22
  await dapManager.load().catch(() => {});
 
23
 
24
  function json(response, status, body) {
25
  const payload = JSON.stringify(body);
@@ -68,6 +70,18 @@ const server = http.createServer(async (request, response) => {
68
  if (request.method === 'GET' && request.url === '/api/workspace') {
69
  return json(response, 200, { workspace: WORKSPACE, entries: await workspaceSummary() });
70
  }
 
 
 
 
 
 
 
 
 
 
 
 
71
  if (request.method === 'GET' && request.url === '/api/git/status') {
72
  try {
73
  return json(response, 200, { workspace: WORKSPACE, status: await runGit(['status', '--short']) });
 
6
  import { CommunityStore } from '../community/store.mjs';
7
  import { LspManager } from './lsp-manager.mjs';
8
  import { DapManager } from './dap-manager.mjs';
9
+ import { WorkspaceManager } from './workspace-manager.mjs';
10
 
11
  const HOST = '127.0.0.1';
12
  const PORT = Number(process.env.AIDE_DAEMON_PORT || 4777);
 
21
  await lspManager.load().catch(() => {});
22
  const dapManager = new DapManager({ manifestPath: path.join(WORKSPACE, 'debuggers', 'manifest.json'), workspace: WORKSPACE });
23
  await dapManager.load().catch(() => {});
24
+ const workspaceManager = new WorkspaceManager(WORKSPACE);
25
 
26
  function json(response, status, body) {
27
  const payload = JSON.stringify(body);
 
70
  if (request.method === 'GET' && request.url === '/api/workspace') {
71
  return json(response, 200, { workspace: WORKSPACE, entries: await workspaceSummary() });
72
  }
73
+ if (request.method === 'GET' && request.url.startsWith('/api/file?')) {
74
+ const relativePath = new URL(request.url, 'http://127.0.0.1').searchParams.get('path');
75
+ return json(response, 200, { path: relativePath, content: await workspaceManager.read(relativePath) });
76
+ }
77
+ if (request.method === 'POST' && request.url === '/api/file/write') {
78
+ const input = await body(request);
79
+ return json(response, 200, await workspaceManager.write(input.path, input.content, input.approved));
80
+ }
81
+ if (request.method === 'POST' && request.url === '/api/patch/apply') {
82
+ const input = await body(request);
83
+ return json(response, 200, await workspaceManager.applyPatch(input.patch, input.approved));
84
+ }
85
  if (request.method === 'GET' && request.url === '/api/git/status') {
86
  try {
87
  return json(response, 200, { workspace: WORKSPACE, status: await runGit(['status', '--short']) });
daemon/test-workspace-manager.mjs ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import assert from 'node:assert/strict';
2
+ import { mkdtemp, mkdir, writeFile, readFile } from 'node:fs/promises';
3
+ import { tmpdir } from 'node:os';
4
+ import path from 'node:path';
5
+ import { execFile } from 'node:child_process';
6
+ import { promisify } from 'node:util';
7
+ import { WorkspaceManager } from './workspace-manager.mjs';
8
+
9
+ const run = promisify(execFile);
10
+ const root = await mkdtemp(path.join(tmpdir(), 'aide-workspace-'));
11
+ await mkdir(path.join(root, 'src'));
12
+ await writeFile(path.join(root, 'src', 'example.ts'), 'export const value = 1;\n');
13
+ await run('git', ['init', '-q'], { cwd: root });
14
+ await run('git', ['add', '.'], { cwd: root });
15
+ await run('git', ['-c', 'user.name=AIDE', '-c', 'user.email=aide@example.invalid', 'commit', '-qm', 'base'], { cwd: root });
16
+ const manager = new WorkspaceManager(root);
17
+ assert.equal(await manager.read('src/example.ts'), 'export const value = 1;\n');
18
+ await assert.rejects(manager.write('../escape.txt', 'bad', true), /escaped/);
19
+ await assert.rejects(manager.write('src/example.ts', 'bad', false), /approval/);
20
+ await manager.write('src/example.ts', 'export const value = 2;\n', true);
21
+ assert.match(await readFile(path.join(root, 'src/example.ts'), 'utf8'), /value = 2/);
22
+ await assert.rejects(manager.applyPatch('diff --git a/src/example.ts b/src/example.ts\n', false), /approval/);
23
+ const patch = 'diff --git a/src/example.ts b/src/example.ts\n--- a/src/example.ts\n+++ b/src/example.ts\n@@ -1 +1 @@\n-export const value = 2;\n+export const value = 3;\n';
24
+ await manager.applyPatch(patch, true);
25
+ assert.match(await manager.read('src/example.ts'), /value = 3/);
26
+ console.log('workspace manager test passed');
daemon/workspace-manager.mjs ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { promises as fs } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { execFile } from 'node:child_process';
4
+
5
+ export class WorkspaceManager {
6
+ constructor(workspace) { this.workspace = path.resolve(workspace); }
7
+
8
+ resolve(relativePath) {
9
+ if (!relativePath || path.isAbsolute(relativePath)) throw new Error('workspace-relative path required');
10
+ const target = path.resolve(this.workspace, relativePath);
11
+ if (!target.startsWith(`${this.workspace}${path.sep}`)) throw new Error('path escaped workspace');
12
+ return target;
13
+ }
14
+
15
+ async read(relativePath) {
16
+ return fs.readFile(this.resolve(relativePath), 'utf8');
17
+ }
18
+
19
+ async write(relativePath, content, approved) {
20
+ if (approved !== true) throw new Error('explicit approval required');
21
+ const target = this.resolve(relativePath);
22
+ await fs.mkdir(path.dirname(target), { recursive: true });
23
+ const temporary = `${target}.aide-tmp-${process.pid}`;
24
+ await fs.writeFile(temporary, String(content), { mode: 0o600 });
25
+ await fs.rename(temporary, target);
26
+ return { path: relativePath, bytes: Buffer.byteLength(String(content)) };
27
+ }
28
+
29
+ async applyPatch(patch, approved) {
30
+ if (approved !== true) throw new Error('explicit approval required');
31
+ if (typeof patch !== 'string' || !patch.startsWith('diff --git ')) throw new Error('unified diff required');
32
+ if (patch.length > 200_000) throw new Error('patch exceeds size limit');
33
+ const temporary = path.join(this.workspace, `.aide-patch-${process.pid}.diff`);
34
+ await fs.writeFile(temporary, patch, { mode: 0o600 });
35
+ try {
36
+ await this.runGit(['apply', '--check', '--whitespace=error', temporary]);
37
+ await this.runGit(['apply', '--whitespace=error', temporary]);
38
+ return { applied: true, bytes: Buffer.byteLength(patch) };
39
+ } finally {
40
+ await fs.rm(temporary, { force: true });
41
+ }
42
+ }
43
+
44
+ runGit(args) {
45
+ return new Promise((resolve, reject) => {
46
+ execFile('git', args, { cwd: this.workspace, timeout: 15000, maxBuffer: 256 * 1024 }, (error, stdout, stderr) => {
47
+ if (error) reject(new Error(stderr.trim() || error.message));
48
+ else resolve(stdout);
49
+ });
50
+ });
51
+ }
52
+ }
desktop/Cargo.lock ADDED
The diff for this file is too large to render. See raw diff
 
desktop/Cargo.toml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [package]
2
+ name = "aide-sovereign-workbench"
3
+ version = "0.1.0"
4
+ description = "AIDE Sovereign Workbench desktop shell"
5
+ authors = ["Ferrell Synthetic Intelligence"]
6
+ edition = "2021"
7
+
8
+ [build-dependencies]
9
+ tauri-build = { version = "2", features = [] }
10
+
11
+ [dependencies]
12
+ tauri = { version = "2", features = [] }
13
+
14
+ [features]
15
+ custom-protocol = ["tauri/custom-protocol"]
desktop/README.md CHANGED
@@ -11,7 +11,7 @@ The production desktop target is a lightweight native shell around the existing
11
 
12
  Tauri is the intended shell because it can provide a smaller offline desktop package than an Electron-only implementation. This environment does not currently have Rust/Tauri installed, so the daemon is the runnable first boundary. Do not label a Tauri binary available until it is compiled and smoke-tested on each target platform.
13
 
14
- The Tauri CLI is now pinned in the root package. Use `npm run desktop:dev` after installing Rust and platform prerequisites, or `npm run desktop:build` for a release build. A compiled binary is not claimed until that command succeeds on the target platform.
15
 
16
  ## Shell Acceptance Gates
17
 
 
11
 
12
  Tauri is the intended shell because it can provide a smaller offline desktop package than an Electron-only implementation. This environment does not currently have Rust/Tauri installed, so the daemon is the runnable first boundary. Do not label a Tauri binary available until it is compiled and smoke-tested on each target platform.
13
 
14
+ The Tauri CLI is now pinned in the root package and the Rust project lives in `desktop/`. `desktop/prepare.mjs` stages only approved frontend assets, avoiding `node_modules` and build artifacts. Use `npm run desktop:dev` after installing platform prerequisites, or `npm run desktop:build` for a release build. A compiled binary is not claimed until that command succeeds on the target platform.
15
 
16
  ## Shell Acceptance Gates
17
 
desktop/build.rs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fn main() {
2
+ tauri_build::build()
3
+ }
desktop/icons/icon.png ADDED
desktop/icons/icon.svg ADDED
desktop/prepare.mjs ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { cp, mkdir, rm } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const desktop = path.dirname(fileURLToPath(import.meta.url));
6
+ const root = path.resolve(desktop, '..');
7
+ const frontend = path.join(desktop, 'frontend');
8
+ await rm(frontend, { recursive: true, force: true });
9
+ await mkdir(frontend, { recursive: true });
10
+ for (const file of ['index.html', 'app.js', 'styles.css']) await cp(path.join(root, file), path.join(frontend, file));
11
+ for (const directory of ['models', 'community', 'languages', 'debuggers', 'training']) await cp(path.join(root, directory), path.join(frontend, directory), { recursive: true });
12
+ console.log(`prepared desktop frontend at ${frontend}`);
desktop/src/main.rs ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
2
+
3
+ fn main() {
4
+ tauri::Builder::default()
5
+ .run(tauri::generate_context!())
6
+ .expect("error while running AIDE desktop shell");
7
+ }
desktop/tauri.conf.json CHANGED
@@ -4,12 +4,12 @@
4
  "version": "0.1.0-preflight",
5
  "identifier": "org.ferrellsyntheticintelligence.aide",
6
  "build": {
7
- "frontendDist": "..",
8
  "devUrl": "http://127.0.0.1:4173"
9
  },
10
  "app": {
11
  "windows": [{"title": "AIDE Sovereign Workbench", "width": 1440, "height": 900, "minWidth": 900, "minHeight": 600}],
12
- "security": {"csp": "default-src 'self' http://127.0.0.1:4173 http://127.0.0.1:4777 http://127.0.0.1:8081; connect-src 'self' http://127.0.0.1:*"}
13
  },
14
- "bundle": {"active": true, "targets": "all", "resources": ["../models", "../community", "../languages", "../debuggers", "../training"]}
15
  }
 
4
  "version": "0.1.0-preflight",
5
  "identifier": "org.ferrellsyntheticintelligence.aide",
6
  "build": {
7
+ "frontendDist": "frontend",
8
  "devUrl": "http://127.0.0.1:4173"
9
  },
10
  "app": {
11
  "windows": [{"title": "AIDE Sovereign Workbench", "width": 1440, "height": 900, "minWidth": 900, "minHeight": 600}],
12
+ "security": {"csp": "default-src 'self' http://127.0.0.1:4173 http://127.0.0.1:4777 http://127.0.0.1:*; connect-src 'self' http://127.0.0.1:*"}
13
  },
14
+ "bundle": {"active": true, "targets": "all", "icon": ["icons/icon.svg"], "resources": []}
15
  }
index.html CHANGED
@@ -69,7 +69,7 @@
69
  </aside>
70
 
71
  <section class="editor-column">
72
- <div class="tabs"><button class="tab active">agent.ts <span>*</span></button><button class="tab">router.ts</button><button class="tab-add">+</button></div>
73
  <div class="breadcrumbs">src <b>/</b> agent.ts <b>/</b> AgentRuntime</div>
74
  <div class="editor" role="textbox" aria-label="Code editor">
75
  <div id="line-numbers" class="line-numbers"></div>
 
69
  </aside>
70
 
71
  <section class="editor-column">
72
+ <div class="tabs"><button class="tab active">agent.ts <span>*</span></button><button class="tab">router.ts</button><button class="tab-add">+</button><button id="save-file" class="tab" style="margin-left:auto;color:#72ff9e">SAVE APPROVED FILE</button></div>
73
  <div class="breadcrumbs">src <b>/</b> agent.ts <b>/</b> AgentRuntime</div>
74
  <div class="editor" role="textbox" aria-label="Code editor">
75
  <div id="line-numbers" class="line-numbers"></div>
package.json CHANGED
@@ -5,17 +5,24 @@
5
  "description": "Local-first sovereign development workbench",
6
  "type": "module",
7
  "scripts": {
8
- "test": "node tests/smoke.mjs && node harness/test-orchestrator.mjs && node daemon/test-model-manager.mjs && node daemon/test-community-store.mjs && node daemon/test-lsp-manager.mjs && node daemon/test-dap-manager.mjs && node benchmarks/test-run.mjs",
9
  "check": "node --check app.js && node --check daemon/server.mjs && node --check harness/orchestrator.mjs && node --check harness/checks.mjs",
10
  "veritas": "node harness/run-veritas.mjs",
11
  "benchmarks": "node benchmarks/run.mjs",
12
  "desktop:dev": "tauri dev --config desktop/tauri.conf.json",
13
- "desktop:build": "tauri build --config desktop/tauri.conf.json"
 
14
  },
15
  "engines": {
16
  "node": ">=20"
17
  },
18
  "license": "Apache-2.0",
 
 
 
 
 
 
19
  "dependencies": {
20
  "typescript": "^7.0.2",
21
  "typescript-language-server": "^5.3.0"
 
5
  "description": "Local-first sovereign development workbench",
6
  "type": "module",
7
  "scripts": {
8
+ "test": "node tests/smoke.mjs && node harness/test-orchestrator.mjs && node daemon/test-model-manager.mjs && node daemon/test-community-store.mjs && node daemon/test-lsp-manager.mjs && node daemon/test-dap-manager.mjs && node daemon/test-workspace-manager.mjs && node benchmarks/test-run.mjs",
9
  "check": "node --check app.js && node --check daemon/server.mjs && node --check harness/orchestrator.mjs && node --check harness/checks.mjs",
10
  "veritas": "node harness/run-veritas.mjs",
11
  "benchmarks": "node benchmarks/run.mjs",
12
  "desktop:dev": "tauri dev --config desktop/tauri.conf.json",
13
+ "desktop:prepare": "node desktop/prepare.mjs",
14
+ "desktop:build": "npm run desktop:prepare && tauri build --config desktop/tauri.conf.json"
15
  },
16
  "engines": {
17
  "node": ">=20"
18
  },
19
  "license": "Apache-2.0",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/anonymousnomad/aide-sovereign-workbench.git"
23
+ },
24
+ "homepage": "https://huggingface.co/FerrellSyntheticIntelligence/aide-sovereign-workbench",
25
+ "bugs": {"url": "https://github.com/anonymousnomad/aide-sovereign-workbench/issues"},
26
  "dependencies": {
27
  "typescript": "^7.0.2",
28
  "typescript-language-server": "^5.3.0"
tests/smoke.mjs CHANGED
@@ -9,6 +9,10 @@ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
9
  const required = [
10
  'index.html', 'app.js', 'styles.css', 'models/manifest.json',
11
  'community/node-manifest.json', 'community/protocol.md',
 
 
 
 
12
  'daemon/server.mjs', 'desktop/README.md'
13
  ];
14
  for (const file of required) assert.ok(existsSync(path.join(root, file)), `missing ${file}`);
 
9
  const required = [
10
  'index.html', 'app.js', 'styles.css', 'models/manifest.json',
11
  'community/node-manifest.json', 'community/protocol.md',
12
+ 'community/casefile-schema.json', 'community/journal-desk.md', 'community/store-schema.json', 'community/store.json',
13
+ 'languages/manifest.json',
14
+ 'debuggers/manifest.json',
15
+ 'benchmarks/manifest.json', 'training/manifest.json', 'desktop/tauri.conf.json',
16
  'daemon/server.mjs', 'desktop/README.md'
17
  ];
18
  for (const file of required) assert.ok(existsSync(path.join(root, file)), `missing ${file}`);