@linzumi/cli 0.0.86-beta → 0.0.87-beta

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +178 -37
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -58,7 +58,7 @@ Install the CLI or run it with `npx`:
58
58
  ```bash
59
59
  npm install -g @linzumi/cli@latest
60
60
  npx -y @linzumi/cli@latest signup
61
- npx -y @linzumi/cli@0.0.86-beta --version
61
+ npx -y @linzumi/cli@0.0.87-beta --version
62
62
  linzumi --version
63
63
  ```
64
64
 
package/dist/index.js CHANGED
@@ -13073,7 +13073,16 @@ async function* defaultClaudeCodeRunner(options) {
13073
13073
  options.wrapApprovedToolInput
13074
13074
  )
13075
13075
  },
13076
- ...options.model === void 0 ? {} : { model: options.model }
13076
+ ...options.model === void 0 ? {} : { model: options.model },
13077
+ ...options.permissionMode === void 0 ? {} : {
13078
+ permissionMode: options.permissionMode,
13079
+ // The SDK requires this safety acknowledgement when a session is
13080
+ // constructed in 'bypassPermissions' (sdk.d.ts Options:
13081
+ // "Must be set to true when using permissionMode:
13082
+ // 'bypassPermissions'"). It is the intentional-bypass flag, only
13083
+ // meaningful for that mode; harmless for the others.
13084
+ ...options.permissionMode === "bypassPermissions" ? { allowDangerouslySkipPermissions: true } : {}
13085
+ }
13077
13086
  // exactOptionalPropertyTypes: the conditional spreads build a union the
13078
13087
  // SDK's Options cannot absorb verbatim; the shape is correct field-wise.
13079
13088
  }
@@ -14992,8 +15001,8 @@ function startCallbackServer(args) {
14992
15001
  }
14993
15002
  resolveCallback?.({ code, state });
14994
15003
  writeOauthResult(response, {
14995
- title: "Connected",
14996
- body: "You can close this tab. Your terminal will finish the setup.",
15004
+ title: "Computer authorized",
15005
+ body: "This computer has been authorized for agentic use in Linzumi. Feel free to close this tab and let the terminal finish setup.",
14997
15006
  status: 200
14998
15007
  });
14999
15008
  } catch (error) {
@@ -15036,29 +15045,108 @@ function writeOauthResult(response, args) {
15036
15045
  response.end(oauthResultHtml(args));
15037
15046
  }
15038
15047
  function oauthResultHtml(args) {
15048
+ const success = args.status >= 200 && args.status < 300;
15049
+ const badgeClass = success ? "badge badge--success" : "badge badge--notice";
15050
+ const badgeMark = success ? '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="mark"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M5 12.5l4.2 4.2L19 7"/></svg>' : '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="mark"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M12 7v6M12 17h.01"/></svg>';
15039
15051
  return `<!doctype html>
15040
- <html>
15052
+ <html lang="en">
15041
15053
  <head>
15042
15054
  <meta charset="utf-8" />
15043
15055
  <meta name="viewport" content="width=device-width, initial-scale=1" />
15044
15056
  <title>${escapeHtml(args.title)}</title>
15045
15057
  <style>
15046
- :root { color-scheme: light dark; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
15047
- body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: #f6f7f9; color: #13161c; }
15048
- main { width: min(520px, calc(100vw - 32px)); border: 1px solid #d9dde5; border-radius: 12px; background: #fff; padding: 30px; box-shadow: 0 24px 70px rgba(18, 25, 38, 0.12); }
15049
- h1 { margin: 0 0 10px; font-size: 24px; line-height: 1.2; }
15050
- p { margin: 0; color: #465160; line-height: 1.55; }
15058
+ :root {
15059
+ color-scheme: light dark;
15060
+ /* Linzumi brand tokens (light) \u2014 kandan/server_v2/web/src/ui/theme/tokens.css */
15061
+ --page-bg: #f5f2ee;
15062
+ --surface: #fcfaf7;
15063
+ --foreground: #1e1b18;
15064
+ --muted: #5c5550;
15065
+ --divider: rgba(138, 148, 144, 0.16);
15066
+ --accent: #c4897a;
15067
+ --success: #5a9a6a;
15068
+ --success-soft: rgba(90, 154, 106, 0.1);
15069
+ --notice-soft: rgba(196, 137, 122, 0.1);
15070
+ --shadow: 0 12px 40px rgba(106, 138, 122, 0.12), 0 4px 12px rgba(106, 138, 122, 0.06);
15071
+ }
15051
15072
  @media (prefers-color-scheme: dark) {
15052
- body { background: #0f131a; color: #f3f5f8; }
15053
- main { background: #171c25; border-color: #2b3442; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4); }
15054
- p { color: #aab4c2; }
15073
+ :root {
15074
+ /* Linzumi brand tokens (dark) */
15075
+ --page-bg: #171b19;
15076
+ --surface: #202522;
15077
+ --foreground: rgba(245, 241, 232, 0.95);
15078
+ --muted: rgba(245, 241, 232, 0.68);
15079
+ --divider: rgba(245, 241, 232, 0.1);
15080
+ --accent: #c8a0b0;
15081
+ --success: #72c488;
15082
+ --success-soft: rgba(114, 196, 136, 0.14);
15083
+ --notice-soft: rgba(200, 160, 176, 0.14);
15084
+ --shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
15085
+ }
15086
+ }
15087
+ * { box-sizing: border-box; }
15088
+ body {
15089
+ margin: 0;
15090
+ min-height: 100vh;
15091
+ display: grid;
15092
+ place-items: center;
15093
+ padding: 24px;
15094
+ background:
15095
+ radial-gradient(1200px 600px at 50% -10%, var(--notice-soft), transparent 60%),
15096
+ var(--page-bg);
15097
+ color: var(--foreground);
15098
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
15099
+ -webkit-font-smoothing: antialiased;
15100
+ }
15101
+ main {
15102
+ width: min(520px, 100%);
15103
+ border: 1px solid var(--divider);
15104
+ border-radius: 16px;
15105
+ background: var(--surface);
15106
+ padding: 40px 36px;
15107
+ box-shadow: var(--shadow);
15108
+ text-align: center;
15109
+ }
15110
+ .logo {
15111
+ width: 44px;
15112
+ height: 44px;
15113
+ margin: 28px auto 0;
15114
+ color: var(--accent);
15115
+ }
15116
+ .logo svg { display: block; width: 100%; height: 100%; }
15117
+ .badge {
15118
+ width: 64px;
15119
+ height: 64px;
15120
+ margin: 0 auto 22px;
15121
+ display: grid;
15122
+ place-items: center;
15123
+ border-radius: 999px;
15124
+ }
15125
+ .badge--success { background: var(--success-soft); color: var(--success); }
15126
+ .badge--notice { background: var(--notice-soft); color: var(--accent); }
15127
+ .mark { width: 32px; height: 32px; }
15128
+ h1 {
15129
+ margin: 0 0 12px;
15130
+ font-size: 23px;
15131
+ font-weight: 600;
15132
+ line-height: 1.3;
15133
+ letter-spacing: -0.01em;
15134
+ color: var(--foreground);
15135
+ }
15136
+ p {
15137
+ margin: 0;
15138
+ color: var(--muted);
15139
+ font-size: 15px;
15140
+ line-height: 1.6;
15055
15141
  }
15056
15142
  </style>
15057
15143
  </head>
15058
15144
  <body>
15059
15145
  <main>
15146
+ <div class="${badgeClass}">${badgeMark}</div>
15060
15147
  <h1>${escapeHtml(args.title)}</h1>
15061
15148
  <p>${escapeHtml(args.body)}</p>
15149
+ <div class="logo">${LINZUMI_LOGO_SVG}</div>
15062
15150
  </main>
15063
15151
  </body>
15064
15152
  </html>`;
@@ -15089,10 +15177,12 @@ function openBrowser(url) {
15089
15177
  });
15090
15178
  });
15091
15179
  }
15180
+ var LINZUMI_LOGO_SVG;
15092
15181
  var init_oauth = __esm({
15093
15182
  "src/oauth.ts"() {
15094
15183
  "use strict";
15095
15184
  init_runnerLogger();
15185
+ LINZUMI_LOGO_SVG = '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path fill="currentColor" d="M206.7,82.37l2.55-6.45,2.01-3.63c.67-1.21,1.07-1.88,2.55-3.63,1.34-1.61,3.36-4.43,5.64-6.58,2.42-2.24,5.06-4.3,7.93-6.18,3.92-2.53,8.17-4.52,12.63-5.91,1.79-.63,4.03-1.16,6.72-1.61,6.1-.88,12.29-.92,18.4-.13,2.69.45,5.06,1.03,7.12,1.75,2.15.67,3.49,1.07,5.64,2.15,4.55,2.16,8.87,4.77,12.9,7.79,1.61,1.34,2.42,2.15,4.16,4.16l5.91,7.66c1.34,2.01,1.34,2.28,2.15,4.03l2.55,6.58c.67,1.34-.13,1.34,1.07.94,1.21-.27,4.3-2.01,6.45-2.82,4.7-1.83,9.62-3,14.64-3.49,2.42-.27,3.76-.54,7.12-.27s9.27,1.21,12.76,2.15c3.63.94,6.58,2.55,8.73,3.49,2.15,1.07,2.55,1.48,4.16,2.55,3.49,2.51,6.77,5.29,9.81,8.33,1.52,1.7,3.04,3.58,4.57,5.64,2.74,4.49,4.86,9.32,6.31,14.37.67,2.28,1.07,3.49,1.34,6.72.27,3.22,0,10.48.4,12.76.27,2.28.27.67,1.61.94,1.48.27,4.3,0,6.72.4,2.42.27,4.97.85,7.66,1.75,6.76,2.32,13.01,5.92,18.4,10.61,2.28,1.75,2.96,2.69,4.3,4.3,3.51,3.93,6.32,8.43,8.33,13.3,1.07,2.15,1.21,2.28,1.88,5.1.54,2.96,1.61,8.19,1.61,12.36s-.81,9.67-1.34,12.76c-.67,3.22-1.07,4.03-2.15,6.18-2.16,4.54-4.81,8.82-7.93,12.76-1.25,1.61-2.6,3-4.03,4.16-1.48,1.34-2.69,2.42-4.7,3.76-3.79,2.34-7.74,4.4-11.82,6.18l-6.58,2.15c-2.06.45-4.12.72-6.18.81l-7.25.13c-2.28,0-2.82.27-6.58-.4-3.76-.81-11.69-2.82-15.99-4.3-4.16-1.34-6.31-2.69-9.67-4.43-3.49-1.75-10.48-6.18-12.9-7.39-8.26-4.54-16.78-8.58-25.52-12.09-4.3-1.75-9.27-3.22-11.82-4.03-2.55-.81-5.24-1.61-7.66-2.15-8.39-2.25-16.99-3.6-25.66-4.03-3.9-.27-4.84-.27-8.19-.13-3.67-.09-7.79.04-12.36.4-7.9.79-15.75,2.04-23.51,3.76-8.37,2.26-16.62,4.95-24.72,8.06-3.22,1.34-2.82.81-9.13,4.16-6.31,3.36-22.03,12.22-28.75,15.58-6.72,3.36-8.73,3.49-11.82,4.43-3.09,1.07-4.3,1.21-6.58,1.61-7.3,1.09-14.71,1.18-22.03.27-2.55-.54-5.78-1.61-7.79-2.28-2.01-.54-2.15-.67-4.03-1.75-2.02-1.07-5.64-3.22-7.79-4.7-3.24-2.15-6.14-4.77-8.6-7.79-1.34-1.52-2.69-3.36-4.03-5.51-1.52-2.51-2.96-5.24-4.3-8.19-2.03-5.46-3.03-11.24-2.96-17.06,0-2.96.13-6.72.67-9.67.54-2.87,1.34-5.6,2.42-8.19,4.24-10.52,12.04-19.22,22.03-24.58,5.19-2.98,10.88-4.98,16.79-5.91,2.55-.4,5.37-.13,6.72-.4,1.34-.27,1.34,1.34,1.61-.94.4-2.28,0-9.4.4-12.76.27-3.36.81-4.97,1.48-7.25,1.87-6.19,4.88-11.97,8.87-17.06,3.47-3.98,7.39-7.54,11.69-10.61,4.43-2.61,9.11-4.77,13.97-6.45,2.55-.67,6.99-1.34,9.13-1.75,2.15-.27,1.88-.13,3.63-.13,1.79-.09,4.03,0,6.72.27,2.69.18,5.73.72,9.13,1.61,3.49,1.07,9.27,4.03,11.28,4.7s.4.27,1.07-.94ZM512.27,255.7c0,141.39-114.62,256-256,256S.27,397.09.27,255.7,114.89-.3,256.27-.3s256,114.62,256,256ZM449.33,352.66c14.67-29.16,22.94-62.09,22.94-96.95,0-119.29-96.71-216-216-216S40.27,136.41,40.27,255.7c0,41.89,11.94,80.98,32.57,114.09,1.7,1.79,2.94.65,3.05-.57.27-1.61,2.75-20.85,4.43-27.27,1.87-7.6,4.52-14.98,7.93-22.03,1.75-3.49,3.76-7.93,6.18-11.82,8.77-13.95,19.75-26.38,32.51-36.81,7.24-5.32,14.87-10.08,22.84-14.24,9.74-4.78,20.09-8.22,30.76-10.21,4.03-.99,7.61-1.66,10.75-2.02,3.36-.54,5.78-.54,9.27-.94,3.49-.54,9.32-1.16,11.82-2.01,6.65-2.27,5.64-6.72,3.09-7.52-2.55-.81-9.67-1.88-13.84-2.96-4.16-1.21-8.73-2.82-11.28-3.76-2.55-.94-2.28-.94-3.9-2.02l-5.91-4.03c-.94-.94-1.34-.94.54-2.02l10.21-5.51c2.01-1.07,1.75-.67,3.09-.13,1.34.67,4.3,2.42,6.72,3.36,7.2,2.69,14.96,3.52,22.57,2.42,1.34-.27,1.34-.54,1.61-1.21.27-.67.81-.94-.13-2.69-.94-1.88-4.43-6.58-5.64-8.46l-1.21-2.28c-.27-.45-1.07-1.07,1.21-1.75,2.42-.54,10.48-2.58,12.9-2.82.86-.09.67,0,1.75,1.07,1.07,1.07,3.09,3.63,4.84,5.24,1.88,1.61,4.43,3.22,6.18,4.3,2.8,1.71,5.99,2.68,9.27,2.82,1.88,0,4.97-.13,7.12-.67,2.15-.4,3.63-.94,5.64-2.02,2.01-1.07,4.7-2.69,6.72-4.43,2.01-1.75,3.49-5.1,5.64-6.04,2.15-.81,4.97.54,7.12.94,2.28.4,4.97,1.21,6.18,1.61,1.21.4,2.01.4.67,2.28l-8.06,10.34c-1.34,1.88.13,5.51,1.21,5.64l5.64.27c2.28-.13,4.43.13,7.66-.67,3.36-.81,9.27-2.96,11.82-3.9,2.69-.94,3.22-1.34,4.16-2.01.81-.54,1.39-1.03,1.75-1.48.45-.27.67-1.07,2.82,0s9.4,4.97,11.28,6.18c2.01,1.21,1.07.94,0,1.75l-5.51,3.9c-1.48.94-1.07.94-3.22,1.88-2.15,1.07-6.58,2.96-9.67,4.03s-4.03,1.75-8.73,2.69c-4.7.81-14.51,1.75-19.48,2.55-4.97.81-7.93,1.34-10.34,2.01-2.28.67-2.15.94-3.49,1.88-1.48,1.07-2.69,1.61-4.97,3.9-2.28,2.28-5.91,6.85-8.73,9.81-2.82,2.96-6.45,6.04-8.33,7.79-2.02,1.61-1.61,1.34-3.36,2.42l-6.99,4.03-4.03,2.02-6.72,2.15c-2.42.67-3.9,1.21-7.66,2.01l-14.91,2.82c-3.63.81-4.3,1.07-7.12,2.01-2.96,1.07-6.22,2.46-9.81,4.16-3.22,1.43-6.81,3.45-10.75,6.04-13.6,9.14-24.61,21.63-31.97,36.27-2.01,3.76-2.96,6.58-3.9,9.27-1.07,2.69-1.61,4.03-2.28,6.58-.67,2.69-1.48,5.24-2.15,9.27-.54,4.16-1.48,11.15-1.75,15.45-.27,4.16-.27,6.04,0,10.21l1.88,14.91c.67,3.76,1.48,5.91,2.15,8.19l1.88,5.64c.99,2.6,2.42,5.78,4.3,9.54,2.15,3.76,5.37,9.13,8.06,13.03,10.08,14.51,23.81,26.36,40.17,33.05,22.55,9.22,43.32,10.46,61.89,10.46,3.25,0,6.49-.09,9.71-.23,3.07-.42,2.74-6.09,10.48-9.42,5.26-2.26,13.7-2.42,14.91-2.55,1.07-.13-5.24-4.57-7.79-6.45-2.55-1.88-4.97-4.3-6.72-5.91-1.75-1.75-2.42-2.28-3.9-4.16-1.61-1.88-3.9-5.51-5.24-7.12-1.34-1.61-1.48-2.28-2.55-2.55-.98-.27-2.37-.09-4.16.54-1.88.4-5.37,1.21-7.12,1.88-1.75.67-2.02.81-3.09,2.01-1.07,1.07-2.69,3.76-3.63,4.7-.81.94-.67.67-1.48.94-.81.27-2.42.67-3.63.54-1.34-.18-2.55-.58-3.63-1.21-.81-.81-1.48-2.42-1.88-3.22-.4-.94-.54-1.21-.54-2.15l.4-3.49c.18-1.52.72-3.27,1.61-5.24.94-1.75,1.88-3.49,4.16-5.64,2.15-2.02,7.52-5.51,9.13-6.85,1.61-1.34,1.21-2.15.54-3.63-2.69-5.16-6.33-9.77-10.75-13.57-2.42-1.88-5.51-3.22-7.79-4.3-2.15-1.21-2.01-1.21-5.78-2.42-3.76-1.07-13.16-3.63-16.79-4.84-3.63-1.07-2.82-.94-5.1-2.01l-8.19-4.3c-1.75-.94-1.34-.54-2.69-1.61l-5.51-4.57c-2.18-1.93-3.77-4.45-4.57-7.25-.45-1.52-.45-2.87,0-4.03.4-1.34,0-1.21,2.01-3.63,2.15-2.42,7.25-7.93,10.21-10.75,3.09-2.82,4.97-4.03,7.79-6.04,5.43-3.82,11.09-7.32,16.93-10.48,2.42-1.21,5.37-2.02,7.12-2.69,1.61-.81,2.64-1.43,3.09-1.88.54-.4.67.54.4-.94-.4-1.48-1.88-4.97-2.28-7.66-.4-2.82-.4-6.18,0-8.73.36-2.42,1.03-4.66,2.01-6.72,1.16-2.24,2.46-4.3,3.9-6.18,1.34-1.7,2.91-3.04,4.7-4.03,1.75-1.07,4.3-2.01,6.18-2.42,1.61-.45,3.13-.58,4.57-.4l4.57.27c1.34.18,2.55.49,3.63.94,1.07.54,2.55,1.48,3.09,2.01.4.67.67.13-.27,1.61-1.07,1.48-4.16,4.57-5.78,7.12-1.61,2.69-2.96,5.6-4.03,8.73-.94,3.22-1.88,8.73-2.01,10.75-.27,2.15,4.7,1.75,5.1.54.54-1.07.27-2.55,1.07-5.1.81-2.42,2.42-7.25,3.9-9.81,1.34-2.55,2.82-3.76,4.57-5.51,1.79-1.88,3.67-3.45,5.64-4.7,1.88-1.21,3.22-1.75,5.64-2.28,2.42-.4,6.18-.67,8.73-.67,2.42,0,3.9.13,6.18.94,2.15.81,5.24,2.69,7.12,4.03,1.79,1.52,3.22,3.09,4.3,4.7,1.21,1.61,1.88,2.96,2.55,5.1.67,2.15,1.34,5.1,1.34,7.66,0,2.69-.54,6.04-1.21,8.19-.63,2.24-1.43,4.03-2.42,5.37-.67,1.34-.94,1.61-2.15,2.82-1.21,1.34-3.22,3.22-4.97,4.57-1.75,1.21-4.43,2.28-5.51,3.22-.94.81-.4,2.51.4,2.42.94.13,1.75.4,4.57-.13,2.82-.4,8.33-2.15,12.22-2.82,11.99-2.63,24.41-2.63,36.4,0,3.22.54,4.16,1.07,6.31,1.75l6.04,2.28c2.42,1.07,5.51,2.42,8.19,4.16,8.15,5.36,15.14,12.3,20.55,20.42,1.61,2.42,2.87,4.66,3.76,6.72,1.85,4.51,3.42,9.13,4.7,13.84.67,2.82,1.21,4.43,1.61,8.19.4,3.76.4,11.82.54,14.37.27,2.55-.13,2.28,1.75,1.34,1.75-.94,20.09-7.74,30.63-31.57,9.16-20.71,1.9-47.26-2.28-55.34-1.75-3.22-4.16-6.99-6.31-9.81-4.44-5.14-9.6-9.62-15.31-13.3-2.96-1.7-5.55-3.09-7.79-4.16-4.33-1.6-8.77-2.86-13.3-3.76l-6.18-.4h-14.37c-2.69-.27-3.1-3.18-.54-4.3,3.64-1.58,9.88-2.63,18.54-2.42,8.78.21,14.91,1.88,17.33,2.55,13.98,3.94,30.19,16.65,38.55,30.76,6.61,11.16,9.81,29.96,9.81,29.96.37,1.75,2.18,1.66,3.08.35ZM232.78,345.3c-3.91,0-7.08,3.17-7.08,7.08s3.17,7.08,7.08,7.08,7.08-3.17,7.08-7.08-3.17-7.08-7.08-7.08Z"/></svg>';
15096
15186
  }
15097
15187
  });
15098
15188
 
@@ -15805,7 +15895,7 @@ var init_remoteCodexExecutionContext = __esm({
15805
15895
  "SHELL",
15806
15896
  "TMPDIR"
15807
15897
  ]);
15808
- ignoredEnvOverrideKeys = /* @__PURE__ */ new Set(["PATH"]);
15898
+ ignoredEnvOverrideKeys = /* @__PURE__ */ new Set(["PATH", "GIT_PAGER"]);
15809
15899
  deniedEnvKeys = /* @__PURE__ */ new Set([
15810
15900
  "BASH_ENV",
15811
15901
  "ENV",
@@ -18430,7 +18520,7 @@ var linzumiCliVersion, linzumiCliVersionText;
18430
18520
  var init_version = __esm({
18431
18521
  "src/version.ts"() {
18432
18522
  "use strict";
18433
- linzumiCliVersion = "0.0.86-beta";
18523
+ linzumiCliVersion = "0.0.87-beta";
18434
18524
  linzumiCliVersionText = `linzumi ${linzumiCliVersion}`;
18435
18525
  }
18436
18526
  });
@@ -25649,29 +25739,18 @@ async function applyControl(codex, kandan, topic, instanceId, options, agentProv
25649
25739
  approvalPolicy: stringValue(control.approvalPolicy) ?? void 0
25650
25740
  });
25651
25741
  if (applied.approval_policy === "never") {
25652
- const pendingForSession = [
25653
- ...pendingClaudeCodeApprovals.entries()
25654
- ].filter(
25655
- ([, pending]) => pending.sessionId === void 0 || pending.sessionId === control.threadId
25656
- );
25657
- for (const [requestId, pending] of pendingForSession) {
25658
- pending.resolve({ type: "allow" });
25659
- await publishClaudeCodeMessageState(kandan, topic, {
25660
- workspace: pending.workspace,
25661
- channel: pending.channel,
25662
- threadId: pending.threadId,
25663
- sourceSeq: pending.sourceSeq,
25664
- status: "processing",
25665
- reason: "Claude Code tool approved",
25666
- sessionId: pending.sessionId ?? control.threadId
25667
- });
25668
- log2("claude_code.approval_request_auto_approved", {
25669
- request_id: requestId,
25670
- source_seq: pending.sourceSeq,
25671
- session_id: pending.sessionId ?? control.threadId,
25672
- reason: "full_access_enabled"
25673
- });
25674
- }
25742
+ await settleClaudeCodeApprovalsForSession({
25743
+ kandan,
25744
+ topic,
25745
+ pendingClaudeCodeApprovals,
25746
+ // activeClaudeCodeSessions is keyed by the SDK session id, so
25747
+ // control.threadId here is the SDK session id, NOT the linzumi thread
25748
+ // id. The drain matches pending approvals by their linzumi threadId,
25749
+ // so pass the session's stored linzumi threadId (Codex PR #1846 P1).
25750
+ sessionThreadId: claudeSession.threadId,
25751
+ log: log2,
25752
+ reason: "full_access_enabled"
25753
+ });
25675
25754
  }
25676
25755
  return {
25677
25756
  instanceId,
@@ -26521,6 +26600,7 @@ async function startClaudeCodeProviderInstance(args) {
26521
26600
  args.options,
26522
26601
  args.control
26523
26602
  );
26603
+ const initialPermissionMode = runtimeSettings.approvalPolicy === void 0 ? void 0 : claudePermissionModeForApprovalPolicy(runtimeSettings.approvalPolicy);
26524
26604
  if (args.resumeSessionId !== void 0) {
26525
26605
  try {
26526
26606
  await validateClaudeCodeResumeSession({
@@ -26557,6 +26637,7 @@ async function startClaudeCodeProviderInstance(args) {
26557
26637
  let startControlResponded = false;
26558
26638
  let activeSessionId;
26559
26639
  let sessionControls;
26640
+ let startupApprovalDrain;
26560
26641
  const planMirrorClient = createLinzumiMcpApiClient({
26561
26642
  kandanUrl: args.options.kandanUrl,
26562
26643
  accessToken: args.options.token,
@@ -26887,6 +26968,18 @@ async function startClaudeCodeProviderInstance(args) {
26887
26968
  linzumiContext
26888
26969
  }),
26889
26970
  model: claudeCodeModelForRuntimeModel(runtimeSettings.model),
26971
+ // Apply the user's initial access level at session START, mirroring
26972
+ // codex (which seeds approvalPolicy / sandbox via
26973
+ // codexThreadRuntimeOverrides at start). Without this every Claude
26974
+ // Code session started in the SDK's 'default' mode and the no-prompt
26975
+ // ("never" -> bypassPermissions) level only took effect once an
26976
+ // update_session_settings control arrived post-start - so WebFetch
26977
+ // (no built-in allowlist) still raised an approval card on turn 1.
26978
+ // The mode is derived from runtimeSettings.approvalPolicy, which the
26979
+ // server already gates so only "never" (paired with a full-access
26980
+ // sandbox) survives to map to bypassPermissions; lesser levels keep
26981
+ // their 'default' / 'acceptEdits' modes.
26982
+ ...initialPermissionMode === void 0 ? {} : { permissionMode: initialPermissionMode },
26890
26983
  resumeSessionId: args.resumeSessionId,
26891
26984
  abortController,
26892
26985
  streamingInput: inputQueue,
@@ -26904,6 +26997,22 @@ async function startClaudeCodeProviderInstance(args) {
26904
26997
  allowedTools: ["mcp__linzumi__*"],
26905
26998
  onSessionControls: (controls) => {
26906
26999
  sessionControls = controls;
27000
+ if (initialPermissionMode === "bypassPermissions") {
27001
+ startupApprovalDrain = settleClaudeCodeApprovalsForSession({
27002
+ kandan: args.kandan,
27003
+ topic: args.topic,
27004
+ pendingClaudeCodeApprovals: args.pendingClaudeCodeApprovals,
27005
+ sessionThreadId: threadId,
27006
+ log: args.log,
27007
+ reason: "full_access_started"
27008
+ }).catch((error) => {
27009
+ args.log("claude_code.startup_approval_drain_failed", {
27010
+ linzumi_thread_id: threadId,
27011
+ claude_session_id: activeSessionId ?? null,
27012
+ message: error instanceof Error ? error.message : String(error)
27013
+ });
27014
+ });
27015
+ }
26907
27016
  },
26908
27017
  onTurnCompleted: () => {
26909
27018
  inputQueue.completeTurn();
@@ -26996,6 +27105,9 @@ async function startClaudeCodeProviderInstance(args) {
26996
27105
  message: error instanceof Error ? error.message : String(error)
26997
27106
  });
26998
27107
  }
27108
+ if (startupApprovalDrain !== void 0) {
27109
+ await startupApprovalDrain;
27110
+ }
26999
27111
  void sessionWork.then(
27000
27112
  () => {
27001
27113
  args.log("claude_code.session_loop_ended", {
@@ -27031,6 +27143,35 @@ function claudePermissionModeForApprovalPolicy(approvalPolicy) {
27031
27143
  return void 0;
27032
27144
  }
27033
27145
  }
27146
+ function claudeCodeApprovalsForSessionThread(pendingClaudeCodeApprovals, sessionThreadId) {
27147
+ return [...pendingClaudeCodeApprovals.entries()].filter(
27148
+ ([, pending]) => pending.threadId === sessionThreadId
27149
+ );
27150
+ }
27151
+ async function settleClaudeCodeApprovalsForSession(args) {
27152
+ const pendingForSession = claudeCodeApprovalsForSessionThread(
27153
+ args.pendingClaudeCodeApprovals,
27154
+ args.sessionThreadId
27155
+ );
27156
+ for (const [requestId, pending] of pendingForSession) {
27157
+ pending.resolve({ type: "allow" });
27158
+ await publishClaudeCodeMessageState(args.kandan, args.topic, {
27159
+ workspace: pending.workspace,
27160
+ channel: pending.channel,
27161
+ threadId: pending.threadId,
27162
+ sourceSeq: pending.sourceSeq,
27163
+ status: "processing",
27164
+ reason: "Claude Code tool approved",
27165
+ sessionId: pending.sessionId ?? args.sessionThreadId
27166
+ });
27167
+ args.log("claude_code.approval_request_auto_approved", {
27168
+ request_id: requestId,
27169
+ source_seq: pending.sourceSeq,
27170
+ session_id: pending.sessionId ?? args.sessionThreadId,
27171
+ reason: args.reason
27172
+ });
27173
+ }
27174
+ }
27034
27175
  function claudeSteerInputText(input) {
27035
27176
  const items = arrayValue(input) ?? [];
27036
27177
  const text2 = items.flatMap((item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linzumi/cli",
3
- "version": "0.0.86-beta",
3
+ "version": "0.0.87-beta",
4
4
  "description": "Linzumi CLI — point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",
5
5
  "type": "module",
6
6
  "bin": {