dsh-opencode-go 0.2.0 → 0.2.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.
Files changed (44) hide show
  1. package/README.en.md +20 -18
  2. package/README.md +26 -18
  3. package/THIRD_PARTY_NOTICES.md +5 -1
  4. package/docs/advanced.en.md +17 -13
  5. package/docs/advanced.md +18 -13
  6. package/docs/assets/usage-history-desktop.jpg +0 -0
  7. package/docs/assets/usage-history-mobile.jpg +0 -0
  8. package/docs/assets/usage-history-models.jpg +0 -0
  9. package/docs/development.md +23 -9
  10. package/docs/usage-analytics.en.md +34 -85
  11. package/docs/usage-analytics.md +34 -85
  12. package/docs/verification.md +50 -13
  13. package/lib/build-info.json +1 -1
  14. package/lib/client.js +2111 -2257
  15. package/lib/free-http-worker.js +32 -0
  16. package/lib/index.js +3078 -1899
  17. package/lib/types/accounts.d.ts +2 -2
  18. package/lib/types/adapter.d.ts +24 -9
  19. package/lib/types/analytics.d.ts +22 -332
  20. package/lib/types/catalog.d.ts +35 -76
  21. package/lib/types/client/AnalyticsDialog.d.ts +11 -18
  22. package/lib/types/client/Section.d.ts +3 -13
  23. package/lib/types/client/UsagePill.d.ts +10 -3
  24. package/lib/types/client/controller.d.ts +10 -8
  25. package/lib/types/client/dashboard-copy.d.ts +58 -0
  26. package/lib/types/client/index.d.ts +9 -0
  27. package/lib/types/client/presentation.d.ts +36 -72
  28. package/lib/types/config.d.ts +5 -1
  29. package/lib/types/contracts.d.ts +80 -25
  30. package/lib/types/conversion.d.ts +10 -2
  31. package/lib/types/free-channel.d.ts +21 -0
  32. package/lib/types/free-http-worker.d.ts +1 -0
  33. package/lib/types/free-policy.d.ts +4 -0
  34. package/lib/types/free-protocol.d.ts +16 -0
  35. package/lib/types/free-runtime.d.ts +2 -0
  36. package/lib/types/free-socks-tunnel.d.ts +4 -0
  37. package/lib/types/free-transport.d.ts +19 -0
  38. package/lib/types/index.d.ts +1 -1
  39. package/lib/types/pricing.d.ts +29 -0
  40. package/lib/types/sdk-types.d.ts +1577 -2890
  41. package/lib/types/transport.d.ts +13 -5
  42. package/lib/vendor-licenses.txt +79 -55
  43. package/package.json +4 -4
  44. package/docs/assets/usage-panel.png +0 -0
@@ -0,0 +1,32 @@
1
+ // src/free-http-worker.ts
2
+ var headersSent = false;
3
+ function write(bytes) {
4
+ return new Promise((resolve, reject) => process.stdout.write(bytes, (error) => error ? reject(error) : resolve()));
5
+ }
6
+ try {
7
+ const chunks = [];
8
+ for await (const chunk of process.stdin) chunks.push(Buffer.from(chunk));
9
+ const input = JSON.parse(Buffer.concat(chunks).toString());
10
+ const options = {
11
+ method: input.method,
12
+ headers: input.headers,
13
+ redirect: input.redirect,
14
+ ...input.body === void 0 ? {} : { body: new Uint8Array(Buffer.from(input.body, "base64")) },
15
+ ...input.proxy ? { proxy: input.proxy } : {}
16
+ };
17
+ const response = await fetch(input.url, options);
18
+ const metadata = {
19
+ status: response.status,
20
+ statusText: response.statusText,
21
+ headers: [...response.headers],
22
+ url: response.url,
23
+ redirected: response.redirected
24
+ };
25
+ await write(JSON.stringify(metadata) + "\n");
26
+ headersSent = true;
27
+ if (response.body) for await (const chunk of response.body) await write(chunk);
28
+ } catch {
29
+ if (!headersSent) await write(JSON.stringify({ error: "Free HTTP worker could not send the request" }) + "\n").catch(() => {
30
+ });
31
+ process.exitCode = 1;
32
+ }