opencode-supertask 0.1.11 → 0.1.12

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.
package/dist/web/index.js CHANGED
@@ -17244,6 +17244,17 @@ async function deleteTmpl(id){if(!confirm('\u786E\u5B9A\u5220\u9664\u6B64\u6A21\
17244
17244
  async function triggerTmpl(id){if(!confirm('\u7ACB\u5373\u89E6\u53D1\u4E00\u6B21?'))return;const r=await fetch('/api/templates/'+id+'/trigger',{method:'POST'});const d=await r.json();if(d.success){alert('\u5DF2\u521B\u5EFA\u4EFB\u52A1 #'+d.taskId);location.reload();}else{alert('\u89E6\u53D1\u5931\u8D25');}}
17245
17245
  function toggleLog(id){const el=document.getElementById('log-'+id);el.style.display=el.style.display==='none'?'block':'none';}
17246
17246
 
17247
+ async function clearDatabase(){
17248
+ if(!confirm('\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u4EFB\u52A1\u6570\u636E\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\uFF01'))return;
17249
+ if(!confirm('\u518D\u6B21\u786E\u8BA4\uFF1A\u5C06\u5220\u9664\u6240\u6709\u4EFB\u52A1\u3001\u6267\u884C\u8BB0\u5F55\u548C\u8C03\u5EA6\u6A21\u677F\u3002'))return;
17250
+ try{
17251
+ const r=await fetch('/api/database/clear',{method:'POST'});
17252
+ const d=await r.json();
17253
+ if(d.success){alert('\u6570\u636E\u5E93\u5DF2\u6E05\u7A7A');location.reload();}
17254
+ else{alert('\u6E05\u7A7A\u5931\u8D25: '+d.error);}
17255
+ }catch(e){alert('\u6E05\u7A7A\u5931\u8D25: '+e.message);}
17256
+ }
17257
+
17247
17258
  async function saveConfig(){
17248
17259
  const form=document.getElementById('config-form');
17249
17260
  const data={
@@ -17557,6 +17568,12 @@ app.get("/system", async (c) => {
17557
17568
  <h3 style="margin:0 0 12px;font-size:14px">\u914D\u7F6E\u6587\u4EF6</h3>
17558
17569
  <div class="ir"><span class="ik">\u8DEF\u5F84</span><span class="iv m sm">${CONFIG_PATH}</span></div>
17559
17570
  <div class="ir"><span class="ik">\u6587\u4EF6\u5B58\u5728</span><span class="iv">${configFileStatus}</span></div>
17571
+ </div>
17572
+
17573
+ <div class="card mt16" style="border-color:var(--red)">
17574
+ <h3 style="margin:0 0 12px;font-size:14px;color:var(--red)">\u5371\u9669\u64CD\u4F5C</h3>
17575
+ <p class="sm mu" style="margin:0 0 12px">\u6E05\u7A7A\u6240\u6709\u4EFB\u52A1\u6570\u636E\uFF08tasks + task_runs + task_templates\uFF09\uFF0C\u4E0D\u53EF\u6062\u590D\u3002</p>
17576
+ <button class="btn btn-danger" style="border-color:var(--red);color:var(--red);padding:6px 16px" onclick="clearDatabase()">\u6E05\u7A7A\u6570\u636E\u5E93</button>
17560
17577
  </div>`;
17561
17578
  return c.html(renderLayout("\u7CFB\u7EDF\u72B6\u6001", "system", body));
17562
17579
  });
@@ -17628,6 +17645,17 @@ app.put("/api/config", async (c) => {
17628
17645
  return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
17629
17646
  }
17630
17647
  });
17648
+ app.post("/api/database/clear", async (c) => {
17649
+ try {
17650
+ const { tasks: tasks3, taskRuns: taskRuns3, taskTemplates: taskTemplates3 } = schema_exports;
17651
+ await db.delete(taskRuns3);
17652
+ await db.delete(taskTemplates3);
17653
+ await db.delete(tasks3);
17654
+ return c.json({ success: true });
17655
+ } catch (err) {
17656
+ return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
17657
+ }
17658
+ });
17631
17659
  var dashboardApp = app;
17632
17660
  var web_default = {
17633
17661
  port: 4680,