@dialt/sdk 0.23.0

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/README.md ADDED
@@ -0,0 +1,319 @@
1
+ # @dialt/sdk
2
+
3
+ The browser SDK for the [Dialt realtime voice API](https://dialt.com/docs/api/) -
4
+ the simplest way to build a realtime voice experience on the web. It owns microphone capture, echo
5
+ cancellation, streaming playback, interruptions and reconnects; Dialt runs the conversation loop.
6
+
7
+ ```sh
8
+ npm install @dialt/sdk
9
+ ```
10
+
11
+ Keep your persistent `ck_…` API key on your backend. Exchange it for a scoped browser credential
12
+ with `POST /api/v1/session-keys`, then connect from a user gesture:
13
+
14
+ ```js
15
+ import { ConverseClient } from '@dialt/sdk';
16
+
17
+ const credential = await fetch('/voice/session', {
18
+ method: 'POST',
19
+ credentials: 'same-origin',
20
+ }).then((response) => {
21
+ if (!response.ok) throw new Error(`Voice credential failed: ${response.status}`);
22
+ return response.json();
23
+ });
24
+
25
+ const client = new ConverseClient({
26
+ url: 'wss://dialt.com/ws',
27
+ sessionId: credential.session_id,
28
+ apiKey: credential.api_key,
29
+ mode: { kind: 'converse' },
30
+ });
31
+
32
+ startButton.addEventListener('click', async () => {
33
+ await client.unlockAudio();
34
+ await client.connect();
35
+ await client.startMic();
36
+ });
37
+ ```
38
+
39
+ `startMic()` resolves only after the AudioWorklet delivers an actual audio frame. A frame containing
40
+ all zero samples is valid silence; only receiving no frames is a stalled capture. The SDK waits a
41
+ bounded period, fully releases the track, worklet, and `AudioContext`, then reacquires once. If the
42
+ replacement also stalls, the promise rejects with `error.code === 'capture_stalled'` and
43
+ `error.retryable === false`.
44
+
45
+ Render capture status from the lifecycle events; do not add another retry or a timer that treats an
46
+ opened device as ready:
47
+
48
+ ```js
49
+ client.addEventListener('warming_up', () => showMicStatus('Preparing microphone…'));
50
+ client.addEventListener('recovering', ({ detail }) => {
51
+ showMicStatus(detail.code === 'capture_stalled'
52
+ ? 'Reconnecting microphone…'
53
+ : 'Updating microphone…');
54
+ });
55
+ client.addEventListener('listening', () => showMicStatus('Listening'));
56
+ client.addEventListener('failed', ({ detail }) => {
57
+ showMicError(detail.code, detail.error);
58
+ });
59
+ ```
60
+
61
+ `warming_up`, `listening`, `recovering`, and `failed` are emitted as typed events and through the
62
+ catch-all `event` listener. `startMic()` accepts `deviceId`; the constructor accepts
63
+ `inputDeviceId` and `captureStartupTimeoutMs` (default 2000 ms). Device management is generic:
64
+
65
+ ```js
66
+ const inputs = await client.getInputDevices();
67
+ await client.setInputDevice(inputs[0].deviceId); // restarts an active capture safely
68
+
69
+ client.addEventListener('devices_changed', ({ detail }) => {
70
+ renderInputPicker(detail.devices, detail.device_id);
71
+ });
72
+ client.addEventListener('input_device_changed', ({ detail }) => {
73
+ selectInput(detail.device_id); // null means follow the system default
74
+ });
75
+ ```
76
+
77
+ The SDK listens for `navigator.mediaDevices.devicechange` while its microphone is active. It
78
+ restarts capture when the selected input disappears or the system-default input changes, and emits
79
+ the refreshed audio-input list. Call `setInputDevice(null)` to return to the system default.
80
+ `stopMic()` removes the listener and is a cancellation barrier: when it resolves, even an earlier
81
+ non-abortable `getUserMedia()` request has settled and any late track has been released.
82
+
83
+ A `silent_mic` event means the server has received sustained digital silence or an unusually
84
+ low startup signal. Treat it as a nonfatal warning: keep the session live while prompting the
85
+ user to check the selected input, hardware mute, and browser and operating-system permissions.
86
+ The event includes `reason`, `duration_ms`, and the observed PCM16 `peak`.
87
+
88
+ ### Browser support
89
+
90
+ The same Browser SDK runs across platforms; there is no separate Chrome SDK. Its API compatibility
91
+ targets are Chromium (including Chrome, Brave and Edge), Firefox and WebKit (including Safari and
92
+ current iOS builds of Chrome and Brave). This is not a production-certification matrix: browser and
93
+ device combinations still require the physical validation described below. WebSocket is the
94
+ default transport everywhere. Experimental WebRTC automatically falls back to WebSocket on WebKit
95
+ so the SDK-owned echo-cancellation path remains in the audio loop.
96
+
97
+ Browser automation cannot validate acoustic echo cancellation, physical output level or Bluetooth
98
+ routing. Certify those on real devices when adding a new browser/engine version, especially an iOS
99
+ build using Apple's alternative-browser-engine entitlement.
100
+
101
+ Playback stays at unity gain. The SDK does not add a limiter, boost output, select a physical
102
+ speaker, or manipulate `navigator.audioSession`: browsers and operating systems own maximum device
103
+ volume and routing, and mobile browsers may attenuate playback while microphone capture is active.
104
+ Keeping capture active preserves barge-in; applications that require guaranteed speaker routing
105
+ need a native media integration.
106
+
107
+ Each inbound JSON frame is emitted once under its typed event name and once under the catch-all
108
+ `event` name. Choose one subscription style for a given handler; registering it on both will render
109
+ the same transcript twice.
110
+
111
+ Automatic WebSocket reconnect resumes conversation context and deferred jobs with the latest server
112
+ token. To preserve the same bounded resume opportunity across a full page reload, persist the SDK's
113
+ opaque state in tab-scoped storage and import it into the replacement client:
114
+
115
+ ```js
116
+ const storageKey = 'converse-resume-state';
117
+ const clientOptions = {
118
+ url: 'wss://dialt.com/ws',
119
+ sessionId: credential.session_id,
120
+ apiKey: credential.api_key,
121
+ mode: originalMode, // reconstruct the same options used before reload
122
+ };
123
+
124
+ let savedResumeState = null;
125
+ try {
126
+ savedResumeState = JSON.parse(sessionStorage.getItem(storageKey) || 'null');
127
+ } catch {
128
+ sessionStorage.removeItem(storageKey);
129
+ }
130
+
131
+ const client = new ConverseClient(clientOptions);
132
+ if (savedResumeState !== null) {
133
+ try {
134
+ client.importResumeState(savedResumeState);
135
+ } catch {
136
+ sessionStorage.removeItem(storageKey);
137
+ }
138
+ }
139
+
140
+ client.addEventListener('resume_state', ({ detail }) => {
141
+ if (detail.state) sessionStorage.setItem(storageKey, JSON.stringify(detail.state));
142
+ else sessionStorage.removeItem(storageKey);
143
+ });
144
+ ```
145
+
146
+ `exportResumeState()` returns the current versioned state (or `null`), and
147
+ `importResumeState(state)` may install it before `connect()`. Reconstruct the same client options on
148
+ the new page: explicit mode fields override stashed configuration, so relying on constructor defaults
149
+ can change the resumed session. Treat the value like a short-lived credential: prefer `sessionStorage` over cross-tab or long-lived storage, and never send it anywhere
150
+ except back to Dialt through the SDK. The server accepts it only during its short resume window
151
+ and only for the identity that created it. The SDK rotates the saved state after every successful
152
+ connection and clears it after an intentional end or `resume_failed`. If a persisted token has
153
+ expired, `connect()` rejects and emits `resume_failed`; offer a deliberate fresh start.
154
+
155
+ A terminal `resume_failed` event stops automatic retries; end local capture and let the caller
156
+ deliberately start a fresh session.
157
+
158
+ Text sessions use the ordinary Dialt model, instructions, tools and events without opening a
159
+ microphone or audio pipeline:
160
+
161
+ ```js
162
+ const textClient = new ConverseClient({
163
+ url: 'wss://dialt.com/ws',
164
+ sessionId: credential.session_id,
165
+ apiKey: credential.api_key,
166
+ mode: { kind: 'converse', modality: 'text' },
167
+ });
168
+ await textClient.connect();
169
+ textClient.sendText('What is the weather like?');
170
+ ```
171
+
172
+ `sendText(text)` commits one user turn and returns whether it was written to the live connection. (In a voice session `sendText` remains the user-role `injectContext` shorthand and returns its acknowledgement promise.)
173
+ The usual `asr`, `turn`, `text_delta`, `utterance`, and `done` events follow without audio. Text
174
+ mode is WebSocket-only; microphone and caller-owned audio methods reject.
175
+
176
+ Hosts can also add silent application context to either modality. Set `reply: true` when the model
177
+ should proactively announce the update:
178
+
179
+ ```js
180
+ client.injectContext('Claude Code finished. Tell the user briefly.', {
181
+ role: 'context',
182
+ reply: true,
183
+ messageId: 'job-42-complete',
184
+ });
185
+ ```
186
+
187
+ `injectContext()` returns a promise resolving to the broker's correlated
188
+ `{type: 'inject_context_ack', message_id, accepted, ...}`. Its role defaults to `'context'`; use
189
+ `'user'` only when the text should be represented as a real user turn. `reply` defaults to false.
190
+
191
+ Browser setup and events are in the [browser guide](https://dialt.com/docs/api/browser/).
192
+ Wire-level playback and tools are in the [WebSocket guide](https://dialt.com/docs/api/websocket/).
193
+
194
+ Tool declarations pass through in `mode.tools`. `expected_duration` says what the caller should
195
+ hear: `"instant"` for fast lookups (the caller hears the answer directly), `"seconds"` for anything
196
+ that takes more than about a second (the assistant acknowledges first, then answers when the result
197
+ arrives), `"long"` for agent or batch jobs; leave it out and Dialt learns from observed results.
198
+ `status_label` supplies a short user-safe name for pending work:
199
+
200
+ ```js
201
+ mode: {
202
+ kind: "converse",
203
+ tools: [{
204
+ name: "lookup_order",
205
+ description: "Look up an order by ID.",
206
+ parameters: { type: "object", properties: { order_id: { type: "string" } } },
207
+ read_only: true,
208
+ expected_duration: "instant",
209
+ status_label: "order lookup",
210
+ }],
211
+ }
212
+ ```
213
+
214
+ For host jobs that should outlive the current voice turn — a coding-agent task, report generation,
215
+ anything the caller should not wait on — declare the tool as a background job:
216
+
217
+ ```js
218
+ mode: {
219
+ kind: "converse",
220
+ tools: [{
221
+ name: "run_task",
222
+ description: "Run a long coding task and report when done.",
223
+ parameters: { type: "object", properties: { instruction: { type: "string" } } },
224
+ deferred: true, // job may outlive the voice turn
225
+ deferred_timeout: 7200, // seconds the detached job may run
226
+ notify_on_complete: true, // speak up when the result lands, even mid-topic
227
+ status_label: "coding task",
228
+ }],
229
+ }
230
+ ```
231
+
232
+ Acknowledge the individual call to release the voice turn, then continue the work in the background:
233
+
234
+ ```js
235
+ client.sendToolDeferred(event.detail.id, {
236
+ handle: `cc-${event.detail.id}`, statusLabel: "Claude Code task",
237
+ });
238
+ ```
239
+
240
+ The handle names *that call*, not your worker — mint a fresh one each time (deriving it from the
241
+ call id, as above, is the simplest way) and check the acknowledgement. Re-using a live handle is
242
+ rejected with `{ accepted: false, reason: "handle_in_use" }`, and a rejected defer is not a
243
+ deferral: the call stays on the ordinary tool timeout and will expire while you believe it is
244
+ running in the background. Route several calls to one long-lived worker with your own
245
+ handle-to-worker map instead.
246
+
247
+ The conversation carries on while the job runs: the agent narrates the hand-off, the caller can talk
248
+ about something else, and when the host reports the result the broker voices it as a completion
249
+ turn (`notify_on_complete`). The user can interrupt that narration or cancel the pending job at any
250
+ point, and reconnects resume pending jobs via the latest server token. See the
251
+ [background tools guide](https://dialt.com/docs/api/background-tools/) for the full
252
+ lifecycle, including progress updates and the delivery-failure contract.
253
+
254
+ A running job that discovers it needs a mid-call decision raises it with
255
+ `sendToolPartialResult(id, content, { interaction: { id, prompt, options } })` — the broker asks
256
+ the user by voice at the next opportunity, with a wire-visible lifecycle (`tool_job_narration`,
257
+ tracked via `narrationState`/`interactionState`). If the decision gets made elsewhere first (e.g.
258
+ clicked in your own UI) or newer intent makes it moot, close it without completing the call:
259
+
260
+ ```js
261
+ const ack = await client.sendToolInteractionUpdate(
262
+ event.detail.id, "overwrite-1", "resolved", { note: "approved in the IDE" });
263
+ // ack.applied === false carries a stable reason (e.g. "already_closed") for late duplicates.
264
+ ```
265
+
266
+ Built-in web search remains bridge-first. A server `tool_cancel` can represent timeout/discard or
267
+ an explicit user request to cancel pending work; hosts should stop that call promptly.
268
+
269
+ ### WebRTC transport (experimental)
270
+
271
+ Experimental: the API is stable, but this transport is newly shipped and still being hardened on
272
+ real networks; `ws` remains the default and recommended fallback.
273
+
274
+ Pass `transport: 'webrtc'` to `ConverseClient` to carry the call over WebRTC (UDP) instead of the
275
+ default WebSocket — more resilient to jitter and packet loss on weak networks. `ws` remains the
276
+ default. Safari/WebKit falls back to `ws` automatically. See the
277
+ [browser guide's WebRTC section](https://dialt.com/docs/api/browser/#webrtc).
278
+
279
+ Dialt-authored SDK code is licensed under the [Apache License 2.0](LICENSE). The bundled AEC
280
+ module contains components under their own terms; see [NOTICE](NOTICE) and
281
+ [THIRD_PARTY_LICENSES](THIRD_PARTY_LICENSES/README.md). These licenses do not apply to the hosted
282
+ Dialt service, its models, or its server-side implementation.
283
+
284
+ ### Ambience: background music and the thinking sound
285
+
286
+ ```js
287
+ const client = new ConverseClient({ url, sessionId, apiKey, mode, ambience: 'thinking' });
288
+ client.setAmbience('continuous'); // switch live; 'off' | 'thinking' | 'continuous'
289
+ ```
290
+
291
+ `ambience` (default `'thinking'`; pass `'off'` to opt out) plays a soft generative bed through the
292
+ SDK's own player:
293
+
294
+ - `'continuous'`: under the whole call from the first reply onward (it never leads), so the silence
295
+ between turns feels connected.
296
+ - `'thinking'`: silent, except while Dialt is blocking on a tool result with nothing to say (the
297
+ server's `working` event - client tools, `web_search`, `think_deeply`). After ~1.5 s it fades in;
298
+ it fades out again under the first syllables of the reply. A caller waiting on a slow backend
299
+ hears "still working" instead of dead air, and nothing else.
300
+
301
+ Pass an object to tune the envelope: `{ mode: 'thinking', afterS: 1.5, fadeInS: 1.5, fadeOutS: 0.3,
302
+ level: 1 }` (`level` is a linear multiplier on the bed's built-in peak of about -21 dBFS). The bed is
303
+ mixed into the same scheduled chunks as reply audio, so it is inside the echo canceller's far-end
304
+ reference, including the SDK's WASM canceller on WebKit/iOS; it is never queued ahead of a reply and
305
+ never counts toward barge `discarded_ms`. WebSocket transport only: over webrtc the SDK player is not
306
+ in the audio path, so the local ambience stays silent and the server-mixed `mode.background_audio`
307
+ bed is the option there.
308
+
309
+ ## Repository development
310
+
311
+ `package.json` is the version source and `CHANGELOG.md` records compatibility changes. Production
312
+ uses the checked-in copy under `web/vendor/converse/`.
313
+
314
+ Before release, run:
315
+
316
+ ```sh
317
+ npm run check
318
+ npm run pack:check
319
+ ```
@@ -0,0 +1,9 @@
1
+ # Third-party components
2
+
3
+ `src/aec3-wasm.js` is generated with Emscripten from `webrtc-audio-processing` v2.1,
4
+ WebRTC, Abseil 20240722.0, and their audio-processing dependencies. The generated runtime may
5
+ also contain portions of Emscripten system libraries, including musl and libc++abi.
6
+
7
+ The corresponding copyright, license, disclaimer, and patent texts are reproduced in this
8
+ directory. These components remain under their respective terms; the SDK Apache License 2.0
9
+ does not replace them.
@@ -0,0 +1,203 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ https://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
+ https://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.
203
+
@@ -0,0 +1,102 @@
1
+ Emscripten is available under 2 licenses, the MIT license and the
2
+ University of Illinois/NCSA Open Source License.
3
+
4
+ Both are permissive open source licenses, with little if any
5
+ practical difference between them.
6
+
7
+ The reason for offering both is that (1) the MIT license is
8
+ well-known, while (2) the University of Illinois/NCSA Open Source
9
+ License allows Emscripten's code to be integrated upstream into
10
+ LLVM, which uses that license, should the opportunity arise.
11
+
12
+ The full text of both licenses follows.
13
+
14
+ ==============================================================================
15
+
16
+ Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file.
17
+
18
+ Permission is hereby granted, free of charge, to any person obtaining a copy
19
+ of this software and associated documentation files (the "Software"), to deal
20
+ in the Software without restriction, including without limitation the rights
21
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
+ copies of the Software, and to permit persons to whom the Software is
23
+ furnished to do so, subject to the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be included in
26
+ all copies or substantial portions of the Software.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
34
+ THE SOFTWARE.
35
+
36
+ ==============================================================================
37
+
38
+ Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file.
39
+ All rights reserved.
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining a
42
+ copy of this software and associated documentation files (the
43
+ "Software"), to deal with the Software without restriction, including
44
+ without limitation the rights to use, copy, modify, merge, publish,
45
+ distribute, sublicense, and/or sell copies of the Software, and to
46
+ permit persons to whom the Software is furnished to do so, subject to
47
+ the following conditions:
48
+
49
+ Redistributions of source code must retain the above copyright
50
+ notice, this list of conditions and the following disclaimers.
51
+
52
+ Redistributions in binary form must reproduce the above
53
+ copyright notice, this list of conditions and the following disclaimers
54
+ in the documentation and/or other materials provided with the
55
+ distribution.
56
+
57
+ Neither the names of Mozilla,
58
+ nor the names of its contributors may be used to endorse
59
+ or promote products derived from this Software without specific prior
60
+ written permission.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
63
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
64
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
65
+ IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
66
+ ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
67
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
68
+ SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
69
+
70
+ ==============================================================================
71
+
72
+ This program uses portions of Node.js source code located in src/library_path.js,
73
+ in accordance with the terms of the MIT license. Node's license follows:
74
+
75
+ """
76
+ Copyright Joyent, Inc. and other Node contributors. All rights reserved.
77
+ Permission is hereby granted, free of charge, to any person obtaining a copy
78
+ of this software and associated documentation files (the "Software"), to
79
+ deal in the Software without restriction, including without limitation the
80
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
81
+ sell copies of the Software, and to permit persons to whom the Software is
82
+ furnished to do so, subject to the following conditions:
83
+
84
+ The above copyright notice and this permission notice shall be included in
85
+ all copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
90
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
93
+ IN THE SOFTWARE.
94
+ """
95
+
96
+ The musl libc project is bundled in this repo, and it has the MIT license, see
97
+ system/lib/libc/musl/COPYRIGHT
98
+
99
+ The third_party/ subdirectory contains code with other licenses. None of it is
100
+ used by default, but certain options use it (e.g., the optional closure compiler
101
+ flag will run closure compiler from third_party/).
102
+
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright(c)1995,97 Mark Olesen <olesen@me.QueensU.CA>
3
+ * Queen's Univ at Kingston (Canada)
4
+ *
5
+ * Permission to use, copy, modify, and distribute this software for
6
+ * any purpose without fee is hereby granted, provided that this
7
+ * entire notice is included in all copies of any software which is
8
+ * or includes a copy or modification of this software and in all
9
+ * copies of the supporting documentation for such software.
10
+ *
11
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
12
+ * IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR QUEEN'S
13
+ * UNIVERSITY AT KINGSTON MAKES ANY REPRESENTATION OR WARRANTY OF ANY
14
+ * KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS
15
+ * FITNESS FOR ANY PARTICULAR PURPOSE.
16
+ *
17
+ * All of which is to say that you can do what you like with this
18
+ * source code provided you don't try to sell it as your own and you
19
+ * include an unaltered copy of this message (including the
20
+ * copyright).
21
+ *
22
+ * It is also implicitly understood that bug fixes and improvements
23
+ * should make their way back to the general Internet community so
24
+ * that everyone benefits.
25
+ */