opencode-windows-scheduler 0.0.0-stage → 1.0.0
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 +45 -0
- package/CROSS_PLATFORM.md +113 -0
- package/LICENSE +21 -0
- package/README.md +173 -2
- package/README.ru.md +131 -0
- package/ROADMAP-STRATEGY.md +217 -0
- package/ROADMAP.md +87 -0
- package/dist/core/cron-to-schtasks.d.ts +20 -0
- package/dist/core/cron-to-schtasks.d.ts.map +1 -0
- package/dist/core/cron-to-schtasks.js +233 -0
- package/dist/core/dry-run.d.ts +44 -0
- package/dist/core/dry-run.d.ts.map +1 -0
- package/dist/core/dry-run.js +252 -0
- package/dist/core/file-watcher.d.ts +31 -0
- package/dist/core/file-watcher.d.ts.map +1 -0
- package/dist/core/file-watcher.js +128 -0
- package/dist/core/lock.d.ts +43 -0
- package/dist/core/lock.d.ts.map +1 -0
- package/dist/core/lock.js +118 -0
- package/dist/core/matrix.d.ts +167 -0
- package/dist/core/matrix.d.ts.map +1 -0
- package/dist/core/matrix.js +687 -0
- package/dist/core/ps-wrapper.d.ts +60 -0
- package/dist/core/ps-wrapper.d.ts.map +1 -0
- package/dist/core/ps-wrapper.js +538 -0
- package/dist/core/record-history.d.ts +14 -0
- package/dist/core/record-history.d.ts.map +1 -0
- package/dist/core/record-history.js +360 -0
- package/dist/core/scheduler/index.d.ts +20 -0
- package/dist/core/scheduler/index.d.ts.map +1 -0
- package/dist/core/scheduler/index.js +32 -0
- package/dist/core/scheduler/linux.d.ts +32 -0
- package/dist/core/scheduler/linux.d.ts.map +1 -0
- package/dist/core/scheduler/linux.js +115 -0
- package/dist/core/scheduler/logs.d.ts +11 -0
- package/dist/core/scheduler/logs.d.ts.map +1 -0
- package/dist/core/scheduler/logs.js +34 -0
- package/dist/core/scheduler/mac.d.ts +39 -0
- package/dist/core/scheduler/mac.d.ts.map +1 -0
- package/dist/core/scheduler/mac.js +175 -0
- package/dist/core/scheduler/posix.d.ts +40 -0
- package/dist/core/scheduler/posix.d.ts.map +1 -0
- package/dist/core/scheduler/posix.js +86 -0
- package/dist/core/scheduler/registry.d.ts +36 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -0
- package/dist/core/scheduler/registry.js +56 -0
- package/dist/core/scheduler/types.d.ts +63 -0
- package/dist/core/scheduler/types.d.ts.map +1 -0
- package/dist/core/scheduler/types.js +1 -0
- package/dist/core/scheduler/windows.d.ts +47 -0
- package/dist/core/scheduler/windows.d.ts.map +1 -0
- package/dist/core/scheduler/windows.js +375 -0
- package/dist/core/wrappers/bash.d.ts +58 -0
- package/dist/core/wrappers/bash.d.ts.map +1 -0
- package/dist/core/wrappers/bash.js +223 -0
- package/dist/db/history-repo.d.ts +69 -0
- package/dist/db/history-repo.d.ts.map +1 -0
- package/dist/db/history-repo.js +150 -0
- package/dist/db/index.d.ts +47 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +120 -0
- package/dist/db/metrics-repo.d.ts +43 -0
- package/dist/db/metrics-repo.d.ts.map +1 -0
- package/dist/db/metrics-repo.js +95 -0
- package/dist/db/migrate.d.ts +24 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +237 -0
- package/dist/db/recovery.d.ts +11 -0
- package/dist/db/recovery.d.ts.map +1 -0
- package/dist/db/recovery.js +38 -0
- package/dist/db/schema.d.ts +24 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +97 -0
- package/dist/db/settings-repo.d.ts +8 -0
- package/dist/db/settings-repo.d.ts.map +1 -0
- package/dist/db/settings-repo.js +27 -0
- package/dist/db/tasks-repo.d.ts +26 -0
- package/dist/db/tasks-repo.d.ts.map +1 -0
- package/dist/db/tasks-repo.js +120 -0
- package/dist/db/templates-repo.d.ts +17 -0
- package/dist/db/templates-repo.d.ts.map +1 -0
- package/dist/db/templates-repo.js +57 -0
- package/dist/gui-experimental.cjs +1 -0
- package/dist/history.d.ts +53 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +57 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2077 -0
- package/dist/notifications.d.ts +45 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +135 -0
- package/dist/rpc.d.ts +2052 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +863 -0
- package/dist/schtasks.d.ts +32 -0
- package/dist/schtasks.d.ts.map +1 -0
- package/dist/schtasks.js +45 -0
- package/dist/server.d.ts +106 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1478 -0
- package/dist/settings.d.ts +43 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +96 -0
- package/dist/shared/jobs-view.d.ts +21 -0
- package/dist/shared/jobs-view.d.ts.map +1 -0
- package/dist/shared/jobs-view.js +28 -0
- package/dist/skill.d.ts +15 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +93 -0
- package/dist/task-transfer.d.ts +176 -0
- package/dist/task-transfer.d.ts.map +1 -0
- package/dist/task-transfer.js +442 -0
- package/dist/templates.d.ts +57 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +16 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +88 -0
- package/dist/workspaces.d.ts +55 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +183 -0
- package/docs/ARCHITECTURE.md +302 -0
- package/docs/FEATURES.md +288 -0
- package/docs/MIGRATION.md +266 -0
- package/docs/dashboard.png +0 -0
- package/gui-experimental.cjs +2 -0
- package/index.js +1 -0
- package/package.json +92 -4
- package/scripts/demo-dashboard.mjs +199 -0
- package/skills/scheduled-job-best-practices/SKILL.md +155 -0
- package/skills/scheduled-job-best-practices/references/recipes.md +123 -0
- package/src/core/cron-to-schtasks.ts +269 -0
- package/src/core/dry-run.ts +315 -0
- package/src/core/file-watcher.ts +171 -0
- package/src/core/lock.ts +134 -0
- package/src/core/matrix.ts +907 -0
- package/src/core/ps-wrapper.ts +572 -0
- package/src/core/record-history.ts +493 -0
- package/src/core/scheduler/index.ts +44 -0
- package/src/core/scheduler/linux.ts +125 -0
- package/src/core/scheduler/logs.ts +37 -0
- package/src/core/scheduler/mac.ts +222 -0
- package/src/core/scheduler/posix.ts +111 -0
- package/src/core/scheduler/registry.ts +93 -0
- package/src/core/scheduler/types.ts +67 -0
- package/src/core/scheduler/windows.ts +469 -0
- package/src/core/wrappers/bash.ts +282 -0
- package/src/db/history-repo.ts +303 -0
- package/src/db/index.ts +166 -0
- package/src/db/metrics-repo.ts +158 -0
- package/src/db/migrate.ts +322 -0
- package/src/db/recovery.ts +46 -0
- package/src/db/schema.ts +109 -0
- package/src/db/settings-repo.ts +31 -0
- package/src/db/tasks-repo.ts +162 -0
- package/src/db/templates-repo.ts +77 -0
- package/src/gui.tsx +2725 -0
- package/src/history.ts +107 -0
- package/src/index.ts +2672 -0
- package/src/notifications.ts +174 -0
- package/src/rpc.ts +933 -0
- package/src/schtasks.ts +75 -0
- package/src/server.ts +1663 -0
- package/src/settings.ts +157 -0
- package/src/shared/jobs-view.ts +38 -0
- package/src/skill.ts +113 -0
- package/src/task-transfer.ts +648 -0
- package/src/templates.ts +67 -0
- package/src/tui.tsx +46 -0
- package/src/types.ts +145 -0
- package/src/workspaces.ts +236 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("solid-js/web"),c=require("solid-js"),ri=require("@opencode/plugin/gui"),Io=require("@opencode/plugin/rpc"),Lt={type:["object","null"],properties:{server:{type:"string"},event:{type:"string"},filter:{type:"string"}},required:["server","event"]},li={type:["object","null"],properties:{workspaceIds:{type:"array",items:{type:"string"}},strategy:{type:["string","null"]},failureMode:{type:["string","null"]},aggregation:{type:["string","null"]},createAggregator:{type:["boolean","null"]},concurrency:{type:["number","null"]},overrides:{type:["object","null"],additionalProperties:{type:"object",properties:{prompt:{type:["string","null"]},model:{type:["string","null"]},qualityGate:{type:["string","null"]},beforeScript:{type:["string","null"]},afterScript:{type:["string","null"]}}}}},required:["workspaceIds"]},qo={type:"object",properties:{name:{type:"string"},schedule:{type:"string"},status:{type:"string"},nextRun:{type:["string","null"]},model:{type:["string","null"]},priority:{type:["number","null"]},retryCount:{type:["number","null"]},retryDelay:{type:["number","null"]},qualityGate:{type:["string","null"]},nextTaskOnSuccess:{type:["string","null"]},nextTaskOnError:{type:["string","null"]},dependsOn:{type:"array",items:{type:"string"}},prompt:{type:"string"},beforeScript:{type:["string","null"]},afterScript:{type:["string","null"]},triggerType:{type:["string","null"]},mcpEvent:Lt,watchPath:{type:["string","null"]},workingDirectory:{type:["string","null"]},workspaceId:{type:["string","null"]},workspaceName:{type:["string","null"]},workspaceColor:{type:["string","null"]},allowedTools:{type:["array","null"],items:{type:"string"}},deniedTools:{type:["array","null"],items:{type:"string"}},matrix:li,matrixParentId:{type:["string","null"]},isMatrixParent:{type:"boolean"},matrixSummary:{type:["object","null"],properties:{totalCount:{type:"number"},successCount:{type:"number"},errorCount:{type:"number"},pendingCount:{type:"number"},status:{type:"string"},message:{type:"string"}}}},required:["name","schedule","status"]},ii={type:"object",properties:{},additionalProperties:!1},Mo={type:"object",properties:{tasks:{type:"array",items:qo}},required:["tasks"]},Lo={type:"object",properties:{name:{type:"string"},schedule:{type:"string"},prompt:{type:"string"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Lt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:li},required:["name","schedule","prompt"]},Ro={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Rt={type:"object",properties:{name:{type:"string"}},required:["name"]},Do=Rt,jo=Rt,Mt={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Go=Mt,Fo=Rt,Wo={type:"object",properties:{success:{type:"boolean"},logs:{type:"string"},error:{type:"string"}},required:["success","logs"]},Bo={type:"object",properties:{taskName:{type:"string"},status:{type:"string"},startedAt:{type:"string"},finishedAt:{type:"string"},durationMs:{type:"number"},error:{type:["string","null"]},nextTask:{type:["string","null"]},model:{type:["string","null"]},preFlightStatus:{type:["string","null"]},postFlightStatus:{type:["string","null"]},allowedTools:{type:["array","null"],items:{type:"string"}},deniedTools:{type:["array","null"],items:{type:"string"}}},required:["taskName","status","startedAt","finishedAt","durationMs","error"]},No={type:"object",properties:{limit:{type:"number"}},additionalProperties:!1},Uo={type:"object",properties:{records:{type:"array",items:Bo}},required:["records"]},Jo={type:"object",properties:{total:{type:"number"},success:{type:"number"},error:{type:"number"}},required:["total","success","error"]},Ho={type:"object",properties:{},additionalProperties:!1},Qo=Jo,Yo={type:"object",properties:{},additionalProperties:!1},Ko={type:"object",properties:{port:{type:["number","null"]}},required:["port"]},Vo={type:"object",properties:{},additionalProperties:!1},Xo={type:"object",properties:{platform:{type:"string"},title:{type:"string"}},required:["platform","title"]},Zo={type:"object",properties:{},additionalProperties:!1},el={type:"object",properties:{success:{type:"boolean"},data:{type:"string"},count:{type:"number"},error:{type:"string"}},required:["success"]},tl={type:"object",properties:{data:{type:"string"}},required:["data"]},rl={type:"object",properties:{success:{type:"boolean"},imported:{type:"number"},errors:{type:"array",items:{type:"string"}},error:{type:"string"}},required:["success"]},il={type:"object",properties:{},additionalProperties:!1},si={type:"object",properties:{enabled:{type:"boolean"},onlyOnError:{type:"boolean"},webhook:{type:"object",properties:{enabled:{type:"boolean"},url:{type:"string"}},required:["enabled","url"]}},required:["enabled","onlyOnError"]},nl={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:si},required:["maxConcurrent","winterMode","notifications"]},ol={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:si},additionalProperties:!1},ll={type:"object",properties:{success:{type:"boolean"},maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:si},required:["success","maxConcurrent","winterMode","notifications"]},sl={type:"object",properties:{},additionalProperties:!1},al={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},mn={type:"object",properties:{id:{type:"string"},name:{type:"string"},prompt:{type:"string"},schedule:{type:"string"},timeoutSeconds:{type:"number"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Lt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}}},required:["id","name","prompt"]},pl={type:"object",properties:{},additionalProperties:!1},cl={type:"object",properties:{templates:{type:"array",items:mn}},required:["templates"]},dl={type:"object",properties:{id:{type:"string"},name:{type:"string"},prompt:{type:"string"},schedule:{type:"string"},timeoutSeconds:{type:"number"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Lt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}}},required:["name","prompt"],additionalProperties:!1},ul={type:"object",properties:{success:{type:"boolean"},template:mn,error:{type:"string"}},required:["success"]},gl={type:"object",properties:{id:{type:"string"}},required:["id"]},fl={type:"object",properties:{success:{type:"boolean"},error:{type:"string"}},required:["success"]},pn=Rt,ml={type:"object",properties:{name:{type:"string"},newSchedule:{type:"string"},newPrompt:{type:"string"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Lt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:li},required:["name"]},yl=Mt,yn={type:"object",properties:{id:{type:"string"},name:{type:"string"},path:{type:"string"},gitRemote:{type:["string","null"]},gitBranch:{type:["string","null"]},color:{type:["string","null"]},createdAt:{type:"string"}},required:["id","name","path","createdAt"]},bl={type:"object",properties:{},additionalProperties:!1},xl={type:"object",properties:{workspaces:{type:"array",items:yn}},required:["workspaces"]},vl={type:"object",properties:{name:{type:"string"},path:{type:"string"},color:{type:"string"}},required:["path"],additionalProperties:!1},cn={type:"object",properties:{success:{type:"boolean"},workspace:yn,error:{type:"string"}},required:["success"]},hl={type:"object",properties:{id:{type:"string"},name:{type:"string"},path:{type:"string"},color:{type:"string"}},required:["id"],additionalProperties:!1},$l={type:"object",properties:{id:{type:"string"}},required:["id"]},wl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success"]},_l={type:"object",properties:{eventName:{type:"string"},payload:{type:["object","null","string","number","boolean","array"]}},required:["eventName"]},kl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},triggered:{type:"array",items:{type:"string"}}},required:["success","triggered"]},Sl={type:"object",properties:{name:{type:"string"},order:{type:"number"},trigger:{type:"string"},cwd:{type:"string"},command:{type:"string"},workspace:{type:["object","null"],properties:{name:{type:"string"},path:{type:"string"}},required:["name","path"]},preFlight:{type:["string","null"]},postFlight:{type:["string","null"]},qualityGate:{type:["string","null"]},roleScoped:{type:["object","null"],properties:{allowed:{type:"array",items:{type:"string"}},denied:{type:"array",items:{type:"string"}}}},estimatedDurationSec:{type:["number","null"]},estimatedCostUsd:{type:["number","null"]},estimatedTokens:{type:["number","null"]},matrixParent:{type:"string"}},required:["name","order","trigger","cwd","command"]},bn={type:"object",properties:{success:{type:"boolean"},taskName:{type:"string"},tasks:{type:"array",items:Sl},totals:{type:"object",properties:{estimatedDurationSec:{type:["number","null"]},estimatedCostUsd:{type:["number","null"]},estimatedTokens:{type:["number","null"]}},required:[]},warnings:{type:"array",items:{type:"string"}},error:{type:"string"}},required:["success","taskName","tasks","warnings"]},Cl={type:"object",properties:{taskName:{type:"string"}},required:["taskName"],additionalProperties:!1},zl={type:"object",properties:{success:{type:"boolean"},reports:{type:"array",items:bn}},required:["success","reports"]},Tl={type:"object",properties:{name:{type:"string"},workspaceId:{type:["string","null"]},workspaceName:{type:["string","null"]},status:{type:"string"},error:{type:["string","null"]},finishedAt:{type:["string","null"]}},required:["name","status"]},El={type:"object",properties:{parentId:{type:"string"}},required:["parentId"],additionalProperties:!1},Pl={type:"object",properties:{parentId:{type:"string"},totalCount:{type:"number"},successCount:{type:"number"},errorCount:{type:"number"},pendingCount:{type:"number"},status:{type:"string"},message:{type:"string"},clones:{type:"array",items:Tl}},required:["parentId","totalCount","successCount","errorCount","status"]},Al={type:"object",properties:{success:{type:"boolean"},report:Pl,error:{type:"string"}},required:["success"]},Ol={type:"object",properties:{name:{type:"string"},workspaceIds:{type:"array",items:{type:"string"}},strategy:{type:"string"},failureMode:{type:"string"},aggregation:{type:"string"}},required:["workspaceIds"],additionalProperties:!1},Il={type:"object",properties:{success:{type:"boolean"},clones:{type:"array",items:{type:"object",properties:{name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:["string","null"]}},required:["name","workspaceId"]}},error:{type:"string"}},required:["success","clones"]},ql={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},cancelled:{type:"array",items:{type:"string"}}},required:["success","message","cancelled"]},Ml={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},removed:{type:"array",items:{type:"string"}}},required:["success","message","removed"]},Ll=Io.Rpc.define({id:"opencode-windows-scheduler",methods:{get_tasks:{input:ii,output:Mo},create_task:{input:Lo,output:Ro},delete_task:{input:Do,output:Mt},run_task:{input:jo,output:Go},pause_task:{input:pn,output:Mt},resume_task:{input:pn,output:Mt},update_task:{input:ml,output:yl},get_task_logs:{input:Fo,output:Wo},get_history:{input:No,output:Uo},get_metrics:{input:Ho,output:Qo},get_dashboard_port:{input:Yo,output:Ko},get_platform:{input:Vo,output:Xo},dry_run:{input:Cl,output:bn},dry_run_all:{input:ii,output:zl},get_matrix_results:{input:El,output:Al},cancel_matrix:{input:Rt,output:ql},cleanup_matrix_orphans:{input:ii,output:Ml},expand_matrix_preview:{input:Ol,output:Il},get_workspaces:{input:bl,output:xl},add_workspace:{input:vl,output:cn},update_workspace:{input:hl,output:cn},delete_workspace:{input:$l,output:wl},export_tasks:{input:Zo,output:el},import_tasks:{input:tl,output:rl},get_settings:{input:il,output:nl},save_settings:{input:ol,output:ll},get_templates:{input:pl,output:cl},save_template:{input:dl,output:ul},delete_template:{input:gl,output:fl},emit_event:{input:_l,output:kl},test_notification:{input:sl,output:al}},events:{}});var Rl=e.template("<div><div style=display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%><div style=display:flex;align-items:center;gap:12px;flex:1;min-width:0><div style=flex:1;min-width:0><div style=display:flex;align-items:center;gap:6px;min-width:0><div style=font-weight:700;font-size:16px;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis></div></div><div style=font-size:12px;color:#a0a0a6;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>📊 Всего: <!> | ✅ <!> | ❌ </div></div><div style=display:flex;align-items:center;gap:8px;flex-shrink:0;min-width:110px></div></div><div style=display:flex;gap:6px><button></button><button></button><button>📄</button><button>🧪</button><button>📜</button><button>✏️"),Dl=e.template("<span>📦 "),jl=e.template('<span style="font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid #ff9f0a;color:#ff9f0a;background:rgba(255,159,10,0.12)">📦 Matrix (<!>)'),Gl=e.template('<span style="font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid #8e8e93;color:#b0b0b6;background:rgba(142,142,147,0.12)">↳ matrix '),Fl=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>👁️"),Wl=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>⚡"),Bl=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>📡"),Nl=e.template("<span style=font-size:12px;flex-shrink:0;cursor:help;color:#c084fc;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px>🧠 "),Ul=e.template("<span style=font-size:12px;flex-shrink:0;cursor:help;color:#f5a623;white-space:nowrap>🚀 "),Jl=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>🔒"),Hl=e.template("<div style=display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35><span style=color:#5ac8fa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>🔗 Зависит от: "),Ql=e.template("<div style=display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35><span>📦 Matrix: <!>/<!> успешных"),Yl=e.template("<div style=display:flex;align-items:center;gap:8px;font-size:12px;color:#a0a0a6;margin-top:2px><span style=white-space:nowrap;overflow:hidden;text-overflow:ellipsis>"),Kl=e.template("<span>→ "),Vl=e.template("<div style=font-size:12px;color:#f5a623;font-weight:600;white-space:nowrap>🟡 Выполняется: <!> сек"),Xl=e.template("<div style=font-size:12px;font-weight:600;white-space:nowrap>"),Zl=e.template("<button>⛔"),es=e.template("<button>🗑"),ts=e.template('<div style="margin-top:8px;padding:8px 12px;background:#1e1e1e;border:1px solid #333;border-radius:6px;display:flex;flex-direction:column;gap:6px;width:100%"><div style=font-size:12px;font-weight:600;color:#ffffff;display:flex;align-items:center;gap:6px>📜 История последних запусков<button style=background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0>✕'),rs=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Запусков пока нет.'),is=e.template('<div style="display:flex;align-items:flex-start;gap:10px;font-size:12px;color:#e0e0e0;padding:4px 0;border-bottom:1px solid #333"><span style=color:#8e8e93;white-space:nowrap></span><span style=fontWeight:600;whiteSpace:nowrap></span><span style=color:#b0b0b0;white-space:nowrap> мс'),ns=e.template("<span style=color:#c084fc;white-space:nowrap>🧠 "),os=e.template("<span style=whiteSpace:nowrap>⚡ pre: "),ls=e.template("<span style=whiteSpace:nowrap>⚡ post: "),ss=e.template("<div style=margin-top:2px;color:#ff6b6b;font-size:11px;white-space:pre-wrap;word-break:break-word>"),as=e.template('<span title="Запущена следующая задача в цепочке"style=color:#5ac8fa;font-size:11px;white-space:nowrap>🔗 → '),ps=e.template('<div style="margin-top:8px;padding:8px 12px;background:#1e1e1e;border:1px solid #333;border-radius:6px;display:flex;flex-direction:column;gap:6px;width:100%"><div style=font-size:12px;font-weight:600;color:#ffffff;display:flex;align-items:center;gap:6px>🧪 Dry-Run: <button style=background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0>✕'),cs=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Симуляция…'),ds=e.template('<div style="font-size:12px;color:#ff6b6b;padding:6px 0">❌ '),us=e.template("<div style=display:flex;flex-direction:column;gap:4px>"),gs=e.template('<div style="font-size:11px;color:#f5a623;padding:4px 0">⚠ '),fs=e.template('<div style="font-size:11px;color:#e0e0e0;padding:4px 0;border-bottom:1px solid #333;display:flex;flex-wrap:wrap;gap:6px;align-items:baseline"><span style=color:#8e8e93;white-space:nowrap>#<!> </span><span style=font-weight:600;white-space:nowrap>🧪 </span><span style=color:#8e8e93;white-space:nowrap>cwd: </span><div style=width:100%;color:#a0a0a6;overflow-wrap:anywhere>$ '),ms=e.template("<span style=color:#5ac8fa;white-space:nowrap>📦 "),ys=e.template("<span style=color:#ff9f0a;white-space:nowrap>↳ matrix "),bs=e.template("<span style=cursor:help>🔒"),xs=e.template("<span style=color:#8e8e93;white-space:nowrap>⏱ ~<!> с"),vs=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~<!> ток."),hs=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~$"),$s=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ pre: "),ws=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ post: "),_s=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>✅ QG: "),ks=e.template('<div style="font-size:11px;color:#b0b0b0;padding:4px 0">Σ '),Ss=e.template('<div><div style=display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap><div style=min-width:0><h2 style=margin:0;font-size:22px;font-weight:800;letter-spacing:0.2px;line-height:1.2;color:#ffffff></h2><div style=margin-top:5px;font-size:11px;font-weight:600;letter-spacing:1.2px;text-transform:uppercase;color:#8e8e93>Local AI CI/CD Orchestrator</div></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><select title="Фильтр задач по workspace"style="padding:6px 10px;border-radius:999px;cursor:pointer;font-size:12px;border:1px solid #333;background:#1e1e1e;color:#e0e0e0;outline:none;max-width:200px"><option value=all>Все workspace</option><option value=none>Без workspace</option></select><button title="Открыть локальный веб-дашборд (фактический порт сервера)"style="display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;cursor:pointer;font-size:12px;user-select:none;white-space:nowrap;transition:background 0.2s ease, border-color 0.2s ease;border:1px solid #333;background:#1e1e1e;color:#e0e0e0">🌐 Открыть дашборд</button><label title="Переключить зимнюю тему"><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>❄️ Зимний режим</label></div></div><div style=display:flex;gap:8px;flex-wrap:wrap;margin-top:8px><button></button><input type=file accept=.json style=display:none><button></button></div><div style=display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px><label style=font-size:12px;color:#b0b0b0;font-weight:500;white-space:nowrap>Макс. одновременных задач:</label><input type=number min=0 style="width:60px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><span style=font-size:11px;color:#8e8e93;white-space:nowrap>(0 = без ограничений)</span></div><div style="width:100%;max-width:700px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden"><button style="display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;box-sizing:border-box;padding:10px 14px;background:transparent;border:none;color:#e0e0e0;font-size:12px;font-weight:600;cursor:pointer;text-align:left"><span>🔔 Уведомления</span><span style=display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93><span></span></span></button></div><div style="width:100%;max-width:700px;box-sizing:border-box;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden"><div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px"><button style=display:flex;align-items:center;gap:8px;background:transparent;border:none;color:#e0e0e0;font-size:12px;font-weight:600;cursor:pointer;text-align:left;padding:0><span>📦 Workspaces</span><span style=font-size:11px;font-weight:400;color:#8e8e93></span><span style=font-size:11px;color:#8e8e93></span></button><button title="Добавить workspace (git-репозиторий)">+ Добавить</button></div></div><div style=display:block;width:100%;margin-top:24px><h3 style=margin:0;margin-bottom:8px;font-size:14px;font-weight:600;color:#ffffff>Задачи'),dn=e.template("<div style=padding:16px;color:#ff3b30;font-size:13px>Ошибка UI: "),un=e.template("<option>📦 "),Cs=e.template('<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px"><label style=display:flex;align-items:center;gap:8px;font-size:12px;color:#e0e0e0;cursor:pointer><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Включить уведомления</label><label><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Только при ошибке</label><div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px"><label><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Webhook (Discord / Slack / generic)</label><input type=url placeholder=https://discord.com/api/webhooks/...><div style=font-size:11px;color:#8e8e93>POST с JSON { content, text } — совместимо с Discord и Slack.</div></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><button></button><span style=font-size:11px;color:#8e8e93>ntfy.sh не используется — только webhook.'),zs=e.template('<div style="display:flex;flex-direction:column;gap:6px;padding:0 14px 12px">'),Ts=e.template('<div style="font-size:12px;color:#8e8e93;padding:4px 0">Workspace не добавлен. Задача без workspace использует рабочую директорию проекта.'),Es=e.template('<div style="display:flex;align-items:center;gap:10px;padding:8px 10px;background:#252526;border:1px solid #333;border-radius:8px;min-width:0"><span></span><div style=display:flex;flex-direction:column;gap:2px;flex:1;min-width:0><span style=font-size:12px;font-weight:700;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>📦 </span><span style=font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis></span><span style=font-size:10px;color:#a0a0a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>git: <!> · </span></div><div style=display:flex;gap:4px;flex-shrink:0><button title="Редактировать workspace"style=background:transparent;border:none;color:#a0a0a6;cursor:pointer;font-size:14px;padding:2px>✏️</button><button title="Удалить workspace (задачи сохраняются)"style=background:transparent;border:none;color:#ff3b30;cursor:pointer;font-size:14px;padding:2px>🗑'),Ps=e.template('<button title="Развернуть форму создания задачи"style="display:flex;align-items:center;justify-content:center;gap:8px;width:100%;max-width:700px;box-sizing:border-box;padding:12px 16px;background:#1e1e1e;border:1px dashed #3a3a3a;border-radius:10px;color:#e0e0e0;font-size:13px;font-weight:600;cursor:pointer;transition:border-color 0.18s ease, background 0.18s ease">➕ Создать задачу'),As=e.template('<div style="display:block;width:100%;max-width:700px;box-sizing:border-box;background:#1e1e1e;padding:20px;border-radius:10px;box-shadow:0 4px 12px rgba(0,0,0,0.2)"><div style=display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:16px><h3 style=margin:0;font-size:14px;font-weight:600;color:#ffffff></h3><div style=display:flex;align-items:center;gap:8px><button title="Сохранить текущие настройки формы как шаблон"style="background:transparent;border:1px solid #333;border-radius:6px;padding:4px 10px;color:#a0a0a6;font-size:11px;cursor:pointer;white-space:nowrap;transition:color 0.18s ease, border-color 0.18s ease">💾 Сохранить как шаблон</button><button title="Свернуть форму"style="background:transparent;border:1px solid #333;border-radius:6px;padding:4px 10px;color:#a0a0a6;font-size:11px;cursor:pointer;white-space:nowrap;transition:color 0.18s ease, border-color 0.18s ease">Скрыть форму ▴</button></div></div><div style="display:block;width:100%;margin-bottom:12px;padding:10px 12px;background:#1a1a1a;border:1px solid #333;border-radius:8px"><label style=display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;font-weight:600;color:#fff><input type=checkbox style=accent-color:#ff9f0a>📦 Matrix (Fan-Out)</label><div style=font-size:11px;color:#8e8e93;margin-top:4px;line-height:1.45>Задача-шаблон раскладывается на клоны по workspace. Родитель сам не выполняется — он запускает клоны и агрегирует результат.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Имя задачи</label><input type=text placeholder="например, Gui-Test"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Тип триггера</label><div style=display:flex;gap:8px><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>По расписанию (Cron)</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>При изменении файла</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>MCP Event</label></div></div><div style=width:100%;marginBottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Расписание</label><select style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"></select></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Промпт</label><textarea placeholder="Напиши краткий отчет о состоянии рынка"rows=2 style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none;resize:vertical"></textarea></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Шаблон промпта</label><select style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"></select></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Модель LLM</label><input type=text list=scheduler-model-presets placeholder="по умолчанию (как в OpenCode)"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><datalist id=scheduler-model-presets><option value=anthropic/claude-3-5-sonnet></option><option value=openai/gpt-4o></option><option value=deepseek/deepseek-coder></option><option value=google/gemini-2.5-pro></option><option value=openai/gpt-4o-mini></option></datalist><div style=font-size:11px;color:#8e8e93;margin-top:6px>Пусто — модель OpenCode по умолчанию. Иначе будет передан флаг --model.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Приоритет</label><select style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"></select><div style=font-size:11px;color:#8e8e93;margin-top:6px>Если готовы несколько задач сразу, первой запускается задача с более высоким приоритетом.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Кол-во повторов при ошибке</label><input type=number min=0 placeholder=0 style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Задержка перед повтором (сек)</label><input type=number min=1 placeholder=60 style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Проверочная команда (Quality Gate)</label><input type=text placeholder="например: npm run test"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><div style=font-size:11px;color:#8e8e93;margin-top:6px>Выполняется после успешного ответа ИИ. Ненулевой код = ошибка задачи.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Команда перед запуском (Pre-flight)</label><input type=text placeholder="например: git pull"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><div style=font-size:11px;color:#8e8e93;margin-top:6px>Например: git pull или npm install. Выполняется в рабочей директории задачи. Ненулевой код отменяет запуск (Pre-flight script failed).</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Команда после запуска (Post-flight)</label><input type=text placeholder="например: git push"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><div style=font-size:11px;color:#8e8e93;margin-top:6px>Например: git push или npm run build. Выполняется в рабочей директории задачи даже при ошибке основной задачи.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Зависит от задач (успешное завершение)</label><div style="display:flex;flex-wrap:wrap;gap:6px;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;min-height:38px;box-sizing:border-box"></div><div style=font-size:11px;color:#8e8e93;margin-top:6px>Задача запустится автоматически, когда все отмеченные задачи завершатся успешно.</div></div><details style=display:block;width:100%;margin-bottom:12px><summary style=cursor:pointer;font-size:12px;color:#b0b0b0;font-weight:500;margin-bottom:8px;user-select:none>🔒 Ограничения инструментов</summary><div style="display:block;width:100%;padding:10px;background:#1e1e1e;border:1px solid #333;border-radius:6px;box-sizing:border-box"><div style=font-size:11px;color:#8e8e93;margin-bottom:8px>⚠ Metadata-only: opencode 2.2.3 не поддерживает allow/deny флаги — ограничения фиксируются в логе и истории. При конфликте приоритет у <b>denied</b>. Пустой allowedTools запрещён.</div><div style=font-size:11px;color:#b0b0b0;margin-bottom:4px>Белый список (allowedTools)</div><div style=display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px></div><div style=font-size:11px;color:#b0b0b0;margin-bottom:4px>Чёрный список (deniedTools)</div><div style=display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px></div><div style=display:flex;gap:6px><input type=text placeholder="свой инструмент, например websearch"style="flex:1;padding:6px 8px;background:#141414;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"><button style="padding:6px 10px;background:transparent;border:1px solid #34c759;color:#34c759;border-radius:6px;cursor:pointer;font-size:12px">+ allowed</button><button style="padding:6px 10px;background:transparent;border:1px solid #ff3b30;color:#ff3b30;border-radius:6px;cursor:pointer;font-size:12px">+ denied</button></div></div></details><div style=display:block;width:100%;margin-top:8px><button title="Локальное превью команды по текущим полям формы (без RPC и без запуска)"style="display:block;width:100%;padding:8px;margin-top:4px;background:transparent;border:1px solid #333;border-radius:6px;color:#d4e6ff;cursor:pointer;font-size:12px">🧪 Превью</button><button>'),Os=e.template('<div style=margin-top:10px;display:flex;flex-direction:column;gap:10px><div><div style=font-size:12px;color:#b0b0b0;font-weight:500;margin-bottom:6px>Workspaces (для матрицы) — выбрано </div></div><div style=display:flex;gap:8px;flex-wrap:wrap><label style=flex:1;min-width:150px;font-size:11px;color:#b0b0b0>Стратегия<select style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"><option value=parallel>parallel — все сразу</option><option value=sequential>sequential — по одному</option></select></label><label style=flex:1;min-width:150px;font-size:11px;color:#b0b0b0>При ошибке<select style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"><option value=continue>continue — продолжать</option><option value=stop>stop — остановить</option></select></label><label style=flex:1;min-width:150px;font-size:11px;color:#b0b0b0>Агрегация<select style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"><option value=summary>summary — сводка</option><option value=per-task>per-task — по задачам</option></select></label></div><label style=display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#e0e0e0><input type=checkbox style=accent-color:#ff9f0a>Создать aggregator-задачу matrix-complete (запустится после всех клонов)</label><label style=font-size:11px;color:#b0b0b0;max-width:240px>Одновременно клонов (concurrency)<input type=number min=1 step=1 style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"></label><div style="padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px;font-size:11px;line-height:1.55;color:#a0a0a6">'),Is=e.template("<div style=font-size:11px;color:#f5a623>Сначала добавьте хотя бы один workspace."),qs=e.template('<div style="display:flex;flex-direction:column;gap:4px;max-height:170px;overflow:auto;padding:6px 8px;background:#141414;border:1px solid #333;border-radius:6px">'),Ms=e.template("<label style=display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#e0e0e0><input type=checkbox style=accent-color:#ff9f0a><span>📦 </span><span style=font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>"),Ls=e.template('<details style="padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px"><summary style=cursor:pointer;font-size:12px;color:#b0b0b0;font-weight:500>⚙ Настройки по workspace — переопределено </summary><div style=margin-top:8px;display:flex;flex-direction:column;gap:8px;max-height:340px;overflow:auto>'),Rs=e.template('<div style="padding:8px;background:#101010;border:1px solid #2a2a2a;border-radius:6px"><div>📦 <span style=margin-left:6px;font-size:10px;color:#8e8e93></span></div><div style=display:flex;flex-direction:column;gap:6px><textarea rows=2 placeholder="Промпт (по умолчанию — общий промпт формы)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;width:100%;resize:vertical;font-family:inherit"></textarea><div style=display:flex;gap:6px;flex-wrap:wrap><input placeholder="Модель (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px"><input placeholder="Quality Gate (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px"></div><div style=display:flex;gap:6px;flex-wrap:wrap><input placeholder="beforeScript (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px"><input placeholder="afterScript (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px">'),Ds=e.template("<div style=color:#ff9f0a;font-weight:600>Будет создано <!> клон(а/ов):"),js=e.template("<div style=color:#e0e0e0;word-break:break-all>"),Gs=e.template("<span style=color:#f5a623>Выберите хотя бы один workspace — превью клонов появится здесь."),Fs=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Workspace (multi-repo)</label><select style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><option value>Без workspace — рабочая директория'),Ws=e.template('<div style="margin-top:8px;padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px;font-size:11px;line-height:1.55;color:#a0a0a6"><div>cwd = <span style=color:#e0e0e0></span></div><div>git branch = <span style=color:#5ac8fa></span></div><div>git remote = <span style=color:#e0e0e0>'),Bs=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Рабочая директория</label><input type=text placeholder="по умолчанию — папка проекта"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><div style=font-size:11px;color:#8e8e93;margin-top:6px>В этой папке задача запустит opencode run — здесь подхватятся MCP-серверы из opencode.json.'),Ns=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Путь к файлу для отслеживания</label><input type=text placeholder="например, C:\\project\\src\\main.ts"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none">'),Us=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>MCP-сервер / источник</label><input type=text placeholder="например, github"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none">'),Js=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Имя события</label><input type=text placeholder="например, github.pr.opened"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none">'),Hs=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Фильтр (опционально)</label><input type=text placeholder="например, repo="my-project" или regex"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><div style=font-size:11px;color:#8e8e93;margin-top:6px>key=value сравнивается с полем payload, иначе фильтр считается regex/подстрокой. События приходят через RPC emit_event.'),mr=e.template("<option>"),Qs=e.template('<div style=display:block;width:100%;margin-top:8px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Cron-выражение</label><input type=text placeholder="* * * * *"style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none">'),Ys=e.template('<div style="display:block;max-height:80px;overflow-y:auto;margin-top:8px;padding:8px;background:#2a1113;border:1px solid #5a1d21;border-radius:6px;font-size:11px;line-height:1.4;color:#ff6b6b;white-space:pre-wrap;word-break:break-word">'),Ks=e.template('<div style=display:flex;align-items:center;gap:6px;margin-top:8px><span style=font-size:10px;color:#8e8e93>Кастомный шаблон:</span><button title="Удалить шаблон"style=background:transparent;border:none;color:#ff3b30;cursor:pointer;font-size:14px;line-height:1;padding:0>🗑'),Vs=e.template("<span style=font-size:11px;color:#ff3b30;font-weight:500;cursor:default>"),Xs=e.template("<option>Другой (<!>)"),Zs=e.template("<span style=font-size:12px;color:#8e8e93>Других задач пока нет"),ni=e.template("<label><input type=checkbox style=margin:0>"),ea=e.template("<span style=color:#5ac8fa;font-size:11px;margin-left:6px>(<!> allowed · <!> denied)"),ta=e.template("<div style=font-size:11px;color:#cfcfd2;margin-top:8px>"),ra=e.template("<div>allowed: [<!>]"),ia=e.template("<div>denied: [<!>]"),na=e.template('<button style="background:transparent;border:1px solid #333;border-radius:6px;padding:8px 16px;color:#ff3b30;cursor:pointer;font-size:13px;width:100%">Отмена'),oa=e.template('<div style="display:block;width:100%;margin-top:8px;padding:10px;background:#1e1e1e;border:1px solid #333;border-radius:6px"><div style=font-size:12px;font-weight:600;color:#ffffff;display:flex;justify-content:space-between;align-items:center>🧪 Превью (локальное, по полям формы)<button style=background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0>✕'),la=e.template("<div style=display:flex;flex-direction:column;gap:4px;font-size:11px;color:#e0e0e0;margin-top:6px><div style=overflow-wrap:anywhere>$ </div><div style=color:#8e8e93>cwd: "),sa=e.template("<div style=color:#8e8e93>🔒 allowed=[<!>] · denied=[<!>]"),aa=e.template("<div style=color:#8e8e93>⚡ pre: "),pa=e.template("<div style=color:#8e8e93>⚡ post: "),ca=e.template("<div style=color:#8e8e93>✅ QG: "),da=e.template("<div style=color:#f5a623>⚠ "),ua=e.template("<div style=font-size:11px;color:#8e8e93;margin-bottom:8px>Фильтр: <!> · показано <!> из "),ga=e.template('<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 16px;color:#a0a0a6;font-size:13px;gap:10px"><span style=font-size:40px;line-height:1></span><span style=max-width:380px;line-height:1.5>'),fa=e.template("<div style=display:flex;flex-direction:column;gap:0>"),ma=e.template(`<div style="position:fixed;bottom:16px;left:16px;right:16px;background:#1e1e1e;border:1px solid #333;border-radius:8px;padding:0;max-height:300px;overflow:hidden;display:flex;flex-direction:column;z-index:1000"><div style="display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid #333;background:#252526;border-radius:8px 8px 0 0"><div style=display:flex;align-items:center;gap:8px><span style=font-size:13px;font-weight:600;color:#ffffff>Логи</span><span style=font-size:11px;color:#8e8e93></span></div><button style=background:transparent;border:none;color:#8e8e93;cursor:pointer;font-size:18px;line-height:1;padding:0;width:24px;height:24px;display:flex;align-items:center;justify-content:center>✕</button></div><div style="flex:1;overflow-y:auto;padding:12px;font-family:Menlo, Monaco, 'Courier New', monospace;font-size:11px;line-height:1.5;color:#d4d4d4;background:#1e1e1e;border-radius:0 0 8px 8px">`),ya=e.template("<div style=white-space:pre-wrap;margin-bottom:2px>"),ba=e.template(`<div style="padding:16px;display:flex;flex-direction:column;gap:16px;font-size:13px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;color:#e0e0e0;background:#0f0f0f"><h2 style=margin:0;font-size:22px;font-weight:800;color:#ffffff></h2><div style=margin-top:5px;font-size:11px;font-weight:600;letter-spacing:1.2px;text-transform:uppercase;color:#8e8e93>Local AI CI/CD Orchestrator</div><div style="background:#2a1a1a;border:1px solid #ff3b30;border-radius:8px;padding:16px;color:#ff3b30">Произошла ошибка отображения. Попробуйте перезагрузить панель.`);function xa(d){switch(d){case"running":return"#f5a623";case"success":return"#34c759";case"error":return"#ff3b30";case"partial":return"#ff9f0a";default:return"#8e8e93"}}const ye=5;function gn(d){const k=typeof d=="number"&&Number.isFinite(d)?Math.min(10,Math.max(0,Math.floor(d))):ye;return k>=10?"Критический":k>=8?"Высокий":k<=3?"Низкий":"Обычный"}const fn=[{value:2,label:"Низкий"},{value:5,label:"Обычный"},{value:8,label:"Высокий"},{value:10,label:"Критический"}];function L(d){return d instanceof Error?d.message:typeof d=="object"&&d!==null&&"message"in d?String(d.message):JSON.stringify(d)}function it(d,k=150){const Te=(d||"").split(/\r?\n/).map(yr=>yr.trim()).find(Boolean)??"";return Te.length>k?Te.slice(0,k-1).trimEnd()+"…":Te}const oi=[{label:"Каждую минуту",value:"* * * * *"},{label:"Каждый час",value:"0 * * * *"},{label:"Каждый день в 09:00",value:"0 9 * * *"},{label:"Каждый понедельник в 10:00",value:"0 10 * * 1"},{label:"Свое расписание…",value:"__custom__"}],va=ri.Plugin.define({setup(d){const k=d.client.rpc(Ll),[Te,yr]=c.createSignal([]),[Q,xn]=c.createSignal([]),[br,vn]=c.createSignal(!1),[Ge,ai]=c.createSignal("all"),[nt,Fe]=c.createSignal(!1),[We,be]=c.createSignal(""),[hn,Be]=c.createSignal(""),[xr,vr]=c.createSignal(null),[ot,pi]=c.createSignal(!1),[ci,Dt]=c.createSignal(""),[hr,$n]=c.createSignal({total:0,success:0,error:0}),[jt,di]=c.createSignal(null),[ui,wn]=c.createSignal([]),gi=[{label:"Свой промпт",value:"custom",prompt:""},{label:"Ночной сторож (тесты)",value:"night-watch",prompt:"Запусти ночные проверки: прогнали тесты, зафиксируй ошибки и составь краткий отчёт о состоянии репозитория."},{label:"Утренний дайджест",value:"morning-digest",prompt:"Собери утренний дайджест: какие изменения были за ночь, есть ли проваленные сборки, что требует внимания сегодня."},{label:"Гигиена кода",value:"code-hygiene",prompt:"Проведи аудит гигиены кода: найди неиспользуемые импорты, неиспользуемые переменные, лишние зависимости и предложи правки."}],[lt,Gt]=c.createSignal("custom"),[Ft,_n]=c.createSignal([]),[kn,Sn]=c.createSignal(0);setInterval(()=>Sn(r=>r+1),1e3);const[Cn,$r]=c.createSignal(1),[re,wr]=c.createSignal(!1),[ce,_r]=c.createSignal(!1),[kr,Sr]=c.createSignal(!0),[Ee,Cr]=c.createSignal(!1),[fi,zr]=c.createSignal(""),[Tr,zn]=c.createSignal(!0),[Wt,mi]=c.createSignal(!1),Ne=new Map;c.onCleanup(()=>{for(const r of Ne.values())clearInterval(r);Ne.clear()});const[Er,Tn]=c.createSignal("Планировщик задач");async function En(){try{const r=await k.get_platform({});r?.title&&Tn(r.title)}catch(r){console.error("RPC Error (get_platform):",r)}}async function Pn(){try{const r=await k.get_settings({});$r(r.maxConcurrent??1),wr(!!r.winterMode);const t=r.notifications;_r(!!t?.enabled),Sr(t?.onlyOnError!==!1),Cr(!!t?.webhook?.enabled),zr(t?.webhook?.url??"")}catch(r){console.error("RPC Error (get_settings):",r)}}function An(){return{enabled:ce(),onlyOnError:kr(),webhook:{enabled:Ee(),url:(fi()||"").trim()}}}async function Pr(r){try{const t=await k.save_settings(r);if(r.maxConcurrent!==void 0&&$r(t.maxConcurrent),r.winterMode!==void 0&&wr(!!t.winterMode),r.notifications!==void 0){const i=t.notifications;_r(!!i?.enabled),Sr(i?.onlyOnError!==!1),Cr(!!i?.webhook?.enabled),zr(i?.webhook?.url??"")}}catch(t){console.error("RPC Error (save_settings):",t),d.toast.show({title:"Не удалось сохранить настройки",variant:"error",description:L(t)})}}async function st(){await Pr({notifications:An()})}async function On(){mi(!0);try{await st();const r=await k.test_notification({});d.toast.show({title:r.success?"Тестовое уведомление отправлено":"Тест не удался",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (test_notification):",r),d.toast.show({title:"Тест не удался",variant:"error",description:L(r)})}finally{mi(!1)}}async function In(r){$r(r),await Pr({maxConcurrent:r})}async function qn(r){wr(r),await Pr({winterMode:r})}const[Ar,Bt]=c.createSignal(null),[Mn,Or]=c.createSignal(!1),[V,Nt]=c.createSignal(""),[Ue,Je]=c.createSignal("* * * * *"),[xe,He]=c.createSignal(""),[yi,at]=c.createSignal("* * * * *"),[Ir,pt]=c.createSignal(0),[qr,ct]=c.createSignal(60),[dt,ut]=c.createSignal(""),[Qe,gt]=c.createSignal(ye),[Ut,ft]=c.createSignal(""),[Ye,mt]=c.createSignal([]),[Jt,yt]=c.createSignal(""),[Ht,bt]=c.createSignal(""),[ie,Pe]=c.createSignal("cron"),[Mr,xt]=c.createSignal(""),[Lr,vt]=c.createSignal(""),[Rr,ht]=c.createSignal(""),[$t,wt]=c.createSignal(""),[Qt,Ke]=c.createSignal(""),[R,Ve]=c.createSignal([]),[D,Xe]=c.createSignal([]),[bi,xi]=c.createSignal(""),[ve,Yt]=c.createSignal(!1),[de,_t]=c.createSignal([]),[Dr,Kt]=c.createSignal("parallel"),[vi,Vt]=c.createSignal("continue"),[hi,Xt]=c.createSignal("summary"),[$i,Zt]=c.createSignal(!1),[wi,er]=c.createSignal(""),[jr,tr]=c.createSignal({}),[kt,Gr]=c.createSignal(!1),[Fr,_i]=c.createSignal(!1),[j,St]=c.createSignal(null),[Ct,Wr]=c.createSignal(""),ki=["bash","edit","write","read","grep","glob","webfetch"];function Si(r,t){r==="allowed"?Ve(i=>i.includes(t)?i.filter(a=>a!==t):[...i,t]):Xe(i=>i.includes(t)?i.filter(a=>a!==t):[...i,t])}function Ci(r){const t=bi().trim();t&&(r==="allowed"?R().includes(t)||Ve([...R(),t]):D().includes(t)||Xe([...D(),t]),xi(""))}function Ln(r,t){_t(i=>t?i.includes(r)?i:[...i,r]:i.filter(a=>a!==r))}function Br(r,t){const i=r.trim()||"task",a=t.trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-");return`${i}-matrix-${a||"workspace"}`}const Nr=()=>de().map(r=>Q().find(t=>t.id===r)).filter(r=>!!r).map(r=>Br(V(),r.name));function zt(r,t,i){tr(a=>{const W={...a[r]??{}};i.trim()?W[t]=i:delete W[t];const M={...a};return Object.keys(W).length>0?M[r]=W:delete M[r],M})}const Rn=()=>Object.keys(jr()).length,zi=()=>{if(!ve())return;const r=wi().trim(),t=r?Number(r):void 0,i=jr();return{workspaceIds:de(),strategy:Dr(),failureMode:vi(),aggregation:hi(),createAggregator:$i(),...t!==void 0&&Number.isFinite(t)&&t>=1?{concurrency:Math.floor(t)}:{},...Object.keys(i).length>0?{overrides:i}:{}}};function rr(){Yt(!1),_t([]),Kt("parallel"),Vt("continue"),Xt("summary"),Zt(!1),er(""),tr({})}function Dn(){return`opencode run${dt().trim()?` --model ${dt().trim()}`:""} "${xe().replace(/\s+/g," ").trim()}"`}const[ha,jn]=c.createSignal(null),[ir,Ti]=c.createSignal(!1),[nr,$a]=c.createSignal(!1),[wa,Gn]=c.createSignal(null);async function Fn(){Ti(!0);try{const r=await k.export_tasks({});if(!r.success){d.toast.show({title:"Ошибка экспорта",variant:"error",description:r.error});return}jn(r.data);const t=new Blob([r.data],{type:"application/json"}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=`windows-scheduler-tasks-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i),d.toast.show({title:`Экспортировано задач: ${r.count}`,variant:"success"})}catch(r){console.error("RPC Error (export_tasks):",r),d.toast.show({title:"Ошибка экспорта",variant:"error",description:L(r)})}finally{Ti(!1)}}function Wn(r){const i=r.target.files?.[0]??null;Gn(i)}async function Ur(){try{const r=await k.get_templates({}),t=Array.isArray(r?.templates)?r.templates:[];_n(t)}catch(r){console.error("RPC Error (get_templates):",r)}}async function or(){try{const r=await k.get_workspaces({}),t=Array.isArray(r?.workspaces)?r.workspaces:[];xn(t)}catch(r){console.error("RPC Error (get_workspaces):",r)}}const Tt=()=>Q().find(r=>r.id===We());async function Bn(){const r=(window.prompt("Путь к git-репозиторию (workspace)","")??"").trim();if(!r)return;const t=(window.prompt("Название workspace (необязательно)","")??"").trim();Fe(!0);try{const i=await k.add_workspace({path:r,...t?{name:t}:{}});if(!i.success){d.toast.show({title:"Ошибка добавления workspace",variant:"error",description:i.error??"Неизвестная ошибка"});return}await or(),i.workspace?.id&&be(i.workspace.id),d.toast.show({title:"Workspace добавлен",variant:"success"})}catch(i){console.error("RPC Error (add_workspace):",i),d.toast.show({title:"Ошибка добавления workspace",variant:"error",description:it(L(i))})}finally{Fe(!1)}}async function Nn(r){const t=(window.prompt("Путь к git-репозиторию",r.path)??"").trim();if(!t)return;const i=(window.prompt("Название workspace",r.name)??"").trim();Fe(!0);try{const a=await k.update_workspace({id:r.id,path:t,...i?{name:i}:{}});if(!a.success){d.toast.show({title:"Ошибка обновления workspace",variant:"error",description:a.error??"Неизвестная ошибка"});return}await or(),d.toast.show({title:"Workspace обновлён",variant:"success"})}catch(a){console.error("RPC Error (update_workspace):",a),d.toast.show({title:"Ошибка обновления workspace",variant:"error",description:it(L(a))})}finally{Fe(!1)}}async function Un(r){if(window.confirm(`Удалить workspace "${r.name}"? Задачи сохранены, привязка будет очищена.`)){Fe(!0);try{const t=await k.delete_workspace({id:r.id});if(!t.success){d.toast.show({title:"Ошибка удаления workspace",variant:"error",description:t.message??"Неизвестная ошибка"});return}We()===r.id&&be(""),Ge()===r.id&&ai("all"),await or(),await ne(),d.toast.show({title:"Workspace удалён",variant:"success",description:t.message})}catch(t){console.error("RPC Error (delete_workspace):",t),d.toast.show({title:"Ошибка удаления workspace",variant:"error",description:it(L(t))})}finally{Fe(!1)}}}const Jn=r=>{if(Gt(r),r.startsWith("custom:")){const i=Ft().find(a=>`custom:${a.id}`===r);if(!i)return;if(He(i.prompt??""),i.schedule){Je(i.schedule);const a=oi.find(W=>W.value===i.schedule);at(a?a.value:"__custom__")}if(pt(i.retryCount??0),ct(i.retryDelay??60),ft(i.qualityGate??""),ut(i.model??""),gt(typeof i.priority=="number"?i.priority:ye),mt(Array.isArray(i.dependsOn)?i.dependsOn:[]),yt(i.beforeScript??""),bt(i.afterScript??""),Pe(i.triggerType==="file"?"file":i.triggerType==="mcp-event"?"mcp-event":"cron"),xt(i.watchPath??""),vt(i.mcpEvent?.server??""),ht(i.mcpEvent?.event??""),wt(i.mcpEvent?.filter??""),Ke(i.workingDirectory??""),be(i.workspaceId??""),Ve(Array.isArray(i.allowedTools)?i.allowedTools:[]),Xe(Array.isArray(i.deniedTools)?i.deniedTools:[]),i.matrix){Yt(!0),_t(Array.isArray(i.matrix.workspaceIds)?i.matrix.workspaceIds:[]),Kt(i.matrix.strategy==="sequential"?"sequential":"parallel"),Vt(i.matrix.failureMode==="stop"?"stop":"continue"),Xt(i.matrix.aggregation==="per-task"?"per-task":"summary"),Zt(!!i.matrix.createAggregator),er(typeof i.matrix.concurrency=="number"?String(i.matrix.concurrency):"");const a=i.matrix.overrides;tr(a?{...a}:{})}else rr();return}const t=gi.find(i=>i.value===r);t&&He(t.prompt)};async function Hn(){if(!(xe()||"").trim()){d.toast.show({title:"Нечего сохранять",variant:"error",description:"Сначала заполните промпт — он обязателен для шаблона."});return}const r=(window.prompt("Название шаблона","")??"").trim();if(r)try{const t=await k.save_template({name:r,prompt:(xe()||"").trim(),schedule:(Ue()||"").trim(),timeoutSeconds:3600,model:(dt()||"").trim(),priority:Qe(),retryCount:Ir(),retryDelay:qr(),qualityGate:(Ut()||"").trim(),beforeScript:(Jt()||"").trim(),afterScript:(Ht()||"").trim(),dependsOn:Ye(),triggerType:ie(),mcpEvent:ie()==="mcp-event"?{server:(Lr()||"").trim(),event:(Rr()||"").trim(),...$t().trim()?{filter:$t().trim()}:{}}:void 0,watchPath:(Mr()||"").trim(),workingDirectory:(Qt()||"").trim(),workspaceId:(We()||"").trim()||void 0,allowedTools:R().length>0?R():void 0,deniedTools:D().length>0?D():void 0,matrix:zi()});if(!t.success){d.toast.show({title:"Не удалось сохранить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}await Ur();const i=t.template;i?.id&&Gt(`custom:${i.id}`),d.toast.show({title:`Шаблон "${r}" сохранён`,variant:"success"})}catch(t){console.error("RPC Error (save_template):",t),d.toast.show({title:"Ошибка сохранения шаблона",variant:"error",description:L(t)})}}async function Qn(r){if(window.confirm(`Удалить шаблон "${r.name}"?`))try{const t=await k.delete_template({id:r.id});if(!t.success){d.toast.show({title:"Не удалось удалить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}lt()===`custom:${r.id}`&&Gt("custom"),await Ur(),d.toast.show({title:`Шаблон "${r.name}" удалён`,variant:"success"})}catch(t){console.error("RPC Error (delete_template):",t),d.toast.show({title:"Ошибка удаления шаблона",variant:"error",description:L(t)})}}async function ne(){try{const r=await k.get_tasks({});console.log("[GUI] Received tasks:",r);const t=Array.isArray(r?.tasks)?r.tasks:[];console.log("[GUI] tasks count:",t.length);const i=t.map(a=>({name:a.name,schedule:a.schedule,status:a.status??"unknown",nextRun:a.nextRun??void 0,paused:a.status?.toLowerCase().includes("disabled"),retryCount:a.retryCount??0,retryDelay:a.retryDelay??60,qualityGate:a.qualityGate??void 0,dependsOn:Array.isArray(a.dependsOn)?a.dependsOn:void 0,model:a.model??void 0,priority:typeof a.priority=="number"?a.priority:ye,beforeScript:a.beforeScript??void 0,afterScript:a.afterScript??void 0,triggerType:a.triggerType??"cron",mcpEvent:a.mcpEvent??void 0,watchPath:a.watchPath??void 0,workingDirectory:a.workingDirectory??void 0,workspaceId:a.workspaceId??void 0,workspaceName:a.workspaceName??void 0,workspaceColor:a.workspaceColor??void 0,allowedTools:Array.isArray(a.allowedTools)?a.allowedTools:void 0,deniedTools:Array.isArray(a.deniedTools)?a.deniedTools:void 0,matrix:a.matrix??null,matrixParentId:a.matrixParentId??null,isMatrixParent:!!a.isMatrixParent,matrixSummary:a.matrixSummary??null,prompt:a.prompt??""}));yr(i),console.log("[GUI] jobs:",Te()),await Yn()}catch(r){console.error("RPC Error (get_tasks):",r),d.toast.show({title:"Ошибка загрузки задач",variant:"error",description:it(L(r))})}}async function Yn(){try{const r=await k.get_metrics({});$n({total:r.total??0,success:r.success??0,error:r.error??0})}catch(r){console.error("RPC Error (get_metrics):",r)}}async function Kn(r){di(r);try{const t=await k.get_history({limit:10});wn(t.records??[])}catch(t){console.error("RPC Error (get_history):",t),d.toast.show({title:"Ошибка загрузки истории",variant:"error",description:L(t)})}}async function Vn(r){Gr(!0),Wr(r),_i(!0),St(null);try{const t=await k.dry_run({taskName:r});St(t)}catch(t){console.error("RPC Error (dry_run):",t),St({success:!1,error:L(t),tasks:[],warnings:[]})}finally{_i(!1)}}function Ei(){Gr(!1),Wr(""),St(null)}async function Xn(){pi(!0),Dt("");try{const r=await k.create_task({name:(V()||"").trim(),schedule:(Ue()||"").trim(),prompt:(xe()||"").trim(),model:(dt()||"").trim(),priority:Qe(),retryCount:Ir(),retryDelay:qr(),qualityGate:(Ut()||"").trim(),beforeScript:(Jt()||"").trim(),afterScript:(Ht()||"").trim(),dependsOn:Ye(),triggerType:ie(),mcpEvent:ie()==="mcp-event"?{server:(Lr()||"").trim(),event:(Rr()||"").trim(),...$t().trim()?{filter:$t().trim()}:{}}:void 0,watchPath:(Mr()||"").trim(),workingDirectory:(Qt()||"").trim(),workspaceId:(We()||"").trim()||void 0,allowedTools:R().length>0?R():void 0,deniedTools:D().length>0?D():void 0,matrix:zi()});if(!r.success){const t=it(r.message);Dt(t),d.toast.show({title:"Ошибка создания задачи",variant:"error",description:t});return}await new Promise(t=>setTimeout(t,500)),await ne(),Nt(""),Je("* * * * *"),He(""),at("* * * * *"),pt(0),ct(60),ft(""),mt([]),ut(""),gt(ye),yt(""),bt(""),Pe("cron"),xt(""),vt(""),ht(""),wt(""),Ke(""),be(""),Ve([]),Xe([]),rr(),Bt(null),Gt("custom"),d.toast.show({title:"Задача создана",variant:"success"})}catch(r){console.error("RPC Error (create_task):",r);const t=it(L(r));Dt(t),d.toast.show({title:"Ошибка создания задачи",variant:"error",description:t})}finally{pi(!1)}}function Zn(r){const t=new Date().toISOString(),i=Ne.get(r);i&&clearInterval(i);let a=0;const W=setInterval(()=>{if(a+=1,a>900){clearInterval(W),Ne.delete(r);return}(async()=>{try{const ue=((await k.get_history({limit:50})).records??[]).find($e=>String($e.taskName??"").toLowerCase()===r.toLowerCase()&&typeof $e.startedAt=="string"&&$e.startedAt>=t);if(!ue)return;clearInterval(W),Ne.delete(r);const J=ue.status==="success",Ze=((Number(ue.durationMs)||0)/1e3).toFixed(1),Ae=ue.error?`: ${ue.error}`:"";d.toast.show({title:J?`Задача "${r}" выполнена`:`Задача "${r}" упала`,variant:J?"success":"error",description:`${Ze}s${Ae}`}),await ne()}catch(M){console.error("RPC Error (get_history):",M)}})()},2e3);Ne.set(r,W)}async function eo(r){if(!r||typeof r!="string"){console.error("[GUI] run_task aborted: empty task name");return}try{const t=await k.run_task({name:r});if(!t.success){d.toast.show({title:`Не удалось запустить "${r}"`,variant:"error",description:t.message});return}d.toast.show({title:t.message||`Задача "${r}" запущена`,variant:"success"}),/уже выполняется/i.test(t.message||"")||Zn(r),await ne()}catch(t){console.error("RPC Error (run_task):",t),d.toast.show({title:"Ошибка запуска",variant:"error",description:L(t)})}}async function to(r){try{const t=await k.pause_task({name:r});if(!t.success){d.toast.show({title:`Не удалось поставить на паузу "${r}"`,variant:"error",description:t.message});return}d.toast.show({title:`Задача "${r}" поставлена на паузу`,variant:"success"}),await ne()}catch(t){console.error("RPC Error (pause_task):",t),d.toast.show({title:"Ошибка паузы",variant:"error",description:L(t)})}}async function ro(r){try{const t=await k.resume_task({name:r});if(!t.success){d.toast.show({title:`Не удалось возобновить "${r}"`,variant:"error",description:t.message});return}d.toast.show({title:`Задача "${r}" возобновлена`,variant:"success"}),await ne()}catch(t){console.error("RPC Error (resume_task):",t),d.toast.show({title:"Ошибка возобновления",variant:"error",description:L(t)})}}async function io(r){if(window.confirm(`Отменить выполняющиеся клоны матрицы "${r}"?`))try{const t=await k.cancel_matrix({name:r});if(!t.success){d.toast.show({title:"Не удалось отменить матрицу",variant:"error",description:t.message});return}d.toast.show({title:t.message,variant:"success"}),await ne()}catch(t){console.error("RPC Error (cancel_matrix):",t),d.toast.show({title:"Ошибка отмены матрицы",variant:"error",description:L(t)})}}async function no(r){const i=Te().find(a=>a.name===r)?.matrix?`Удалить матрицу "${r}" вместе со всеми клонами и агрегатором?`:`Удалить задачу "${r}"?`;if(window.confirm(i))try{const a=await k.delete_task({name:r});if(!a.success){d.toast.show({title:"Ошибка удаления",variant:"error",description:a.message});return}d.toast.show({title:`Задача "${r}" удалена`,variant:"success"}),xr()===r&&(Be(""),vr(null)),Ar()?.name===r&&Bt(null),await ne()}catch(a){console.error("RPC Error (delete_task):",a),d.toast.show({title:"Ошибка удаления",variant:"error",description:L(a)})}}async function oo(r){vr(r),Be("Загрузка логов…");try{const t=await k.get_task_logs({name:r});if(!t.success){Be(t.error||"Не удалось загрузить логи"),d.toast.show({title:"Ошибка чтения логов",variant:"error",description:t.error});return}Be(t.logs||"(пусто)")}catch(t){console.error("RPC Error (get_task_logs):",t),Be("Ошибка чтения логов: "+L(t))}}function lo(r){Bt(r),Or(!1),Nt(r.name),Je(r.schedule),He(r.prompt??""),ut(r.model??""),gt(typeof r.priority=="number"?r.priority:ye),pt(r.retryCount??0),ct(r.retryDelay??60),ft(r.qualityGate??""),mt(Array.isArray(r.dependsOn)?r.dependsOn:[]),yt(r.beforeScript??""),bt(r.afterScript??""),Pe(r.triggerType??"cron"),xt(r.watchPath??""),vt(r.mcpEvent?.server??""),ht(r.mcpEvent?.event??""),wt(r.mcpEvent?.filter??""),Ke(r.workingDirectory??""),be(r.workspaceId??""),Ve(Array.isArray(r.allowedTools)?r.allowedTools:[]),Xe(Array.isArray(r.deniedTools)?r.deniedTools:[]),r.matrix?(Yt(!0),_t(Array.isArray(r.matrix.workspaceIds)?r.matrix.workspaceIds:[]),Kt(r.matrix.strategy==="sequential"?"sequential":"parallel"),Vt(r.matrix.failureMode==="stop"?"stop":"continue"),Xt(r.matrix.aggregation==="per-task"?"per-task":"summary"),Zt(!!r.matrix.createAggregator),er(typeof r.matrix.concurrency=="number"?String(r.matrix.concurrency):""),tr(r.matrix.overrides?{...r.matrix.overrides}:{})):rr();const t=oi.find(i=>i.value===r.schedule);at(t?t.value:"__custom__")}ne(),or(),Pn(),En(),Ur();const so=setInterval(ne,5e3);c.onCleanup(()=>clearInterval(so));const ao=yi()==="__custom__",Jr=Ar()!==null,Et=()=>Te()??[],Hr=()=>{const r=Ge();return r==="all"?Et():r==="none"?Et().filter(t=>!t.workspaceId):Et().filter(t=>t.workspaceId===r)},Pi=()=>{const r=(Ar()?.name??V()).trim().toLowerCase();return Et().map(t=>t.name).filter(t=>t.trim().toLowerCase()!==r)};function po(r,t){mt(i=>t?i.some(a=>a.toLowerCase()===r.toLowerCase())?i:[...i,r]:i.filter(a=>a.toLowerCase()!==r.toLowerCase()))}const[co,Ai]=c.createSignal(null);function he(r=!1){return`background:${r?"rgba(90,200,250,0.16)":"transparent"};border:1px solid ${r?"rgba(90,200,250,0.5)":"#333"};border-radius:6px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:${r?"#5ac8fa":"#cfcfd2"};font-size:14px;line-height:1;padding:0;transition:background 0.18s ease, border-color 0.18s ease, color 0.18s ease`}function F(r,t,i=!1){const a=r.currentTarget;a&&(a.style.background=t?"rgba(255,255,255,0.09)":i?"rgba(90,200,250,0.16)":"transparent",a.style.borderColor=t?"#5ac8fa":i?"rgba(90,200,250,0.5)":"#333",a.style.color=t||i?"#5ac8fa":"#cfcfd2")}const uo=r=>{const t=r.job;return!t||!t.name?null:(()=>{var i=Rl(),a=i.firstChild,W=a.firstChild,M=W.firstChild,U=M.firstChild,ue=U.firstChild,J=U.nextSibling,Ze=J.firstChild,Ae=Ze.nextSibling,$e=Ae.nextSibling,we=$e.nextSibling;we.nextSibling;var lr=M.nextSibling,_e=W.nextSibling,oe=_e.firstChild,ge=oe.nextSibling,fe=ge.nextSibling,le=fe.nextSibling,me=le.nextSibling,Oe=me.nextSibling;return e.insert(ue,()=>t.name),e.insert(U,(()=>{var l=e.memo(()=>!!t.workspaceName);return()=>l()&&(()=>{var s=Dl();return s.firstChild,e.insert(s,()=>t.workspaceName,null),e.effect(b=>{var T=`Workspace: ${t.workspaceName}${t.workingDirectory?` (${t.workingDirectory})`:""}`,C=`font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid ${t.workspaceColor||"#5ac8fa"};color:${t.workspaceColor||"#5ac8fa"};background:${t.workspaceColor||"#5ac8fa"}1a`;return T!==b.e&&e.setAttribute(s,"title",b.e=T),b.t=e.style(s,C,b.t),b},{e:void 0,t:void 0}),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>!!(t.isMatrixParent&&t.matrix));return()=>l()&&(()=>{var s=jl(),b=s.firstChild,T=b.nextSibling;return T.nextSibling,e.insert(s,()=>t.matrix.workspaceIds.length,T),e.insert(s,(()=>{var C=e.memo(()=>!!t.matrix.concurrency);return()=>C()?` ⚙${t.matrix.concurrency}`:""})(),null),e.effect(()=>e.setAttribute(s,"title",`Matrix fan-out: ${t.matrix.workspaceIds.length} клонов, стратегия: ${t.matrix.strategy??"parallel"}, при ошибке: ${t.matrix.failureMode??"continue"}${t.matrix.concurrency?`, одновременно: ${t.matrix.concurrency}`:""}${t.matrix.overrides?`, переопределено workspace: ${Object.keys(t.matrix.overrides).length}`:""}`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>!!t.matrixParentId);return()=>l()&&(()=>{var s=Gl();return s.firstChild,e.insert(s,()=>t.matrixParentId,null),e.effect(()=>e.setAttribute(s,"title",`Клон матрицы. Родитель: ${t.matrixParentId}`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>!!t.watchPath);return()=>l()&&(()=>{var s=Fl();return e.effect(()=>e.setAttribute(s,"title",`Отслеживание файла: ${t.watchPath}`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>!!(t.beforeScript||t.afterScript));return()=>l()&&(()=>{var s=Wl();return e.effect(()=>e.setAttribute(s,"title",`Lifecycle hooks: ${[t.beforeScript?`pre: ${t.beforeScript}`:"",t.afterScript?`post: ${t.afterScript}`:""].filter(Boolean).join(" · ")}`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>t.triggerType==="mcp-event");return()=>l()&&(()=>{var s=Bl();return e.effect(()=>e.setAttribute(s,"title",`MCP-событие: ${t.mcpEvent?.event??"—"}${t.mcpEvent?.filter?` (фильтр: ${t.mcpEvent.filter})`:""}`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>!!t.model);return()=>l()&&(()=>{var s=Nl();return s.firstChild,e.insert(s,()=>t.model,null),e.effect(()=>e.setAttribute(s,"title",`Модель LLM: ${t.model}`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>typeof t.priority=="number"&&t.priority!==ye);return()=>l()&&(()=>{var s=Ul();return s.firstChild,e.insert(s,()=>gn(t.priority),null),e.effect(()=>e.setAttribute(s,"title",`Приоритет: ${gn(t.priority)} (${t.priority})`)),s})()})(),null),e.insert(U,(()=>{var l=e.memo(()=>!!(Array.isArray(t.allowedTools)&&t.allowedTools.length>0||Array.isArray(t.deniedTools)&&t.deniedTools.length>0));return()=>l()?(()=>{var s=Jl();return e.effect(()=>e.setAttribute(s,"title",`Ограничения инструментов: ${[t.allowedTools?.length?`allowed=[${t.allowedTools.join(", ")}]`:"",t.deniedTools?.length?`denied=[${t.deniedTools.join(", ")}]`:""].filter(Boolean).join(" · ")}`)),s})():null})(),null),e.insert(M,(()=>{var l=e.memo(()=>!!(Array.isArray(t.dependsOn)&&t.dependsOn.length>0));return()=>l()&&(()=>{var s=Hl(),b=s.firstChild;return b.firstChild,e.insert(b,()=>t.dependsOn.join(" + "),null),s})()})(),J),e.insert(M,(()=>{var l=e.memo(()=>!!(t.isMatrixParent&&t.matrixSummary));return()=>l()&&(()=>{var s=Ql(),b=s.firstChild,T=b.firstChild,C=T.nextSibling,O=C.nextSibling,h=O.nextSibling;return h.nextSibling,e.insert(b,()=>t.matrixSummary.successCount,C),e.insert(b,()=>t.matrixSummary.totalCount,h),e.insert(b,(()=>{var x=e.memo(()=>t.matrixSummary.errorCount>0);return()=>x()?` · ❌ ${t.matrixSummary.errorCount}`:""})(),null),e.insert(b,(()=>{var x=e.memo(()=>t.matrixSummary.pendingCount>0);return()=>x()?` · ⏳ ${t.matrixSummary.pendingCount}`:""})(),null),e.effect(x=>{var _=t.matrixSummary.message,q=`cursor:help;color:${xa(t.matrixSummary.status)};white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;return _!==x.e&&e.setAttribute(b,"title",x.e=_),x.t=e.style(b,q,x.t),x},{e:void 0,t:void 0}),s})()})(),J),e.insert(J,()=>hr().total,Ae),e.insert(J,()=>hr().success,we),e.insert(J,()=>hr().error,null),e.insert(M,(()=>{var l=e.memo(()=>!!(t.schedule||t.nextRun));return()=>l()&&(()=>{var s=Yl(),b=s.firstChild;return e.insert(b,()=>t.schedule),e.insert(s,(()=>{var T=e.memo(()=>!!t.nextRun);return()=>T()&&(()=>{var C=Kl();return C.firstChild,e.insert(C,()=>t.nextRun,null),C})()})(),null),s})()})(),null),e.insert(lr,(()=>{var l=e.memo(()=>t.status==="running");return()=>l()?(()=>{var s=Vl(),b=s.firstChild,T=b.nextSibling;return T.nextSibling,e.insert(s,kn,T),s})():(()=>{var s=Xl();return e.insert(s,(()=>{var b=e.memo(()=>t.status==="success");return()=>b()?"🟢 Готова":e.memo(()=>t.status==="error")()?"🔴 Ошибка":t.status==="partial"?"🟠 Частично":"⚪ Пауза"})()),s})()})()),oe.addEventListener("mouseleave",l=>{F(l,!1),Ai(s=>s===t.name?null:s)}),oe.addEventListener("mouseenter",l=>{F(l,!0),re()&&Ai(t.name)}),oe.$$click=()=>{eo(t.name)},e.insert(oe,()=>re()&&co()===t.name?"❄️":"▶"),ge.addEventListener("mouseleave",l=>F(l,!1)),ge.addEventListener("mouseenter",l=>F(l,!0)),ge.$$click=()=>{t.paused?ro(t.name):to(t.name)},e.insert(ge,()=>t.paused?"▶":"⏸"),fe.addEventListener("mouseleave",l=>F(l,!1)),fe.addEventListener("mouseenter",l=>F(l,!0)),fe.$$click=()=>{oo(t.name)},le.addEventListener("mouseleave",l=>F(l,!1,kt()&&Ct()===t.name)),le.addEventListener("mouseenter",l=>F(l,!0,kt()&&Ct()===t.name)),le.$$click=()=>{Vn(t.name)},me.addEventListener("mouseleave",l=>F(l,!1,jt()===t.name)),me.addEventListener("mouseenter",l=>F(l,!0,jt()===t.name)),me.$$click=()=>{Kn(t.name)},Oe.addEventListener("mouseleave",l=>F(l,!1)),Oe.addEventListener("mouseenter",l=>F(l,!0)),Oe.$$click=()=>{lo(t)},e.insert(_e,(()=>{var l=e.memo(()=>!!t.matrix);return()=>l()&&(()=>{var s=Zl();return s.addEventListener("mouseleave",b=>F(b,!1)),s.addEventListener("mouseenter",b=>F(b,!0)),s.$$click=()=>{io(t.name)},e.effect(b=>{var T=`Отменить выполняющиеся клоны матрицы "${t.name}"`,C=he();return T!==b.e&&e.setAttribute(s,"title",b.e=T),b.t=e.style(s,C,b.t),b},{e:void 0,t:void 0}),s})()})(),null),e.insert(_e,(()=>{var l=e.memo(()=>!t.matrixParentId);return()=>l()&&(()=>{var s=es();return s.addEventListener("mouseleave",b=>F(b,!1)),s.addEventListener("mouseenter",b=>F(b,!0)),s.$$click=()=>{no(t.name)},e.effect(b=>{var T=t.matrix?`Удалить матрицу "${t.name}" вместе с клонами`:`Удалить "${t.name}"`,C=he();return T!==b.e&&e.setAttribute(s,"title",b.e=T),b.t=e.style(s,C,b.t),b},{e:void 0,t:void 0}),s})()})(),null),e.insert(i,(()=>{var l=e.memo(()=>jt()===t.name);return()=>l()&&(()=>{var s=ts(),b=s.firstChild,T=b.firstChild,C=T.nextSibling;return C.addEventListener("mouseleave",O=>{O.target.style.color="#8e8e93"}),C.addEventListener("mouseenter",O=>{O.target.style.color="#ffffff"}),C.$$click=()=>di(null),e.insert(s,(()=>{var O=e.memo(()=>ui().length===0);return()=>O()?rs():ui().map(h=>(()=>{var x=is(),_=x.firstChild,q=_.nextSibling,ke=q.nextSibling,y=ke.firstChild;return e.insert(_,()=>new Date(h.startedAt).toLocaleString()),e.insert(q,()=>h.status==="success"?"✅ Успех":"❌ Ошибка"),e.insert(ke,()=>h.durationMs,y),e.insert(x,(()=>{var p=e.memo(()=>!!h.model);return()=>p()&&(()=>{var u=ns();return u.firstChild,e.insert(u,()=>h.model,null),e.effect(()=>e.setAttribute(u,"title",`Модель: ${h.model}`)),u})()})(),null),e.insert(x,(()=>{var p=e.memo(()=>!!(h.preFlightStatus&&h.preFlightStatus!=="skipped"));return()=>p()&&(()=>{var u=os();return u.firstChild,e.insert(u,()=>h.preFlightStatus==="success"?"✅":"❌",null),e.effect(g=>{var $=`Pre-flight: ${h.preFlightStatus}`,f=h.preFlightStatus==="success"?"#34c759":"#ff3b30";return $!==g.e&&e.setAttribute(u,"title",g.e=$),f!==g.t&&e.setStyleProperty(u,"color",g.t=f),g},{e:void 0,t:void 0}),u})()})(),null),e.insert(x,(()=>{var p=e.memo(()=>!!(h.postFlightStatus&&h.postFlightStatus!=="skipped"));return()=>p()&&(()=>{var u=ls();return u.firstChild,e.insert(u,()=>h.postFlightStatus==="success"?"✅":"❌",null),e.effect(g=>{var $=`Post-flight: ${h.postFlightStatus}`,f=h.postFlightStatus==="success"?"#34c759":"#ff3b30";return $!==g.e&&e.setAttribute(u,"title",g.e=$),f!==g.t&&e.setStyleProperty(u,"color",g.t=f),g},{e:void 0,t:void 0}),u})()})(),null),e.insert(x,(()=>{var p=e.memo(()=>!!h.error);return()=>p()&&(()=>{var u=ss();return e.insert(u,()=>h.error),u})()})(),null),e.insert(x,(()=>{var p=e.memo(()=>!!h.nextTask);return()=>p()&&(()=>{var u=as();return u.firstChild,e.insert(u,()=>h.nextTask,null),u})()})(),null),e.effect(p=>{var u=h.startedAt+h.durationMs,g=h.status==="success"?"#34c759":"#ff3b30";return u!==p.e&&e.setAttribute(x,"key",p.e=u),g!==p.t&&e.setStyleProperty(q,"color",p.t=g),p},{e:void 0,t:void 0}),x})())})(),null),s})()})(),null),e.insert(i,(()=>{var l=e.memo(()=>!!(kt()&&Ct()===t.name));return()=>l()&&(()=>{var s=ps(),b=s.firstChild,T=b.firstChild,C=T.nextSibling;return e.insert(b,()=>t.name,C),C.addEventListener("mouseleave",O=>{O.target.style.color="#8e8e93"}),C.addEventListener("mouseenter",O=>{O.target.style.color="#ffffff"}),C.$$click=()=>Ei(),e.insert(s,(()=>{var O=e.memo(()=>!!Fr());return()=>O()&&cs()})(),null),e.insert(s,(()=>{var O=e.memo(()=>!!(!Fr()&&j()&&!j().success));return()=>O()&&(()=>{var h=ds();return h.firstChild,e.insert(h,()=>j().error??"Симуляция не удалась",null),h})()})(),null),e.insert(s,(()=>{var O=e.memo(()=>!!(!Fr()&&j()&&j().success));return()=>O()&&(()=>{var h=us();return e.insert(h,(()=>{var x=e.memo(()=>!!(Array.isArray(j().warnings)&&j().warnings.length>0));return()=>x()&&(()=>{var _=gs();return _.firstChild,e.insert(_,()=>j().warnings.map(q=>`· ${q}`).join(" | "),null),_})()})(),null),e.insert(h,()=>j().tasks.map(x=>(()=>{var _=fs(),q=_.firstChild,ke=q.firstChild,y=ke.nextSibling;y.nextSibling;var p=q.nextSibling;p.firstChild;var u=p.nextSibling;u.firstChild;var g=u.nextSibling;return g.firstChild,e.insert(q,()=>(x.order??0)+1,y),e.insert(q,()=>x.trigger,null),e.insert(p,()=>x.name,null),e.insert(_,(()=>{var $=e.memo(()=>!!x.workspace);return()=>$()&&(()=>{var f=ms();return f.firstChild,e.insert(f,()=>x.workspace.name,null),f})()})(),u),e.insert(_,(()=>{var $=e.memo(()=>!!x.matrixParent);return()=>$()&&(()=>{var f=ys();return f.firstChild,e.insert(f,()=>x.matrixParent,null),f})()})(),u),e.insert(u,()=>x.cwd||"(папка проекта)",null),e.insert(_,(()=>{var $=e.memo(()=>!!x.roleScoped);return()=>$()&&(()=>{var f=bs();return e.effect(()=>e.setAttribute(f,"title",`allowed=[${(x.roleScoped.allowed??[]).join(", ")}] · denied=[${(x.roleScoped.denied??[]).join(", ")}]`)),f})()})(),g),e.insert(_,(()=>{var $=e.memo(()=>x.estimatedDurationSec!=null);return()=>$()&&(()=>{var f=xs(),I=f.firstChild,P=I.nextSibling;return P.nextSibling,e.insert(f,()=>x.estimatedDurationSec,P),f})()})(),g),e.insert(_,(()=>{var $=e.memo(()=>x.estimatedTokens!=null);return()=>$()&&(()=>{var f=vs(),I=f.firstChild,P=I.nextSibling;return P.nextSibling,e.insert(f,()=>x.estimatedTokens,P),f})()})(),g),e.insert(_,(()=>{var $=e.memo(()=>x.estimatedCostUsd!=null);return()=>$()&&(()=>{var f=hs();return f.firstChild,e.insert(f,()=>Number(x.estimatedCostUsd).toFixed(4),null),f})()})(),g),e.insert(g,()=>x.command,null),e.insert(_,(()=>{var $=e.memo(()=>!!x.preFlight);return()=>$()&&(()=>{var f=$s();return f.firstChild,e.insert(f,()=>x.preFlight,null),f})()})(),null),e.insert(_,(()=>{var $=e.memo(()=>!!x.postFlight);return()=>$()&&(()=>{var f=ws();return f.firstChild,e.insert(f,()=>x.postFlight,null),f})()})(),null),e.insert(_,(()=>{var $=e.memo(()=>!!x.qualityGate);return()=>$()&&(()=>{var f=_s();return f.firstChild,e.insert(f,()=>x.qualityGate,null),f})()})(),null),e.effect(()=>e.setAttribute(_,"key",`${x.name}-${x.order}`)),_})()),null),e.insert(h,(()=>{var x=e.memo(()=>!!(j().totals&&(j().totals.estimatedDurationSec!=null||j().totals.estimatedTokens!=null)));return()=>x()&&(()=>{var _=ks();return _.firstChild,e.insert(_,()=>(j().totals.estimatedDurationSec??"—")+" с · "+(j().totals.estimatedTokens??"—")+" токенов"+(j().totals.estimatedCostUsd!=null?` · ~$${Number(j().totals.estimatedCostUsd).toFixed(4)}`:""),null),_})()})(),null),h})()})(),null),s})()})(),null),e.effect(l=>{var s=`background:#252526;border-radius:10px;padding:16px;margin-bottom:12px;display:flex;flex-direction:column;gap:10px;border:1px solid ${re()?"rgba(135, 206, 250, 0.4)":"#333"}`,b=`Запустить "${t.name}"`,T=he(),C=t.paused?`Возобновить "${t.name}"`:`Поставить на паузу "${t.name}"`,O=he(),h=`Логи "${t.name}"`,x=he(),_=`Dry-Run симуляция "${t.name}"`,q=he(kt()&&Ct()===t.name),ke=`История "${t.name}"`,y=he(jt()===t.name),p=`Редактировать "${t.name}"`,u=he();return l.e=e.style(i,s,l.e),b!==l.t&&e.setAttribute(oe,"title",l.t=b),l.a=e.style(oe,T,l.a),C!==l.o&&e.setAttribute(ge,"title",l.o=C),l.i=e.style(ge,O,l.i),h!==l.n&&e.setAttribute(fe,"title",l.n=h),l.s=e.style(fe,x,l.s),_!==l.h&&e.setAttribute(le,"title",l.h=_),l.r=e.style(le,q,l.r),ke!==l.d&&e.setAttribute(me,"title",l.d=ke),l.l=e.style(me,y,l.l),p!==l.u&&e.setAttribute(Oe,"title",l.u=p),l.c=e.style(Oe,u,l.c),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),i})()};try{return d.add(ri.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(c.ErrorBoundary,{fallback:r=>(()=>{var t=dn(),i=t.firstChild;return e.insert(t,()=>r.message,null),t})(),get children(){var r=Ss(),t=r.firstChild,i=t.firstChild,a=i.firstChild,W=i.nextSibling,M=W.firstChild,U=M.firstChild,ue=U.nextSibling,J=M.nextSibling,Ze=J.nextSibling,Ae=Ze.firstChild,$e=t.nextSibling,we=$e.firstChild,lr=we.nextSibling,_e=lr.nextSibling,oe=$e.nextSibling,ge=oe.firstChild,fe=ge.nextSibling,le=oe.nextSibling,me=le.firstChild,Oe=me.firstChild,l=Oe.nextSibling,s=l.firstChild,b=le.nextSibling,T=b.firstChild,C=T.firstChild,O=C.firstChild,h=O.nextSibling,x=h.nextSibling,_=C.nextSibling,q=b.nextSibling,ke=q.firstChild;return e.insert(a,(()=>{var y=e.memo(()=>!!re());return()=>y()?`❄️ ${Er()} ❄️`:Er()})()),M.addEventListener("change",y=>ai(y.currentTarget.value)),e.insert(M,()=>Q().map(y=>(()=>{var p=un(),u=p.firstChild;return e.insert(p,()=>y.name,null),e.effect(()=>e.setAttribute(p,"key",y.id)),e.effect(()=>p.value=y.id),p})()),ue),J.addEventListener("mouseleave",y=>{const p=y.currentTarget;p.style.borderColor="#333",p.style.background="#1e1e1e",p.style.color="#e0e0e0"}),J.addEventListener("mouseenter",y=>{const p=y.currentTarget;p.style.borderColor="#5ac8fa",p.style.background="rgba(90,200,250,0.12)",p.style.color="#5ac8fa"}),J.$$click=async()=>{const y=window.open("","_blank");let p=3782;try{const g=await k.get_dashboard_port({});g&&typeof g.port=="number"&&g.port>0&&(p=g.port)}catch(g){console.warn("[scheduler] Не удалось получить порт дашборда:",g)}const u="http://localhost:"+p;y?y.location.href=u:window.open(u,"_blank")},Ae.addEventListener("change",y=>{qn(y.currentTarget.checked)}),we.$$click=Fn,e.insert(we,()=>ir()?"Экспорт...":"Экспорт"),lr.addEventListener("change",Wn),_e.$$click=()=>document.querySelector('input[type="file"]')?.click(),e.insert(_e,()=>nr()?"Импорт...":"Импорт"),fe.addEventListener("change",y=>In(Number(y.currentTarget.value)||1)),me.$$click=()=>zn(!Tr()),e.insert(l,(()=>{var y=e.memo(()=>!!ce());return()=>y()?kr()?"только ошибки":"все запуски":"выключены"})(),s),e.insert(s,()=>Tr()?"▾":"▴"),e.insert(le,(()=>{var y=e.memo(()=>!Tr());return()=>y()&&(()=>{var p=Cs(),u=p.firstChild,g=u.firstChild,$=u.nextSibling,f=$.firstChild,I=$.nextSibling,P=I.firstChild,G=P.firstChild,H=P.nextSibling,se=I.nextSibling,ae=se.firstChild;return g.addEventListener("change",z=>{_r(z.currentTarget.checked),st()}),f.addEventListener("change",z=>{Sr(z.currentTarget.checked),st()}),G.addEventListener("change",z=>{Cr(z.currentTarget.checked),st()}),H.addEventListener("change",()=>{st()}),H.$$input=z=>zr(z.currentTarget.value),ae.$$click=()=>{On()},e.insert(ae,()=>Wt()?"Отправка...":"🧪 Тестовое уведомление"),e.effect(z=>{var Pt=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${ce()?1:.5}`,Se=!ce(),Ie=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${ce()?1:.5}`,qe=!ce(),B=!ce()||!Ee(),et=`display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none;opacity:${ce()&&Ee()?1:.5}`,Ce=Wt()||!Ee(),Me=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${Wt()||!Ee()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${Wt()||!Ee()?.6:1}`;return z.e=e.style($,Pt,z.e),Se!==z.t&&(f.disabled=z.t=Se),z.a=e.style(P,Ie,z.a),qe!==z.o&&(G.disabled=z.o=qe),B!==z.i&&(H.disabled=z.i=B),z.n=e.style(H,et,z.n),Ce!==z.s&&(ae.disabled=z.s=Ce),z.h=e.style(ae,Me,z.h),z},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e.effect(()=>g.checked=ce()),e.effect(()=>f.checked=kr()),e.effect(()=>G.checked=Ee()),e.effect(()=>H.value=fi()||""),p})()})(),null),C.$$click=()=>vn(!br()),e.insert(h,()=>Q().length),e.insert(x,()=>br()?"▾":"▴"),_.$$click=()=>{Bn()},e.insert(b,(()=>{var y=e.memo(()=>!br());return()=>y()&&(()=>{var p=zs();return e.insert(p,(()=>{var u=e.memo(()=>Q().length===0);return()=>u()?Ts():Q().map(g=>(()=>{var $=Es(),f=$.firstChild,I=f.nextSibling,P=I.firstChild,G=P.firstChild,H=P.nextSibling,se=H.nextSibling,ae=se.firstChild,z=ae.nextSibling,Pt=z.nextSibling,Se=I.nextSibling,Ie=Se.firstChild,qe=Ie.nextSibling;return e.insert(P,()=>g.name,null),e.insert(H,()=>g.path),e.insert(se,()=>g.gitBranch||"—",z),e.insert(se,()=>g.gitRemote||"remote не задан",null),Ie.$$click=()=>{Nn(g)},qe.$$click=()=>{Un(g)},e.effect(B=>{var et=`width:9px;height:9px;border-radius:50%;background:${g.color||"#5ac8fa"};flex-shrink:0`,Ce=g.path,Me=nt(),sr=nt();return B.e=e.style(f,et,B.e),Ce!==B.t&&e.setAttribute(H,"title",B.t=Ce),Me!==B.a&&(Ie.disabled=B.a=Me),sr!==B.o&&(qe.disabled=B.o=sr),B},{e:void 0,t:void 0,a:void 0,o:void 0}),$})())})()),p})()})(),null),e.insert(r,(()=>{var y=e.memo(()=>!!Mn());return()=>y()?(()=>{var p=Ps();return p.addEventListener("mouseleave",u=>{const g=u.currentTarget;g.style.borderColor="#3a3a3a",g.style.background="#1e1e1e"}),p.addEventListener("mouseenter",u=>{const g=u.currentTarget;g.style.borderColor="#5ac8fa",g.style.background="#232326"}),p.$$click=()=>Or(!1),p})():(()=>{var p=As(),u=p.firstChild,g=u.firstChild,$=g.nextSibling,f=$.firstChild,I=f.nextSibling,P=u.nextSibling,G=P.firstChild,H=G.firstChild,se=G.nextSibling,ae=P.nextSibling,z=ae.firstChild,Pt=z.nextSibling,Se=ae.nextSibling,Ie=Se.firstChild,qe=Ie.nextSibling,B=qe.firstChild,et=B.firstChild,Ce=B.nextSibling,Me=Ce.firstChild,sr=Ce.nextSibling,Oi=sr.firstChild,Le=Se.nextSibling,go=Le.firstChild,Qr=go.nextSibling,Ii=Le.nextSibling,fo=Ii.firstChild,qi=fo.nextSibling,Yr=Ii.nextSibling,mo=Yr.firstChild,ar=mo.nextSibling,Mi=Yr.nextSibling,yo=Mi.firstChild,Li=yo.nextSibling,Ri=Mi.nextSibling,bo=Ri.firstChild,pr=bo.nextSibling,Di=Ri.nextSibling,xo=Di.firstChild,ji=xo.nextSibling,Gi=Di.nextSibling,vo=Gi.firstChild,Fi=vo.nextSibling,Wi=Gi.nextSibling,ho=Wi.firstChild,Bi=ho.nextSibling,Ni=Wi.nextSibling,$o=Ni.firstChild,Ui=$o.nextSibling,Ji=Ni.nextSibling,wo=Ji.firstChild,Hi=wo.nextSibling,Qi=Ji.nextSibling,_o=Qi.firstChild,ko=_o.nextSibling,Yi=Qi.nextSibling,Kr=Yi.firstChild,_a=Kr.firstChild,Ki=Kr.nextSibling,So=Ki.firstChild,Co=So.nextSibling,Vi=Co.nextSibling,zo=Vi.nextSibling,Xi=zo.nextSibling,To=Xi.nextSibling,Vr=To.firstChild,Zi=Vr.nextSibling,Eo=Zi.nextSibling,en=Yi.nextSibling,tn=en.firstChild,cr=tn.nextSibling;return e.insert(g,Jr?"Редактирование задачи":"Новая задача"),f.addEventListener("mouseleave",o=>{const n=o.currentTarget;n.style.color="#a0a0a6",n.style.borderColor="#333"}),f.addEventListener("mouseenter",o=>{const n=o.currentTarget;n.style.color="#5ac8fa",n.style.borderColor="#5ac8fa"}),f.$$click=Hn,I.addEventListener("mouseleave",o=>{const n=o.currentTarget;n.style.color="#a0a0a6",n.style.borderColor="#333"}),I.addEventListener("mouseenter",o=>{const n=o.currentTarget;n.style.color="#5ac8fa",n.style.borderColor="#5ac8fa"}),I.$$click=()=>Or(!0),H.addEventListener("change",o=>{const n=o.currentTarget.checked;Yt(n),n&&(be(""),de().length===0&&_t(Q().map(v=>v.id)))}),e.insert(P,(()=>{var o=e.memo(()=>!!ve());return()=>o()&&(()=>{var n=Os(),v=n.firstChild,m=v.firstChild,w=m.firstChild,S=v.nextSibling,E=S.firstChild,Y=E.firstChild,ze=Y.nextSibling,At=E.nextSibling,Re=At.firstChild,Ot=Re.nextSibling,K=At.nextSibling,A=K.firstChild,pe=A.nextSibling,De=S.nextSibling,dr=De.firstChild,It=De.nextSibling,rn=It.firstChild,Xr=rn.nextSibling,nn=It.nextSibling;return e.insert(m,()=>de().length,null),e.insert(v,(()=>{var N=e.memo(()=>Q().length===0);return()=>N()?Is():(()=>{var X=qs();return e.insert(X,()=>Q().map(ee=>(()=>{var tt=Ms(),rt=tt.firstChild,Z=rt.nextSibling,qt=Z.firstChild,je=Z.nextSibling;return rt.addEventListener("change",ur=>Ln(ee.id,ur.currentTarget.checked)),e.insert(Z,()=>ee.name,null),e.insert(je,()=>ee.path),e.effect(ur=>e.style(Z,`color:${ee.color||"#5ac8fa"}`,ur)),e.effect(()=>rt.checked=de().includes(ee.id)),tt})())),X})()})(),null),ze.addEventListener("change",N=>Kt(N.currentTarget.value==="sequential"?"sequential":"parallel")),Ot.addEventListener("change",N=>Vt(N.currentTarget.value==="stop"?"stop":"continue")),pe.addEventListener("change",N=>Xt(N.currentTarget.value==="per-task"?"per-task":"summary")),dr.addEventListener("change",N=>Zt(N.currentTarget.checked)),Xr.$$input=N=>er(N.currentTarget.value),e.insert(n,(()=>{var N=e.memo(()=>de().length>0);return()=>N()&&(()=>{var X=Ls(),ee=X.firstChild,tt=ee.firstChild,rt=ee.nextSibling;return e.insert(ee,Rn,null),e.insert(rt,()=>de().map(Z=>{const qt=Q().find(gr=>gr.id===Z);if(!qt)return null;const je=jr()[Z]??{},ur="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box";return(()=>{var gr=Rs(),fr=gr.firstChild,Po=fr.firstChild,on=Po.nextSibling,Ao=fr.nextSibling,Zr=Ao.firstChild,ln=Zr.nextSibling,ei=ln.firstChild,sn=ei.nextSibling,Oo=ln.nextSibling,ti=Oo.firstChild,an=ti.nextSibling;return e.insert(fr,()=>qt.name,on),e.insert(on,()=>Br(V(),qt.name)),Zr.$$input=te=>zt(Z,"prompt",te.currentTarget.value),ei.$$input=te=>zt(Z,"model",te.currentTarget.value),sn.$$input=te=>zt(Z,"qualityGate",te.currentTarget.value),ti.$$input=te=>zt(Z,"beforeScript",te.currentTarget.value),an.$$input=te=>zt(Z,"afterScript",te.currentTarget.value),e.effect(te=>e.style(fr,`font-size:12px;font-weight:600;margin-bottom:6px;color:${qt.color||"#5ac8fa"}`,te)),e.effect(()=>Zr.value=je.prompt??""),e.effect(()=>ei.value=je.model??""),e.effect(()=>sn.value=je.qualityGate??""),e.effect(()=>ti.value=je.beforeScript??""),e.effect(()=>an.value=je.afterScript??""),gr})()})),X})()})(),nn),e.insert(nn,(()=>{var N=e.memo(()=>Nr().length>0);return()=>N()?[(()=>{var X=Ds(),ee=X.firstChild,tt=ee.nextSibling,rt=tt.nextSibling;return e.insert(X,()=>Nr().length,tt),X})(),(()=>{var X=js();return e.insert(X,()=>Nr().join(", ")),X})()]:Gs()})()),e.effect(()=>e.setAttribute(Xr,"placeholder",Dr()==="sequential"?"1 (sequential)":"без лимита")),e.effect(()=>ze.value=Dr()),e.effect(()=>Ot.value=vi()),e.effect(()=>pe.value=hi()),e.effect(()=>dr.checked=$i()),e.effect(()=>Xr.value=wi()),n})()})(),null),e.insert(p,(()=>{var o=e.memo(()=>!ve());return()=>o()&&(()=>{var n=Fs(),v=n.firstChild,m=v.nextSibling,w=m.firstChild;return m.addEventListener("change",S=>{be(S.currentTarget.value),S.currentTarget.value&&Ke("")}),e.insert(m,()=>Q().map(S=>(()=>{var E=un(),Y=E.firstChild;return e.insert(E,()=>S.name,null),e.effect(()=>e.setAttribute(E,"key",S.id)),e.effect(()=>E.value=S.id),E})()),null),e.insert(n,(()=>{var S=e.memo(()=>!!Tt());return()=>S()&&(()=>{var E=Ws(),Y=E.firstChild,ze=Y.firstChild,At=ze.nextSibling,Re=Y.nextSibling,Ot=Re.firstChild,K=Ot.nextSibling,A=Re.nextSibling,pe=A.firstChild,De=pe.nextSibling;return e.insert(At,()=>Tt().path),e.insert(K,()=>Tt().gitBranch||"—"),e.insert(De,()=>Tt().gitRemote||"—"),E})()})(),null),e.effect(()=>m.value=We()),n})()})(),ae),Pt.$$input=o=>Nt(o.currentTarget.value),e.insert(p,(()=>{var o=e.memo(()=>!We()&&!ve());return()=>o()&&(()=>{var n=Bs(),v=n.firstChild,m=v.nextSibling;return m.$$input=w=>Ke(w.currentTarget.value),e.effect(()=>m.value=Qt()||""),n})()})(),Se),et.addEventListener("change",()=>Pe("cron")),Me.addEventListener("change",()=>Pe("file")),Oi.addEventListener("change",()=>Pe("mcp-event")),e.insert(p,(()=>{var o=e.memo(()=>ie()==="file");return()=>o()&&(()=>{var n=Ns(),v=n.firstChild,m=v.nextSibling;return m.$$input=w=>xt(w.currentTarget.value),e.effect(()=>m.value=Mr()||""),n})()})(),Le),e.insert(p,(()=>{var o=e.memo(()=>ie()==="mcp-event");return()=>o()&&[(()=>{var n=Us(),v=n.firstChild,m=v.nextSibling;return m.$$input=w=>vt(w.currentTarget.value),e.effect(()=>m.value=Lr()||""),n})(),(()=>{var n=Js(),v=n.firstChild,m=v.nextSibling;return m.$$input=w=>ht(w.currentTarget.value),e.effect(()=>m.value=Rr()||""),n})(),(()=>{var n=Hs(),v=n.firstChild,m=v.nextSibling;return m.$$input=w=>wt(w.currentTarget.value),e.effect(()=>m.value=$t()||""),n})()]})(),Le),Qr.addEventListener("change",o=>{const n=o.currentTarget.value;at(n),n!=="__custom__"&&Je(n)}),e.insert(Qr,()=>oi.map(o=>(()=>{var n=mr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})())),e.insert(Le,ao&&(()=>{var o=Qs(),n=o.firstChild,v=n.nextSibling;return v.$$input=m=>Je(m.currentTarget.value),e.effect(()=>v.value=Ue()||""),o})(),null),e.insert(Le,(()=>{var o=e.memo(()=>!!ci());return()=>o()&&(()=>{var n=Ys();return e.insert(n,ci),n})()})(),null),qi.$$input=o=>He(o.currentTarget.value),ar.addEventListener("change",o=>Jn(o.currentTarget.value)),e.insert(ar,()=>gi.map(o=>(()=>{var n=mr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})()),null),e.insert(ar,()=>Ft().map(o=>(()=>{var n=mr();return e.insert(n,()=>o.name),e.effect(()=>e.setAttribute(n,"key",o.id)),e.effect(()=>n.value=`custom:${o.id}`),n})()),null),e.insert(Yr,(()=>{var o=e.memo(()=>!!lt().startsWith("custom:"));return()=>o()&&(()=>{var n=Ks(),v=n.firstChild,m=v.nextSibling;return e.insert(n,()=>Ft().map(w=>`custom:${w.id}`!==lt()?null:(()=>{var S=Vs();return e.insert(S,()=>w.name),e.effect(()=>e.setAttribute(S,"key",w.id)),S})()),m),m.addEventListener("mouseleave",w=>{w.currentTarget.style.color="#ff3b30"}),m.addEventListener("mouseenter",w=>{w.currentTarget.style.color="#c92a2a"}),m.$$click=()=>{const w=Ft().find(S=>`custom:${S.id}`===lt());w&&Qn(w)},n})()})(),null),Li.$$input=o=>ut(o.currentTarget.value),pr.addEventListener("change",o=>gt(Number(o.currentTarget.value)||ye)),e.insert(pr,()=>fn.map(o=>(()=>{var n=mr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=String(o.value)),n})()),null),e.insert(pr,(()=>{var o=e.memo(()=>!fn.some(n=>n.value===Qe()));return()=>o()&&(()=>{var n=Xs(),v=n.firstChild,m=v.nextSibling,w=m.nextSibling;return e.insert(n,Qe,m),e.effect(()=>n.value=String(Qe())),n})()})(),null),ji.$$input=o=>pt(Number(o.currentTarget.value)||0),Fi.$$input=o=>ct(Number(o.currentTarget.value)||60),Bi.$$input=o=>ft(o.currentTarget.value),Ui.$$input=o=>yt(o.currentTarget.value),Hi.$$input=o=>bt(o.currentTarget.value),e.insert(ko,(()=>{var o=e.memo(()=>Pi().length===0);return()=>o()?Zs():Pi().map(n=>(()=>{var v=ni(),m=v.firstChild;return m.addEventListener("change",w=>po(n,w.currentTarget.checked)),e.insert(v,n,null),e.effect(w=>e.style(v,`display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:14px;border:1px solid ${Ye().includes(n)?"#5ac8fa":"#333"};background:${Ye().includes(n)?"rgba(90,200,250,0.12)":"transparent"};color:${Ye().includes(n)?"#5ac8fa":"#cfcfd2"};font-size:12px;cursor:pointer;user-select:none`,w)),e.effect(()=>m.checked=Ye().includes(n)),v})())})()),e.insert(Kr,(()=>{var o=e.memo(()=>R().length>0||D().length>0);return()=>o()&&(()=>{var n=ea(),v=n.firstChild,m=v.nextSibling,w=m.nextSibling,S=w.nextSibling,E=S.nextSibling;return e.insert(n,()=>R().length,m),e.insert(n,()=>D().length,S),n})()})(),null),e.insert(Vi,()=>ki.map(o=>(()=>{var n=ni(),v=n.firstChild;return v.addEventListener("change",()=>Si("allowed",o)),e.insert(n,o,null),e.effect(m=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${R().includes(o)?"#34c759":"#333"};background:${R().includes(o)?"rgba(52,199,89,0.12)":"transparent"};color:${R().includes(o)?"#34c759":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,m)),e.effect(()=>v.checked=R().includes(o)),n})())),e.insert(Xi,()=>ki.map(o=>(()=>{var n=ni(),v=n.firstChild;return v.addEventListener("change",()=>Si("denied",o)),e.insert(n,o,null),e.effect(m=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${D().includes(o)?"#ff3b30":"#333"};background:${D().includes(o)?"rgba(255,59,48,0.12)":"transparent"};color:${D().includes(o)?"#ff3b30":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,m)),e.effect(()=>v.checked=D().includes(o)),n})())),Vr.$$input=o=>xi(o.currentTarget.value),Zi.$$click=()=>Ci("allowed"),Eo.$$click=()=>Ci("denied"),e.insert(Ki,(()=>{var o=e.memo(()=>R().length>0||D().length>0);return()=>o()&&(()=>{var n=ta();return e.insert(n,(()=>{var v=e.memo(()=>R().length>0);return()=>v()&&(()=>{var m=ra(),w=m.firstChild,S=w.nextSibling,E=S.nextSibling;return e.insert(m,()=>R().join(", "),S),m})()})(),null),e.insert(n,(()=>{var v=e.memo(()=>D().length>0);return()=>v()&&(()=>{var m=ia(),w=m.firstChild,S=w.nextSibling,E=S.nextSibling;return e.insert(m,()=>D().join(", "),S),m})()})(),null),n})()})(),null),tn.$$click=()=>{Wr("(форма)");const o={order:0,trigger:"manual",command:Dn(),roleScoped:R().length>0||D().length>0?{allowed:R(),denied:D()}:null,preFlight:(Jt()||"").trim()||null,postFlight:(Ht()||"").trim()||null,qualityGate:(Ut()||"").trim()||null},n=de().map(v=>Q().find(m=>m.id===v)).filter(v=>!!v).map((v,m)=>({...o,name:Br(V(),v.name),order:m,cwd:v.path,matrixParent:V()||"(без имени)"}));St({tasks:ve()?n:[{...o,name:V()||"(без имени)",cwd:Tt()?.path||(Qt()||"").trim()||"(папка проекта)"}],totals:{},warnings:[...V().trim()?[]:["Не указано имя — превью локальное (форма не сохранена)."],...ve()?[`Matrix: будет создано ${n.length} клон(а/ов) по workspace; родитель сам не выполняется.`]:[]]}),Gr(!0)},cr.$$click=Xn,e.insert(cr,()=>ot()?"Создание...":Jr?"Сохранить":"Создать задачу"),e.insert(en,Jr&&(()=>{var o=na();return o.$$click=()=>{Bt(null),Nt(""),Je("* * * * *"),He(""),ut(""),gt(ye),pt(0),ct(60),ft(""),mt([]),yt(""),bt(""),Pe("cron"),xt(""),vt(""),ht(""),wt(""),Ke(""),be(""),Ve([]),Xe([]),rr(),at("* * * * *"),Dt("")},o})(),null),e.insert(p,(()=>{var o=e.memo(()=>!!(kt()&&Ct()==="(форма)"));return()=>o()&&(()=>{var n=oa(),v=n.firstChild,m=v.firstChild,w=m.nextSibling;return w.$$click=()=>Ei(),e.insert(n,()=>{const S=j();if(!S)return null;const E=S.tasks?.[0];return(()=>{var Y=la(),ze=Y.firstChild,At=ze.firstChild,Re=ze.nextSibling,Ot=Re.firstChild;return e.insert(ze,()=>E?.command,null),e.insert(Re,()=>E?.cwd,null),e.insert(Y,(()=>{var K=e.memo(()=>!!E?.roleScoped);return()=>K()&&(()=>{var A=sa(),pe=A.firstChild,De=pe.nextSibling,dr=De.nextSibling,It=dr.nextSibling,rn=It.nextSibling;return e.insert(A,()=>(E.roleScoped.allowed??[]).join(", "),De),e.insert(A,()=>(E.roleScoped.denied??[]).join(", "),It),A})()})(),null),e.insert(Y,(()=>{var K=e.memo(()=>!!E?.preFlight);return()=>K()&&(()=>{var A=aa(),pe=A.firstChild;return e.insert(A,()=>E.preFlight,null),A})()})(),null),e.insert(Y,(()=>{var K=e.memo(()=>!!E?.postFlight);return()=>K()&&(()=>{var A=pa(),pe=A.firstChild;return e.insert(A,()=>E.postFlight,null),A})()})(),null),e.insert(Y,(()=>{var K=e.memo(()=>!!E?.qualityGate);return()=>K()&&(()=>{var A=ca(),pe=A.firstChild;return e.insert(A,()=>E.qualityGate,null),A})()})(),null),e.insert(Y,(()=>{var K=e.memo(()=>!!(Array.isArray(S.warnings)&&S.warnings.length>0));return()=>K()&&(()=>{var A=da(),pe=A.firstChild;return e.insert(A,()=>S.warnings.join(" | "),null),A})()})(),null),Y})()},null),n})()})(),null),e.effect(o=>{var n=ie()!=="cron"?"none":"block",v=ot()||!(V()||"").trim()||!(Ue()||"").trim()||!(xe()||"").trim()||ve()&&de().length===0,m=`display:block;width:100%;padding:10px;margin-top:8px;background:${ot()?"#666":"#007acc"};color:white;border-radius:6px;border:none;cursor:${ot()||!(V()||"").trim()||!(Ue()||"").trim()||!(xe()||"").trim()?"not-allowed":"pointer"};font-size:13px;font-weight:500;opacity:${ot()||!(V()||"").trim()||!(Ue()||"").trim()||!(xe()||"").trim()?.6:1}`;return n!==o.e&&e.setStyleProperty(Le,"display",o.e=n),v!==o.t&&(cr.disabled=o.t=v),o.a=e.style(cr,m,o.a),o},{e:void 0,t:void 0,a:void 0}),e.effect(()=>H.checked=ve()),e.effect(()=>Pt.value=V()||""),e.effect(()=>et.checked=ie()==="cron"),e.effect(()=>Me.checked=ie()==="file"),e.effect(()=>Oi.checked=ie()==="mcp-event"),e.effect(()=>Qr.value=yi()),e.effect(()=>qi.value=xe()||""),e.effect(()=>ar.value=lt()),e.effect(()=>Li.value=dt()||""),e.effect(()=>pr.value=String(Qe())),e.effect(()=>ji.value=Ir()),e.effect(()=>Fi.value=qr()),e.effect(()=>Bi.value=Ut()||""),e.effect(()=>Ui.value=Jt()||""),e.effect(()=>Hi.value=Ht()||""),e.effect(()=>Vr.value=bi()),p})()})(),q),e.insert(q,(()=>{var y=e.memo(()=>Ge()!=="all");return()=>y()&&(()=>{var p=ua(),u=p.firstChild,g=u.nextSibling,$=g.nextSibling,f=$.nextSibling,I=f.nextSibling;return e.insert(p,(()=>{var P=e.memo(()=>Ge()==="none");return()=>P()?"без workspace":`📦 ${Q().find(G=>G.id===Ge())?.name??"workspace"}`})(),g),e.insert(p,()=>Hr().length,f),e.insert(p,()=>Et().length,null),p})()})(),null),e.insert(q,(()=>{var y=e.memo(()=>Hr().length===0);return()=>y()?(()=>{var p=ga(),u=p.firstChild,g=u.nextSibling;return e.insert(u,()=>re()?"🎄":"📅"),e.insert(g,()=>re()?"Задач пока нет. Самое время украсить ёлку!":"Нет активных задач. Создайте первую и доверьте рутину ИИ!"),p})():(()=>{var p=fa();return e.insert(p,()=>Hr().map(u=>e.createComponent(uo,{get key(){return u.name},job:u}))),p})()})(),null),e.insert(r,(()=>{var y=e.memo(()=>!!xr());return()=>y()&&(()=>{var p=ma(),u=p.firstChild,g=u.firstChild,$=g.firstChild,f=$.nextSibling,I=g.nextSibling,P=u.nextSibling;return e.insert(f,xr),I.addEventListener("mouseleave",G=>{G.target.style.color="#8e8e93"}),I.addEventListener("mouseenter",G=>{G.target.style.color="#ff3b30"}),I.$$click=()=>{vr(null),Be("")},e.insert(P,()=>hn().split(`
|
|
2
|
+
`).map((G,H)=>(()=>{var se=ya();return e.setAttribute(se,"key",H),e.insert(se,G),se})())),p})()})(),null),e.effect(y=>{var p=`display:flex;flex-direction:column;width:100%;height:100%;max-height:100vh;min-height:0;box-sizing:border-box;overflow-y:auto;overflow-x:hidden;gap:24px;padding:20px;font-size:13px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;color:#e0e0e0;transition:background 0.3s ease;scrollbar-width:thin;scrollbar-color:#444 transparent;background:${re()?"linear-gradient(180deg, #0f172a 0%, #000000 100%)":"#0f0f0f"}`,u=`display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;cursor:pointer;font-size:12px;user-select:none;white-space:nowrap;transition:background 0.2s ease, border-color 0.2s ease;border:1px solid ${re()?"rgba(135, 206, 250, 0.5)":"#333"};background:${re()?"rgba(135, 206, 250, 0.12)":"#1e1e1e"};color:#e0e0e0`,g=ir(),$=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${ir()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${ir()?.6:1};transition:background 0.18s ease`,f=nr(),I=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${nr()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${nr()?.6:1};transition:background 0.18s ease`,P=nt(),G=`padding:5px 10px;border-radius:6px;border:1px solid #333;background:#252526;color:${nt()?"#666":"#5ac8fa"};font-size:11px;font-weight:600;cursor:${nt()?"not-allowed":"pointer"}`;return y.e=e.style(r,p,y.e),y.t=e.style(Ze,u,y.t),g!==y.a&&(we.disabled=y.a=g),y.o=e.style(we,$,y.o),f!==y.i&&(_e.disabled=y.i=f),y.n=e.style(_e,I,y.n),P!==y.s&&(_.disabled=y.s=P),y.h=e.style(_,G,y.h),y},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e.effect(()=>M.value=Ge()),e.effect(()=>Ae.checked=re()),e.effect(()=>fe.value=Cn()),r}})})}catch(r){return console.error("GUI render error:",r),d.add(ri.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(c.ErrorBoundary,{fallback:t=>(()=>{var i=dn();return i.firstChild,e.insert(i,()=>t.message,null),i})(),get children(){var t=ba(),i=t.firstChild;return e.insert(i,Er),t}})})}}});e.delegateEvents(["click","input"]);exports.default=va;
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './dist/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-windows-scheduler",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Local-first scheduling and orchestration for OpenCode v2 agent jobs: cron, DAG pipelines, matrix fan-out, quality gates and observability. Free and open source (MIT).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "opencode-windows-scheduler contributors",
|
|
7
|
+
"homepage": "https://github.com/DeadSno/opencode-windows-scheduler#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/DeadSno/opencode-windows-scheduler.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/DeadSno/opencode-windows-scheduler/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opencode",
|
|
17
|
+
"opencode-plugin",
|
|
18
|
+
"scheduler",
|
|
19
|
+
"cron",
|
|
20
|
+
"task-scheduler",
|
|
21
|
+
"windows-scheduler",
|
|
22
|
+
"launchd",
|
|
23
|
+
"systemd",
|
|
24
|
+
"ai-agents",
|
|
25
|
+
"automation",
|
|
26
|
+
"matrix-builds",
|
|
27
|
+
"dag"
|
|
28
|
+
],
|
|
29
|
+
"main": "dist/index.js",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"type": "module",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": "./src/index.ts",
|
|
34
|
+
"./tui": "./src/tui.tsx",
|
|
35
|
+
"./gui-experimental": "./gui-experimental.cjs"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"src",
|
|
40
|
+
"index.js",
|
|
41
|
+
"gui-experimental.cjs",
|
|
42
|
+
"skills",
|
|
43
|
+
"scripts",
|
|
44
|
+
"docs",
|
|
45
|
+
"README.md",
|
|
46
|
+
"README.ru.md",
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"CHANGELOG.md",
|
|
49
|
+
"CROSS_PLATFORM.md",
|
|
50
|
+
"ROADMAP.md",
|
|
51
|
+
"ROADMAP-STRATEGY.md"
|
|
52
|
+
],
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsc",
|
|
61
|
+
"build:gui": "vite build",
|
|
62
|
+
"demo": "node scripts/demo-dashboard.mjs",
|
|
63
|
+
"prepare": "npm run build",
|
|
64
|
+
"prepublishOnly": "npm run build && npm run build:gui",
|
|
65
|
+
"test": "node test-sqlite.mjs && node test-crash-recovery.mjs && node test-workspaces.mjs && node test-role-scoped.mjs && node test-dry-run.mjs && node test-matrix.mjs && node test-matrix-lifecycle.mjs && node test-matrix-sync.mjs && node test-agent-tools.mjs && node test-skill.mjs && node test-docs.mjs",
|
|
66
|
+
"test:sqlite": "node test-sqlite.mjs",
|
|
67
|
+
"test:crash": "node test-crash-recovery.mjs",
|
|
68
|
+
"test:workspaces": "node test-workspaces.mjs",
|
|
69
|
+
"test:role": "node test-role-scoped.mjs",
|
|
70
|
+
"test:dry-run": "node test-dry-run.mjs",
|
|
71
|
+
"test:matrix": "node test-matrix.mjs",
|
|
72
|
+
"test:matrix-lifecycle": "node test-matrix-lifecycle.mjs",
|
|
73
|
+
"test:matrix-sync": "node test-matrix-sync.mjs",
|
|
74
|
+
"test:agent": "node test-agent-tools.mjs",
|
|
75
|
+
"test:skill": "node test-skill.mjs",
|
|
76
|
+
"test:docs": "node test-docs.mjs"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@opencode/plugin": "^2.2.7",
|
|
80
|
+
"@opencode/schema": "^2.2.7",
|
|
81
|
+
"chokidar": "^6.0.0",
|
|
82
|
+
"iconv-lite": "^0.7.3",
|
|
83
|
+
"zod": "^4.6.7"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@opentui/core": ">=0.8.1",
|
|
87
|
+
"@opentui/solid": ">=0.8.1",
|
|
88
|
+
"@types/node": "^20.19.43",
|
|
89
|
+
"solid-js": "^1.9.0",
|
|
90
|
+
"typescript": "^5.9.3",
|
|
91
|
+
"vite": "^7.0.0",
|
|
92
|
+
"vite-plugin-solid": "^2.11.0"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Demo dashboard: seeds a temporary database with a realistic job set
|
|
3
|
+
* (cron jobs, a DAG chain, a matrix with clones, a file trigger) and
|
|
4
|
+
* starts the local web dashboard.
|
|
5
|
+
*
|
|
6
|
+
* Usage: node scripts/demo-dashboard.mjs [--port 3782]
|
|
7
|
+
*
|
|
8
|
+
* The demo uses a temporary APPDATA directory, so it never touches your
|
|
9
|
+
* real jobs, history or settings.
|
|
10
|
+
*/
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import os from "node:os";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
|
|
15
|
+
const portArgIndex = process.argv.indexOf("--port");
|
|
16
|
+
const preferredPort =
|
|
17
|
+
portArgIndex >= 0 && process.argv[portArgIndex + 1]
|
|
18
|
+
? Number(process.argv[portArgIndex + 1])
|
|
19
|
+
: 3782;
|
|
20
|
+
|
|
21
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "ws-scheduler-demo-"));
|
|
22
|
+
process.env.APPDATA = tempRoot;
|
|
23
|
+
|
|
24
|
+
for (const dir of ["frontend", "backend", "mobile", "docs", "infra"]) {
|
|
25
|
+
fs.mkdirSync(path.join(tempRoot, "repos", dir), { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { initDb, closeDb } = await import("../dist/db/index.js");
|
|
29
|
+
const { saveTask, listTasks } = await import("../dist/db/tasks-repo.js");
|
|
30
|
+
const { recordRun, getHistory } = await import("../dist/db/history-repo.js");
|
|
31
|
+
const { addWorkspace } = await import("../dist/workspaces.js");
|
|
32
|
+
const { aggregateMatrixResults } = await import("../dist/core/matrix.js");
|
|
33
|
+
const { startDashboardServer } = await import("../dist/server.js");
|
|
34
|
+
|
|
35
|
+
initDb();
|
|
36
|
+
|
|
37
|
+
const frontend = addWorkspace({ path: path.join(tempRoot, "repos", "frontend"), name: "Frontend" });
|
|
38
|
+
const backend = addWorkspace({ path: path.join(tempRoot, "repos", "backend"), name: "Backend" });
|
|
39
|
+
const mobile = addWorkspace({ path: path.join(tempRoot, "repos", "mobile"), name: "Mobile" });
|
|
40
|
+
const docs = addWorkspace({ path: path.join(tempRoot, "repos", "docs"), name: "Docs" });
|
|
41
|
+
const infra = addWorkspace({ path: path.join(tempRoot, "repos", "infra"), name: "Infra" });
|
|
42
|
+
|
|
43
|
+
const tasks = [
|
|
44
|
+
{
|
|
45
|
+
name: "nightly-deps",
|
|
46
|
+
schedule: "0 3 * * *",
|
|
47
|
+
prompt: "Обнови зависимости, прогони тесты и приложи отчёт.",
|
|
48
|
+
model: "anthropic/claude-sonnet-4",
|
|
49
|
+
priority: 7,
|
|
50
|
+
qualityGate: "npm test",
|
|
51
|
+
workspaceId: backend.id,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "deploy",
|
|
55
|
+
schedule: "0 4 * * *",
|
|
56
|
+
prompt: "Собери, протестируй и задеплой сервис.",
|
|
57
|
+
model: "anthropic/claude-sonnet-4",
|
|
58
|
+
priority: 9,
|
|
59
|
+
matrix: {
|
|
60
|
+
workspaceIds: [frontend.id, backend.id, mobile.id],
|
|
61
|
+
strategy: "parallel",
|
|
62
|
+
failureMode: "continue",
|
|
63
|
+
aggregation: "summary",
|
|
64
|
+
concurrency: 2,
|
|
65
|
+
createAggregator: true,
|
|
66
|
+
overrides: { [mobile.id]: { qualityGate: "npm run test:mobile" } },
|
|
67
|
+
},
|
|
68
|
+
isMatrixParent: true,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "deploy-matrix-Frontend",
|
|
72
|
+
schedule: "0 4 * * *",
|
|
73
|
+
prompt: "Собери, протестируй и задеплой сервис.",
|
|
74
|
+
workspaceId: frontend.id,
|
|
75
|
+
matrixParentId: "deploy",
|
|
76
|
+
triggerType: "file",
|
|
77
|
+
qualityGate: "npm test",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "deploy-matrix-Backend",
|
|
81
|
+
schedule: "0 4 * * *",
|
|
82
|
+
prompt: "Собери, протестируй и задеплой сервис.",
|
|
83
|
+
workspaceId: backend.id,
|
|
84
|
+
matrixParentId: "deploy",
|
|
85
|
+
triggerType: "file",
|
|
86
|
+
qualityGate: "npm test",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "deploy-matrix-Mobile",
|
|
90
|
+
schedule: "0 4 * * *",
|
|
91
|
+
prompt: "Собери, протестируй и задеплой сервис.",
|
|
92
|
+
workspaceId: mobile.id,
|
|
93
|
+
matrixParentId: "deploy",
|
|
94
|
+
triggerType: "file",
|
|
95
|
+
qualityGate: "npm run test:mobile",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "smoke-tests",
|
|
99
|
+
schedule: "30 4 * * *",
|
|
100
|
+
prompt: "Прогони smoke-тесты после деплоя и напиши в чат при падении.",
|
|
101
|
+
dependsOn: ["deploy"],
|
|
102
|
+
priority: 10,
|
|
103
|
+
workspaceId: infra.id,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "docs-sync",
|
|
107
|
+
schedule: "",
|
|
108
|
+
prompt: "Перегенерируй документацию по OpenAPI-схеме.",
|
|
109
|
+
triggerType: "file",
|
|
110
|
+
watchPath: "C:\\projects\\docs\\openapi.yaml",
|
|
111
|
+
workspaceId: docs.id,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "weekly-report",
|
|
115
|
+
schedule: "0 9 * * 1",
|
|
116
|
+
prompt: "Собери недельный отчёт: PR, инциденты, стоимость токенов.",
|
|
117
|
+
model: "openai/gpt-5.1",
|
|
118
|
+
priority: 4,
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
for (const task of tasks) saveTask(task);
|
|
123
|
+
|
|
124
|
+
function run(name, status, ageMinutes, durationMs, error = null, extra = {}) {
|
|
125
|
+
const startedAt = new Date(Date.now() - ageMinutes * 60_000).toISOString();
|
|
126
|
+
recordRun(
|
|
127
|
+
name,
|
|
128
|
+
status,
|
|
129
|
+
startedAt,
|
|
130
|
+
durationMs,
|
|
131
|
+
error,
|
|
132
|
+
undefined,
|
|
133
|
+
extra.tokens ?? 4200,
|
|
134
|
+
extra.costUsd ?? 0.012,
|
|
135
|
+
extra.model ?? "anthropic/claude-sonnet-4",
|
|
136
|
+
extra.preFlight ?? "skipped",
|
|
137
|
+
extra.postFlight ?? "skipped"
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
run("deploy-matrix-Frontend", "success", 95, 74_000, null, { tokens: 18_400 });
|
|
142
|
+
run("deploy-matrix-Backend", "success", 94, 128_000, null, { tokens: 26_800 });
|
|
143
|
+
run("deploy-matrix-Mobile", "error", 93, 46_000, "Gradle build failed: SDK 35 not installed", { tokens: 9_200 });
|
|
144
|
+
run("deploy", "partial", 92, 0, "1 из 3 клонов завершился с ошибкой");
|
|
145
|
+
run("smoke-tests", "success", 88, 31_000, null, { preFlight: "success", postFlight: "success" });
|
|
146
|
+
run("nightly-deps", "success", 60, 212_000, null, { tokens: 44_200, costUsd: 0.09 });
|
|
147
|
+
run("nightly-deps", "error", 24 * 60 + 60, 96_000, "Quality Gate failed: npm test exit code 1", { preFlight: "success" });
|
|
148
|
+
run("weekly-report", "success", 2 * 24 * 60, 155_000, null, { tokens: 61_300, costUsd: 0.14, model: "openai/gpt-5.1" });
|
|
149
|
+
run("docs-sync", "success", 300, 22_000, null, { tokens: 7_400 });
|
|
150
|
+
|
|
151
|
+
const history = getHistory(null, 500);
|
|
152
|
+
const latestStatus = (name) => {
|
|
153
|
+
const record = getHistory(name, 1)[0];
|
|
154
|
+
return record ? record.status : "pending";
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
function taskView(definition) {
|
|
158
|
+
const aggregate = definition.isMatrixParent ? aggregateMatrixResults(definition.name) : null;
|
|
159
|
+
const status = aggregate ? aggregate.status : latestStatus(definition.name);
|
|
160
|
+
return {
|
|
161
|
+
...definition,
|
|
162
|
+
status,
|
|
163
|
+
nextRun: definition.triggerType === "file" ? null : "сегодня, 03:00",
|
|
164
|
+
matrixSummary: aggregate
|
|
165
|
+
? {
|
|
166
|
+
status: aggregate.status,
|
|
167
|
+
message: aggregate.message,
|
|
168
|
+
successCount: aggregate.successCount,
|
|
169
|
+
errorCount: aggregate.errorCount,
|
|
170
|
+
pendingCount: aggregate.pendingCount,
|
|
171
|
+
totalCount: aggregate.totalCount,
|
|
172
|
+
}
|
|
173
|
+
: undefined,
|
|
174
|
+
metrics: {
|
|
175
|
+
total: history.filter((h) => h.taskName === definition.name).length,
|
|
176
|
+
success: history.filter((h) => h.taskName === definition.name && h.status === "success").length,
|
|
177
|
+
error: history.filter((h) => h.taskName === definition.name && h.status === "error").length,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const deps = {
|
|
183
|
+
getTasks: async () => listTasks().map(taskView),
|
|
184
|
+
runTask: async () => ({ alreadyRunning: false }),
|
|
185
|
+
deleteTask: async () => {},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const started = await startDashboardServer(deps, { preferred: preferredPort, fallback: preferredPort + 1000 });
|
|
189
|
+
console.log(`Demo dashboard: http://127.0.0.1:${started.port}`);
|
|
190
|
+
console.log("Press Ctrl+C to stop.");
|
|
191
|
+
|
|
192
|
+
const shutdown = () => {
|
|
193
|
+
try {
|
|
194
|
+
closeDb();
|
|
195
|
+
} catch {}
|
|
196
|
+
process.exit(0);
|
|
197
|
+
};
|
|
198
|
+
process.on("SIGINT", shutdown);
|
|
199
|
+
process.on("SIGTERM", shutdown);
|