@north-light/crouter 0.3.166 → 0.3.168

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/runtime.lock.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.166",
3
+ "version": "0.3.168",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.166",
9
+ "version": "0.3.168",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@crouton-kit/humanloop": "0.4.21",
13
+ "@crouton-kit/humanloop": "0.4.22",
14
14
  "@earendil-works/pi-agent-core": "0.83.0",
15
15
  "@earendil-works/pi-ai": "0.83.0",
16
16
  "@earendil-works/pi-coding-agent": "0.83.0",
@@ -2073,9 +2073,9 @@
2073
2073
  }
2074
2074
  },
2075
2075
  "node_modules/@crouton-kit/humanloop": {
2076
- "version": "0.4.21",
2077
- "resolved": "https://registry.npmjs.org/@crouton-kit/humanloop/-/humanloop-0.4.21.tgz",
2078
- "integrity": "sha512-j/8dVAhl2R4dWvykSjC+yCEEb/n7P+P1FZLEFWD1pVB24tubYVmA3vJSr359nOO8esmJ+h/+S8Oef8eGZ6n6tA==",
2076
+ "version": "0.4.22",
2077
+ "resolved": "https://registry.npmjs.org/@crouton-kit/humanloop/-/humanloop-0.4.22.tgz",
2078
+ "integrity": "sha512-ELT+I4sk4e/PPzq8LGUQE8ggfvtxn9zFxHV3OkGp7GL7+n8RgKQ3OWNww/ZHoseoZSA7srVDN2L6u314CTi1mg==",
2079
2079
  "hasInstallScript": true,
2080
2080
  "workspaces": [
2081
2081
  "web"
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { mkdirSync, mkdtempSync, rmSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { tmpdir } from 'node:os';
6
+
7
+ const PACKAGE_NAME = '@north-light/crouter';
8
+
9
+ function run(command, args, options) {
10
+ const result = spawnSync(command, args, options);
11
+ if (result.error) throw new Error(`${command} ${args.join(' ')}: ${result.error.message}`);
12
+ if (result.status !== 0) throw new Error(`${command} ${args.join(' ')} failed (${result.status ?? result.signal ?? 'unknown'})`);
13
+ return result;
14
+ }
15
+
16
+ function latestArchive(directory) {
17
+ const result = run('npm', ['pack', `${PACKAGE_NAME}@latest`, '--json', '--pack-destination', directory], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'] });
18
+ const packed = JSON.parse(result.stdout);
19
+ if (!Array.isArray(packed) || typeof packed[0]?.filename !== 'string') throw new Error('npm pack did not report an archive');
20
+ return join(directory, packed[0].filename);
21
+ }
22
+
23
+ const temporary = mkdtempSync(join(tmpdir(), 'crtr-self-update-'));
24
+ try {
25
+ const archive = latestArchive(temporary);
26
+ const release = join(temporary, 'package');
27
+ mkdirSync(release);
28
+ run('tar', ['-xzf', archive, '--strip-components=1', '-C', release]);
29
+ run(process.execPath, [join(release, 'scripts', 'install-runtime.mjs'), release], { stdio: 'inherit' });
30
+ } finally {
31
+ rmSync(temporary, { recursive: true, force: true });
32
+ }