n2n-nexus 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,358 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.5.0] - 2026-06-14
6
+
7
+ ### 🏗️ Daemon + MCP Architecture (Breaking Refactor)
8
+
9
+ Complete architectural rewrite. The old Host/Guest election mechanism is replaced by a standalone HTTP daemon as the single source of truth.
10
+
11
+ **Why**: The election model assumed all AI instances share the same `localhost`. This fails across Windows/WSL/VM environments (different localhost namespaces) and whenever the "Host" IDE is closed. Split-brain risk was unacceptable.
12
+
13
+ #### New Architecture
14
+ - **`n2n-nexus daemon`** — standalone HTTP server; user starts it manually; owns all data, tool definitions, and business logic; never dies when an IDE closes
15
+ - **`n2n-nexus mcp`** — stateless MCP proxy; IDE starts it via `npx`; fetches tool list from daemon (`GET /api/tools`), forwards every tool call (`POST /api/tools/call`)
16
+ - **Cross-environment**: set `NEXUS_ENDPOINT` to bridge Windows/WSL/VM or remote machines
17
+
18
+ #### MCP Behavior
19
+ - Starts with empty tool list; background retry loop (every 3 s) until daemon is reachable
20
+ - On connect: sends `notifications/tools/list_changed` → IDE reloads tools automatically
21
+ - On daemon disconnect: clears tool list, notifies IDE, resumes retry loop
22
+ - No hardcoded tool names in MCP — daemon upgrades are transparent
23
+
24
+ #### Deleted (not needed in new architecture)
25
+ - `src/network/` — election, Host, Guest
26
+ - `src/auth/` — Host/Guest permission gates
27
+ - `src/tools/handlers/`, `src/tools/definitions.ts`, `src/tools/schemas/`
28
+ - `src/resources/` — MCP Resources layer
29
+ - `src/server/resources.ts`, `src/server/tools.ts`
30
+
31
+ #### Storage layer unchanged
32
+ `src/storage/` is kept as-is. SQLite WAL mode is safe because only the daemon process writes directly; MCP processes go through HTTP, serializing all writes naturally.
33
+
34
+ ---
35
+
36
+ ## [0.4.2] - 2026-01-14
37
+ ### 🛡️ Stability & Automation
38
+ - **Lefthook Integration**: Added high-performance Git hooks. Now automatically runs `lint` on commit and `build + test` on push to ensure zero regressions.
39
+ - **E2E Test Stability**: Fixed a critical hang in subprocess logging by implementing `stdout` draining.
40
+ - **CLI Port Override**: Fixed a bug where the `--port` flag was ignored during Host Election.
41
+ - **Non-blocking Handshake**: Optimized Stdio connection to prevent blocking election logic.
42
+
43
+ ## [0.4.1] - 2026-01-14
44
+ ### ✨ Developer Experience & Observability
45
+ - **MCP Logging Protocol**: Implemented standard `notifications/message` protocol support. Debug logs now appear directly in the IDE's "Model Context Protocol" output channel.
46
+ - **Improved Stdio Handling**: Verified and strictly enforced JSON-RPC compliance on `stdout` to prevent IDE integration issues.
47
+ - **Better Error Reporting**: Boot failures now include more descriptive context on `stderr`.
48
+
49
+ ## [0.4.0] - 2026-01-14
50
+ ### 🚀 High Availability & Scalability
51
+ - **Failover Mechanism**: Implemented automatic Guest-to-Host promotion. If the Host process dies, a Guest detects usage of the port/lock and takes over immediately with data persistence.
52
+ - **Progressive Discovery**: Added `search_projects` tool. Allows AI to find relevant projects by query without loading the entire 1000+ project registry, reducing context usage.
53
+ - **Immediate Handshake**: Implementing Request Buffering allows the server to accept IDE requests immediately (<10ms) while the Host Election runs in background (~300ms). Fixes startup race conditions.
54
+ - **Stability**: Added explicit E2E tests for process failover (`tests/failover.test.ts`) and request buffering (`tests/buffered_requests.test.ts`).
55
+
56
+ ## [0.3.9] - 2026-01-11
57
+ ### 🚀 Online First Architecture
58
+ - **Performance**: Removed top-level blocking await for election. Server now starts in <300ms (Online First), reducing startup time by 99% in congested networks.
59
+ - **Stability**: Fixed "Timeout" errors in MCP clients (Cursor/Claude) by ensuring `tools/list` is available immediately before Host Election completes.
60
+ - **Race Condition Fix**: Implemented explicit server shutdown before transitioning from Local to Guest mode to prevent Stdio stream conflicts.
61
+ - **Refactor**: Moved `isHost` logic from static config to dynamic `updateConfig` flow.
62
+
63
+
64
+ ## [0.3.5] - 2026-01-10
65
+ ### Protocol & Stability
66
+ - **Fix (Zombie Host)**: Implemented "Intelligent Retry" and "Re-Election" logic. If a Guest repeatedly connects to a Zombie Host (handshake OK, SSE broken), it will now automatically trigger a re-election process, blacklist the bad port, and promote itself to Host on a new port if necessary.
67
+ - **Refactor**: Enabled dynamic role switching (Guest -> Host) without process restart.
68
+
69
+ ## [0.3.4] - 2026-01-10
70
+ ### Protocol & Stability
71
+ - **New Handshake Protocol**: Introduced `POST /nexus/handshake` to replace legacy `/hello`. Supports strict versioning (Client/Server) and robust Host detection.
72
+ - **Global Error Safety Net**: Implemented `uncaughtException` and `unhandledRejection` handlers to prevent process exits from background task errors, ensuring high availability of the Hub.
73
+ - **Fix (EOF Error)**: Resolved "Connection Closed: EOF" crashes caused by non-idempotent SQLite initialization during repeated tool calls.
74
+ - **Fix (Zombie Host)**: Eliminated infinite retry loops by improving Guest's host detection logic.
75
+ - **Test Coverage**: Added `guest_connection.test.ts` to verify Guest-Host SSE integration.
76
+
77
+ ## [0.3.3] - 2026-01-10
78
+ ### 🔄 Zero-Config Persistence
79
+ - **XDG Base Directory Support**: Moved valid storage location from ephemeral `node_modules` to system-standard user data paths:
80
+ - **Linux/WSL**: `~/.local/share/n2n-nexus`
81
+ - **Windows**: `%APPDATA%\n2n-nexus`
82
+ - **macOS**: `~/Library/Application Support/n2n-nexus`
83
+ - **Data Persistence**: Data now survives `npx` cache clearing, project deletion, and re-installations.
84
+ - **Bind Address**: Changed default listener to `0.0.0.0` to support WSL Mirror Mode networking.
85
+ - **Identity Safety**: Default "Assistant" ID now appends a random suffix (e.g., `Assistant-x9a2`) to prevent conflicts when multiple empty IDEs connect.
86
+
87
+ ## [0.3.8] - 2026-01-11
88
+
89
+ ### Fixed
90
+ - **Guest Proxy Framing**: Implemented proper message framing (newline-delimited JSON buffer) in Guest-to-Host proxy. This resolves "context deadline exceeded" timeouts in IDEs where stdin pipes fragment JSON-RPC messages.
91
+
92
+ ## [0.3.7] - 2026-01-08
93
+ ### Security & Stability
94
+ - **Security**: Fixed potential URL parameter injection in Guest proxy connection URL.
95
+ - **Stability**: Refactored host election fallback loop from async recursion to `while(true)` to prevent long-term stack overflow.
96
+ - **Refactor**: Improved code structure in `config.ts` for better maintainability.
97
+
98
+ ## [0.3.1] - 2026-01-08
99
+ ### Fixed
100
+ - **Critical**: Recursive stack overflow in Guest proxy reconnection logic (partial fix).
101
+ - **Critical**: Server crash when fallback port binding fails (now retries with backoff).
102
+ - **Performance**: Optimized port scanning with batch concurrency (56s -> 3s scan time).
103
+ - **Config**: Expanded port range to 5688-5800 (113 ports).
104
+
105
+ ## [v0.3.0] - 2026-01-08
106
+
107
+ ### 🌐 Global Hub Architecture (Zero-Config Multi-IDE Collaboration)
108
+
109
+ This release introduces a fully automatic Host election and Global Hub architecture, enabling seamless multi-IDE collaboration without any configuration.
110
+
111
+ #### Automatic Host Election (Port-Based)
112
+ - **Port Range 5688-5700**: First instance to bind becomes Host, others become Guests.
113
+ - **Probe-First Strategy**: Guests scan for existing Host before attempting to bind, eliminating race conditions.
114
+ - **Hello Handshake**: `/hello` endpoint validates Nexus identity, distinguishing from other services.
115
+ - **10s Failover Window**: On bind failure, Guests wait 10 seconds then re-probe to join the winner.
116
+
117
+ #### Global Hub (SSE-Based Communication)
118
+ - **Single Hub Architecture**: All IDEs (regardless of project) connect to the same Host for cross-project collaboration.
119
+ - **Stdio-to-SSE Proxy**: Guests transparently forward IDE traffic to Host via SSE.
120
+ - **Multi-Session Routing**: Host maintains session map for concurrent Guest connections.
121
+ - **Storage Path Inheritance**: Host broadcasts `rootStorage` path; Guests inherit it for seamless failover.
122
+
123
+ #### Heartbeat & Watchdog (High Availability)
124
+ - **Host Heartbeat**: Host sends `: ping` every 30 seconds to keep connections alive.
125
+ - **Guest Watchdog**: Guests monitor activity; if silent for 60 seconds, trigger automatic re-election.
126
+ - **Hot Failover**: Surviving Guests automatically promote to new Host using inherited storage path.
127
+
128
+ #### Terminology Refactoring
129
+ - **Moderator → Host**: All code, tests, and documentation updated.
130
+ - **`isModerator` → `isHost`**: API and config properties renamed.
131
+ - **`moderator_*` → `host_*`**: Tool names updated (e.g., `host_maintenance`).
132
+
133
+ #### Zero-Config Experience
134
+ - **`--id` Deprecated**: Instance ID now auto-derived from project folder name.
135
+ - **`--host` Removed**: Host role determined automatically by port binding.
136
+ - **Simplified CLI**: Just `npx n2n-nexus` to get started.
137
+
138
+ | Metric | Before | After |
139
+ |--------|--------|-------|
140
+ | Required CLI Args | 2-3 | 0-1 |
141
+ | Manual Host Setup | Required | Automatic |
142
+ | Multi-IDE Sync | File-based | SSE Real-time |
143
+ | Failover Time | Manual restart | < 10 seconds |
144
+
145
+ #### Test Coverage
146
+ - New `election.test.ts` with 9 test cases covering probe, bind, and race scenarios.
147
+ - All 55 tests passing.
148
+
149
+ ## [v0.2.1] - 2026-01-01
150
+
151
+ ### 🚀 Token Economy Deep Optimization
152
+
153
+ This release focuses on reducing context window consumption when AI loads the MCP server.
154
+
155
+ #### Tool Definition Optimization (-49% Token Reduction)
156
+ - **Hand-Crafted Schemas**: Replaced `Zod.toJSONSchema()` with manually optimized `definitions.ts`.
157
+ - **Removed $schema Spam**: Eliminated redundant `$schema` declarations per tool (~50 chars saved per tool).
158
+ - **Concise Descriptions**: Reduced average description length by 50%.
159
+ - **Hidden Internal Tools**: `update_task` (marked `[INTERNAL]`) excluded from public `ListTools`.
160
+
161
+ | Metric | Before | After | Improvement |
162
+ |--------|--------|-------|-------------|
163
+ | Tool Definitions | 10,241 chars | 5,237 chars | **-49%** |
164
+ | Approx Tokens | ~2,560 | ~1,310 | **-1,250 tokens** |
165
+
166
+ #### Incremental Message Reading
167
+ - **Read Cursors Table**: New `read_cursors` SQLite table tracks each IDE's last read message ID per meeting.
168
+ - **Auto-Increment**: `read_messages` automatically returns only unread messages based on `instanceId`.
169
+ - **Zero Config**: No `afterId` parameter needed - cursor managed entirely server-side.
170
+ - **Response Enhancement**: Returns `{ newMessages: N, messages: [...] }` for easy verification.
171
+
172
+ #### Context7-Style Progressive Loading
173
+ - **`get_global_topology` Upgrade**:
174
+ - **Default (List Mode)**: Returns lightweight summary `{ totalProjects, totalEdges, projects: [{id, name}] }`.
175
+ - **Focused Mode**: Pass `projectId` to get detailed subgraph for that specific project.
176
+ - **`listResources` Optimization**:
177
+ - **O(1) Scaling**: Resource list size is now constant regardless of project count.
178
+ - **Static Resources**: Fixed 8 core resources (chat, registry, docs, meetings, etc.).
179
+ - **Template-Based Projects**: Individual projects no longer dynamically listed; use templates instead.
180
+ - **Discovery Flow**: AI reads `hub/registry` → discovers project IDs → constructs URI from template.
181
+
182
+ | Scenario | Before | After |
183
+ |----------|--------|-------|
184
+ | 0 projects | 8 resources | 8 resources + 4 templates |
185
+ | 20 projects | 28 resources | 8 resources + 4 templates (fixed) |
186
+ | 50 projects | 58 resources | 8 resources + 4 templates (fixed) |
187
+
188
+ #### Documentation
189
+ - Updated `README.md` with new tool behaviors (`[Incremental]`, `[Progressive]`).
190
+ - Updated `ASSISTANT_GUIDE.md` to v0.2.1 with "渐进式发现,增量读取" principle.
191
+ - Reorganized Resources section with Core Resources + Resource Templates structure.
192
+
193
+ ## [v0.2.0] - 2025-12-31
194
+
195
+ ### 🚀 Task Primitive System (Phase 2 & 3)
196
+ - **Async Deepening**: Critical blocking operations (`rename_project`, `moderator_delete_project`) migrated to the Task primitive with background cascading updates.
197
+ - **Traceability**: All tasks now support `source_meeting_id` to link execution back to meeting decisions.
198
+ - **Progressive UI**: Added `progress` tracking (0.0-1.0) and `result_uri` for structured task output.
199
+ - **Lifecycle Tools**: Added `create_task`, `get_task`, `list_tasks`, `update_task`, and `cancel_task`.
200
+
201
+ ### 🛡️ Type Safety & Security
202
+ - **Defense-in-Depth**: Implemented secondary permission gates inside `handleRemoveProject` and `handleModeratorMaintenance` for maximum project isolation.
203
+ - **Meeting Hardening**: `end_meeting` and `archive_meeting` are now strictly **Moderator-only**.
204
+ - **Zod integration**: All tool definitions migrated to strictly-typed Zod schemas with regex path-traversal protection.
205
+ - **Infrastructure**: Modernized toolchain to **TypeScript 5.9.3**, **Vitest 4.0.16**, and **ESLint 9.39.2**.
206
+
207
+ ### ✂️ Code Diet (Architectural Cleanliness)
208
+ - **The Great Purge**: Removed 6 redundant tools (`list_projects`, `read_project`, `list_global_docs`, `read_global_doc`, `list_meetings`, `read_meeting`) in favor of Resource URIs.
209
+ - **Native Zod 4 Schemas**: Removed `zod-to-json-schema` dependency; now using native Zod 4 `toJSONSchema()` generation.
210
+
211
+ ## [v0.1.9] - 2025-12-30
212
+
213
+ ### 🛡️ Collaboration & Security
214
+ - **Initiator-only Permissions**: Implemented restricted access for `end_meeting` and `archive_meeting`.
215
+ - **Session Presence Awareness**: Automated `[ONLINE/OFFLINE]` status messages in global logs.
216
+ - **Clean Tool Naming**: Finalized transition to `send_message` and `read_messages`.
217
+
218
+ ### 🌐 Resource Namespacing (MCP 2025 Standard)
219
+ - **Unified Authority**: All core resource URIs migrated to `mcp://nexus/`.
220
+ - **New Resources**: Added `mcp://nexus/status` and `mcp://nexus/active-meeting`.
221
+
222
+ ## [v0.1.8] - 2025-12-30
223
+
224
+ ### 🎯 Meeting Architecture (Phase 1 & 2)
225
+ - **Hybrid Storage Backend**: Automatic selection between **SQLite** (preferred) and **JSON Fallback**.
226
+ - **SQLite Engine**: Powered by `better-sqlite3` with **WAL mode** for high-concurrency and multi-process safety.
227
+ - **New Lifecycle Entity**: `MeetingSession` replaces monolithic chat logs with discrete sessions.
228
+ - **Lifecycle Tools**:
229
+ - `start_meeting(topic)`: Creates dedicated session with unique ID and random entropy.
230
+ - `end_meeting(meetingId?, summary?)`: Closes meeting, collects decisions.
231
+ - `archive_meeting(meetingId)`: Moves sessions to historical archives.
232
+ - `list_meetings(status?)`: Filtered discovery of sessions.
233
+ - `read_meeting(meetingId)`: Detailed retrieval of history, participants, and decisions.
234
+
235
+ ### 🏗️ API & Storage Improvements
236
+ - **Structured JSON Responses**: Meeting tools now return machine-readable JSON for better agent integration.
237
+ - **Smart Auto-Routing**: Global discussion messages are automatically routed to active meetings.
238
+ - **ID Generation**: Robust slug generation with Base64 fallback for non-ASCII topics (Chinese/Unicode).
239
+ - **Concurrency Control**: Shared `AsyncMutex` utility and native SQLite locking.
240
+ - **Status Reporting**: `mcp://nexus/status` now reports `storage_mode` and `is_degraded` flags.
241
+
242
+ ### 🧪 Quality Assurance
243
+ - **Comprehensive Test Suite**: Added 24+ integration and stress tests (100% Green).
244
+ - **Concurrency Stress Tests**: Validated data integrity under rapid message bursts.
245
+ - **Fallback Verification**: Confirmed system stability when native modules are unavailable.
246
+
247
+ ### 🛡️ Security
248
+ - **Hardened Project Deletion**: Renamed `delete_project` to `moderator_delete_project` and enforced explicit moderator validation to prevent unauthorized project destruction.
249
+ - **Path Sanitization**: Enhanced error handling to strip absolute local file paths from MCP error messages.
250
+
251
+ ### 📄 Resources & Documentation
252
+ - **New Resource**: Added `mcp://nexus/active-meeting` for instant access to the current meeting transcript and decisions.
253
+ - **Improved Tooling UX**: Documented return value structures and administrative requirements in tool definitions.
254
+ - **Manuals**: Updated `ASSISTANT_GUIDE.md` and both README versions with new admin tool documentation and Phase 2 best practices.
255
+
256
+ ## [v0.1.7] - 2025-12-30
257
+
258
+ ### ⚙️ CLI Simplification
259
+ - **Moderator flag**: Replaced `--moderator-id <id>` with simple `--moderator` boolean flag.
260
+ - Moderator: `--id Master-AI --moderator`
261
+ - Regular AI: `--id Assistant-AI` (no extra flag needed)
262
+
263
+ ### ✅ Tests
264
+ - Added session resource tests for role verification (Moderator/Regular).
265
+ - All 17 unit tests passing.
266
+
267
+ ## [v0.1.6] - 2025-12-29
268
+
269
+ ### 🔒 Concurrency Safety
270
+ - **AsyncMutex Lock**: Implemented mutex-based concurrency control to prevent race conditions during simultaneous file writes.
271
+ - Protected write operations:
272
+ - Discussion: `addGlobalLog()`, `pruneGlobalLogs()`, `clearGlobalLogs()`
273
+ - Registry: `saveProjectManifest()`, `renameProject()`, `deleteProject()`
274
+
275
+ ### 📦 Schema v2.0
276
+ - **Manifest Schema Enhancements**: Added new optional fields for cross-project collaboration and compatibility:
277
+ - `apiDependencies`: Map of projectId to version constraint (e.g., `">=v2.1"`)
278
+ - `gatewayCompatibility`: Gateway version compatibility string
279
+ - `api_versions`: Feature-level API versions
280
+ - `feature_tier`: Capability category declaration for interoperability
281
+
282
+ ## [v0.1.5] - 2025-12-29
283
+
284
+ ### 🚀 Major Features
285
+ - **Project ID Naming Convention**: Enforced `[prefix]_[technical-name]` standard with 13 type prefixes (web_, api_, chrome_, vscode_, mcp_, android_, ios_, flutter_, desktop_, lib_, bot_, infra_, doc_).
286
+ - **MCP Prompts Capability**: Added `init_project_nexus` prompt for guiding AI through proper project registration workflow.
287
+ - **delete_project Tool**: New admin tool for complete project removal (manifest, assets, registry entry).
288
+
289
+ ### 🔒 Guardrails
290
+ - Added `validateProjectId()` with runtime regex validation in `handleRegisterSession`, `handleSyncProjectAssets`, and `handleRenameProject`.
291
+ - Projects with invalid ID formats are now rejected at the API level.
292
+
293
+ ### ✨ Enhancements
294
+ - Resource names now display project type icons (e.g., "🌐 Website: web_example.com").
295
+ - Handler unit tests expanded to cover delete, rename, and validation scenarios.
296
+
297
+ ### 📄 Documentation
298
+ - Added "Project ID Conventions" section to README.md.
299
+ - Updated tool descriptions with Prefix Dictionary guidance.
300
+
301
+ ## [v0.1.4] - 2025-12-29
302
+
303
+ ### 🐛 Bug Fix
304
+ - Added shebang (`#!/usr/bin/env node`) to fix npx execution on Windows.
305
+
306
+ ## [v0.1.3] - 2025-12-29
307
+
308
+ ### 🔧 CI/CD
309
+ - Switched to npm Trusted Publishing (OIDC) - no more NPM_TOKEN needed.
310
+ - Upgraded to Node.js 22 for npm 11.5.1+ support.
311
+ - Added `--provenance` flag for supply chain security.
312
+
313
+ ## [v0.1.2] - 2025-12-29
314
+
315
+ ### 🔧 Refactoring
316
+ - Modularized codebase into `tools/`, `resources/`, and `storage/` modules.
317
+ - Reduced `index.ts` from 535 to 115 lines.
318
+ - Moved tests from `src/__tests__/` to top-level `tests/` directory.
319
+
320
+ ### 📦 CI/CD
321
+ - Changed GitHub Actions trigger from `release` to tag push (`v*`).
322
+
323
+ ### 📄 Documentation
324
+ - Added npm downloads badge.
325
+ - Fixed repository URLs to `n2n-nexus`.
326
+
327
+ ## [v0.1.1] - 2025-12-29
328
+
329
+ ### 📦 npm Release
330
+ - Published to npm as `n2n-nexus`.
331
+ - Updated README with `npx` configuration for easy MCP integration.
332
+ - Added CLI arguments documentation table.
333
+
334
+ ## [v0.1.0] - 2025-12-29
335
+
336
+ ### 🚀 Major Features
337
+ - **Project Asset Hub**: Centralized storage for Project Manifests, Internal Docs, and Assets (Images/Files).
338
+ - **Communication Channels**:
339
+ - `mcp://chat/global`: Real-time inter-agent messaging stream.
340
+ - `post_global_discussion`: Broadcast tool for coordination.
341
+ - **Topology Engine**:
342
+ - `get_global_topology`: Auto-generates dependency graphs based on manifest `relations`.
343
+ - **Global Knowledge Base**:
344
+ - New `docs/` directory structure for shared standards.
345
+ - Tools: `sync_global_doc`, `read_global_doc`, `list_global_docs`.
346
+ - **Self-Healing Storage**:
347
+ - Automatic repair of corrupted JSON registries or logs.
348
+ - Safe-defaults for missing configurations.
349
+
350
+ ### 🛠️ Tooling
351
+ - Added `update_project` for partial manifest patches.
352
+ - Added `rename_project` with auto-cascading reference updates across all projects.
353
+ - Added `register_session_context` for IDE session binding.
354
+ - Added `moderator_maintenance` for log pruning.
355
+
356
+ ### 📚 Documentation
357
+ - Updated `README.md` with complete architecture diagrams and data persistence details.
358
+ - Added `ASSISTANT_GUIDE.md` for AI-to-AI operational protocols.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2025] [Antigravity Dev Team]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.