@mmmbuto/nexuscrew 0.8.45 → 0.8.46

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.
@@ -11,7 +11,7 @@
11
11
  <meta name="apple-mobile-web-app-title" content="NexusCrew" />
12
12
  <link rel="manifest" href="/manifest.json" />
13
13
  <title>NexusCrew</title>
14
- <script type="module" crossorigin src="/assets/index-DNFEGdog.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-DMG-rioF.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-BAq6N1Md.css">
16
16
  </head>
17
17
  <body>
@@ -1 +1 @@
1
- {"version":"0.8.45"}
1
+ {"version":"0.8.46"}
@@ -34,7 +34,7 @@ const {
34
34
  resolveCwd, normalizeCwdRel, deriveCwdRel,
35
35
  } = require('./definitions.js');
36
36
  const {
37
- publicCatalog, describeManaged, describeCatalogCredential, defaultShellEngine, defaultAgyEngine,
37
+ publicCatalog, describeManaged, describeCatalogCredential, defaultShellEngine, defaultAgyEngine, defaultKimiEngine,
38
38
  } = require('./managed.js');
39
39
  const { validEnvKey } = require('./env-key.js');
40
40
  const { setCredential, removeCredential } = require('./credentials.js');
@@ -107,6 +107,21 @@ function backfillAgyEngine(defsPath, defs, cfg = {}) {
107
107
  try { return atomicWrite(defsPath, draft); } catch (_) { return defs; }
108
108
  }
109
109
 
110
+ // Backfill dell'engine Kimi Code CLI nativo: installazioni esistenti ricevono
111
+ // kimi.native in modo idempotente e non distruttivo. Nessun platform gate: il
112
+ // CLI gira ovunque giri Node e su Termux il resolver applica gia' il workaround
113
+ // shebang. Idempotente (gia' presente -> skip), NON sovrascrive un id
114
+ // 'kimi.native' gia' scelto dall'utente per altro (collisione -> skip, store
115
+ // invariato), rispetta il cap MAX_ENGINES. Non tocca CELLE.
116
+ function backfillKimiEngine(defsPath, defs) {
117
+ if (!defs || defs.engines.some((engine) => engine.managed?.client === 'kimi')) return defs;
118
+ if (defs.engines.some((engine) => engine.id === 'kimi.native')) return defs;
119
+ if (defs.engines.length >= CAPS.MAX_ENGINES) return defs;
120
+ const draft = draftFrom(defs);
121
+ draft.engines.push(defaultKimiEngine());
122
+ try { return atomicWrite(defsPath, draft); } catch (_) { return defs; }
123
+ }
124
+
110
125
  // Applica engine + modello + policy come un'unica transizione. Ogni engine ricorda
111
126
  // il proprio ultimo modello E l'ultima policy; passando a un altro engine né
112
127
  // l'uno né l'altra attraversano il confine. La policy e' PER-CELL PER-ENGINE:
@@ -275,6 +290,7 @@ async function createBuiltinFleet(cfg = {}) {
275
290
  }
276
291
  boot = backfillShellEngine(defsPath, boot);
277
292
  boot = backfillAgyEngine(defsPath, boot, cfg);
293
+ boot = backfillKimiEngine(defsPath, boot);
278
294
  }
279
295
 
280
296
  // Adopt or create the shared server before exposing a mutable Fleet. Reapply
@@ -808,7 +824,7 @@ async function createBuiltinFleet(cfg = {}) {
808
824
  rc: { type: 'boolean', required: false, default: false },
809
825
  managed: {
810
826
  type: 'object', requiredFor: 'managed',
811
- client: { type: 'enum', values: ['claude', 'codex', 'codex-vl', 'pi', 'agy', 'shell'] },
827
+ client: { type: 'enum', values: ['claude', 'codex', 'codex-vl', 'pi', 'agy', 'kimi', 'shell'] },
812
828
  provider: { type: 'catalog', source: 'managedCatalog' },
813
829
  credentialProfile: { type: 'string', required: false, max: 32 },
814
830
  model: { type: 'string', required: false, max: CAPS.MAX_MODEL_VAL_LEN },
@@ -873,6 +889,7 @@ module.exports = {
873
889
  createBuiltinFleet,
874
890
  backfillShellEngine,
875
891
  backfillAgyEngine,
892
+ backfillKimiEngine,
876
893
  resolveCellCwd,
877
894
  composeLaunchArgv,
878
895
  composeClientInvocation,
@@ -65,7 +65,7 @@ const MANAGED_KEYS = new Set(['client', 'provider', 'credentialProfile', 'model'
65
65
  // resolution order (runtime -> store -> shell -> key files -> legacy) so a
66
66
  // pre-WP1 fleet.json migrates no-op: no existing cell changes resolution.
67
67
  const CREDENTIAL_SOURCES = Object.freeze(['environment', 'nexuscrew-store', 'auto']);
68
- const CLIENT_LABELS = Object.freeze({ claude: 'Claude Code', codex: 'Codex', 'codex-vl': 'Codex-VL', pi: 'Pi', agy: 'Agy', shell: 'Shell' });
68
+ const CLIENT_LABELS = Object.freeze({ claude: 'Claude Code', codex: 'Codex', 'codex-vl': 'Codex-VL', pi: 'Pi', agy: 'Agy', kimi: 'Kimi Code CLI', shell: 'Shell' });
69
69
  const PROVIDER_ID_RE = /^[a-z][a-z0-9_-]{0,31}$/;
70
70
 
71
71
  function validBaseUrl(value) {
@@ -142,6 +142,16 @@ const CATALOG = Object.freeze([
142
142
  // (core) per la UI; describeManaged lo dichiara non configurato altrove.
143
143
  // Termux/Windows restano fuori dal primary: l'utente usa agy via shell.local.
144
144
  { id: 'agy.native', client: 'agy', provider: 'native', label: 'Agy', auth: 'login', protocol: 'agy_native', core: true },
145
+
146
+ // Kimi Code CLI nativo (@moonshot-ai/kimi-code): client gestito con auth
147
+ // delegata al login del CLI (device-code flow, provider in config.toml).
148
+ // NexusCrew non legge ne' copia credenziali: nessun env provider, nessun
149
+ // token su argv. Distinto dal provider claude.kimi-code (adattatore Claude
150
+ // Code sull'endpoint Kimi), che resta il percorso K3 gestito via ANTHROPIC_*.
151
+ // Non e' un default seed: backfill idempotente in builtin.js, come Agy ma
152
+ // senza platform gate (il CLI gira ovunque giri Node; su Termux il resolver
153
+ // applica gia' il workaround shebang needsExplicitNode).
154
+ { id: 'kimi.native', client: 'kimi', provider: 'native', label: 'Kimi account (CLI login)', auth: 'login', protocol: 'kimi_native', core: true, notice: 'kimi-native' },
145
155
  ]);
146
156
 
147
157
  function profileFor(client, provider, credentialProfile) {
@@ -234,6 +244,18 @@ function defaultAgyEngine() {
234
244
  };
235
245
  }
236
246
 
247
+ // Engine Kimi Code CLI per il backfill (builtin.js): standard di default, auth
248
+ // delegata al login nativo del CLI, niente remote-control. Non e' un default seed.
249
+ function defaultKimiEngine() {
250
+ const profile = CATALOG.find((entry) => entry.id === 'kimi.native');
251
+ return {
252
+ id: profile.id,
253
+ label: CLIENT_LABELS.kimi,
254
+ rc: false,
255
+ managed: { client: 'kimi', provider: 'native', model: '', permissionPolicy: 'standard' },
256
+ };
257
+ }
258
+
237
259
  function parseAssignments(raw) {
238
260
  const out = {};
239
261
  for (const line of raw.split(/\r?\n/)) {
@@ -753,6 +775,11 @@ function resolveManagedEngine(engine, cell, cfg = {}) {
753
775
  if (effectivePolicy === 'unsafe') {
754
776
  if (spec.client === 'claude' || spec.client === 'agy') args.push('--dangerously-skip-permissions');
755
777
  if (spec.client === 'codex' || spec.client === 'codex-vl') args.push('--dangerously-bypass-approvals-and-sandbox');
778
+ // Kimi Code CLI: unsafe mappa su --yolo (auto-approva le chiamate tool
779
+ // ordinarie ma l'agente puo' ancora fare domande). --auto (fully
780
+ // autonomous, nessuna domanda) NON e' mappato: il contratto NexusCrew
781
+ // distingue solo standard/unsafe e il default resta interattivo.
782
+ if (spec.client === 'kimi') args.push('--yolo');
756
783
  }
757
784
  let shellOneShot = false;
758
785
  if (spec.client === 'shell') {
@@ -884,8 +911,17 @@ function resolveManagedEngine(engine, cell, cfg = {}) {
884
911
  // dal push generico qui sotto). Senza prompt parte il TUI interattivo `agy`.
885
912
  if (model) args.push('--model', model);
886
913
  if (cell?.prompt) args.push('--prompt-interactive');
914
+ } else if (spec.client === 'kimi') {
915
+ // Kimi Code CLI nativo: auth e provider gestiti dal CLI (login device-code,
916
+ // config.toml): niente env provider, niente credenziali su argv. Il CLI non
917
+ // documenta un flag prompt interattivo (`kimi -p` e' non-interattivo, senza
918
+ // TUI): il prompt della cella NON va su argv ma viene iniettato via
919
+ // bracketed paste dopo la readiness (promptMode 'send-keys' qui sotto,
920
+ // reiniettato anche ai restart supervisionati). Senza argomenti parte il
921
+ // TUI interattivo nella cwd della cella.
922
+ if (model) args.push('--model', model);
887
923
  }
888
- if (spec.client !== 'shell' && cell?.prompt) args.push(cell.prompt);
924
+ if (spec.client !== 'shell' && spec.client !== 'kimi' && cell?.prompt) args.push(cell.prompt);
889
925
  // nexuscrew-store source: neutralize the profile's env set in the composed
890
926
  // child env (unset, never empty), so the runtime cannot leak credentials that
891
927
  // the local store is meant to own.
@@ -896,7 +932,8 @@ function resolveManagedEngine(engine, cell, cfg = {}) {
896
932
  args.unshift(info.binary);
897
933
  }
898
934
  return { ok: true, info, engine: {
899
- ...engine, command, args, env, promptMode: 'managed-argv', clientBinary: info.binary,
935
+ ...engine, command, args, env,
936
+ promptMode: spec.client === 'kimi' ? 'send-keys' : 'managed-argv', clientBinary: info.binary,
900
937
  ...(spec.client === 'shell' ? { shellOneShot } : {}),
901
938
  } };
902
939
  }
@@ -909,7 +946,10 @@ function publicCatalog() {
909
946
  protocols: [...(p.protocols || [p.protocol])], supportsUnsafe: !['pi', 'shell'].includes(p.client), requiresModel: !!p.requiresModel || !!p.custom,
910
947
  permissionPolicyDefault: p.client === 'claude' ? 'unsafe' : 'standard',
911
948
  rc: !!p.rc, custom: !!p.custom, default: !!p.default, notice: p.notice || '',
912
- credentialEnv: p.auth === 'dynamic' ? !!p.credentialEnv : (ENV_KEY_RE.test(p.auth || '') ? p.auth : false),
949
+ // 'login'/'none' non sono variabili d'ambiente: nessuna KEY section per gli
950
+ // engine che delegano l'auth al login del CLI (rappresentazione onesta).
951
+ credentialEnv: p.auth === 'dynamic' ? !!p.credentialEnv
952
+ : (p.auth !== 'login' && p.auth !== 'none' && ENV_KEY_RE.test(p.auth || '') ? p.auth : false),
913
953
  defaultEnvKey: p.defaultEnvKey || '',
914
954
  }));
915
955
  }
@@ -918,7 +958,7 @@ module.exports = {
918
958
  CATALOG, OLLAMA_CLOUD_MODELS, OLLAMA_CONTEXT, ALIBABA_TOKEN_PLAN_MODELS,
919
959
  ALIBABA_CODEX_MODELS, ALIBABA_TOKEN_PLAN_CONTEXT, ALIBABA_PI_MODELS,
920
960
  CLIENT_LABELS, normalizeManagedSpec, profileFor,
921
- defaultDefinitions, defaultShellEngine, defaultAgyEngine, describeManaged, describeCatalogCredential, discoverOllamaModels, resolveManagedEngine, needsExplicitNode,
961
+ defaultDefinitions, defaultShellEngine, defaultAgyEngine, defaultKimiEngine, describeManaged, describeCatalogCredential, discoverOllamaModels, resolveManagedEngine, needsExplicitNode,
922
962
  discoverPiModels, EXTERNAL_DISCOVERY_TIMEOUT_MS, parseEnvFile, parseProviderShellFile, findBinary, publicCatalog, writePiProviderExtension,
923
963
  providerKeyPaths, parseProviderKeyFiles, credentialSources, credential,
924
964
  credentialEnvNeutralizeSet, applyStoreNeutralization,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/nexuscrew",
3
- "version": "0.8.45",
3
+ "version": "0.8.46",
4
4
  "description": "Faithful browser tmux client — attach to live sessions over a real PTY, localhost-only, mobile-easy",
5
5
  "main": "lib/server.js",
6
6
  "bin": {