opencode-supertask 0.1.10 → 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
@@ -16493,8 +16493,6 @@ var tasks = sqliteTable("tasks", {
16493
16493
  // 任务分组与依赖
16494
16494
  batchId: text("batch_id"),
16495
16495
  dependsOn: integer("depends_on"),
16496
- // OpenCode Session
16497
- sessionId: text("session_id"),
16498
16496
  // 状态
16499
16497
  status: text("status").default("pending"),
16500
16498
  // 时间戳(老字段保持秒级 timestamp)
@@ -17246,6 +17244,17 @@ async function deleteTmpl(id){if(!confirm('\u786E\u5B9A\u5220\u9664\u6B64\u6A21\
17246
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');}}
17247
17245
  function toggleLog(id){const el=document.getElementById('log-'+id);el.style.display=el.style.display==='none'?'block':'none';}
17248
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
+
17249
17258
  async function saveConfig(){
17250
17259
  const form=document.getElementById('config-form');
17251
17260
  const data={
@@ -17559,6 +17568,12 @@ app.get("/system", async (c) => {
17559
17568
  <h3 style="margin:0 0 12px;font-size:14px">\u914D\u7F6E\u6587\u4EF6</h3>
17560
17569
  <div class="ir"><span class="ik">\u8DEF\u5F84</span><span class="iv m sm">${CONFIG_PATH}</span></div>
17561
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>
17562
17577
  </div>`;
17563
17578
  return c.html(renderLayout("\u7CFB\u7EDF\u72B6\u6001", "system", body));
17564
17579
  });
@@ -17630,6 +17645,17 @@ app.put("/api/config", async (c) => {
17630
17645
  return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
17631
17646
  }
17632
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
+ });
17633
17659
  var dashboardApp = app;
17634
17660
  var web_default = {
17635
17661
  port: 4680,