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/cli/index.js CHANGED
@@ -9317,8 +9317,6 @@ var init_schema = __esm({
9317
9317
  // 任务分组与依赖
9318
9318
  batchId: text("batch_id"),
9319
9319
  dependsOn: integer("depends_on"),
9320
- // OpenCode Session
9321
- sessionId: text("session_id"),
9322
9320
  // 状态
9323
9321
  status: text("status").default("pending"),
9324
9322
  // 时间戳(老字段保持秒级 timestamp)
@@ -22129,6 +22127,17 @@ async function deleteTmpl(id){if(!confirm('\u786E\u5B9A\u5220\u9664\u6B64\u6A21\
22129
22127
  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');}}
22130
22128
  function toggleLog(id){const el=document.getElementById('log-'+id);el.style.display=el.style.display==='none'?'block':'none';}
22131
22129
 
22130
+ async function clearDatabase(){
22131
+ if(!confirm('\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u4EFB\u52A1\u6570\u636E\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\uFF01'))return;
22132
+ 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;
22133
+ try{
22134
+ const r=await fetch('/api/database/clear',{method:'POST'});
22135
+ const d=await r.json();
22136
+ if(d.success){alert('\u6570\u636E\u5E93\u5DF2\u6E05\u7A7A');location.reload();}
22137
+ else{alert('\u6E05\u7A7A\u5931\u8D25: '+d.error);}
22138
+ }catch(e){alert('\u6E05\u7A7A\u5931\u8D25: '+e.message);}
22139
+ }
22140
+
22132
22141
  async function saveConfig(){
22133
22142
  const form=document.getElementById('config-form');
22134
22143
  const data={
@@ -22530,6 +22539,12 @@ var init_web = __esm({
22530
22539
  <h3 style="margin:0 0 12px;font-size:14px">\u914D\u7F6E\u6587\u4EF6</h3>
22531
22540
  <div class="ir"><span class="ik">\u8DEF\u5F84</span><span class="iv m sm">${CONFIG_PATH}</span></div>
22532
22541
  <div class="ir"><span class="ik">\u6587\u4EF6\u5B58\u5728</span><span class="iv">${configFileStatus}</span></div>
22542
+ </div>
22543
+
22544
+ <div class="card mt16" style="border-color:var(--red)">
22545
+ <h3 style="margin:0 0 12px;font-size:14px;color:var(--red)">\u5371\u9669\u64CD\u4F5C</h3>
22546
+ <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>
22547
+ <button class="btn btn-danger" style="border-color:var(--red);color:var(--red);padding:6px 16px" onclick="clearDatabase()">\u6E05\u7A7A\u6570\u636E\u5E93</button>
22533
22548
  </div>`;
22534
22549
  return c.html(renderLayout("\u7CFB\u7EDF\u72B6\u6001", "system", body));
22535
22550
  });
@@ -22601,6 +22616,17 @@ var init_web = __esm({
22601
22616
  return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
22602
22617
  }
22603
22618
  });
22619
+ app.post("/api/database/clear", async (c) => {
22620
+ try {
22621
+ const { tasks: tasks3, taskRuns: taskRuns3, taskTemplates: taskTemplates4 } = schema_exports;
22622
+ await db.delete(taskRuns3);
22623
+ await db.delete(taskTemplates4);
22624
+ await db.delete(tasks3);
22625
+ return c.json({ success: true });
22626
+ } catch (err) {
22627
+ return c.json({ success: false, error: err instanceof Error ? err.message : String(err) });
22628
+ }
22629
+ });
22604
22630
  dashboardApp = app;
22605
22631
  web_default = {
22606
22632
  port: 4680,