jinzd-ai-cli 0.4.253 → 0.4.255

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 (33) hide show
  1. package/dist/{batch-TPW2SM6G.js → batch-OWBKG6XZ.js} +2 -2
  2. package/dist/{chunk-P5JUXUBS.js → chunk-2UZ23L5P.js} +2 -2
  3. package/dist/{chunk-SC6FMQLH.js → chunk-3WKUKMBG.js} +3 -3
  4. package/dist/{chunk-YWG5KKSL.js → chunk-7QWFFLKV.js} +3 -3
  5. package/dist/{chunk-RPYNPLIE.js → chunk-B42HK6GL.js} +1 -1
  6. package/dist/{chunk-UMW33EEH.js → chunk-CU5ZNAIX.js} +1 -1
  7. package/dist/{chunk-Q4KBR2SG.js → chunk-FOC2YWOF.js} +1 -1
  8. package/dist/{chunk-OWCEONX7.js → chunk-IRSNREEO.js} +1 -1
  9. package/dist/{chunk-BZNTSGLQ.js → chunk-PSP4W2MG.js} +15 -7
  10. package/dist/{chunk-YMHARKR6.js → chunk-SMIQ6CBX.js} +1 -1
  11. package/dist/{chunk-M2QHKPRA.js → chunk-SVWIUNOA.js} +1 -1
  12. package/dist/{chunk-ABMMKA5S.js → chunk-U6OV523Y.js} +1 -1
  13. package/dist/{chunk-USG3ASQ2.js → chunk-X2V76VPG.js} +1 -1
  14. package/dist/{chunk-2JHYZUQE.js → chunk-YJ7VL7VL.js} +1 -1
  15. package/dist/{ci-DYTVVEBO.js → ci-V5GVGYZO.js} +4 -4
  16. package/dist/{ci-format-QTSA6FJJ.js → ci-format-CTGDLJTS.js} +2 -2
  17. package/dist/{constants-7KSDW6RF.js → constants-LJRYL7IN.js} +1 -1
  18. package/dist/{doctor-cli-ZOIMXV4C.js → doctor-cli-GOM2GQUK.js} +4 -4
  19. package/dist/electron-server.js +17 -9
  20. package/dist/{hub-6L2UCZAU.js → hub-4EEDUJED.js} +1 -1
  21. package/dist/index.js +116 -112
  22. package/dist/{persistent-memory-HQKE5X7Z.js → persistent-memory-DMN76UB5.js} +2 -2
  23. package/dist/{persistent-memory-QOT2TQCT.js → persistent-memory-EEAGHDFR.js} +2 -2
  24. package/dist/{pr-HMOXDXWR.js → pr-Q74YHWN2.js} +4 -4
  25. package/dist/{run-tests-RSYTYFZF.js → run-tests-ADZQ2JWI.js} +2 -2
  26. package/dist/{run-tests-JVQU3RAN.js → run-tests-N3ES4YMU.js} +2 -2
  27. package/dist/{server-O2YQGG72.js → server-HUWVPJKQ.js} +5 -5
  28. package/dist/{server-VOIG5VKM.js → server-PMEZ3HDO.js} +11 -11
  29. package/dist/{task-orchestrator-PLP3INNN.js → task-orchestrator-KLCN25OY.js} +5 -5
  30. package/dist/{usage-3EQUVK37.js → usage-MNMRX5OE.js} +2 -2
  31. package/dist/web/client/api.js +41 -0
  32. package/dist/web/client/app.js +9 -35
  33. package/package.json +2 -1
@@ -23,7 +23,7 @@ import {
23
23
  scanDirTree,
24
24
  scanProject,
25
25
  setupProxy
26
- } from "./chunk-P5JUXUBS.js";
26
+ } from "./chunk-2UZ23L5P.js";
27
27
  import {
28
28
  computeCost,
29
29
  formatCost,
@@ -63,7 +63,7 @@ import {
63
63
  spawnAgentContext,
64
64
  truncateOutput,
65
65
  undoStack
66
- } from "./chunk-BZNTSGLQ.js";
66
+ } from "./chunk-PSP4W2MG.js";
67
67
  import {
68
68
  addMemoryEntry,
69
69
  clearMemoryEntries,
@@ -77,7 +77,7 @@ import {
77
77
  parseWritableScope,
78
78
  updateMemoryApproval,
79
79
  updateMemoryEntry
80
- } from "./chunk-USG3ASQ2.js";
80
+ } from "./chunk-X2V76VPG.js";
81
81
  import "./chunk-GLSR2NR3.js";
82
82
  import "./chunk-UUSRWSSX.js";
83
83
  import "./chunk-CKH4KQ4E.js";
@@ -90,13 +90,13 @@ import {
90
90
  buildDoctorReport,
91
91
  formatDoctorReport,
92
92
  loadContextFiles
93
- } from "./chunk-SC6FMQLH.js";
93
+ } from "./chunk-3WKUKMBG.js";
94
94
  import {
95
95
  ProviderRegistry
96
96
  } from "./chunk-ZRBGH245.js";
97
97
  import {
98
98
  ConfigManager
99
- } from "./chunk-OWCEONX7.js";
99
+ } from "./chunk-IRSNREEO.js";
100
100
  import {
101
101
  describePlugin,
102
102
  getActivePluginAssets,
@@ -111,7 +111,7 @@ import {
111
111
  runTool,
112
112
  setPluginEnabled,
113
113
  trustPlugin
114
- } from "./chunk-Q4KBR2SG.js";
114
+ } from "./chunk-FOC2YWOF.js";
115
115
  import {
116
116
  CONTENT_ONLY_STREAM_REMINDER,
117
117
  TEE_FINAL_USER_NUDGE,
@@ -136,7 +136,7 @@ import {
136
136
  getGitRoot
137
137
  } from "./chunk-HOSJZMQS.js";
138
138
  import "./chunk-4BKXL7SM.js";
139
- import "./chunk-ABMMKA5S.js";
139
+ import "./chunk-U6OV523Y.js";
140
140
  import {
141
141
  AGENTIC_BEHAVIOR_GUIDELINE,
142
142
  AUTHOR,
@@ -152,7 +152,7 @@ import {
152
152
  SKILLS_DIR_NAME,
153
153
  VERSION,
154
154
  buildUserIdentityPrompt
155
- } from "./chunk-M2QHKPRA.js";
155
+ } from "./chunk-SVWIUNOA.js";
156
156
  import "./chunk-6RPGQ5CG.js";
157
157
  import "./chunk-KHYD3WXE.js";
158
158
  import "./chunk-NYNSYLFY.js";
@@ -813,7 +813,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
813
813
  Cost: ${formatCost(cost)}` : "";
814
814
  let memoryLine = "";
815
815
  try {
816
- const { countPendingMemories } = await import("./persistent-memory-HQKE5X7Z.js");
816
+ const { countPendingMemories } = await import("./persistent-memory-DMN76UB5.js");
817
817
  const pending = countPendingMemories(ctx.config.getConfigDir());
818
818
  if (pending > 0) memoryLine = `
819
819
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1622,7 +1622,7 @@ async function handleSecurityReview(args, ctx) {
1622
1622
  async function handleTest(args, ctx) {
1623
1623
  ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
1624
1624
  try {
1625
- const { executeTests } = await import("./run-tests-RSYTYFZF.js");
1625
+ const { executeTests } = await import("./run-tests-ADZQ2JWI.js");
1626
1626
  const argStr = args.join(" ").trim();
1627
1627
  let testArgs = {};
1628
1628
  if (argStr) {
@@ -1886,7 +1886,7 @@ async function handleMemory(args, ctx) {
1886
1886
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
1887
1887
  } else if (sub === "export") {
1888
1888
  if (args[1] === "md") {
1889
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-HQKE5X7Z.js");
1889
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-DMN76UB5.js");
1890
1890
  ctx.send({
1891
1891
  type: "export_data",
1892
1892
  format: "md",
@@ -3,15 +3,15 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-BZNTSGLQ.js";
7
- import "./chunk-USG3ASQ2.js";
6
+ } from "./chunk-PSP4W2MG.js";
7
+ import "./chunk-X2V76VPG.js";
8
8
  import "./chunk-GLSR2NR3.js";
9
9
  import "./chunk-UUSRWSSX.js";
10
10
  import "./chunk-CKH4KQ4E.js";
11
11
  import "./chunk-BXP6YZ2P.js";
12
12
  import {
13
13
  runTool
14
- } from "./chunk-Q4KBR2SG.js";
14
+ } from "./chunk-FOC2YWOF.js";
15
15
  import {
16
16
  getDangerLevel,
17
17
  runLeanAgentLoop
@@ -19,10 +19,10 @@ import {
19
19
  import "./chunk-5ULLIOVC.js";
20
20
  import "./chunk-HOSJZMQS.js";
21
21
  import "./chunk-4BKXL7SM.js";
22
- import "./chunk-ABMMKA5S.js";
22
+ import "./chunk-U6OV523Y.js";
23
23
  import {
24
24
  SUBAGENT_ALLOWED_TOOLS
25
- } from "./chunk-M2QHKPRA.js";
25
+ } from "./chunk-SVWIUNOA.js";
26
26
  import "./chunk-6RPGQ5CG.js";
27
27
  import "./chunk-KHYD3WXE.js";
28
28
  import "./chunk-NYNSYLFY.js";
@@ -8,9 +8,9 @@ import {
8
8
  } from "./chunk-GUOLPI33.js";
9
9
  import {
10
10
  ConfigManager
11
- } from "./chunk-OWCEONX7.js";
11
+ } from "./chunk-IRSNREEO.js";
12
12
  import "./chunk-5ULLIOVC.js";
13
- import "./chunk-M2QHKPRA.js";
13
+ import "./chunk-SVWIUNOA.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
15
 
16
16
  // src/cli/usage.ts
@@ -0,0 +1,41 @@
1
+ export async function fetchSessionReplay(sessionId) {
2
+ const resp = await fetch('/api/sessions/' + encodeURIComponent(sessionId) + '/replay', {
3
+ credentials: 'same-origin',
4
+ });
5
+ const data = await resp.json().catch(() => ({}));
6
+ if (!resp.ok) {
7
+ throw new Error(data.error || String(resp.status));
8
+ }
9
+ return data.session;
10
+ }
11
+
12
+ export async function submitAuth(mode, username, password) {
13
+ const path = mode === 'register' ? '/api/auth/register' : '/api/auth/login';
14
+ const resp = await fetch(path, {
15
+ method: 'POST',
16
+ headers: { 'content-type': 'application/json' },
17
+ credentials: 'same-origin',
18
+ body: JSON.stringify({ username, password }),
19
+ });
20
+ const data = await resp.json().catch(() => ({}));
21
+ return { ok: resp.ok, status: resp.status, data };
22
+ }
23
+
24
+ export async function logoutAuth() {
25
+ await fetch('/api/auth/logout', { method: 'POST', credentials: 'same-origin' });
26
+ }
27
+
28
+ export async function fetchStatus() {
29
+ const resp = await fetch('/api/status');
30
+ return resp.json();
31
+ }
32
+
33
+ export async function registerFirstUser(username, password) {
34
+ const resp = await fetch('/api/auth/register', {
35
+ method: 'POST',
36
+ headers: { 'Content-Type': 'application/json' },
37
+ credentials: 'same-origin',
38
+ body: JSON.stringify({ username, password }),
39
+ });
40
+ return resp.json();
41
+ }
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import { escapeHtml, formatToolArgs, formatDuration, sanitizeHtml } from './util.js';
11
+ import { fetchSessionReplay, fetchStatus, logoutAuth, registerFirstUser, submitAuth } from './api.js';
11
12
 
12
13
  // ── State ──────────────────────────────────────────────────────────
13
14
  // All cross-cutting mutable state now lives in state.js (P0-4 Phase 1),
@@ -43,8 +44,7 @@ marked.setOptions({
43
44
 
44
45
  function connect() {
45
46
  const protocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
46
- // Security: do NOT put token in URL (visible in logs/referrer). Cookie is sent automatically.
47
- // For reconnection, also send token as first message in case cookie is blocked.
47
+ // Security: do NOT put token in URL or WebSocket JSON. Cookie is sent automatically.
48
48
  ws = new WebSocket(`${protocol}//${location.host}?tabId=${tabId}`);
49
49
 
50
50
  ws.onopen = () => {
@@ -52,10 +52,6 @@ function connect() {
52
52
  reconnectDelay = 1000; // Reset backoff on success
53
53
  connectionStatus.textContent = '🟢 Connected';
54
54
  connectionStatus.className = 'status-connected';
55
- // Send stored token for auth (in case cookie is not available)
56
- if (authToken) {
57
- ws.send(JSON.stringify({ type: 'auth', action: 'token', token: authToken }));
58
- }
59
55
  requestSessionList();
60
56
  checkAuthStatus();
61
57
  // Start heartbeat ping every 30s
@@ -1155,15 +1151,7 @@ async function openReplay(sessionId) {
1155
1151
  modal.showModal();
1156
1152
 
1157
1153
  try {
1158
- const headers = {};
1159
- if (authToken) headers['Authorization'] = 'Bearer ' + authToken;
1160
- const resp = await fetch('/api/sessions/' + encodeURIComponent(sessionId) + '/replay', { headers });
1161
- if (!resp.ok) {
1162
- const body = await resp.json().catch(() => ({}));
1163
- metaEl.textContent = 'Failed: ' + (body.error || resp.status);
1164
- return;
1165
- }
1166
- const { session } = await resp.json();
1154
+ const session = await fetchSessionReplay(sessionId);
1167
1155
  renderReplay(session, metaEl, usageEl, timelineEl);
1168
1156
  } catch (err) {
1169
1157
  metaEl.textContent = 'Failed to load: ' + (err && err.message ? err.message : err);
@@ -2707,16 +2695,9 @@ export async function handleAuth(event) {
2707
2695
  submitBtn.disabled = true;
2708
2696
 
2709
2697
  try {
2710
- const path = authMode === 'register' ? '/api/auth/register' : '/api/auth/login';
2711
- const resp = await fetch(path, {
2712
- method: 'POST',
2713
- headers: { 'content-type': 'application/json' },
2714
- credentials: 'same-origin', // ensure Set-Cookie is honored
2715
- body: JSON.stringify({ username, password }),
2716
- });
2717
- const data = await resp.json().catch(() => ({}));
2718
- if (!resp.ok || !data.success) {
2719
- errorEl.textContent = data.error || `Authentication failed (HTTP ${resp.status})`;
2698
+ const { ok, status, data } = await submitAuth(authMode, username, password);
2699
+ if (!ok || !data.success) {
2700
+ errorEl.textContent = data.error || `Authentication failed (HTTP ${status})`;
2720
2701
  errorEl.classList.remove('hidden');
2721
2702
  submitBtn.disabled = false;
2722
2703
  return;
@@ -2775,7 +2756,7 @@ function updateUserMenu() {
2775
2756
  export async function handleLogout() {
2776
2757
  // M4 fix (v0.4.107): only the server can clear an httpOnly cookie.
2777
2758
  try {
2778
- await fetch('/api/auth/logout', { method: 'POST', credentials: 'same-origin' });
2759
+ await logoutAuth();
2779
2760
  } catch { /* ignore — close WS anyway */ }
2780
2761
  authToken = '';
2781
2762
  authUsername = '';
@@ -2832,8 +2813,7 @@ export async function handleLogout() {
2832
2813
 
2833
2814
  async function checkAuthStatus() {
2834
2815
  try {
2835
- const res = await fetch('/api/status');
2836
- const data = await res.json();
2816
+ const data = await fetchStatus();
2837
2817
  const btn = document.getElementById('btn-enable-auth');
2838
2818
  if (data.auth && !data.auth.enabled && !authUsername) {
2839
2819
  btn.classList.remove('hidden');
@@ -2851,13 +2831,7 @@ export function showEnableAuthDialog() {
2851
2831
 
2852
2832
  // M4 fix (v0.4.107): credentials:'same-origin' lets the httpOnly cookie
2853
2833
  // come back; we no longer touch the token.
2854
- fetch('/api/auth/register', {
2855
- method: 'POST',
2856
- headers: { 'Content-Type': 'application/json' },
2857
- credentials: 'same-origin',
2858
- body: JSON.stringify({ username, password }),
2859
- })
2860
- .then(r => r.json())
2834
+ registerFirstUser(username, password)
2861
2835
  .then(data => {
2862
2836
  if (data.error) {
2863
2837
  alert('Error: ' + data.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.253",
3
+ "version": "0.4.255",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,6 +21,7 @@
21
21
  "test:providers": "vitest run --config vitest.providers.config.ts tests/integration/provider-smoke.test.ts",
22
22
  "test:watch": "vitest",
23
23
  "test:coverage": "vitest run --coverage",
24
+ "test:dist": "npm run build && vitest run tests/unit/cli/version-drift.test.ts",
24
25
  "lint": "eslint src --max-warnings=0",
25
26
  "smoke:dist": "node scripts/smoke-dist.mjs",
26
27
  "prepublishOnly": "npm run build",