@velarscript/desktop 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +247 -0
- package/dist/build.d.ts +53 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +351 -0
- package/dist/build.js.map +1 -0
- package/dist/compiler.d.ts +4 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +1967 -0
- package/dist/compiler.js.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +140 -0
- package/dist/config.js.map +1 -0
- package/dist/host.d.ts +3 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +71 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/package-host.d.ts +3 -0
- package/dist/package-host.d.ts.map +1 -0
- package/dist/package-host.js +20 -0
- package/dist/package-host.js.map +1 -0
- package/dist/test-runtime.d.ts +16 -0
- package/dist/test-runtime.d.ts.map +1 -0
- package/dist/test-runtime.js +475 -0
- package/dist/test-runtime.js.map +1 -0
- package/dist/worker.js +546 -0
- package/native/macos/VelarDesktopHost.swift +1258 -0
- package/native/macos/VelarScript.icns +0 -0
- package/native/macos/VelarTerminalHost.swift +203 -0
- package/native/node/project-transactions.js +157 -0
- package/native/node/worker.js +2220 -0
- package/package.json +63 -0
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
|
|
95
|
+
Derivative 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 [yyyy] [name of copyright owner]
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# @velarscript/desktop
|
|
2
|
+
|
|
3
|
+
The optional single-project VelarScript Desktop framework. Application authors
|
|
4
|
+
write one ordinary VelarScript source graph with the same components, JSX,
|
|
5
|
+
Look, state, derived values, resources, and actions used by
|
|
6
|
+
`@velarscript/web`. There is no user-facing renderer project, main project,
|
|
7
|
+
local server, port, or IPC layer.
|
|
8
|
+
|
|
9
|
+
Internally the package composes the Web compiler/runtime with a least-privilege
|
|
10
|
+
Node capability host and a thin operating-system WebView shell. Privileged APIs
|
|
11
|
+
remain asynchronous and are transported through a versioned bridge generated
|
|
12
|
+
by the framework. That separation is an implementation and security boundary,
|
|
13
|
+
not a second application programming model.
|
|
14
|
+
|
|
15
|
+
Each official target module captures the bridge identity, its data-valued
|
|
16
|
+
invoke operation, and any platform/environment snapshot fields when that module
|
|
17
|
+
initializes. Replacing a global bridge later cannot reroute an official API.
|
|
18
|
+
The system-WebView transport also captures its serializer, encoders, timers,
|
|
19
|
+
collections, Promise constructor, and native message handler before application
|
|
20
|
+
JavaScript executes, so ordinary dependency code cannot monkey-patch an active
|
|
21
|
+
capability call into a different transport.
|
|
22
|
+
`velar/desktop-test` is the intentional exception: the controller installs a
|
|
23
|
+
fresh isolated browser Page for each test, so the helper resolves and validates
|
|
24
|
+
one data-only controller snapshot per call instead of retaining authority from
|
|
25
|
+
the previous test.
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"formatVersion": 2,
|
|
30
|
+
"entry": "src/main.vel",
|
|
31
|
+
"outDir": "dist/renderer",
|
|
32
|
+
"publicDir": "public",
|
|
33
|
+
"extensions": ["@velarscript/desktop"],
|
|
34
|
+
"desktop": {
|
|
35
|
+
"productName": "Example",
|
|
36
|
+
"identifier": "com.example.app",
|
|
37
|
+
"permissions": {
|
|
38
|
+
"files": ["project"],
|
|
39
|
+
"processes": ["git"],
|
|
40
|
+
"terminal": true,
|
|
41
|
+
"network": ["https://api.example.com"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The macOS host uses the system WKWebView and never bundles Chromium, Electron,
|
|
48
|
+
or Tauri. Thin builds keep Node external and require Node.js 24 or newer. The
|
|
49
|
+
package supplies the borderless VelarScript mark as the default application
|
|
50
|
+
icon, so a project receives a branded Dock and Finder identity without owning
|
|
51
|
+
platform icon files. A future custom-icon contract must remain an explicit
|
|
52
|
+
project setting rather than replacing this package default implicitly.
|
|
53
|
+
The host resolves an explicit absolute `VELAR_DESKTOP_NODE`, absolute entries from
|
|
54
|
+
the launch environment's `PATH`, and trusted system package-manager locations
|
|
55
|
+
without a shell, then verifies the runtime version. Build-machine executable
|
|
56
|
+
paths and versions are not embedded in the application.
|
|
57
|
+
A future standalone profile must report its runtime bytes separately instead
|
|
58
|
+
of hiding them from the application size budget.
|
|
59
|
+
`velar package` asks the CLI package host to build the exact official language
|
|
60
|
+
server, the bounded project-task launcher, the platform build engine, and the
|
|
61
|
+
native PTY helper. They
|
|
62
|
+
are stored under `Contents/Resources/host` and counted separately as language,
|
|
63
|
+
task, build-engine, terminal-host, and capability-Worker bytes. The generated tools contain the official
|
|
64
|
+
Core/Web/Desktop compiler extensions and source-backed standard assets, so the
|
|
65
|
+
installed application neither searches `PATH` for `velar`, resolves project npm
|
|
66
|
+
packages, nor depends on the build workspace. The default Desktop size budget
|
|
67
|
+
is currently 32 MiB. It is an accounting threshold rather than an architecture
|
|
68
|
+
ceiling: a project may set `desktop.build.sizeBudgetBytes` to a larger measured
|
|
69
|
+
value when the bundle composition explains the growth. The package command
|
|
70
|
+
still reports every component and the application tree hash; size pressure must
|
|
71
|
+
not split a privileged owner across the renderer boundary.
|
|
72
|
+
|
|
73
|
+
Desktop owns `velar/desktop` and permission-scoped target implementations of
|
|
74
|
+
`velar/fs`, `velar/path`, `velar/process`, `velar/http`, and `velar/env`.
|
|
75
|
+
Packaged applications may call `languageServer() -> Promise<LanguageServer>`.
|
|
76
|
+
The returned owner sends and pulls bounded JSON message bodies through
|
|
77
|
+
`send(message)`, `next()`, and idempotent `close()`; Content-Length framing,
|
|
78
|
+
the exact official executable, and child-process ownership remain private to
|
|
79
|
+
Desktop. Only one pull may be pending, at most four servers may be live, and
|
|
80
|
+
document-generation retirement, project-grant replacement, Worker failure, or
|
|
81
|
+
host shutdown reaps the corresponding process group. This exact official tool
|
|
82
|
+
does not require a general process permission and cannot launch an arbitrary
|
|
83
|
+
command.
|
|
84
|
+
Applications with the `project` file grant may also call
|
|
85
|
+
`projectChanges() -> Promise<ProjectChanges>`. Desktop binds the returned owner
|
|
86
|
+
to the same durable `@velaros-ai/project` kernel that prepares and validates
|
|
87
|
+
transactions. The public surface is intentionally finite: `list(limit)`,
|
|
88
|
+
`get(transactionId)`, pull-based `subscribe()`, `apply(transactionId)`,
|
|
89
|
+
`rollback(transactionId)`, and idempotent `close()`. It exposes reviewable
|
|
90
|
+
intent, patch, diff, risk, revision, lifecycle, and timestamp projections, but
|
|
91
|
+
never the project root, persistence paths, policies, providers, old/new full
|
|
92
|
+
file contents, arbitrary metadata, or a caller-selected file operation.
|
|
93
|
+
Transactions and their latest projections are committed under the app-data
|
|
94
|
+
root before project mutation; a restarted Worker restores an interrupted
|
|
95
|
+
apply/rollback to its prior durable state and fails closed if an external edit
|
|
96
|
+
conflicts with that recovery. The JSONL change feed is fsynced before
|
|
97
|
+
subscribers observe a row. Subscriptions coalesce the latest record per
|
|
98
|
+
transaction and request a full `list()` rescan on bounded queue overflow.
|
|
99
|
+
Changing the project grant retires existing handles; an already-running
|
|
100
|
+
apply/rollback finishes against the original durable owner before that owner is
|
|
101
|
+
closed. The complete owner is bundled into the existing Node capability Worker
|
|
102
|
+
and adds about 4.39 MiB; there is still no Electron-style user main process,
|
|
103
|
+
second source graph, local server, port, or renderer-accessible IPC design.
|
|
104
|
+
|
|
105
|
+
Applications with the `project` file grant may also call
|
|
106
|
+
`startProjectTask(ProjectTaskCommand, arguments, options)`. The finite command
|
|
107
|
+
set is `check`, `test`, `browserTest`, `build`, `fix`, `package`, and `run`;
|
|
108
|
+
only `run` accepts program arguments. `browserTest` always runs all three
|
|
109
|
+
engines through the packaged official browser-test supervisor and cannot
|
|
110
|
+
accept a browser, output-directory, or CLI-flag override. The Playwright driver
|
|
111
|
+
is counted in the application bundle; matching Chromium, Firefox, and WebKit
|
|
112
|
+
binaries remain an explicit external Playwright cache and a missing engine
|
|
113
|
+
fails the task instead of silently reducing coverage.
|
|
114
|
+
The returned `ProjectTask` exposes its package-owned PID plus pull-based
|
|
115
|
+
`next()`, terminal `wait()`, and bounded `stop()` operations. Desktop fixes the
|
|
116
|
+
working directory to the current canonical project grant, injects only its
|
|
117
|
+
counted build-engine path, and for `package` only, the Worker-validated current
|
|
118
|
+
application Resources template. The package host rebuilds the target renderer
|
|
119
|
+
and copies the same versioned official tools and native system-WebView assets;
|
|
120
|
+
it does not resolve project `node_modules`, a source checkout, or `PATH`.
|
|
121
|
+
Desktop exposes no executable, shell, working-directory, environment,
|
|
122
|
+
package-manager, or caller-controlled browser-test option. Output is incrementally
|
|
123
|
+
decoded and tagged by `ProjectTaskOutputChannel`, only one pull may be active,
|
|
124
|
+
at most four tasks may live, output and timeout are bounded, and callers must
|
|
125
|
+
consume output before waiting. Explicit stop, timeout, document retirement,
|
|
126
|
+
project replacement, Worker failure, and host shutdown reuse the same
|
|
127
|
+
process-group termination and confirmed-reaping owner as `velar/process`.
|
|
128
|
+
Applications with the `project` file grant and an explicit
|
|
129
|
+
`desktop.permissions.terminal: true` grant may call
|
|
130
|
+
`openTerminal({columns, rows}) -> Promise<TerminalSession>`. Desktop fixes the
|
|
131
|
+
working directory to the current canonical project, launches only the user's
|
|
132
|
+
trusted login shell, and exposes no executable, shell path, cwd, environment,
|
|
133
|
+
or command-string option. The returned owner publishes the shell PID and
|
|
134
|
+
bounded `write(text)`, `resize(columns, rows)`, pull-based `next()`, terminal
|
|
135
|
+
`wait()`, and idempotent `close()` operations. Input chunks are capped at 1 MiB,
|
|
136
|
+
the decoded output queue applies PTY backpressure at 2 MiB and fails closed
|
|
137
|
+
above 4 MiB, one pull may be active, and at most four sessions may live. The
|
|
138
|
+
output stream must be consumed through its final `null` before `wait()`; an
|
|
139
|
+
explicit `close()` discards that requirement while still confirming cleanup. The
|
|
140
|
+
package-owned native helper and the shell occupy separate process groups;
|
|
141
|
+
Desktop publishes both to its native crash owner before returning the session.
|
|
142
|
+
Explicit close, document retirement, project replacement, Worker failure, and
|
|
143
|
+
host shutdown terminate and confirm reaping of both groups. Terminal output is
|
|
144
|
+
the PTY's UTF-8 text, including control sequences emitted by interactive
|
|
145
|
+
programs; presentation and session/tab orchestration remain application UX.
|
|
146
|
+
Applications with the `project` file grant may call
|
|
147
|
+
`selectProjectDirectory()` to open the native directory chooser. A successful
|
|
148
|
+
choice atomically replaces the single project grant for subsequent relative
|
|
149
|
+
`velar/fs`, `velar/path`, and default process-working-directory operations;
|
|
150
|
+
cancel returns `null`. `selectedProjectDirectory()` reports only a user-picked
|
|
151
|
+
or restored grant, while `projectDirectory()` continues to report the current
|
|
152
|
+
effective root, including the private app-data fallback before any selection.
|
|
153
|
+
The macOS host persists the user's explicit choice as a bounded bookmark and
|
|
154
|
+
restores it before renderer startup. Project selection has no arbitrary timeout
|
|
155
|
+
while the native chooser is open. Replacing the grant cancels unpublished
|
|
156
|
+
capability work and releases project-owned processes; filesystem effects that
|
|
157
|
+
already reached the operating system may still settle, with their retired
|
|
158
|
+
results discarded. The capability Worker revalidates the replacement directory
|
|
159
|
+
and keeps the independent `app-data` grant unchanged. This is one dynamic
|
|
160
|
+
single-project authority, not a renderer-owned allowlist and not a second file
|
|
161
|
+
API.
|
|
162
|
+
`velar/fs.createText` preserves Node's exclusive no-clobber contract inside the
|
|
163
|
+
capability Worker; authorization and creation remain one bounded native effect
|
|
164
|
+
rather than a renderer-side check followed by an overwriting write.
|
|
165
|
+
`replaceTextIfMatches` carries the same optimistic edit contract: file
|
|
166
|
+
mutations for one canonical target are coordinated inside the capability
|
|
167
|
+
Worker and a matching replacement commits by same-directory rename. External
|
|
168
|
+
processes outside the bridge are not silently described as participants in
|
|
169
|
+
that lock.
|
|
170
|
+
`watchFiles` also preserves Node's public pull contract and bounds: one active
|
|
171
|
+
`next()`, at most 128 live watchers, a 4,096-path/2 MiB coalescing queue, and
|
|
172
|
+
`rescan=true` when a native event cannot identify a safe path. Watcher handles
|
|
173
|
+
belong to the current document generation and granted roots. Explicit
|
|
174
|
+
`close()`, owner retirement, input shutdown, fatal drain, and a successful
|
|
175
|
+
project-root replacement all close them; a pending pull cannot publish an
|
|
176
|
+
event from the old project after authority changes.
|
|
177
|
+
Desktop preserves the shared HTTP failure model across its native bridge:
|
|
178
|
+
non-2xx, cancellation/timeout, and request/response transport failures remain
|
|
179
|
+
distinct typed errors instead of collapsing Worker failures into one string.
|
|
180
|
+
`process.start` is async on Node and Desktop. Process-only applications may
|
|
181
|
+
omit file grants and use the launch directory as the default working directory;
|
|
182
|
+
an explicit working directory must be inside a granted file root. Exact
|
|
183
|
+
executable grants prevent shell parsing but do not claim to OS-sandbox the
|
|
184
|
+
native program's own effects—product approval and tool policy remain outside
|
|
185
|
+
the language package. Process stdout/stderr crosses the worker bridge as
|
|
186
|
+
enum-tagged pull chunks consumed by `async for`; incremental UTF-8 decoding,
|
|
187
|
+
single-reader ownership, output bounds, and the consume-before-`wait` lifecycle
|
|
188
|
+
match the Node target. The renderer reuses Node's internal process host ABI for
|
|
189
|
+
value validation, Map snapshots, Promise operations, and result assembly, and
|
|
190
|
+
composes the compiler-owned UTF-8 budget runtime. Desktop does not maintain a
|
|
191
|
+
second semantic implementation and adds only its capability bridge and isolated
|
|
192
|
+
worker. HTTP response bodies cross the
|
|
193
|
+
bridge as bounded pull-based chunks, so timeout and cancellation remain active
|
|
194
|
+
through body consumption. Redirects continue only while every exact origin is
|
|
195
|
+
granted. `desktop.permissions.secrets` is disjoint from readable environment
|
|
196
|
+
permissions; `velar/http.secretHeader` lets the worker inject those values
|
|
197
|
+
without exposing them to the renderer, and cross-origin redirects strip every
|
|
198
|
+
secret-derived header. Large filesystem, process-input, and HTTP-request values use a bounded
|
|
199
|
+
bidirectional chunk transport instead of inheriting WebView message-size
|
|
200
|
+
accidents.
|
|
201
|
+
|
|
202
|
+
Each loaded main document owns a private bridge generation. Page request IDs
|
|
203
|
+
may restart at one after reload, but the native host translates the generation
|
|
204
|
+
and page ID to a host-global Worker request ID before forwarding. Committed
|
|
205
|
+
navigation retires the old generation: late responses are discarded, old
|
|
206
|
+
process groups are terminated, old HTTP streams are aborted, and the Worker
|
|
207
|
+
rejects any handle used by a different generation. Native completion injection
|
|
208
|
+
requires the private generation as well, so application JavaScript cannot
|
|
209
|
+
resolve a pending bridge request by invoking the transport hook with only a
|
|
210
|
+
guessed numeric ID. Filesystem work that has already reached the OS may finish;
|
|
211
|
+
its retired response is never routed into the replacement document.
|
|
212
|
+
Pending serialized requests and assembled response chunks each share a 128 MiB
|
|
213
|
+
aggregate bridge budget, so the 1,024-request count cannot multiply every
|
|
214
|
+
per-request limit into unbounded transport memory. A finite bridge timeout
|
|
215
|
+
sends a private generation-qualified cancellation before rejecting. Native
|
|
216
|
+
code discards the later response without treating it as an unknown protocol
|
|
217
|
+
message, and the Worker aborts an active HTTP request or stops a process that
|
|
218
|
+
has not safely transferred its public handle. Filesystem effects remain
|
|
219
|
+
non-cancellable and retain their bounded request reservation until they settle.
|
|
220
|
+
|
|
221
|
+
Filesystem content calls follow symlinks only when the canonical target stays
|
|
222
|
+
inside a granted root. Metadata, move, and removal operate on the final entry
|
|
223
|
+
instead; dangling links cannot be used as write targets. The renderer, native
|
|
224
|
+
worker, and deterministic test host independently enforce the same path,
|
|
225
|
+
file-size, list-count, list-text, result-shape, and replacement contracts.
|
|
226
|
+
Desktop path composition rejects sparse/accessor-backed Lists and checks the
|
|
227
|
+
combined result, not just each input. Native home, app-data, and project paths
|
|
228
|
+
must remain absolute and bounded. Readable environment values are snapshotted
|
|
229
|
+
from data descriptors under the same 64-variable, 64 KiB item, and 1 MiB total
|
|
230
|
+
budgets enforced by the native host.
|
|
231
|
+
|
|
232
|
+
```sh
|
|
233
|
+
velar package .
|
|
234
|
+
velar test . --browser=all
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`velar test --browser` runs `.browser.test.vel` files without opening a window.
|
|
238
|
+
It installs a deterministic, permission-aware in-memory Desktop filesystem,
|
|
239
|
+
finite ProjectChanges owner, and deterministic handles for manifest-granted
|
|
240
|
+
processes; the native worker keeps a separate integration suite for real
|
|
241
|
+
filesystem, process, network, and durable transaction enforcement. Test
|
|
242
|
+
modules may import the restricted `velar/desktop-test` helpers to inspect
|
|
243
|
+
app-data/project text, create a bounded test directory, and call
|
|
244
|
+
`seedProjectChange(transactionId, lifecycle, diff)` through the page's actual
|
|
245
|
+
capability bridge;
|
|
246
|
+
ordinary `velar/fs` remains application-side and is not faked in the test
|
|
247
|
+
controller process.
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { VelarDesktopConfig } from "./config.ts";
|
|
2
|
+
export interface DesktopBuildManifest {
|
|
3
|
+
readonly formatVersion: 2;
|
|
4
|
+
readonly kind: "velar-desktop-build";
|
|
5
|
+
readonly productName: string;
|
|
6
|
+
readonly identifier: string;
|
|
7
|
+
readonly version: string;
|
|
8
|
+
readonly platform: "macos";
|
|
9
|
+
readonly architecture: string;
|
|
10
|
+
readonly hostProtocolVersion: 1;
|
|
11
|
+
readonly runtime: {
|
|
12
|
+
readonly kind: "external-node";
|
|
13
|
+
readonly minimumMajor: 24;
|
|
14
|
+
readonly discovery: "environment-and-system-paths";
|
|
15
|
+
readonly embedded: false;
|
|
16
|
+
};
|
|
17
|
+
readonly applicationBundle: string;
|
|
18
|
+
readonly sizeBudgetBytes: number;
|
|
19
|
+
readonly sizes: {
|
|
20
|
+
readonly hostBytes: number;
|
|
21
|
+
readonly rendererBytes: number;
|
|
22
|
+
readonly capabilityHostBytes: number;
|
|
23
|
+
readonly languageServerBytes: number;
|
|
24
|
+
readonly projectTaskBytes: number;
|
|
25
|
+
readonly buildEngineBytes: number;
|
|
26
|
+
readonly terminalHostBytes: number;
|
|
27
|
+
readonly toolchainBytes: number;
|
|
28
|
+
readonly metadataBytes: number;
|
|
29
|
+
readonly totalBytes: number;
|
|
30
|
+
};
|
|
31
|
+
readonly sha256: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DesktopBuildResult {
|
|
34
|
+
readonly outputDirectory: string;
|
|
35
|
+
readonly applicationBundle: string;
|
|
36
|
+
readonly manifestPath: string;
|
|
37
|
+
readonly manifest: DesktopBuildManifest;
|
|
38
|
+
}
|
|
39
|
+
export type DesktopBuildSizes = DesktopBuildManifest["sizes"];
|
|
40
|
+
/**
|
|
41
|
+
* MIG-3: a budget failure that reports only the total forces upstream
|
|
42
|
+
* archaeology before anyone can judge whether raising the budget is safe. The
|
|
43
|
+
* composition — every component, its share, and the mandatory first-party
|
|
44
|
+
* tooling floor no project can shrink — makes that judgment possible in one
|
|
45
|
+
* pass, so this is the one message the failure prints.
|
|
46
|
+
*/
|
|
47
|
+
export declare function desktopSizeBudgetFailure(sizes: DesktopBuildSizes, sizeBudgetBytes: number): string | null;
|
|
48
|
+
export declare function formatDesktopBytes(value: number): string;
|
|
49
|
+
export declare function buildDesktopApplication(projectRoot: string, config: VelarDesktopConfig, buildRenderer: (outputDirectory: string) => Promise<void>, buildTool: (tool: {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly outputFile: string;
|
|
52
|
+
}) => Promise<void>): Promise<DesktopBuildResult>;
|
|
53
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;QAC/B,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC;QAC1B,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAC;QACnD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;QACrC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;QACrC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAClC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAClC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;QACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;CACzC;AAED,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAkE9D;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoBzG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,EAC1B,aAAa,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EACzD,SAAS,EAAE,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GACvF,OAAO,CAAC,kBAAkB,CAAC,CA6H7B"}
|