opencode-supertask 0.1.39 → 0.1.40
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/CHANGELOG.md +9 -0
- package/README.md +152 -352
- package/README.zh-CN.md +243 -0
- package/dist/cli/index.js +215 -47
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/index.js +195 -43
- package/dist/gateway/index.js.map +1 -1
- package/dist/plugin/supertask.js +37 -4
- package/dist/plugin/supertask.js.map +1 -1
- package/dist/web/index.js +179 -41
- package/dist/web/index.js.map +1 -1
- package/dist/worker/index.d.ts +1 -0
- package/dist/worker/index.js +34 -3
- package/dist/worker/index.js.map +1 -1
- package/drizzle/0008_good_smasher.sql +3 -0
- package/drizzle/meta/0008_snapshot.json +606 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/plugin/supertask.js
CHANGED
|
@@ -26774,6 +26774,7 @@ var tasks = sqliteTable("tasks", {
|
|
|
26774
26774
|
name: text("name").notNull(),
|
|
26775
26775
|
agent: text("agent").notNull(),
|
|
26776
26776
|
model: text("model").default("default"),
|
|
26777
|
+
variant: text("variant"),
|
|
26777
26778
|
prompt: text("prompt").notNull(),
|
|
26778
26779
|
cwd: text("cwd"),
|
|
26779
26780
|
// 分类与优先级
|
|
@@ -26818,6 +26819,7 @@ var taskRuns = sqliteTable("task_runs", {
|
|
|
26818
26819
|
taskId: integer2("task_id").notNull().references(() => tasks.id, { onDelete: "cascade" }),
|
|
26819
26820
|
sessionId: text("session_id"),
|
|
26820
26821
|
model: text("model"),
|
|
26822
|
+
variant: text("variant"),
|
|
26821
26823
|
status: text("status").default("running"),
|
|
26822
26824
|
startedAt: integer2("started_at", { mode: "timestamp" }).$defaultFn(() => /* @__PURE__ */ new Date()),
|
|
26823
26825
|
finishedAt: integer2("finished_at", { mode: "timestamp" }),
|
|
@@ -26838,6 +26840,7 @@ var taskTemplates = sqliteTable("task_templates", {
|
|
|
26838
26840
|
name: text("name").notNull(),
|
|
26839
26841
|
agent: text("agent").notNull(),
|
|
26840
26842
|
model: text("model").default("default"),
|
|
26843
|
+
variant: text("variant"),
|
|
26841
26844
|
prompt: text("prompt").notNull(),
|
|
26842
26845
|
cwd: text("cwd"),
|
|
26843
26846
|
category: text("category").default("general"),
|
|
@@ -27012,6 +27015,22 @@ function normalizeTaskBatchId(batchId) {
|
|
|
27012
27015
|
return batchId.trim() || null;
|
|
27013
27016
|
}
|
|
27014
27017
|
|
|
27018
|
+
// src/core/model-variant.ts
|
|
27019
|
+
var MAX_MODEL_VARIANT_LENGTH = 128;
|
|
27020
|
+
var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001F\u007F]/;
|
|
27021
|
+
function normalizeModelVariant(value) {
|
|
27022
|
+
if (value === void 0 || value === null) return value;
|
|
27023
|
+
const normalized = value.trim();
|
|
27024
|
+
if (!normalized) return null;
|
|
27025
|
+
if (normalized.length > MAX_MODEL_VARIANT_LENGTH) {
|
|
27026
|
+
throw new Error(`variant \u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 ${MAX_MODEL_VARIANT_LENGTH} \u4E2A\u5B57\u7B26`);
|
|
27027
|
+
}
|
|
27028
|
+
if (CONTROL_CHARACTER_PATTERN.test(normalized)) {
|
|
27029
|
+
throw new Error("variant \u4E0D\u80FD\u5305\u542B\u63A7\u5236\u5B57\u7B26");
|
|
27030
|
+
}
|
|
27031
|
+
return normalized;
|
|
27032
|
+
}
|
|
27033
|
+
|
|
27015
27034
|
// src/core/services/task.service.ts
|
|
27016
27035
|
var { tasks: tasks2, taskRuns: taskRuns2 } = schema_exports;
|
|
27017
27036
|
var cleanupInvocation = 0;
|
|
@@ -27077,7 +27096,8 @@ var TaskService = class {
|
|
|
27077
27096
|
static async add(data) {
|
|
27078
27097
|
const normalizedData = {
|
|
27079
27098
|
...data,
|
|
27080
|
-
batchId: normalizeTaskBatchId(data.batchId)
|
|
27099
|
+
batchId: normalizeTaskBatchId(data.batchId),
|
|
27100
|
+
variant: normalizeModelVariant(data.variant)
|
|
27081
27101
|
};
|
|
27082
27102
|
this.validateNewTask(normalizedData);
|
|
27083
27103
|
return db.transaction((tx) => {
|
|
@@ -27105,7 +27125,11 @@ var TaskService = class {
|
|
|
27105
27125
|
}
|
|
27106
27126
|
static async update(id, data, scope = {}) {
|
|
27107
27127
|
if (Object.keys(data).length === 0) throw new Error("\u81F3\u5C11\u63D0\u4F9B\u4E00\u4E2A\u8981\u4FEE\u6539\u7684\u5B57\u6BB5");
|
|
27108
|
-
const normalizedData =
|
|
27128
|
+
const normalizedData = {
|
|
27129
|
+
...data,
|
|
27130
|
+
...data.batchId === void 0 ? {} : { batchId: normalizeTaskBatchId(data.batchId) ?? null },
|
|
27131
|
+
...data.variant === void 0 ? {} : { variant: normalizeModelVariant(data.variant) ?? null }
|
|
27132
|
+
};
|
|
27109
27133
|
return db.transaction((tx) => {
|
|
27110
27134
|
const task = tx.select().from(tasks2).where(and(
|
|
27111
27135
|
eq(tasks2.id, id),
|
|
@@ -27117,6 +27141,7 @@ var TaskService = class {
|
|
|
27117
27141
|
name: normalizedData.name ?? task.name,
|
|
27118
27142
|
agent: normalizedData.agent ?? task.agent,
|
|
27119
27143
|
model: normalizedData.model ?? task.model,
|
|
27144
|
+
variant: normalizedData.variant === void 0 ? task.variant : normalizedData.variant,
|
|
27120
27145
|
prompt: normalizedData.prompt ?? task.prompt,
|
|
27121
27146
|
cwd: task.cwd,
|
|
27122
27147
|
category: normalizedData.category ?? task.category,
|
|
@@ -27891,7 +27916,8 @@ var TaskTemplateService = class {
|
|
|
27891
27916
|
static async create(data) {
|
|
27892
27917
|
const normalizedData = {
|
|
27893
27918
|
...data,
|
|
27894
|
-
batchId: normalizeTaskBatchId(data.batchId)
|
|
27919
|
+
batchId: normalizeTaskBatchId(data.batchId),
|
|
27920
|
+
variant: normalizeModelVariant(data.variant)
|
|
27895
27921
|
};
|
|
27896
27922
|
this.validate(normalizedData);
|
|
27897
27923
|
const now = Date.now();
|
|
@@ -27957,7 +27983,8 @@ var TaskTemplateService = class {
|
|
|
27957
27983
|
static async update(id, data) {
|
|
27958
27984
|
const normalizedData = {
|
|
27959
27985
|
...data,
|
|
27960
|
-
batchId: normalizeTaskBatchId(data.batchId) ?? null
|
|
27986
|
+
batchId: normalizeTaskBatchId(data.batchId) ?? null,
|
|
27987
|
+
...data.variant === void 0 ? {} : { variant: normalizeModelVariant(data.variant) ?? null }
|
|
27961
27988
|
};
|
|
27962
27989
|
this.validate(normalizedData);
|
|
27963
27990
|
const now = Date.now();
|
|
@@ -29604,6 +29631,7 @@ var SuperTaskPlugin = async () => {
|
|
|
29604
29631
|
agent: tool.schema.string().trim().min(1).describe("\u6267\u884C\u7684 Agent \u540D\u79F0\uFF0C\u5982 localize-gen, course-gen"),
|
|
29605
29632
|
prompt: tool.schema.string().trim().min(1).describe("\u53D1\u9001\u7ED9 Agent \u7684\u5B8C\u6574\u63D0\u793A\u8BCD"),
|
|
29606
29633
|
model: tool.schema.string().optional().describe("\u4F7F\u7528\u7684\u6A21\u578B\uFF0C\u5982 gemini-2.5-pro"),
|
|
29634
|
+
variant: tool.schema.string().trim().min(1).max(128).optional().describe("\u6A21\u578B variant\uFF0C\u5982 low\u3001high\u3001xhigh\uFF1B\u4EC5\u5728\u6A21\u578B\u652F\u6301\u65F6\u4F7F\u7528"),
|
|
29607
29635
|
category: tool.schema.enum(["translate", "generate", "review", "test", "general"]).optional().describe("\u4EFB\u52A1\u5206\u7C7B"),
|
|
29608
29636
|
importance: tool.schema.number().int().min(1).max(5).optional().describe("\u91CD\u8981\u7A0B\u5EA6 1-5\uFF085 \u6700\u91CD\u8981\uFF09"),
|
|
29609
29637
|
urgency: tool.schema.number().int().min(1).max(5).optional().describe("\u7D27\u6025\u7A0B\u5EA6 1-5\uFF085 \u6700\u7D27\u6025\uFF09"),
|
|
@@ -29624,6 +29652,7 @@ var SuperTaskPlugin = async () => {
|
|
|
29624
29652
|
agent: args.agent,
|
|
29625
29653
|
prompt: args.prompt,
|
|
29626
29654
|
model: args.model,
|
|
29655
|
+
variant: args.variant,
|
|
29627
29656
|
category: args.category ?? "general",
|
|
29628
29657
|
importance: args.importance ?? 3,
|
|
29629
29658
|
urgency: args.urgency ?? 3,
|
|
@@ -29657,6 +29686,7 @@ var SuperTaskPlugin = async () => {
|
|
|
29657
29686
|
name: task.name,
|
|
29658
29687
|
agent: task.agent,
|
|
29659
29688
|
model: task.model,
|
|
29689
|
+
variant: task.variant,
|
|
29660
29690
|
prompt: task.prompt,
|
|
29661
29691
|
cwd: task.cwd,
|
|
29662
29692
|
category: task.category,
|
|
@@ -29778,6 +29808,7 @@ var SuperTaskPlugin = async () => {
|
|
|
29778
29808
|
name: task.name,
|
|
29779
29809
|
agent: task.agent,
|
|
29780
29810
|
model: task.model,
|
|
29811
|
+
variant: task.variant,
|
|
29781
29812
|
prompt: task.prompt,
|
|
29782
29813
|
cwd: task.cwd,
|
|
29783
29814
|
category: task.category,
|
|
@@ -29801,6 +29832,7 @@ var SuperTaskPlugin = async () => {
|
|
|
29801
29832
|
agent: tool.schema.string().trim().min(1).describe("\u6267\u884C\u7684 Agent \u540D\u79F0"),
|
|
29802
29833
|
prompt: tool.schema.string().trim().min(1).describe("\u53D1\u9001\u7ED9 Agent \u7684\u5B8C\u6574\u63D0\u793A\u8BCD"),
|
|
29803
29834
|
model: tool.schema.string().optional().describe("\u4F7F\u7528\u7684\u6A21\u578B"),
|
|
29835
|
+
variant: tool.schema.string().trim().min(1).max(128).optional().describe("\u6A21\u578B variant\uFF0C\u5982 low\u3001high\u3001xhigh\uFF1B\u4EC5\u5728\u6A21\u578B\u652F\u6301\u65F6\u4F7F\u7528"),
|
|
29804
29836
|
category: tool.schema.enum(["translate", "generate", "review", "test", "general"]).optional().describe("\u4EFB\u52A1\u5206\u7C7B"),
|
|
29805
29837
|
importance: tool.schema.number().int().min(1).max(5).optional().describe("\u91CD\u8981\u7A0B\u5EA6 1-5"),
|
|
29806
29838
|
urgency: tool.schema.number().int().min(1).max(5).optional().describe("\u7D27\u6025\u7A0B\u5EA6 1-5"),
|
|
@@ -29844,6 +29876,7 @@ var SuperTaskPlugin = async () => {
|
|
|
29844
29876
|
agent: args.agent,
|
|
29845
29877
|
prompt: args.prompt,
|
|
29846
29878
|
model: args.model,
|
|
29879
|
+
variant: args.variant,
|
|
29847
29880
|
category: args.category ?? "general",
|
|
29848
29881
|
importance: args.importance ?? 3,
|
|
29849
29882
|
urgency: args.urgency ?? 3,
|