@clagentic/console 1.10.0 → 1.11.0-beta.2

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 (97) hide show
  1. package/README.md +14 -1
  2. package/bin/cli.js +38 -16
  3. package/lib/agents.js +1 -55
  4. package/lib/bash-auto-approve.js +133 -0
  5. package/lib/build-identity.js +23 -5
  6. package/lib/build-sha.json +2 -2
  7. package/lib/build-update-check.js +0 -62
  8. package/lib/build-update-offer.js +23 -13
  9. package/lib/build-update-restart.js +59 -43
  10. package/lib/cli/arg-validation.js +50 -0
  11. package/lib/cli/daemon-launch.js +5 -4
  12. package/lib/cli/menus.js +2 -2
  13. package/lib/cli/schedule-input-subcommands.js +327 -0
  14. package/lib/cli/session-subcommands.js +101 -17
  15. package/lib/client-build-id.js +56 -0
  16. package/lib/daemon.js +38 -6
  17. package/lib/identity/index.js +9 -4
  18. package/lib/injected-sender.js +225 -0
  19. package/lib/message-sender-record.js +133 -0
  20. package/lib/pending-prompts.js +55 -0
  21. package/lib/permission-mode-policy.js +63 -0
  22. package/lib/permission-settings.js +96 -0
  23. package/lib/permission-summary.js +67 -0
  24. package/lib/project-connection.js +10 -11
  25. package/lib/project-external-trigger.js +9 -1
  26. package/lib/project-loop.js +50 -23
  27. package/lib/project-permission-settings.js +59 -0
  28. package/lib/project-prompt-responses.js +25 -15
  29. package/lib/project-sessions.js +164 -60
  30. package/lib/project-user-message.js +18 -47
  31. package/lib/project.js +46 -74
  32. package/lib/public/app.js +4 -7
  33. package/lib/public/css/channel-layout.css +20 -0
  34. package/lib/public/css/diagnostics.css +7 -0
  35. package/lib/public/css/input.css +78 -0
  36. package/lib/public/css/menus.css +17 -0
  37. package/lib/public/css/overlays.css +0 -3
  38. package/lib/public/css/scheduler-modal.css +5 -0
  39. package/lib/public/index.html +44 -8
  40. package/lib/public/modules/app-connection.js +18 -1
  41. package/lib/public/modules/app-loop-ui.js +11 -1
  42. package/lib/public/modules/app-messages.js +23 -30
  43. package/lib/public/modules/app-panels.js +10 -3
  44. package/lib/public/modules/app-rate-limit.js +64 -88
  45. package/lib/public/modules/app-rendering.js +37 -6
  46. package/lib/public/modules/approve-tools-toggle.js +33 -0
  47. package/lib/public/modules/at-agents.js +8 -0
  48. package/lib/public/modules/build-guard.js +61 -0
  49. package/lib/public/modules/build-update-detail.js +1 -4
  50. package/lib/public/modules/diagnostics.js +98 -9
  51. package/lib/public/modules/injected-identity.js +78 -0
  52. package/lib/public/modules/injected-label.js +62 -0
  53. package/lib/public/modules/input.js +64 -114
  54. package/lib/public/modules/loop-hooks-warning.js +20 -0
  55. package/lib/public/modules/mode-options.js +35 -16
  56. package/lib/public/modules/permission-settings.js +56 -0
  57. package/lib/public/modules/project-settings.js +3 -0
  58. package/lib/public/modules/rate-limit-state.js +47 -22
  59. package/lib/public/modules/schedule-panel.js +234 -0
  60. package/lib/public/modules/schedule-time.js +193 -0
  61. package/lib/public/modules/scheduled-input-actions.js +19 -0
  62. package/lib/public/modules/scheduler-config.js +12 -0
  63. package/lib/public/modules/scheduler.js +8 -0
  64. package/lib/public/modules/server-settings.js +5 -9
  65. package/lib/public/modules/settings-defaults.js +18 -4
  66. package/lib/runtime-env.js +4 -0
  67. package/lib/scheduled-input/ipc.js +92 -0
  68. package/lib/scheduled-input/rate-limit-resume.js +53 -0
  69. package/lib/scheduled-input/records.js +350 -0
  70. package/lib/scheduled-input/service.js +743 -0
  71. package/lib/scheduled-input/store.js +132 -0
  72. package/lib/scheduled-input/ws.js +194 -0
  73. package/lib/scheduler.js +4 -0
  74. package/lib/sdk-bridge.js +194 -175
  75. package/lib/sdk-message-processor.js +13 -5
  76. package/lib/sdk-skill-discovery.js +17 -0
  77. package/lib/sender-ref.js +109 -0
  78. package/lib/server.js +37 -11
  79. package/lib/session-directory.js +224 -0
  80. package/lib/session-file-scan.js +55 -0
  81. package/lib/session-input-ipc.js +21 -0
  82. package/lib/session-input.js +396 -23
  83. package/lib/session-name-holder.js +82 -0
  84. package/lib/session-resume.js +3 -0
  85. package/lib/sessions.js +111 -2
  86. package/lib/turn-initiator.js +6 -2
  87. package/lib/updater.js +8 -2
  88. package/lib/ws-schema.js +20 -9
  89. package/lib/yoke/adapters/claude-worker.js +3 -1
  90. package/lib/yoke/adapters/claude.js +13 -17
  91. package/lib/yoke/adapters/codex.js +18 -5
  92. package/lib/yoke/adapters/permission-relay.js +9 -0
  93. package/lib/yoke/interface.js +7 -1
  94. package/package.json +1 -1
  95. package/scripts/check-test-count.js +1 -1
  96. package/scripts/install-local-test.js +45 -1
  97. package/scripts/postinstall.js +1 -0
@@ -15,7 +15,10 @@
15
15
  // trailing JSON array specifically (the only valid JSON substring `npm pack
16
16
  // --json` ever emits), rather than trusting the whole stdout to be clean.
17
17
 
18
+ const fs = require('fs');
19
+ const path = require('path');
18
20
  const { execFileSync } = require('child_process');
21
+ const { createTreeHasher } = require('../lib/build-identity');
19
22
 
20
23
  // Extracts the packed tarball filename from `npm pack --json`'s raw stdout.
21
24
  // Exported (not just used internally) so tests can exercise the parsing
@@ -66,7 +69,48 @@ function packAndGetFilename() {
66
69
  return extractTarballFilename(raw);
67
70
  }
68
71
 
72
+ // A same-sha reinstall replaces the installed files with new inodes under a
73
+ // running daemon, so it can only do harm: the daemon is already running that
74
+ // build. True when the installed build has this tree's sha and the same files.
75
+ // `read` is injectable for tests; it must return { headSha, installedSha,
76
+ // repoHash, installedHash } and any of them may be null when unknown.
77
+ function installedMatchesTree(read) {
78
+ const s = read();
79
+ return !!(s.headSha && s.installedSha === s.headSha &&
80
+ s.repoHash && s.installedHash === s.repoHash);
81
+ }
82
+
83
+ function readTreeState() {
84
+ const repoRoot = path.join(__dirname, '..');
85
+ const headSha = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: repoRoot, encoding: 'utf8' }).trim();
86
+ const globalRoot = execFileSync('npm', ['root', '-g'], { encoding: 'utf8' }).trim();
87
+ const installedRoot = path.join(globalRoot, '@clagentic', 'console');
88
+ const installedSha = JSON.parse(fs.readFileSync(path.join(installedRoot, 'lib', 'build-sha.json'), 'utf8')).sha;
89
+ return {
90
+ headSha,
91
+ installedSha,
92
+ repoHash: createTreeHasher(repoRoot).hash(),
93
+ installedHash: createTreeHasher(installedRoot).hash(),
94
+ };
95
+ }
96
+
97
+ // Any failure to establish the match (nothing installed yet, unreadable
98
+ // tree) means "install", never "skip".
99
+ function shouldSkipInstall(read) {
100
+ try {
101
+ return installedMatchesTree(read || readTreeState);
102
+ } catch (err) {
103
+ console.log(`[install-local-test] could not compare with the installed build (${err.message}); installing`);
104
+ return false;
105
+ }
106
+ }
107
+
69
108
  function main() {
109
+ if (!process.argv.includes('--force') && shouldSkipInstall()) {
110
+ console.log('[install-local-test] ok: this build is already installed with identical files; nothing to do (--force reinstalls)');
111
+ return;
112
+ }
113
+
70
114
  let tarball;
71
115
  try {
72
116
  tarball = packAndGetFilename();
@@ -90,7 +134,7 @@ function main() {
90
134
  console.log('[install-local-test] ok: installed');
91
135
  }
92
136
 
93
- module.exports = { extractTarballFilename };
137
+ module.exports = { extractTarballFilename, installedMatchesTree, shouldSkipInstall };
94
138
 
95
139
  if (require.main === module) {
96
140
  main();
@@ -2,6 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  // postinstall.js — installs/updates the systemd service unit on Linux global npm installs.
5
+ // It never reads or writes Claude Code settings.
5
6
  // Runs automatically after `npm install -g @clagentic/console`.
6
7
  // Does nothing on non-Linux platforms, on non-global installs (a local `npm ci` /
7
8
  // `npm install` in a dev checkout or worktree must never touch /etc/systemd or