devanvil 2.1.0 → 2.1.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 (95) hide show
  1. package/README.ar.md +48 -23
  2. package/README.md +12 -8
  3. package/SECURITY.md +36 -16
  4. package/dist/cli.js +72 -5
  5. package/dist/cli.js.map +1 -0
  6. package/dist/core/contract-drift.js +16 -5
  7. package/dist/core/contract-drift.js.map +1 -0
  8. package/dist/core/converters.d.ts +3 -1
  9. package/dist/core/converters.js +317 -37
  10. package/dist/core/converters.js.map +1 -0
  11. package/dist/core/cron.js +38 -4
  12. package/dist/core/cron.js.map +1 -0
  13. package/dist/core/crypto.js +12 -1
  14. package/dist/core/crypto.js.map +1 -0
  15. package/dist/core/curl.js +6 -1
  16. package/dist/core/curl.js.map +1 -0
  17. package/dist/core/diff.js +3 -2
  18. package/dist/core/diff.js.map +1 -0
  19. package/dist/core/encoding.js +2 -1
  20. package/dist/core/encoding.js.map +1 -0
  21. package/dist/core/importers.js +1 -0
  22. package/dist/core/importers.js.map +1 -0
  23. package/dist/core/jwt.js +22 -8
  24. package/dist/core/jwt.js.map +1 -0
  25. package/dist/core/llm-tokens.js +1 -0
  26. package/dist/core/llm-tokens.js.map +1 -0
  27. package/dist/core/log-analyzer.js +1 -0
  28. package/dist/core/log-analyzer.js.map +1 -0
  29. package/dist/core/network.js +1 -0
  30. package/dist/core/network.js.map +1 -0
  31. package/dist/core/oauth-protobuf.js +17 -10
  32. package/dist/core/oauth-protobuf.js.map +1 -0
  33. package/dist/core/openapi.js +1 -0
  34. package/dist/core/openapi.js.map +1 -0
  35. package/dist/core/pipeline.js +1 -0
  36. package/dist/core/pipeline.js.map +1 -0
  37. package/dist/core/regex.js +14 -4
  38. package/dist/core/regex.js.map +1 -0
  39. package/dist/core/runner.js +1 -0
  40. package/dist/core/runner.js.map +1 -0
  41. package/dist/core/secrets.js +12 -7
  42. package/dist/core/secrets.js.map +1 -0
  43. package/dist/core/security.d.ts +24 -1
  44. package/dist/core/security.js +122 -4
  45. package/dist/core/security.js.map +1 -0
  46. package/dist/core/sql-explain.js +1 -0
  47. package/dist/core/sql-explain.js.map +1 -0
  48. package/dist/core/tls.js +6 -2
  49. package/dist/core/tls.js.map +1 -0
  50. package/dist/index.js +1 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/server/app.d.ts +5 -1
  53. package/dist/server/app.js +157 -13
  54. package/dist/server/app.js.map +1 -0
  55. package/dist/server/http-proxy.js +20 -10
  56. package/dist/server/http-proxy.js.map +1 -0
  57. package/dist/server/http-utils.d.ts +9 -0
  58. package/dist/server/http-utils.js +36 -3
  59. package/dist/server/http-utils.js.map +1 -0
  60. package/dist/server/load-tester.js +4 -0
  61. package/dist/server/load-tester.js.map +1 -0
  62. package/dist/server/mcp.d.ts +1 -1
  63. package/dist/server/mcp.js +12 -7
  64. package/dist/server/mcp.js.map +1 -0
  65. package/dist/server/mock-store.js +55 -13
  66. package/dist/server/mock-store.js.map +1 -0
  67. package/dist/server/plugin-loader.d.ts +2 -1
  68. package/dist/server/plugin-loader.js +22 -1
  69. package/dist/server/plugin-loader.js.map +1 -0
  70. package/dist/server/recorder-store.js +51 -2
  71. package/dist/server/recorder-store.js.map +1 -0
  72. package/dist/server/routes/network-routes.js +65 -10
  73. package/dist/server/routes/network-routes.js.map +1 -0
  74. package/dist/server/routes/tools-routes.js +10 -2
  75. package/dist/server/routes/tools-routes.js.map +1 -0
  76. package/dist/server/routes/workspace-routes.js +29 -6
  77. package/dist/server/routes/workspace-routes.js.map +1 -0
  78. package/dist/server/webhook-store.d.ts +1 -0
  79. package/dist/server/webhook-store.js +16 -2
  80. package/dist/server/webhook-store.js.map +1 -0
  81. package/dist/server/workspace-store.d.ts +4 -1
  82. package/dist/server/workspace-store.js +32 -7
  83. package/dist/server/workspace-store.js.map +1 -0
  84. package/dist/server/ws-probe.js +9 -0
  85. package/dist/server/ws-probe.js.map +1 -0
  86. package/dist/ui/app.js +83 -7
  87. package/dist/ui/styles.css +2 -2
  88. package/dist/ui/tools-data.js +47 -30
  89. package/dist/ui/tools-network.js +102 -28
  90. package/dist/ui/tools-ops.js +16 -12
  91. package/dist/ui/tools-pro.js +1 -0
  92. package/dist/ui/tools-security.js +30 -22
  93. package/dist/ui/tools-v12.js +41 -14
  94. package/dist/ui/tools-v21.js +26 -10
  95. package/package.json +4 -3
@@ -30,7 +30,11 @@
30
30
  function saveHistory(entry) {
31
31
  const list = loadHistory().filter((x) => !(x.method === entry.method && x.url === entry.url));
32
32
  list.unshift(entry);
33
- localStorage.setItem('devanvil.apiHistory', JSON.stringify(list.slice(0, 12)));
33
+ try {
34
+ localStorage.setItem('devanvil.apiHistory', JSON.stringify(list.slice(0, 12)));
35
+ } catch {
36
+ // Ignore storage quota or sandboxed iframe restrictions
37
+ }
34
38
  renderHistory();
35
39
  }
36
40
 
@@ -51,8 +55,12 @@
51
55
  const recordMockChk = h('input', { type: 'checkbox' });
52
56
  const envSelect = h('select', { style: { width: '160px' }, onChange: async (e) => {
53
57
  if (!e.target.value) return;
54
- await api('/api/workspace/environments/active', { body: { id: e.target.value } });
55
- toast('Active environment switched', 'ok');
58
+ try {
59
+ await api('/api/workspace/environments/active', { body: { id: e.target.value } });
60
+ toast('Active environment switched', 'ok');
61
+ } catch (err) {
62
+ toast(err.message, 'err');
63
+ }
56
64
  } });
57
65
 
58
66
  async function loadEnvironments() {
@@ -87,7 +95,7 @@
87
95
 
88
96
  const initialHeadersText = pending?.headers
89
97
  ? Object.entries(pending.headers).map(([k, v]) => `${k}: ${v}`).join('\n')
90
- : 'Accept: application/json\nUser-Agent: DevAnvil/1.1';
98
+ : 'Accept: application/json\nUser-Agent: DevAnvil/2.1';
91
99
 
92
100
  const headersArea = h('textarea', {
93
101
  rows: 5,
@@ -148,13 +156,20 @@
148
156
  }
149
157
  }
150
158
 
159
+ function utf8ToBase64(str) {
160
+ const bytes = new TextEncoder().encode(str);
161
+ let bin = '';
162
+ for (const b of bytes) bin += String.fromCharCode(b);
163
+ return btoa(bin);
164
+ }
165
+
151
166
  function buildEffectiveHeaders() {
152
167
  const hdrs = parseHeadersText(headersArea.value);
153
168
  const aType = authTypeSel.value;
154
169
  const aVal = authValInput.value.trim();
155
170
  if (aType === 'bearer' && aVal) hdrs['Authorization'] = `Bearer ${aVal}`;
156
171
  else if (aType === 'apikey' && aVal) hdrs['X-API-Key'] = aVal;
157
- else if (aType === 'basic' && aVal) hdrs['Authorization'] = `Basic ${btoa(aVal)}`;
172
+ else if (aType === 'basic' && aVal) hdrs['Authorization'] = `Basic ${utf8ToBase64(aVal)}`;
158
173
  return hdrs;
159
174
  }
160
175
 
@@ -367,6 +382,38 @@
367
382
  'div',
368
383
  { class: 'row' },
369
384
  h('button', { type: 'button', class: 'btn btn-sm', onClick: saveToCollection }, 'Save to Collection'),
385
+ h(
386
+ 'button',
387
+ {
388
+ type: 'button',
389
+ class: 'btn btn-ghost btn-sm',
390
+ onClick: () => {
391
+ const boundary = `----DevAnvilForm${Date.now().toString(16)}`;
392
+ const fields = [
393
+ ['name', 'devanvil-sample'],
394
+ ['mode', 'offline'],
395
+ ];
396
+ const parts = fields.map(
397
+ ([k, v]) => `--${boundary}\r\nContent-Disposition: form-data; name="${k}"\r\n\r\n${v}\r\n`,
398
+ );
399
+ parts.push(
400
+ `--${boundary}\r\nContent-Disposition: form-data; name="file"; filename="hello.txt"\r\nContent-Type: text/plain\r\n\r\nHello from DevAnvil multipart builder!\r\n--${boundary}--\r\n`,
401
+ );
402
+ if (method === 'GET' || method === 'HEAD') {
403
+ method = 'POST';
404
+ methodSel.value = 'POST';
405
+ }
406
+ const hdrs = parseHeadersText(headersArea.value);
407
+ delete hdrs['content-type'];
408
+ hdrs['Content-Type'] = `multipart/form-data; boundary=${boundary}`;
409
+ headersArea.value = Object.entries(hdrs).map(([k, v]) => `${k}: ${v}`).join('\n');
410
+ bodyArea.value = parts.join('');
411
+ void refreshCodegen();
412
+ toast('Built multipart/form-data payload & Content-Type boundary', 'ok');
413
+ },
414
+ },
415
+ 'Multipart Builder',
416
+ ),
370
417
  h('button', { type: 'button', class: 'btn btn-ghost btn-sm', onClick: refreshCodegen }, 'Generate Code'),
371
418
  ),
372
419
  ),
@@ -485,15 +532,19 @@
485
532
  type: 'button',
486
533
  class: 'btn btn-xs',
487
534
  onClick: async () => {
488
- const testMethod = r.method === 'ANY' ? 'GET' : r.method;
489
- const resp = await fetch(samplePath, {
490
- method: testMethod,
491
- headers: testMethod !== 'GET' && testMethod !== 'HEAD' ? { 'Content-Type': 'application/json' } : {},
492
- body: testMethod !== 'GET' && testMethod !== 'HEAD' ? '{"sample":true}' : undefined,
493
- });
494
- const txt = await resp.text();
495
- mockPreview.textContent = `${testMethod} ${samplePath} -> HTTP ${resp.status}\n\n${txt}`;
496
- await loadMocks();
535
+ try {
536
+ const testMethod = r.method === 'ANY' ? 'GET' : r.method;
537
+ const resp = await fetch(samplePath, {
538
+ method: testMethod,
539
+ headers: testMethod !== 'GET' && testMethod !== 'HEAD' ? { 'Content-Type': 'application/json' } : {},
540
+ body: testMethod !== 'GET' && testMethod !== 'HEAD' ? '{"sample":true}' : undefined,
541
+ });
542
+ const txt = await resp.text();
543
+ mockPreview.textContent = `${testMethod} ${samplePath} -> HTTP ${resp.status}\n\n${txt}`;
544
+ await loadMocks();
545
+ } catch (err) {
546
+ toast(err.message, 'err');
547
+ }
497
548
  },
498
549
  },
499
550
  'Test Live',
@@ -513,9 +564,13 @@
513
564
  type: 'button',
514
565
  class: 'btn btn-danger btn-xs',
515
566
  onClick: async () => {
516
- await api(`/api/mocks/${r.id}`, { method: 'DELETE' });
517
- toast('Mock route removed', 'ok');
518
- await loadMocks();
567
+ try {
568
+ await api(`/api/mocks/${encodeURIComponent(r.id)}`, { method: 'DELETE' });
569
+ toast('Mock route removed', 'ok');
570
+ await loadMocks();
571
+ } catch (err) {
572
+ toast(err.message, 'err');
573
+ }
519
574
  },
520
575
  },
521
576
  'Delete',
@@ -625,8 +680,12 @@
625
680
  sseBadge.className = 'badge badge-ok';
626
681
  });
627
682
  sseSource.addEventListener('webhook', async () => {
628
- const refreshed = await api(`/api/webhooks/${encodeURIComponent(activeChannel)}`);
629
- renderWebhookEvents(refreshed.events || []);
683
+ try {
684
+ const refreshed = await api(`/api/webhooks/${encodeURIComponent(activeChannel)}`);
685
+ renderWebhookEvents(refreshed.events || []);
686
+ } catch {
687
+ // Ignore transient refresh errors while SSE stays active
688
+ }
630
689
  });
631
690
  sseSource.addEventListener('cleared', () => {
632
691
  renderWebhookEvents([]);
@@ -642,12 +701,17 @@
642
701
  }
643
702
 
644
703
  async function sendTestWebhook() {
645
- await fetch(`/hook/${encodeURIComponent(activeChannel)}/stripe-demo?env=staging`, {
646
- method: 'POST',
647
- headers: { 'Content-Type': 'application/json', 'X-Webhook-Signature': 't=1700000000,v1=demo_sig' },
648
- body: JSON.stringify({ event: 'invoice.paid', amount: 4900, currency: 'usd', liveTest: true }),
649
- });
650
- toast('Captured test webhook live!', 'ok');
704
+ try {
705
+ const resp = await fetch(`/hook/${encodeURIComponent(activeChannel)}/stripe-demo?env=staging`, {
706
+ method: 'POST',
707
+ headers: { 'Content-Type': 'application/json', 'X-Webhook-Signature': 't=1700000000,v1=demo_sig' },
708
+ body: JSON.stringify({ event: 'invoice.paid', amount: 4900, currency: 'usd', liveTest: true }),
709
+ });
710
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
711
+ toast('Captured test webhook live!', 'ok');
712
+ } catch (err) {
713
+ toast(err.message, 'err');
714
+ }
651
715
  }
652
716
 
653
717
  const layout = h(
@@ -677,8 +741,12 @@
677
741
  type: 'button',
678
742
  class: 'btn btn-ghost btn-xs',
679
743
  onClick: async () => {
680
- const data = await api('/api/mocks');
681
- await copyText(JSON.stringify(data.routes, null, 2), 'Exported mock routes JSON to clipboard');
744
+ try {
745
+ const data = await api('/api/mocks');
746
+ await copyText(JSON.stringify(data.routes, null, 2), 'Exported mock routes JSON to clipboard');
747
+ } catch (err) {
748
+ toast(err.message, 'err');
749
+ }
682
750
  },
683
751
  },
684
752
  'Export JSON',
@@ -701,7 +769,13 @@
701
769
  channelInput,
702
770
  h('button', { type: 'button', class: 'btn btn-sm', onClick: () => connectChannel(channelInput.value) }, 'Switch Channel'),
703
771
  h('button', { type: 'button', class: 'btn btn-primary btn-sm', onClick: sendTestWebhook }, 'Send Test Webhook'),
704
- h('button', { type: 'button', class: 'btn btn-ghost btn-sm', onClick: () => api(`/api/webhooks/${encodeURIComponent(activeChannel)}`, { method: 'DELETE' }) }, 'Clear'),
772
+ h('button', { type: 'button', class: 'btn btn-ghost btn-sm', onClick: async () => {
773
+ try {
774
+ await api(`/api/webhooks/${encodeURIComponent(activeChannel)}`, { method: 'DELETE' });
775
+ } catch (err) {
776
+ toast(err.message, 'err');
777
+ }
778
+ } }, 'Clear'),
705
779
  ),
706
780
  h(
707
781
  'div',
@@ -236,18 +236,22 @@
236
236
  const httpList = h('div', { class: 'stack', style: { maxHeight: '260px', overflowY: 'auto' } });
237
237
 
238
238
  async function loadHttpStatuses() {
239
- const res = await api(`/api/utils/http-statuses?q=${encodeURIComponent(httpQuery.value)}`);
240
- httpList.textContent = '';
241
- for (const s of res.statuses) {
242
- const cls = s.code < 200 ? 'badge-info' : s.code < 300 ? 'badge-ok' : s.code < 400 ? 'badge-warn' : 'badge-err';
243
- httpList.appendChild(
244
- h(
245
- 'div',
246
- { class: 'list-item' },
247
- h('div', { class: 'row' }, h('span', { class: `badge ${cls}` }, String(s.code)), h('strong', {}, s.title)),
248
- h('div', { style: { fontSize: '12px', color: 'var(--text-muted)' } }, s.description),
249
- ),
250
- );
239
+ try {
240
+ const res = await api(`/api/utils/http-statuses?q=${encodeURIComponent(httpQuery.value)}`);
241
+ httpList.textContent = '';
242
+ for (const s of res.statuses) {
243
+ const cls = s.code < 200 ? 'badge-info' : s.code < 300 ? 'badge-ok' : s.code < 400 ? 'badge-warn' : 'badge-err';
244
+ httpList.appendChild(
245
+ h(
246
+ 'div',
247
+ { class: 'list-item' },
248
+ h('div', { class: 'row' }, h('span', { class: `badge ${cls}` }, String(s.code)), h('strong', {}, s.title)),
249
+ h('div', { style: { fontSize: '12px', color: 'var(--text-muted)' } }, s.description),
250
+ ),
251
+ );
252
+ }
253
+ } catch (err) {
254
+ toast(err.message, 'err');
251
255
  }
252
256
  }
253
257
 
@@ -238,6 +238,7 @@ components:
238
238
  render(root) {
239
239
  const sampleText = [
240
240
  '# Sample config snippet — safe synthetic values assembled for demo',
241
+ // devanvil-ignore-next-line (intentional synthetic demo fixture for Secret Guard UI)
241
242
  'DATABASE_URL=postgres://admin:SuperSecretPass99@db.internal:5432/prod',
242
243
  `AWS_ACCESS_KEY_ID=${['AKIA', 'IOSFODNN7EXAMPLE'].join('')}`,
243
244
  `STRIPE_SECRET=${['sk', 'live', '51DemoFixtureExample0000000000'].join('_')}`,
@@ -255,29 +255,33 @@
255
255
  const pwOut = h('div', { class: 'stack' });
256
256
 
257
257
  async function genPasswords() {
258
- const res = await api('/api/crypto/password', {
259
- body: { length: Number(pwLen.value), symbols: pwSym.checked, excludeAmbiguous: pwAmb.checked, count: 3 },
260
- });
261
- pwOut.textContent = '';
262
- for (const item of res.items) {
263
- pwOut.appendChild(
264
- h(
265
- 'div',
266
- { class: 'list-item' },
267
- h(
268
- 'div',
269
- { class: 'row-between' },
270
- h('code', { class: 'mono', style: { wordBreak: 'break-all', fontWeight: '600' } }, item.password),
271
- h('button', { type: 'button', class: 'btn btn-ghost btn-xs', onClick: () => copyText(item.password, 'Password copied') }, 'Copy'),
272
- ),
258
+ try {
259
+ const res = await api('/api/crypto/password', {
260
+ body: { length: Number(pwLen.value), symbols: pwSym.checked, excludeAmbiguous: pwAmb.checked, count: 3 },
261
+ });
262
+ pwOut.textContent = '';
263
+ for (const item of res.items) {
264
+ pwOut.appendChild(
273
265
  h(
274
266
  'div',
275
- { class: 'row' },
276
- h('span', { class: `badge ${item.strength === 'very-strong' || item.strength === 'strong' ? 'badge-ok' : 'badge-warn'}` }, `${item.entropyBits} bits (${item.strength})`),
277
- h('span', { class: 'badge badge-subtle' }, `Offline crack: ${item.crackTimeEstimate}`),
267
+ { class: 'list-item' },
268
+ h(
269
+ 'div',
270
+ { class: 'row-between' },
271
+ h('code', { class: 'mono', style: { wordBreak: 'break-all', fontWeight: '600' } }, item.password),
272
+ h('button', { type: 'button', class: 'btn btn-ghost btn-xs', onClick: () => copyText(item.password, 'Password copied') }, 'Copy'),
273
+ ),
274
+ h(
275
+ 'div',
276
+ { class: 'row' },
277
+ h('span', { class: `badge ${item.strength === 'very-strong' || item.strength === 'strong' ? 'badge-ok' : 'badge-warn'}` }, `${item.entropyBits} bits (${item.strength})`),
278
+ h('span', { class: 'badge badge-subtle' }, `Offline crack: ${item.crackTimeEstimate}`),
279
+ ),
278
280
  ),
279
- ),
280
- );
281
+ );
282
+ }
283
+ } catch (err) {
284
+ toast(err.message, 'err');
281
285
  }
282
286
  }
283
287
 
@@ -295,8 +299,12 @@
295
299
  const idOut = h('pre', { class: 'code-box' }, '');
296
300
 
297
301
  async function genIds() {
298
- const res = await api('/api/crypto/ids', { body: { kind: idKind.value, count: 6 } });
299
- idOut.textContent = res.ids.join('\n');
302
+ try {
303
+ const res = await api('/api/crypto/ids', { body: { kind: idKind.value, count: 6 } });
304
+ idOut.textContent = res.ids.join('\n');
305
+ } catch (err) {
306
+ toast(err.message, 'err');
307
+ }
300
308
  }
301
309
 
302
310
  const layout = h(
@@ -105,9 +105,13 @@
105
105
  type: 'button',
106
106
  class: 'btn btn-xs btn-primary',
107
107
  onClick: async () => {
108
- await api('/api/workspace/environments/active', { body: { id: env.id } });
109
- toast(`Switched active environment -> ${env.name}`, 'ok');
110
- await refreshWorkspace();
108
+ try {
109
+ await api('/api/workspace/environments/active', { body: { id: env.id } });
110
+ toast(`Switched active environment -> ${env.name}`, 'ok');
111
+ await refreshWorkspace();
112
+ } catch (err) {
113
+ toast(err.message, 'err');
114
+ }
111
115
  },
112
116
  },
113
117
  'Set Active',
@@ -136,9 +140,13 @@
136
140
  type: 'button',
137
141
  class: 'btn btn-xs btn-ghost',
138
142
  onClick: async () => {
139
- await api(`/api/workspace/environments/${encodeURIComponent(env.id)}`, { method: 'DELETE' });
140
- toast(`Deleted environment "${env.name}"`, 'ok');
141
- await refreshWorkspace();
143
+ try {
144
+ await api(`/api/workspace/environments/${encodeURIComponent(env.id)}`, { method: 'DELETE' });
145
+ toast(`Deleted environment "${env.name}"`, 'ok');
146
+ await refreshWorkspace();
147
+ } catch (err) {
148
+ toast(err.message, 'err');
149
+ }
142
150
  },
143
151
  },
144
152
  'Delete',
@@ -289,9 +297,13 @@
289
297
  type: 'button',
290
298
  class: 'btn btn-xs btn-ghost',
291
299
  onClick: async () => {
292
- await api(`/api/workspace/collections/${encodeURIComponent(col.id)}/requests/${encodeURIComponent(req.id)}`, { method: 'DELETE' });
293
- toast(`Deleted request "${req.name}"`, 'ok');
294
- await refreshWorkspace();
300
+ try {
301
+ await api(`/api/workspace/collections/${encodeURIComponent(col.id)}/requests/${encodeURIComponent(req.id)}`, { method: 'DELETE' });
302
+ toast(`Deleted request "${req.name}"`, 'ok');
303
+ await refreshWorkspace();
304
+ } catch (err) {
305
+ toast(err.message, 'err');
306
+ }
295
307
  },
296
308
  },
297
309
  'Delete Request',
@@ -393,9 +405,13 @@
393
405
  type: 'button',
394
406
  class: 'btn btn-xs btn-ghost',
395
407
  onClick: async () => {
396
- await api(`/api/workspace/collections/${encodeURIComponent(col.id)}`, { method: 'DELETE' });
397
- toast(`Deleted collection "${col.name}"`, 'ok');
398
- await refreshWorkspace();
408
+ try {
409
+ await api(`/api/workspace/collections/${encodeURIComponent(col.id)}`, { method: 'DELETE' });
410
+ toast(`Deleted collection "${col.name}"`, 'ok');
411
+ await refreshWorkspace();
412
+ } catch (err) {
413
+ toast(err.message, 'err');
414
+ }
399
415
  },
400
416
  },
401
417
  'Delete',
@@ -429,8 +445,12 @@
429
445
  type: 'button',
430
446
  class: 'btn btn-sm',
431
447
  onClick: async () => {
432
- const data = await api('/api/workspace');
433
- await copyText(JSON.stringify(data.workspace, null, 2), 'Exported devanvil.json to clipboard');
448
+ try {
449
+ const data = await api('/api/workspace');
450
+ await copyText(JSON.stringify(data.workspace, null, 2), 'Exported devanvil.json to clipboard');
451
+ } catch (err) {
452
+ toast(err.message, 'err');
453
+ }
434
454
  },
435
455
  },
436
456
  'Export devanvil.json',
@@ -691,6 +711,13 @@
691
711
  h('button', { type: 'button', class: 'btn btn-xs', onClick: () => copyText(claudeCliCmd, 'Copied Claude Code command') }, 'Copy'),
692
712
  ),
693
713
  h('pre', { class: 'code-box' }, claudeCliCmd),
714
+ h(
715
+ 'div',
716
+ { class: 'row-between' },
717
+ h('strong', { style: { fontSize: '12.5px' } }, 'Streamable HTTP MCP Endpoint (Live Now)'),
718
+ h('button', { type: 'button', class: 'btn btn-xs', onClick: () => copyText(`${window.location.origin}/mcp`, 'Copied Streamable HTTP MCP URL') }, 'Copy URL'),
719
+ ),
720
+ h('pre', { class: 'code-box' }, `POST ${window.location.origin}/mcp (JSON-RPC 2.0 · Origin-guarded)`),
694
721
  ),
695
722
  h(
696
723
  'div',
@@ -163,9 +163,13 @@
163
163
  type: 'button',
164
164
  class: 'btn btn-xs btn-primary',
165
165
  onClick: async () => {
166
- const res = await api('/api/recorder/export', { body: { mode: 'openapi' } });
167
- recOut.textContent = JSON.stringify(res.spec, null, 2);
168
- await copyText(recOut.textContent, 'Inferred OpenAPI 3.0.3 copied to clipboard!');
166
+ try {
167
+ const res = await api('/api/recorder/export', { body: { mode: 'openapi' } });
168
+ recOut.textContent = JSON.stringify(res.spec, null, 2);
169
+ await copyText(recOut.textContent, 'Inferred OpenAPI 3.0.3 copied to clipboard!');
170
+ } catch (err) {
171
+ toast(err.message, 'err');
172
+ }
169
173
  },
170
174
  },
171
175
  'Infer OpenAPI 3.0',
@@ -176,8 +180,12 @@
176
180
  type: 'button',
177
181
  class: 'btn btn-xs',
178
182
  onClick: async () => {
179
- const res = await api('/api/recorder/export', { body: { mode: 'mocks' } });
180
- toast(`Mounted ${res.mountedCount} recorded route(s) at /mock/*`, 'ok');
183
+ try {
184
+ const res = await api('/api/recorder/export', { body: { mode: 'mocks' } });
185
+ toast(`Mounted ${res.mountedCount} recorded route(s) at /mock/*`, 'ok');
186
+ } catch (err) {
187
+ toast(err.message, 'err');
188
+ }
181
189
  },
182
190
  },
183
191
  'Mount as Mocks',
@@ -188,8 +196,12 @@
188
196
  type: 'button',
189
197
  class: 'btn btn-xs',
190
198
  onClick: async () => {
191
- const res = await api('/api/recorder/export', { body: { mode: 'collection' } });
192
- toast(`Saved ${res.requestCount} recorded request(s) to Workspace Collection`, 'ok');
199
+ try {
200
+ const res = await api('/api/recorder/export', { body: { mode: 'collection' } });
201
+ toast(`Saved ${res.requestCount} recorded request(s) to Workspace Collection`, 'ok');
202
+ } catch (err) {
203
+ toast(err.message, 'err');
204
+ }
193
205
  },
194
206
  },
195
207
  'Save Collection',
@@ -200,9 +212,13 @@
200
212
  type: 'button',
201
213
  class: 'btn btn-xs btn-ghost',
202
214
  onClick: async () => {
203
- await api('/api/recorder', { method: 'DELETE' });
204
- recOut.textContent = 'Recorder cleared.';
205
- await refreshRecorder();
215
+ try {
216
+ await api('/api/recorder', { method: 'DELETE' });
217
+ recOut.textContent = 'Recorder cleared.';
218
+ await refreshRecorder();
219
+ } catch (err) {
220
+ toast(err.message, 'err');
221
+ }
206
222
  },
207
223
  },
208
224
  'Clear',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devanvil",
3
- "version": "2.1.0",
4
- "description": "Local-first, zero-dependency offline Developer Studio, MCP Server & CLI — 14 local studios: OpenAPI-to-Mock, Workspaces + Postman/HAR Import, Record & Replay, SSE Stream Tester, Secret & .env Guard (SARIF), LLM Token Studio, JWT, Regex/ReDoS & Pipelines.",
3
+ "version": "2.1.2",
4
+ "description": "Local-first, zero-dependency offline Developer Studio, 16-Tool AI Agent MCP Server & CLI — 18 studios: OpenAPI-to-Mock, Contract Drift, Traffic Recorder, OAuth2 PKCE, Protobuf Wire, HTTP Load Bench, SQL EXPLAIN, Log Analyzer, Worker+VM Plugins, Secret Guard (SARIF), JWT, Data/XML & Pipelines.",
5
5
  "keywords": [
6
6
  "developer-tools",
7
7
  "dev-tools",
@@ -62,7 +62,8 @@
62
62
  "build": "tsc -p tsconfig.json && node scripts/postbuild.mjs",
63
63
  "build:sea": "npm run build && node scripts/build-sea.mjs",
64
64
  "typecheck": "tsc -p tsconfig.test.json --noEmit",
65
- "test": "npm run build && tsc -p tsconfig.test.json && node --test --test-reporter=spec dist-test/tests/*.test.js",
65
+ "test": "npm run build && tsc -p tsconfig.test.json && node scripts/run-tests.mjs",
66
+ "test:coverage": "tsc -p tsconfig.json --sourceMap false --inlineSources false && node scripts/postbuild.mjs && tsc -p tsconfig.test.json && node scripts/run-tests.mjs --coverage && npm run build",
66
67
  "bench": "npm run build && node scripts/bench.mjs",
67
68
  "start": "node dist/cli.js serve",
68
69
  "dev": "npm run build && node dist/cli.js serve --port 4321",