@mnemonik/cli 7.112.1 → 7.112.4

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 (47) hide show
  1. package/dist/auth/credentials.d.ts +7 -2
  2. package/dist/auth/credentials.d.ts.map +1 -1
  3. package/dist/auth/credentials.js +308 -96
  4. package/dist/auth/index.d.ts +15 -0
  5. package/dist/auth/index.d.ts.map +1 -1
  6. package/dist/auth/index.js +69 -13
  7. package/dist/auth/index.js.map +1 -1
  8. package/dist/diagnostics.js +312 -100
  9. package/dist/digests.json +45 -45
  10. package/dist/identity/migrate.js +37 -0
  11. package/dist/install/journal.js +37 -0
  12. package/dist/install/journey.js +37 -0
  13. package/dist/install/ownership.js +37 -0
  14. package/dist/install/transaction.d.ts +1 -3
  15. package/dist/install/transaction.d.ts.map +1 -1
  16. package/dist/install/transaction.js +64 -14
  17. package/dist/install/transaction.js.map +1 -1
  18. package/dist/install/ui.js +37 -0
  19. package/dist/installation.js +37 -0
  20. package/dist/launcher.js +37 -0
  21. package/dist/preflight.js +1 -1
  22. package/dist/project/eligibility.js +37 -0
  23. package/dist/project/records.js +37 -0
  24. package/dist/project.d.ts +11 -2
  25. package/dist/project.d.ts.map +1 -1
  26. package/dist/project.js +43 -2
  27. package/dist/project.js.map +1 -1
  28. package/dist/router.js +38 -1
  29. package/dist/runtime/releaseSource.js +37 -0
  30. package/dist/runtime/selfUpdate.js +37 -0
  31. package/dist/runtime/signers.js +242 -50
  32. package/dist/runtime/store.js +34 -0
  33. package/dist/runtime/updateCheck.js +37 -0
  34. package/dist/sbom.json +21 -21
  35. package/dist/scanner/control.js +37 -0
  36. package/dist/scanner/discover.js +1 -1
  37. package/dist/scanner/enable.js +37 -0
  38. package/dist/scanner/service.js +37 -0
  39. package/dist/scanner/update.js +37 -0
  40. package/dist/scanner-release.json +29 -29
  41. package/dist/status.js +41 -4
  42. package/dist/transport/server.d.ts +21 -2
  43. package/dist/transport/server.d.ts.map +1 -1
  44. package/dist/transport/server.js +15 -1
  45. package/dist/transport/server.js.map +1 -1
  46. package/dist/vendor/local-setup.js +37 -0
  47. package/package.json +31 -31
@@ -501,6 +501,13 @@ var require_ignore = __commonJS({
501
501
  }
502
502
  });
503
503
 
504
+ // packages/shared/dist/hookTimeouts.js
505
+ var init_hookTimeouts = __esm({
506
+ "packages/shared/dist/hookTimeouts.js"() {
507
+ "use strict";
508
+ }
509
+ });
510
+
504
511
  // packages/shared/dist/runtimeSigners.js
505
512
  import { basename, dirname as dirname2, join as join2, resolve, sep, win32 } from "node:path";
506
513
  import { execFile, execFileSync } from "node:child_process";
@@ -618,11 +625,37 @@ var init_runtimeReader = __esm({
618
625
  });
619
626
 
620
627
  // packages/shared/dist/projectSetupHandoff.js
628
+ var PROJECT_ENSURE_TIMEOUT_MS, SUPERVISOR, RUN_STALE_MS;
621
629
  var init_projectSetupHandoff = __esm({
622
630
  "packages/shared/dist/projectSetupHandoff.js"() {
623
631
  "use strict";
624
632
  init_runtimeSigners();
633
+ init_hookTimeouts();
625
634
  init_runtimeReader();
635
+ PROJECT_ENSURE_TIMEOUT_MS = 3e4;
636
+ SUPERVISOR = `
637
+ const { execFile } = require('node:child_process');
638
+ const { writeFileSync, renameSync } = require('node:fs');
639
+ const [out, bin, ...args] = process.argv.slice(1);
640
+ let input = '';
641
+ process.stdin.setEncoding('utf8');
642
+ process.stdin.on('data', (chunk) => (input += chunk));
643
+ process.stdin.on('end', () => {
644
+ const child = execFile(
645
+ process.execPath,
646
+ [bin, ...args],
647
+ { shell: false, timeout: ${PROJECT_ENSURE_TIMEOUT_MS}, killSignal: 'SIGKILL', maxBuffer: 64 * 1024, env: process.env },
648
+ (error, stdout) => {
649
+ const result = { code: error ? (typeof error.code === 'number' ? error.code : null) : 0, killed: !!(error && error.killed), stdout: String(stdout) };
650
+ writeFileSync(out + '.tmp', JSON.stringify(result), { mode: 0o600 });
651
+ renameSync(out + '.tmp', out);
652
+ }
653
+ );
654
+ child.stdin.on('error', () => {});
655
+ child.stdin.end(input);
656
+ });
657
+ `;
658
+ RUN_STALE_MS = PROJECT_ENSURE_TIMEOUT_MS + 1e4;
626
659
  }
627
660
  });
628
661
 
@@ -631,6 +664,7 @@ var init_hookRuntime = __esm({
631
664
  "packages/shared/dist/hookRuntime.js"() {
632
665
  "use strict";
633
666
  init_runtimeSigners();
667
+ init_hookTimeouts();
634
668
  init_repositoryRoot();
635
669
  init_runtimeReader();
636
670
  init_runtimeSigners();
@@ -6398,6 +6432,9 @@ var DEFAULT_OPTIONS = {
6398
6432
  };
6399
6433
  var BUILT_IN_IGNORE_DIR_SET = new Set(BUILT_IN_IGNORE_DIRS);
6400
6434
 
6435
+ // packages/shared/dist/index.js
6436
+ init_hookTimeouts();
6437
+
6401
6438
  // packages/shared/dist/jitDeliveryAck.js
6402
6439
  init_runtimeSigners();
6403
6440
 
@@ -4899,7 +4899,7 @@ async function readIdentityFile(dir, options = {}) {
4899
4899
  if (options.selectedRoot) {
4900
4900
  try {
4901
4901
  const value = JSON.parse(text);
4902
- if (value && typeof value === "object" && !Array.isArray(value) && !("projectId" in value))
4902
+ if (value && typeof value === "object" && !Array.isArray(value) && !("projectId" in value) && (!("schemaVersion" in value) || value.schemaVersion === 1))
4903
4903
  return { kind: "absent" };
4904
4904
  } catch {
4905
4905
  }
@@ -501,6 +501,13 @@ var require_ignore = __commonJS({
501
501
  }
502
502
  });
503
503
 
504
+ // packages/shared/dist/hookTimeouts.js
505
+ var init_hookTimeouts = __esm({
506
+ "packages/shared/dist/hookTimeouts.js"() {
507
+ "use strict";
508
+ }
509
+ });
510
+
504
511
  // packages/shared/dist/runtimeSigners.js
505
512
  import { basename, dirname as dirname2, join as join2, resolve, sep, win32 } from "node:path";
506
513
  import { execFile, execFileSync } from "node:child_process";
@@ -618,11 +625,37 @@ var init_runtimeReader = __esm({
618
625
  });
619
626
 
620
627
  // packages/shared/dist/projectSetupHandoff.js
628
+ var PROJECT_ENSURE_TIMEOUT_MS, SUPERVISOR, RUN_STALE_MS;
621
629
  var init_projectSetupHandoff = __esm({
622
630
  "packages/shared/dist/projectSetupHandoff.js"() {
623
631
  "use strict";
624
632
  init_runtimeSigners();
633
+ init_hookTimeouts();
625
634
  init_runtimeReader();
635
+ PROJECT_ENSURE_TIMEOUT_MS = 3e4;
636
+ SUPERVISOR = `
637
+ const { execFile } = require('node:child_process');
638
+ const { writeFileSync, renameSync } = require('node:fs');
639
+ const [out, bin, ...args] = process.argv.slice(1);
640
+ let input = '';
641
+ process.stdin.setEncoding('utf8');
642
+ process.stdin.on('data', (chunk) => (input += chunk));
643
+ process.stdin.on('end', () => {
644
+ const child = execFile(
645
+ process.execPath,
646
+ [bin, ...args],
647
+ { shell: false, timeout: ${PROJECT_ENSURE_TIMEOUT_MS}, killSignal: 'SIGKILL', maxBuffer: 64 * 1024, env: process.env },
648
+ (error, stdout) => {
649
+ const result = { code: error ? (typeof error.code === 'number' ? error.code : null) : 0, killed: !!(error && error.killed), stdout: String(stdout) };
650
+ writeFileSync(out + '.tmp', JSON.stringify(result), { mode: 0o600 });
651
+ renameSync(out + '.tmp', out);
652
+ }
653
+ );
654
+ child.stdin.on('error', () => {});
655
+ child.stdin.end(input);
656
+ });
657
+ `;
658
+ RUN_STALE_MS = PROJECT_ENSURE_TIMEOUT_MS + 1e4;
626
659
  }
627
660
  });
628
661
 
@@ -631,6 +664,7 @@ var init_hookRuntime = __esm({
631
664
  "packages/shared/dist/hookRuntime.js"() {
632
665
  "use strict";
633
666
  init_runtimeSigners();
667
+ init_hookTimeouts();
634
668
  init_repositoryRoot();
635
669
  init_runtimeReader();
636
670
  init_runtimeSigners();
@@ -6404,6 +6438,9 @@ var DEFAULT_OPTIONS = {
6404
6438
  };
6405
6439
  var BUILT_IN_IGNORE_DIR_SET = new Set(BUILT_IN_IGNORE_DIRS);
6406
6440
 
6441
+ // packages/shared/dist/index.js
6442
+ init_hookTimeouts();
6443
+
6407
6444
  // packages/shared/dist/jitDeliveryAck.js
6408
6445
  init_runtimeSigners();
6409
6446
 
@@ -501,6 +501,13 @@ var require_ignore = __commonJS({
501
501
  }
502
502
  });
503
503
 
504
+ // packages/shared/dist/hookTimeouts.js
505
+ var init_hookTimeouts = __esm({
506
+ "packages/shared/dist/hookTimeouts.js"() {
507
+ "use strict";
508
+ }
509
+ });
510
+
504
511
  // packages/shared/dist/runtimeSigners.js
505
512
  import { basename, dirname as dirname2, join as join2, resolve, sep, win32 } from "node:path";
506
513
  import { execFile, execFileSync } from "node:child_process";
@@ -618,11 +625,37 @@ var init_runtimeReader = __esm({
618
625
  });
619
626
 
620
627
  // packages/shared/dist/projectSetupHandoff.js
628
+ var PROJECT_ENSURE_TIMEOUT_MS, SUPERVISOR, RUN_STALE_MS;
621
629
  var init_projectSetupHandoff = __esm({
622
630
  "packages/shared/dist/projectSetupHandoff.js"() {
623
631
  "use strict";
624
632
  init_runtimeSigners();
633
+ init_hookTimeouts();
625
634
  init_runtimeReader();
635
+ PROJECT_ENSURE_TIMEOUT_MS = 3e4;
636
+ SUPERVISOR = `
637
+ const { execFile } = require('node:child_process');
638
+ const { writeFileSync, renameSync } = require('node:fs');
639
+ const [out, bin, ...args] = process.argv.slice(1);
640
+ let input = '';
641
+ process.stdin.setEncoding('utf8');
642
+ process.stdin.on('data', (chunk) => (input += chunk));
643
+ process.stdin.on('end', () => {
644
+ const child = execFile(
645
+ process.execPath,
646
+ [bin, ...args],
647
+ { shell: false, timeout: ${PROJECT_ENSURE_TIMEOUT_MS}, killSignal: 'SIGKILL', maxBuffer: 64 * 1024, env: process.env },
648
+ (error, stdout) => {
649
+ const result = { code: error ? (typeof error.code === 'number' ? error.code : null) : 0, killed: !!(error && error.killed), stdout: String(stdout) };
650
+ writeFileSync(out + '.tmp', JSON.stringify(result), { mode: 0o600 });
651
+ renameSync(out + '.tmp', out);
652
+ }
653
+ );
654
+ child.stdin.on('error', () => {});
655
+ child.stdin.end(input);
656
+ });
657
+ `;
658
+ RUN_STALE_MS = PROJECT_ENSURE_TIMEOUT_MS + 1e4;
626
659
  }
627
660
  });
628
661
 
@@ -631,6 +664,7 @@ var init_hookRuntime = __esm({
631
664
  "packages/shared/dist/hookRuntime.js"() {
632
665
  "use strict";
633
666
  init_runtimeSigners();
667
+ init_hookTimeouts();
634
668
  init_repositoryRoot();
635
669
  init_runtimeReader();
636
670
  init_runtimeSigners();
@@ -6398,6 +6432,9 @@ var DEFAULT_OPTIONS = {
6398
6432
  };
6399
6433
  var BUILT_IN_IGNORE_DIR_SET = new Set(BUILT_IN_IGNORE_DIRS);
6400
6434
 
6435
+ // packages/shared/dist/index.js
6436
+ init_hookTimeouts();
6437
+
6401
6438
  // packages/shared/dist/jitDeliveryAck.js
6402
6439
  init_runtimeSigners();
6403
6440
 
@@ -501,6 +501,13 @@ var require_ignore = __commonJS({
501
501
  }
502
502
  });
503
503
 
504
+ // packages/shared/dist/hookTimeouts.js
505
+ var init_hookTimeouts = __esm({
506
+ "packages/shared/dist/hookTimeouts.js"() {
507
+ "use strict";
508
+ }
509
+ });
510
+
504
511
  // packages/shared/dist/runtimeSigners.js
505
512
  import { basename, dirname as dirname2, join as join2, resolve, sep, win32 } from "node:path";
506
513
  import { execFile, execFileSync } from "node:child_process";
@@ -618,11 +625,37 @@ var init_runtimeReader = __esm({
618
625
  });
619
626
 
620
627
  // packages/shared/dist/projectSetupHandoff.js
628
+ var PROJECT_ENSURE_TIMEOUT_MS, SUPERVISOR, RUN_STALE_MS;
621
629
  var init_projectSetupHandoff = __esm({
622
630
  "packages/shared/dist/projectSetupHandoff.js"() {
623
631
  "use strict";
624
632
  init_runtimeSigners();
633
+ init_hookTimeouts();
625
634
  init_runtimeReader();
635
+ PROJECT_ENSURE_TIMEOUT_MS = 3e4;
636
+ SUPERVISOR = `
637
+ const { execFile } = require('node:child_process');
638
+ const { writeFileSync, renameSync } = require('node:fs');
639
+ const [out, bin, ...args] = process.argv.slice(1);
640
+ let input = '';
641
+ process.stdin.setEncoding('utf8');
642
+ process.stdin.on('data', (chunk) => (input += chunk));
643
+ process.stdin.on('end', () => {
644
+ const child = execFile(
645
+ process.execPath,
646
+ [bin, ...args],
647
+ { shell: false, timeout: ${PROJECT_ENSURE_TIMEOUT_MS}, killSignal: 'SIGKILL', maxBuffer: 64 * 1024, env: process.env },
648
+ (error, stdout) => {
649
+ const result = { code: error ? (typeof error.code === 'number' ? error.code : null) : 0, killed: !!(error && error.killed), stdout: String(stdout) };
650
+ writeFileSync(out + '.tmp', JSON.stringify(result), { mode: 0o600 });
651
+ renameSync(out + '.tmp', out);
652
+ }
653
+ );
654
+ child.stdin.on('error', () => {});
655
+ child.stdin.end(input);
656
+ });
657
+ `;
658
+ RUN_STALE_MS = PROJECT_ENSURE_TIMEOUT_MS + 1e4;
626
659
  }
627
660
  });
628
661
 
@@ -631,6 +664,7 @@ var init_hookRuntime = __esm({
631
664
  "packages/shared/dist/hookRuntime.js"() {
632
665
  "use strict";
633
666
  init_runtimeSigners();
667
+ init_hookTimeouts();
634
668
  init_repositoryRoot();
635
669
  init_runtimeReader();
636
670
  init_runtimeSigners();
@@ -6398,6 +6432,9 @@ var DEFAULT_OPTIONS = {
6398
6432
  };
6399
6433
  var BUILT_IN_IGNORE_DIR_SET = new Set(BUILT_IN_IGNORE_DIRS);
6400
6434
 
6435
+ // packages/shared/dist/index.js
6436
+ init_hookTimeouts();
6437
+
6401
6438
  // packages/shared/dist/jitDeliveryAck.js
6402
6439
  init_runtimeSigners();
6403
6440
 
@@ -1,23 +1,23 @@
1
1
  {
2
- "version": "7.112.1",
3
- "digestsSha256": "f1fdb1452ae03d24ead7141d9e45ce7217a939082b506f6f24c76f37c01cf165",
2
+ "version": "7.112.4",
3
+ "digestsSha256": "ddaa9b6e61e7bde7830290115a4dae0929e6821fcb981fef20b9d4612c6fd63b",
4
4
  "platforms": {
5
5
  "darwin-arm64": {
6
6
  "schemaVersion": 1,
7
7
  "artifact": "scanner",
8
- "version": "7.112.1",
8
+ "version": "7.112.4",
9
9
  "entry": "scanner-darwin-arm64",
10
10
  "files": {
11
11
  "scanner-darwin-arm64": {
12
- "sha256": "a9ecd47185c213f7dddd38a05b88fdd719b8b7d31e7694018ca1c9b94871d4ec",
13
- "size": 155505568,
12
+ "sha256": "bb573bb638726b6975d4cc174fb70b84c299cea213a5e4b5b0b0da45d5a891db",
13
+ "size": 155604640,
14
14
  "executable": true
15
15
  }
16
16
  },
17
- "totalSize": 155505568,
17
+ "totalSize": 155604640,
18
18
  "source": {
19
19
  "kind": "release",
20
- "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.1/"
20
+ "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.4/"
21
21
  },
22
22
  "signer": {
23
23
  "platform": "darwin",
@@ -29,19 +29,19 @@
29
29
  "darwin-x64": {
30
30
  "schemaVersion": 1,
31
31
  "artifact": "scanner",
32
- "version": "7.112.1",
32
+ "version": "7.112.4",
33
33
  "entry": "scanner-darwin-x64",
34
34
  "files": {
35
35
  "scanner-darwin-x64": {
36
- "sha256": "17370885d724a7c892fa2134f67374873f9fb9d2325d3159fbc17cbb8f0258b3",
37
- "size": 157265008,
36
+ "sha256": "635944446122ee3dcdf110b1dbb9f239c53b2e805cc871eb0837c31dca859417",
37
+ "size": 157364080,
38
38
  "executable": true
39
39
  }
40
40
  },
41
- "totalSize": 157265008,
41
+ "totalSize": 157364080,
42
42
  "source": {
43
43
  "kind": "release",
44
- "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.1/"
44
+ "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.4/"
45
45
  },
46
46
  "signer": {
47
47
  "platform": "darwin",
@@ -53,24 +53,24 @@
53
53
  "linux-arm64": {
54
54
  "schemaVersion": 1,
55
55
  "artifact": "scanner",
56
- "version": "7.112.1",
56
+ "version": "7.112.4",
57
57
  "entry": "scanner-linux-arm64",
58
58
  "files": {
59
59
  "scanner-linux-arm64": {
60
- "sha256": "0ac58350c8ed44990095e15d292bcdb3aff83a91e2d270c58ba5d47bc0991381",
61
- "size": 156568704,
60
+ "sha256": "a2b1a6cd67f935098f357cdca6b2507978d6f8120a7a6f35899642ad26b9acfd",
61
+ "size": 156634240,
62
62
  "executable": true
63
63
  },
64
64
  "scanner-linux-arm64.minisig": {
65
- "sha256": "84bc22260611ec4d08344d81c1ea1748dd132ffd715a0eeaf50703c2c4c142bd",
65
+ "sha256": "96541a3d7625dacb597b7c50da0926d293afc38f5c09537a3268ddf49124356c",
66
66
  "size": 314,
67
67
  "executable": false
68
68
  }
69
69
  },
70
- "totalSize": 156569018,
70
+ "totalSize": 156634554,
71
71
  "source": {
72
72
  "kind": "release",
73
- "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.1/"
73
+ "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.4/"
74
74
  },
75
75
  "signer": {
76
76
  "platform": "linux",
@@ -83,24 +83,24 @@
83
83
  "linux-x64": {
84
84
  "schemaVersion": 1,
85
85
  "artifact": "scanner",
86
- "version": "7.112.1",
86
+ "version": "7.112.4",
87
87
  "entry": "scanner-linux-x64",
88
88
  "files": {
89
89
  "scanner-linux-x64": {
90
- "sha256": "f50763c946722293b0d7d044af2c3c4d77578c778cc04c65223687b4f5510376",
91
- "size": 160238784,
90
+ "sha256": "5b6fec90ecbc4989b1aa3cb99d3490f6ffcbdf2aecab6791dd1d75f6bbf04ebb",
91
+ "size": 160304320,
92
92
  "executable": true
93
93
  },
94
94
  "scanner-linux-x64.minisig": {
95
- "sha256": "436191fedb1bc5364e751e12bfdbb2bbd6772b592995bd86cb2b06056cafa9df",
95
+ "sha256": "4ad7f30997fbf2871001a56d29ba8c57429b639a970b1f7e11ac51a5db589ae7",
96
96
  "size": 312,
97
97
  "executable": false
98
98
  }
99
99
  },
100
- "totalSize": 160239096,
100
+ "totalSize": 160304632,
101
101
  "source": {
102
102
  "kind": "release",
103
- "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.1/"
103
+ "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.4/"
104
104
  },
105
105
  "signer": {
106
106
  "platform": "linux",
@@ -113,19 +113,19 @@
113
113
  "win-x64": {
114
114
  "schemaVersion": 1,
115
115
  "artifact": "scanner",
116
- "version": "7.112.1",
116
+ "version": "7.112.4",
117
117
  "entry": "scanner-win-x64.exe",
118
118
  "files": {
119
119
  "scanner-win-x64.exe": {
120
- "sha256": "c7c6ee4658fe3841de6c0c57ebb6d4afdc506b47097789f7f2199a65dcc7b4d1",
121
- "size": 127268864,
120
+ "sha256": "ff8570588b99dbfd34566fa570326e9b954af421bffc7011e6bba7ee1660ea36",
121
+ "size": 127366144,
122
122
  "executable": true
123
123
  }
124
124
  },
125
- "totalSize": 127268864,
125
+ "totalSize": 127366144,
126
126
  "source": {
127
127
  "kind": "release",
128
- "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.1/"
128
+ "url": "https://github.com/JayDeeCo-Limited/mnemonik-cli/releases/download/scanner-v7.112.4/"
129
129
  },
130
130
  "signingStatus": "unsigned",
131
131
  "disclosureVersion": "2026.09.1"
package/dist/status.js CHANGED
@@ -501,6 +501,13 @@ var require_ignore = __commonJS({
501
501
  }
502
502
  });
503
503
 
504
+ // packages/shared/dist/hookTimeouts.js
505
+ var init_hookTimeouts = __esm({
506
+ "packages/shared/dist/hookTimeouts.js"() {
507
+ "use strict";
508
+ }
509
+ });
510
+
504
511
  // packages/shared/dist/runtimeSigners.js
505
512
  import { basename, dirname as dirname2, join as join2, resolve, sep, win32 } from "node:path";
506
513
  import { execFile, execFileSync } from "node:child_process";
@@ -623,7 +630,7 @@ var init_runtimeReader = __esm({
623
630
  import { constants } from "node:fs";
624
631
  import { lstat, mkdir, open, readdir, realpath, rename, rm } from "node:fs/promises";
625
632
  import { tmpdir } from "node:os";
626
- import { dirname as dirname3, join as join3, relative } from "node:path";
633
+ import { basename as basename2, dirname as dirname3, join as join3, relative } from "node:path";
627
634
  async function readPrivate(path) {
628
635
  const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
629
636
  try {
@@ -663,11 +670,37 @@ async function pendingProjectSetup(root) {
663
670
  results.sort((a, b) => Date.parse(b.time) - Date.parse(a.time));
664
671
  return results[0]?.outcome === "done" ? [] : results.slice(0, 1);
665
672
  }
673
+ var PROJECT_ENSURE_TIMEOUT_MS, SUPERVISOR, RUN_STALE_MS;
666
674
  var init_projectSetupHandoff = __esm({
667
675
  "packages/shared/dist/projectSetupHandoff.js"() {
668
676
  "use strict";
669
677
  init_runtimeSigners();
678
+ init_hookTimeouts();
670
679
  init_runtimeReader();
680
+ PROJECT_ENSURE_TIMEOUT_MS = 3e4;
681
+ SUPERVISOR = `
682
+ const { execFile } = require('node:child_process');
683
+ const { writeFileSync, renameSync } = require('node:fs');
684
+ const [out, bin, ...args] = process.argv.slice(1);
685
+ let input = '';
686
+ process.stdin.setEncoding('utf8');
687
+ process.stdin.on('data', (chunk) => (input += chunk));
688
+ process.stdin.on('end', () => {
689
+ const child = execFile(
690
+ process.execPath,
691
+ [bin, ...args],
692
+ { shell: false, timeout: ${PROJECT_ENSURE_TIMEOUT_MS}, killSignal: 'SIGKILL', maxBuffer: 64 * 1024, env: process.env },
693
+ (error, stdout) => {
694
+ const result = { code: error ? (typeof error.code === 'number' ? error.code : null) : 0, killed: !!(error && error.killed), stdout: String(stdout) };
695
+ writeFileSync(out + '.tmp', JSON.stringify(result), { mode: 0o600 });
696
+ renameSync(out + '.tmp', out);
697
+ }
698
+ );
699
+ child.stdin.on('error', () => {});
700
+ child.stdin.end(input);
701
+ });
702
+ `;
703
+ RUN_STALE_MS = PROJECT_ENSURE_TIMEOUT_MS + 1e4;
671
704
  }
672
705
  });
673
706
 
@@ -676,6 +709,7 @@ var init_hookRuntime = __esm({
676
709
  "packages/shared/dist/hookRuntime.js"() {
677
710
  "use strict";
678
711
  init_runtimeSigners();
712
+ init_hookTimeouts();
679
713
  init_repositoryRoot();
680
714
  init_runtimeReader();
681
715
  init_runtimeSigners();
@@ -6466,6 +6500,9 @@ var DEFAULT_OPTIONS = {
6466
6500
  };
6467
6501
  var BUILT_IN_IGNORE_DIR_SET = new Set(BUILT_IN_IGNORE_DIRS);
6468
6502
 
6503
+ // packages/shared/dist/index.js
6504
+ init_hookTimeouts();
6505
+
6469
6506
  // packages/shared/dist/jitDeliveryAck.js
6470
6507
  init_runtimeSigners();
6471
6508
 
@@ -7502,7 +7539,7 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
7502
7539
  // packages/cli/src/status.ts
7503
7540
  init_hookRuntime();
7504
7541
  import { devReadiness, expectedScannerDisclosureVersion } from "./runtime/releaseSource.js";
7505
- import { basename as basename2, isAbsolute, relative as relative2, resolve as resolve2 } from "node:path";
7542
+ import { basename as basename3, isAbsolute, relative as relative2, resolve as resolve2 } from "node:path";
7506
7543
  import { Output } from "./output.js";
7507
7544
  import {
7508
7545
  runProjectCommand
@@ -7712,7 +7749,7 @@ function buildStatusDocument(input) {
7712
7749
  projects: [
7713
7750
  {
7714
7751
  projectId: project.projectId,
7715
- displayName: basename2(project.resolvedRoot),
7752
+ displayName: basename3(project.resolvedRoot),
7716
7753
  repositoryMatch: project.identity,
7717
7754
  identityFile: null,
7718
7755
  summary: { conditions },
@@ -7811,7 +7848,7 @@ function renderStatusSummaries(document, output, options = {}) {
7811
7848
  document.conditions,
7812
7849
  options.agent
7813
7850
  );
7814
- const connected = [...new Set(document.scanner?.roots?.map((root) => basename2(root)) ?? [])].sort(
7851
+ const connected = [...new Set(document.scanner?.roots?.map((root) => basename3(root)) ?? [])].sort(
7815
7852
  (left, right) => left.toLocaleLowerCase().localeCompare(right.toLocaleLowerCase())
7816
7853
  );
7817
7854
  if (connected.length) {
@@ -21,7 +21,21 @@ export interface ServerTransportOptions {
21
21
  issueContext(input: Evidence & {
22
22
  projectId?: string;
23
23
  }): Promise<CliIssueContext>;
24
+ /** Each request's own bound (PROJECT_REQUEST_TIMEOUT_MS). */
25
+ requestTimeoutMs?: number;
26
+ /**
27
+ * Epoch ms after which no request is sent and each in flight is cut short
28
+ * (`project ensure --agent` sets it inside its supervisor's 30 s limit).
29
+ */
30
+ deadline?: number;
24
31
  }
32
+ /**
33
+ * A project-setup request that has not answered by then is abandoned and
34
+ * reported `unreachable` (the command's retryable failure). Without it a
35
+ * server that accepted the connection and never answered held the command,
36
+ * and the hook's detached `project ensure` helper, indefinitely.
37
+ */
38
+ export declare const PROJECT_REQUEST_TIMEOUT_MS = 5000;
25
39
  type AccountContext = {
26
40
  owner: Owner;
27
41
  userId: string;
@@ -56,13 +70,18 @@ export declare function createServerTransport(options: ServerTransportOptions):
56
70
  reason: string;
57
71
  }>;
58
72
  credentials: {
59
- putCliOAuth: (metadata: import("@mnemonik/credentials").CliOAuthMetadata, tokens: import("@mnemonik/credentials").CliOAuthTokens | string) => Promise<{
73
+ putCliOAuth: (metadata: import("@mnemonik/credentials").CliOAuthMetadata, tokens: import("@mnemonik/credentials").CliOAuthTokens | string) => ReturnType<(metadata: import("@mnemonik/credentials").CliOAuthMetadata, tokens: import("@mnemonik/credentials").CliOAuthTokens | string) => Promise<{
60
74
  store: string;
61
- }>;
75
+ }>>;
62
76
  readCliOAuth: () => Promise<CliOAuthCredential | null>;
63
77
  rotateCli: (transport: CliCredentialTransport) => Promise<import("@mnemonik/credentials").ActionRequired | import("@mnemonik/credentials").RetryLater | CliOAuthCredential>;
64
78
  withCliCredential: <T>(transport: CliCredentialTransport, work: (accessToken: string) => Promise<import("@mnemonik/credentials").WorkResponse<T>>) => Promise<import("@mnemonik/credentials").WorkResponse<T> | import("@mnemonik/credentials").ActionRequired | import("@mnemonik/credentials").RetryLater>;
65
79
  removeCliOAuth: () => Promise<void>;
80
+ revokeCli: (transport: import("@mnemonik/credentials").CliRevocationTransport) => Promise<import("@mnemonik/credentials").ActionRequired | import("@mnemonik/credentials").RetryLater | {
81
+ status: 'revoked';
82
+ familyId: string;
83
+ }>;
84
+ waitForCliLease: () => Promise<void>;
66
85
  putFamily: (componentKind: import("@mnemonik/credentials").ComponentKind, response: import("@mnemonik/credentials").ComponentCredentialResponse) => Promise<import("@mnemonik/credentials").FamilyCredential>;
67
86
  readFamily: (familyId: string) => Promise<import("@mnemonik/credentials").FamilyCredential | null>;
68
87
  rotateFamily: (familyId: string, transport: import("@mnemonik/credentials").CredentialTransport) => Promise<import("@mnemonik/credentials").RotationResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/transport/server.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAK9D,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,QAAQ,EAAE,KAAK,GAAG,kBAAkB,GAAG,YAAY,CAAC;IACpD,aAAa,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACzD,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MA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,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;AAYlF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMjD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAIvF;AAOD,qBAAa,yBAA0B,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,EAAE,cAAc;IAA3C,YAAqB,MAAM,EAAE,cAAc,EAG1C;CACF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAmH5B,MAAM,KAAG,OAAO,CAAC,cAAc,CAAC;4BAwBvC,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;gCAIpD,MAAM,UACT,MAAM,qBACK,qBAAqB,GAAG,IAAI;;;EAyBpD"}
@@ -5,6 +5,7 @@ import { createCliCredentials } from "../auth/credentials.js";
5
5
  import { URLSearchParams } from "node:url";
6
6
  import { createCliAuth } from "../auth/index.js";
7
7
  var DEFAULT_API = "https://api.mnemonik.dev/";
8
+ var PROJECT_REQUEST_TIMEOUT_MS = 5e3;
8
9
  var action = (state, allowedActions = ["retry", "cancel"]) => ({
9
10
  status: "ACTION_REQUIRED",
10
11
  state,
@@ -41,6 +42,13 @@ function createServerTransport(options) {
41
42
  const fetchImpl = options.fetch ?? fetch;
42
43
  const credentials = options.credentials ?? createCliCredentials();
43
44
  const getCliBearer = options.getCliBearer ?? createCliAuth({ resource, fetch: fetchImpl, credentials }).getCliBearer;
45
+ const requestBudget = () => Math.max(
46
+ 0,
47
+ Math.min(
48
+ options.requestTimeoutMs ?? PROJECT_REQUEST_TIMEOUT_MS,
49
+ (options.deadline ?? Infinity) - Date.now()
50
+ )
51
+ );
44
52
  const rotation = {
45
53
  async rotateCli(current) {
46
54
  const response = await fetchImpl(`${current.issuer.replace(/\/$/u, "")}/oauth/token`, {
@@ -51,7 +59,9 @@ function createServerTransport(options) {
51
59
  client_id: current.clientId,
52
60
  refresh_token: current.refreshToken,
53
61
  resource
54
- })
62
+ }),
63
+ // A timeout throws: the credential adapter treats it as a lost response.
64
+ signal: AbortSignal.timeout(Math.max(1, requestBudget()))
55
65
  });
56
66
  return {
57
67
  status: response.status,
@@ -64,8 +74,11 @@ function createServerTransport(options) {
64
74
  const firstBearer = suppliedBearer ?? await getCliBearer();
65
75
  if (typeof firstBearer !== "string") return signInAction(firstBearer);
66
76
  const send = async (bearer) => {
77
+ const budget = requestBudget();
78
+ if (budget <= 0) return { status: 503, body: action("unreachable") };
67
79
  try {
68
80
  const response = await fetchImpl(`${apiBase}${path}`, {
81
+ signal: AbortSignal.timeout(budget),
69
82
  method,
70
83
  headers: {
71
84
  authorization: `Bearer ${bearer}`,
@@ -147,6 +160,7 @@ function createServerTransport(options) {
147
160
  };
148
161
  }
149
162
  export {
163
+ PROJECT_REQUEST_TIMEOUT_MS,
150
164
  ServerActionRequiredError,
151
165
  accountActions,
152
166
  createServerTransport,