@spikonado/sprocket 0.3.2 → 0.3.4-dev.04deb785bd4d32787658e847593187577d69a7fc

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 (43) hide show
  1. package/README.md +18 -2
  2. package/bin/sprocket.js +1 -1
  3. package/lib/launcher.js +36 -10
  4. package/lib/update-api.js +5 -0
  5. package/lib/update.js +1036 -0
  6. package/package.json +6 -6
  7. package/web/_app/immutable/assets/0.D9kFaRQb.css +2 -0
  8. package/web/_app/immutable/assets/2.CMU7pdv8.css +1 -0
  9. package/web/_app/immutable/chunks/2EswWPt9.js +70 -0
  10. package/web/_app/immutable/chunks/6FQ4cSov.js +1 -0
  11. package/web/_app/immutable/chunks/CD7JWMei.js +1 -0
  12. package/web/_app/immutable/chunks/CirtoWSJ.js +3 -0
  13. package/web/_app/immutable/chunks/D9pQdF5A.js +6 -0
  14. package/web/_app/immutable/chunks/DxnLzla4.js +1 -0
  15. package/web/_app/immutable/chunks/{C7n7Hkve.js → VSK6LhsJ.js} +1 -1
  16. package/web/_app/immutable/chunks/aSUXxYi9.js +2 -0
  17. package/web/_app/immutable/chunks/mWKhuXx1.js +1 -0
  18. package/web/_app/immutable/entry/app.BUemioih.js +2 -0
  19. package/web/_app/immutable/entry/start.Dya3HLNw.js +1 -0
  20. package/web/_app/immutable/nodes/0.CgqhmoX9.js +1 -0
  21. package/web/_app/immutable/nodes/1.DxOJRkyo.js +1 -0
  22. package/web/_app/immutable/nodes/2.CD4fjwD6.js +127 -0
  23. package/web/_app/immutable/nodes/3.8Yz-D-Rp.js +1 -0
  24. package/web/_app/immutable/nodes/4.3-nMfBiZ.js +1 -0
  25. package/web/_app/version.json +1 -1
  26. package/web/callback.html +16 -15
  27. package/web/index.html +13 -12
  28. package/web/pair.html +16 -16
  29. package/web/_app/immutable/assets/0.CAFzdT87.css +0 -2
  30. package/web/_app/immutable/chunks/B2QV2lSm.js +0 -1
  31. package/web/_app/immutable/chunks/BQbJFoq8.js +0 -1
  32. package/web/_app/immutable/chunks/D-3DgMVM.js +0 -3
  33. package/web/_app/immutable/chunks/DQzmXkOB.js +0 -1
  34. package/web/_app/immutable/chunks/DXwWhsEw.js +0 -6
  35. package/web/_app/immutable/chunks/D_6EnlQE.js +0 -2
  36. package/web/_app/immutable/chunks/DtbzskMF.js +0 -1
  37. package/web/_app/immutable/entry/app.CeGw4OSi.js +0 -2
  38. package/web/_app/immutable/entry/start.B77P4R2b.js +0 -1
  39. package/web/_app/immutable/nodes/0.DmC-g_Lj.js +0 -1
  40. package/web/_app/immutable/nodes/1.Djk_ySAI.js +0 -1
  41. package/web/_app/immutable/nodes/2.DOq86jPW.js +0 -124
  42. package/web/_app/immutable/nodes/3.D40OcmEn.js +0 -1
  43. package/web/_app/immutable/nodes/4.coTLLCMq.js +0 -1
package/README.md CHANGED
@@ -27,7 +27,7 @@ npx @spikonado/sprocket
27
27
 
28
28
  The above runs Sprocket through your browser unless you have the desktop app installed.
29
29
 
30
- ### Desktop App
30
+ ### Desktop app
31
31
 
32
32
  Install it for your OS from the latest [GitHub Release Artifacts](https://github.com/spikonado/sprocket/releases) and run it.
33
33
 
@@ -63,6 +63,9 @@ Override with `SPROCKET_DATA_DIR`.
63
63
 
64
64
  | Command | Behavior |
65
65
  | --------------------------- | ------------------------------------------------------------------------------ |
66
+ | `sprocket update` | Update a global npm, bun, pnpm, or yarn install on the current channel. |
67
+ | `sprocket update --check` | Report whether an update is available without installing. |
68
+ | `sprocket upgrade` | Alias for `update`. |
66
69
  | `sprocket serve` | Run the local server in the foreground without launching a client. |
67
70
  | `sprocket serve --api-only` | Serve only `/api`; intended for development (see [Development](#development)). |
68
71
 
@@ -77,6 +80,7 @@ Common Sprocket server overrides are available as environment variables:
77
80
  | `SPROCKET_HOST` | Bind host; defaults to `127.0.0.1`. |
78
81
  | `SPROCKET_DESKTOP_EXECUTABLE` | Full path to the desktop executable to be used by the Sprocket CLI. |
79
82
  | `PUBLIC_CONVEX_URL` | Convex deployment used by the agent runtime. |
83
+ | `PUBLIC_MODEL_GATEWAY_URL` | Public AI gateway origin for the UI catalog (`GET /api/v1/models`). |
80
84
  | `SPROCKET_STATIC_DIR` | Web build to serve instead of the bundled build. |
81
85
 
82
86
  ## Development
@@ -101,15 +105,24 @@ Start the browser development environment:
101
105
  bun dev
102
106
  ```
103
107
 
104
- After creating a convex deployment and configuring authkit following the instructions, configure the Convex deployment with the API key for each model provider you want to enable.
108
+ After creating a Convex deployment and configuring AuthKit, give the deployment an API key for each model provider you want to enable.
105
109
 
106
110
  This runs Vite at `http://localhost:5173` and the Rust API at `http://127.0.0.1:7731`, with development state kept in `.sprocket-dev` inside the repository.
111
+ It targets the dev Convex deployment. To run against the production Convex
112
+ deployment with `~/.sprocket` state instead:
113
+
114
+ ```sh
115
+ bun dev:prod
116
+ ```
117
+
107
118
  To develop against Electron instead, run:
108
119
 
109
120
  ```sh
110
121
  bun dev:desktop
111
122
  ```
112
123
 
124
+ The `dev:prod` / `dev:prod:desktop` variants use the production Convex deployment and `~/.sprocket`.
125
+
113
126
  ### Building and testing
114
127
 
115
128
  ```sh
@@ -131,6 +144,9 @@ Published installers come from GitHub Releases; the `sprocket` CLI is published
131
144
  ## Troubleshooting
132
145
 
133
146
  - If `17731` is already occupied, set `SPROCKET_PORT` before launching.
147
+ - If installed sign-in cannot save or restore its native session, check that
148
+ your operating system credential service is available. Linux development
149
+ environments need a working Secret Service provider.
134
150
  - If `sprocket` opens the browser instead of the desktop app, install `sprocket-desktop` from [GitHub Releases](https://github.com/spikonado/sprocket/releases) onto `PATH`, or set `SPROCKET_DESKTOP_EXECUTABLE`.
135
151
  - Unsigned macOS and Windows desktop builds may need a Gatekeeper / SmartScreen override the first time you open them.
136
152
  - Contact [aarav@spikonado.com](mailto:aarav@spikonado.com) for help.
package/bin/sprocket.js CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  import { launch } from '../lib/launcher.js';
4
4
 
5
- launch(process.argv.slice(2));
5
+ await launch(process.argv.slice(2));
package/lib/launcher.js CHANGED
@@ -2,7 +2,8 @@ import { spawnSync } from 'node:child_process';
2
2
  import { accessSync, chmodSync, constants, readFileSync } from 'node:fs';
3
3
  import { createRequire } from 'node:module';
4
4
  import path from 'node:path';
5
- import { fileURLToPath } from 'node:url';
5
+
6
+ import { createHost, parseUpdateArgs, runUpdateCli, UPDATE_API_FILENAME } from './update.js';
6
7
 
7
8
  const require = createRequire(import.meta.url);
8
9
 
@@ -74,20 +75,45 @@ export function run(binary, args, options = {}) {
74
75
  return result.status ?? 1;
75
76
  }
76
77
 
77
- export function launch(args) {
78
+ export function nativeChildEnvironment(env, staticDir, updateNode, updateScript) {
79
+ const next = {
80
+ ...env,
81
+ SPROCKET_STATIC_DIR: env.SPROCKET_STATIC_DIR || staticDir,
82
+ SPROCKET_UPDATE_NODE: updateNode,
83
+ SPROCKET_UPDATE_SCRIPT: updateScript
84
+ };
85
+ delete next.SPROCKET_UPDATE_MANAGED;
86
+ return next;
87
+ }
88
+
89
+ export async function launch(args, options = {}) {
90
+ const env = { ...(options.env ?? process.env) };
91
+ delete env.SPROCKET_UPDATE_MANAGED;
92
+ const parsed = parseUpdateArgs(args);
93
+ if (parsed.kind !== 'none') {
94
+ const code = await runUpdateCli(parsed, options.host ?? createHost({ env }));
95
+ process.exitCode = code;
96
+ return code;
97
+ }
98
+
78
99
  try {
79
- const packageRoot = path.dirname(fileURLToPath(import.meta.url));
80
- const staticDir = path.resolve(packageRoot, '../web');
81
- const binary = resolveNativeBinary();
82
- ensureExecutable(binary);
100
+ const libDir = options.libDir ?? import.meta.dirname;
101
+ const staticDir = path.resolve(libDir, '../web');
102
+ const binary = (options.resolveBinary ?? resolveNativeBinary)();
103
+ (options.ensureExecutable ?? ensureExecutable)(binary);
83
104
  process.exitCode = run(binary, args, {
84
- env: {
85
- ...process.env,
86
- SPROCKET_STATIC_DIR: process.env.SPROCKET_STATIC_DIR || staticDir
87
- }
105
+ env: nativeChildEnvironment(
106
+ env,
107
+ staticDir,
108
+ options.execPath ?? process.execPath,
109
+ path.resolve(libDir, UPDATE_API_FILENAME)
110
+ ),
111
+ spawn: options.spawn
88
112
  });
113
+ return process.exitCode;
89
114
  } catch (error) {
90
115
  console.error(`sprocket: ${error.message}`);
91
116
  process.exitCode = 1;
117
+ return 1;
92
118
  }
93
119
  }
@@ -0,0 +1,5 @@
1
+ import { runUpdateApi } from './update.js';
2
+
3
+ const { exitCode, payload } = await runUpdateApi(process.argv[2]);
4
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
5
+ process.exitCode = exitCode;