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.
@@ -6013,8 +6013,6 @@ var init_schema = __esm({
6013
6013
  // 任务分组与依赖
6014
6014
  batchId: text("batch_id"),
6015
6015
  dependsOn: integer("depends_on"),
6016
- // OpenCode Session
6017
- sessionId: text("session_id"),
6018
6016
  // 状态
6019
6017
  status: text("status").default("pending"),
6020
6018
  // 时间戳(老字段保持秒级 timestamp)
@@ -18319,6 +18317,17 @@ async function deleteTmpl(id){if(!confirm('\u786E\u5B9A\u5220\u9664\u6B64\u6A21\
18319
18317
  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');}}
18320
18318
  function toggleLog(id){const el=document.getElementById('log-'+id);el.style.display=el.style.display==='none'?'block':'none';}
18321
18319
 
18320
+ async function clearDatabase(){
18321
+ if(!confirm('\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u4EFB\u52A1\u6570\u636E\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\uFF01'))return;
18322
+ 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;
18323
+ try{
18324
+ const r=await fetch('/api/database/clear',{method:'POST'});
18325
+ const d=await r.json();
18326
+ if(d.success){alert('\u6570\u636E\u5E93\u5DF2\u6E05\u7A7A');location.reload();}
18327
+ else{alert('\u6E05\u7A7A\u5931\u8D25: '+d.error);}
18328
+ }catch(e){alert('\u6E05\u7A7A\u5931\u8D25: '+e.message);}
18329
+ }
18330
+
18322
18331
  async function saveConfig(){
18323
18332
  const form=document.getElementById('config-form');
18324
18333
  const data={
@@ -18720,6 +18729,12 @@ var init_web = __esm({
18720
18729
  <h3 style="margin:0 0 12px;font-size:14px">\u914D\u7F6E\u6587\u4EF6</h3>
18721
18730
  <div class="ir"><span class="ik">\u8DEF\u5F84</span><span class="iv m sm">${CONFIG_PATH}</span></div>
18722
18731
  <div class="ir"><span class="ik">\u6587\u4EF6\u5B58\u5728</span><span class="iv">${configFileStatus}</span></div>
18732
+ </div>
18733
+
18734
+ <div class="card mt16" style="border-color:var(--red)">
18735
+ <h3 style="margin:0 0 12px;font-size:14px;color:var(--red)">\u5371\u9669\u64CD\u4F5C</h3>
18736
+ <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>
18737
+ <button class="btn btn-danger" style="border-color:var(--red);color:var(--red);padding:6px 16px" onclick="clearDatabase()">\u6E05\u7A7A\u6570\u636E\u5E93</button>
18723
18738
  </div>`;
18724
18739
  return c.html(renderLayout("\u7CFB\u7EDF\u72B6\u6001", "system", body));
18725
18740
  });
@@ -18791,6 +18806,17 @@ var init_web = __esm({
18791
18806
  return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
18792
18807
  }
18793
18808
  });
18809
+ app.post("/api/database/clear", async (c) => {
18810
+ try {
18811
+ const { tasks: tasks3, taskRuns: taskRuns3, taskTemplates: taskTemplates4 } = schema_exports;
18812
+ await db.delete(taskRuns3);
18813
+ await db.delete(taskTemplates4);
18814
+ await db.delete(tasks3);
18815
+ return c.json({ success: true });
18816
+ } catch (err) {
18817
+ return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
18818
+ }
18819
+ });
18794
18820
  dashboardApp = app;
18795
18821
  web_default = {
18796
18822
  port: 4680,