@crewx/shared 0.0.6-rc.39 → 0.0.6-rc.40

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.
@@ -1,4 +1,4 @@
1
- export type RuntimeCredentialPurpose = 'notify' | 'wi' | 'chromex-negotiate' | 'pairing';
1
+ export type RuntimeCredentialPurpose = 'notify' | 'wi' | 'chromex-negotiate' | 'pairing' | 'app-dev';
2
2
  export interface ResolvedCredential {
3
3
  token: string;
4
4
  source: 'env' | 'file';
@@ -44,6 +44,7 @@ const RUNTIME_CREDENTIAL_PURPOSES = new Set([
44
44
  'wi',
45
45
  'chromex-negotiate',
46
46
  'pairing',
47
+ 'app-dev',
47
48
  ]);
48
49
  // These are sysexits-style values so shell callers can distinguish the local
49
50
  // credential failure before an HTTP request is attempted.
@@ -79,7 +80,9 @@ function invalidPurpose(purpose) {
79
80
  }
80
81
  function missingCredential(purpose, filePath) {
81
82
  throw new CrewxCredentialError('MISSING', `Runtime credential '${purpose}' is missing at ${filePath}. `
82
- + 'Run the CrewX server once to create it or set CREWX_API_TOKEN.');
83
+ + (purpose === 'app-dev'
84
+ ? 'The running CrewX may be too old or not started; start it once to create the credential.'
85
+ : 'Run the CrewX server once to create it or set CREWX_API_TOKEN.'));
83
86
  }
84
87
  function badMode(purpose, filePath) {
85
88
  throw new CrewxCredentialError('BAD_MODE', `Runtime credential '${purpose}' at ${filePath} has insecure permissions; expected mode 0600.`);
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
3
  import { getCrewxHome } from '@crewx/sdk';
4
4
 
5
- export type RuntimeCredentialPurpose = 'notify' | 'wi' | 'chromex-negotiate' | 'pairing';
5
+ export type RuntimeCredentialPurpose = 'notify' | 'wi' | 'chromex-negotiate' | 'pairing' | 'app-dev';
6
6
 
7
7
  export interface ResolvedCredential {
8
8
  token: string;
@@ -16,6 +16,7 @@ const RUNTIME_CREDENTIAL_PURPOSES = new Set<RuntimeCredentialPurpose>([
16
16
  'wi',
17
17
  'chromex-negotiate',
18
18
  'pairing',
19
+ 'app-dev',
19
20
  ]);
20
21
 
21
22
  // These are sysexits-style values so shell callers can distinguish the local
@@ -60,7 +61,9 @@ function missingCredential(purpose: RuntimeCredentialPurpose, filePath: string):
60
61
  throw new CrewxCredentialError(
61
62
  'MISSING',
62
63
  `Runtime credential '${purpose}' is missing at ${filePath}. `
63
- + 'Run the CrewX server once to create it or set CREWX_API_TOKEN.',
64
+ + (purpose === 'app-dev'
65
+ ? 'The running CrewX may be too old or not started; start it once to create the credential.'
66
+ : 'Run the CrewX server once to create it or set CREWX_API_TOKEN.'),
64
67
  );
65
68
  }
66
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/shared",
3
- "version": "0.0.6-rc.39",
3
+ "version": "0.0.6-rc.40",
4
4
  "main": "skill-tracer.js",
5
5
  "exports": {
6
6
  ".": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "description": "Shared utilities for CrewX built-in packages",
30
30
  "dependencies": {
31
- "@crewx/sdk": "0.9.0-rc.124"
31
+ "@crewx/sdk": "0.9.0-rc.125"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",
@@ -58,6 +58,15 @@ describe('resolveCrewxApiCredential', () => {
58
58
  });
59
59
  });
60
60
 
61
+ it('resolves the app-dev runtime credential', () => {
62
+ writeCredential('app-dev');
63
+
64
+ expect(resolveCrewxApiCredential('app-dev')).toEqual({
65
+ token: `crewxrt_app-dev_${VALID_HEX}`,
66
+ source: 'file',
67
+ });
68
+ });
69
+
61
70
  it('prefers CREWX_API_TOKEN without inspecting the runtime credential file', () => {
62
71
  writeCredential('wi', 0o644);
63
72
  process.env['CREWX_API_TOKEN'] = 'env-token';