opencode-windows-scheduler 1.1.0 → 1.2.1

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.
Files changed (144) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/README.md +18 -8
  3. package/README.ru.md +13 -3
  4. package/ROADMAP-STRATEGY.md +2 -2
  5. package/ROADMAP.md +51 -18
  6. package/dist/core/analytics.d.ts +10 -0
  7. package/dist/core/analytics.d.ts.map +1 -1
  8. package/dist/core/analytics.js +21 -0
  9. package/dist/core/dry-run.d.ts +18 -1
  10. package/dist/core/dry-run.d.ts.map +1 -1
  11. package/dist/core/dry-run.js +49 -3
  12. package/dist/core/matrix.d.ts.map +1 -1
  13. package/dist/core/matrix.js +10 -0
  14. package/dist/core/one-shot.d.ts +62 -0
  15. package/dist/core/one-shot.d.ts.map +1 -0
  16. package/dist/core/one-shot.js +126 -0
  17. package/dist/core/otel.d.ts +4 -0
  18. package/dist/core/otel.d.ts.map +1 -0
  19. package/dist/core/otel.js +98 -0
  20. package/dist/core/prometheus.d.ts +23 -0
  21. package/dist/core/prometheus.d.ts.map +1 -0
  22. package/dist/core/prometheus.js +146 -0
  23. package/dist/core/ps-wrapper.d.ts +36 -2
  24. package/dist/core/ps-wrapper.d.ts.map +1 -1
  25. package/dist/core/ps-wrapper.js +124 -4
  26. package/dist/core/record-history.d.ts.map +1 -1
  27. package/dist/core/record-history.js +9 -0
  28. package/dist/core/schedule-gate.d.ts +2 -0
  29. package/dist/core/schedule-gate.d.ts.map +1 -0
  30. package/dist/core/schedule-gate.js +182 -0
  31. package/dist/core/schedule-v2.d.ts +88 -0
  32. package/dist/core/schedule-v2.d.ts.map +1 -0
  33. package/dist/core/schedule-v2.js +496 -0
  34. package/dist/core/scheduler/linux.d.ts +12 -3
  35. package/dist/core/scheduler/linux.d.ts.map +1 -1
  36. package/dist/core/scheduler/linux.js +80 -3
  37. package/dist/core/scheduler/mac.d.ts.map +1 -1
  38. package/dist/core/scheduler/mac.js +17 -3
  39. package/dist/core/scheduler/posix.d.ts.map +1 -1
  40. package/dist/core/scheduler/posix.js +3 -0
  41. package/dist/core/scheduler/registry.d.ts +4 -0
  42. package/dist/core/scheduler/registry.d.ts.map +1 -1
  43. package/dist/core/scheduler/types.d.ts +20 -3
  44. package/dist/core/scheduler/types.d.ts.map +1 -1
  45. package/dist/core/scheduler/windows.d.ts.map +1 -1
  46. package/dist/core/scheduler/windows.js +23 -2
  47. package/dist/core/session.d.ts +34 -0
  48. package/dist/core/session.d.ts.map +1 -0
  49. package/dist/core/session.js +105 -0
  50. package/dist/core/structured-log.d.ts +84 -0
  51. package/dist/core/structured-log.d.ts.map +1 -0
  52. package/dist/core/structured-log.js +137 -0
  53. package/dist/core/wrappers/bash.d.ts +24 -0
  54. package/dist/core/wrappers/bash.d.ts.map +1 -1
  55. package/dist/core/wrappers/bash.js +70 -3
  56. package/dist/db/history-repo.d.ts +8 -0
  57. package/dist/db/history-repo.d.ts.map +1 -1
  58. package/dist/db/history-repo.js +76 -6
  59. package/dist/db/metrics-repo.d.ts +3 -0
  60. package/dist/db/metrics-repo.d.ts.map +1 -1
  61. package/dist/db/metrics-repo.js +16 -8
  62. package/dist/db/migrate.d.ts.map +1 -1
  63. package/dist/db/migrate.js +8 -1
  64. package/dist/db/schema.d.ts +1 -1
  65. package/dist/db/schema.d.ts.map +1 -1
  66. package/dist/db/schema.js +19 -0
  67. package/dist/gui-experimental.cjs +1 -0
  68. package/dist/history.d.ts +7 -0
  69. package/dist/history.d.ts.map +1 -1
  70. package/dist/history.js +13 -0
  71. package/dist/index.d.ts +137 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +1323 -78
  74. package/dist/integrations.d.ts +64 -0
  75. package/dist/integrations.d.ts.map +1 -0
  76. package/dist/integrations.js +205 -0
  77. package/dist/notifications.d.ts +112 -6
  78. package/dist/notifications.d.ts.map +1 -1
  79. package/dist/notifications.js +396 -34
  80. package/dist/profiles.d.ts +60 -0
  81. package/dist/profiles.d.ts.map +1 -0
  82. package/dist/profiles.js +209 -0
  83. package/dist/rpc.d.ts +592 -4
  84. package/dist/rpc.d.ts.map +1 -1
  85. package/dist/rpc.js +233 -6
  86. package/dist/server.d.ts +2 -0
  87. package/dist/server.d.ts.map +1 -1
  88. package/dist/server.js +473 -58
  89. package/dist/settings.d.ts +95 -0
  90. package/dist/settings.d.ts.map +1 -1
  91. package/dist/settings.js +186 -8
  92. package/dist/shared/jobs-view.d.ts +43 -5
  93. package/dist/shared/jobs-view.d.ts.map +1 -1
  94. package/dist/shared/jobs-view.js +125 -7
  95. package/dist/task-transfer.d.ts +32 -3
  96. package/dist/task-transfer.d.ts.map +1 -1
  97. package/dist/task-transfer.js +101 -3
  98. package/dist/types.d.ts.map +1 -1
  99. package/dist/types.js +3 -11
  100. package/dist/workspaces.d.ts +43 -0
  101. package/dist/workspaces.d.ts.map +1 -1
  102. package/dist/workspaces.js +174 -8
  103. package/docs/ARCHITECTURE.md +32 -12
  104. package/docs/FEATURES.md +186 -10
  105. package/gui-experimental.cjs +4 -2
  106. package/package.json +15 -2
  107. package/scripts/demo-dashboard.mjs +12 -2
  108. package/src/core/analytics.ts +36 -0
  109. package/src/core/dry-run.ts +65 -4
  110. package/src/core/matrix.ts +10 -0
  111. package/src/core/one-shot.ts +173 -0
  112. package/src/core/otel.ts +128 -0
  113. package/src/core/prometheus.ts +215 -0
  114. package/src/core/ps-wrapper.ts +144 -4
  115. package/src/core/record-history.ts +13 -0
  116. package/src/core/schedule-gate.ts +213 -0
  117. package/src/core/schedule-v2.ts +533 -0
  118. package/src/core/scheduler/linux.ts +90 -3
  119. package/src/core/scheduler/mac.ts +35 -4
  120. package/src/core/scheduler/posix.ts +3 -0
  121. package/src/core/scheduler/registry.ts +4 -0
  122. package/src/core/scheduler/types.ts +20 -3
  123. package/src/core/scheduler/windows.ts +24 -2
  124. package/src/core/session.ts +115 -0
  125. package/src/core/structured-log.ts +205 -0
  126. package/src/core/wrappers/bash.ts +98 -2
  127. package/src/db/history-repo.ts +90 -7
  128. package/src/db/metrics-repo.ts +19 -7
  129. package/src/db/migrate.ts +7 -1
  130. package/src/db/schema.ts +25 -0
  131. package/src/gui.tsx +3832 -2868
  132. package/src/history.ts +17 -0
  133. package/src/index.ts +1670 -117
  134. package/src/integrations.ts +253 -0
  135. package/src/notifications.ts +516 -40
  136. package/src/profiles.ts +236 -0
  137. package/src/rpc.ts +244 -6
  138. package/src/server.ts +506 -58
  139. package/src/settings.ts +336 -9
  140. package/src/shared/jobs-view.ts +158 -8
  141. package/src/task-transfer.ts +151 -5
  142. package/src/tui.tsx +290 -14
  143. package/src/types.ts +3 -13
  144. package/src/workspaces.ts +214 -8
@@ -1,2 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("solid-js/web"),p=require("solid-js"),bi=require("@opencode/plugin/gui"),tl=require("@opencode/plugin/rpc"),Nt={type:["object","null"],properties:{server:{type:"string"},event:{type:"string"},filter:{type:"string"}},required:["server","event"]},$i={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"]},rl={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:Nt,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:$i,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"]},xi={type:"object",properties:{},additionalProperties:!1},il={type:"object",properties:{tasks:{type:"array",items:rl}},required:["tasks"]},nl={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:Nt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:$i},required:["name","schedule","prompt"]},ol={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Wt={type:"object",properties:{name:{type:"string"}},required:["name"]},ll=Wt,sl=Wt,Bt={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},al=Bt,pl=Wt,cl={type:"object",properties:{success:{type:"boolean"},logs:{type:"string"},error:{type:"string"}},required:["success","logs"]},dl={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"]},ul={type:"object",properties:{limit:{type:"number"}},additionalProperties:!1},gl={type:"object",properties:{records:{type:"array",items:dl}},required:["records"]},fl={type:"object",properties:{total:{type:"number"},success:{type:"number"},error:{type:"number"}},required:["total","success","error"]},ml={type:"object",properties:{},additionalProperties:!1},yl=fl,bl={type:"object",properties:{},additionalProperties:!1},xl={type:"object",properties:{port:{type:["number","null"]}},required:["port"]},vl={type:"object",properties:{},additionalProperties:!1},hl={type:"object",properties:{platform:{type:"string"},title:{type:"string"}},required:["platform","title"]},$l={type:"object",properties:{},additionalProperties:!1},wl={type:"object",properties:{success:{type:"boolean"},data:{type:"string"},count:{type:"number"},error:{type:"string"}},required:["success"]},_l={type:"object",properties:{data:{type:"string"}},required:["data"]},kl={type:"object",properties:{success:{type:"boolean"},imported:{type:"number"},errors:{type:"array",items:{type:"string"}},error:{type:"string"}},required:["success"]},Sl={type:"object",properties:{},additionalProperties:!1},wi={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"]},_i={type:"object",properties:{retentionDays:{type:"number"},maxRecords:{type:"number"},lastCleanupAt:{type:["string","null"]},lastCleanupDeleted:{type:"number"}},required:["retentionDays","maxRecords"]},Cl={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:wi,history:_i},required:["maxConcurrent","winterMode","notifications"]},zl={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:wi,history:_i},additionalProperties:!1},Tl={type:"object",properties:{success:{type:"boolean"},maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:wi,history:_i},required:["success","maxConcurrent","winterMode","notifications"]},El={type:"object",properties:{retentionDays:{type:"number"},maxRecords:{type:"number"}},additionalProperties:!1},Pl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},deleted:{type:"number"},deletedByAge:{type:"number"},deletedByCount:{type:"number"},kept:{type:"number"},retentionDays:{type:"number"},maxRecords:{type:"number"},vacuumed:{type:"boolean"}},required:["success","message","deleted","kept"]},Al={type:"object",properties:{days:{type:"number"},topLimit:{type:"number"}},additionalProperties:!1},Ol={type:"object",properties:{success:{type:"boolean"},report:{type:["object","null"]},error:{type:"string"}},required:["success","report"]},Ml={type:"object",properties:{},additionalProperties:!1},Rl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},In={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:Nt,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"]},Il={type:"object",properties:{},additionalProperties:!1},Ll={type:"object",properties:{templates:{type:"array",items:In}},required:["templates"]},ql={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:Nt,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},Dl={type:"object",properties:{success:{type:"boolean"},template:In,error:{type:"string"}},required:["success"]},jl={type:"object",properties:{id:{type:"string"}},required:["id"]},Gl={type:"object",properties:{success:{type:"boolean"},error:{type:"string"}},required:["success"]},En=Wt,Fl={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:Nt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:$i},required:["name"]},Bl=Bt,Ln={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"]},Nl={type:"object",properties:{},additionalProperties:!1},Wl={type:"object",properties:{workspaces:{type:"array",items:Ln}},required:["workspaces"]},Ul={type:"object",properties:{name:{type:"string"},path:{type:"string"},color:{type:"string"}},required:["path"],additionalProperties:!1},Pn={type:"object",properties:{success:{type:"boolean"},workspace:Ln,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},Jl={type:"object",properties:{id:{type:"string"}},required:["id"]},Ql={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success"]},Yl={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"]},Vl={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"]},qn={type:"object",properties:{success:{type:"boolean"},taskName:{type:"string"},tasks:{type:"array",items:Vl},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"]},Xl={type:"object",properties:{taskName:{type:"string"}},required:["taskName"],additionalProperties:!1},Zl={type:"object",properties:{success:{type:"boolean"},reports:{type:"array",items:qn}},required:["success","reports"]},es={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"]},ts={type:"object",properties:{parentId:{type:"string"}},required:["parentId"],additionalProperties:!1},rs={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:es}},required:["parentId","totalCount","successCount","errorCount","status"]},is={type:"object",properties:{success:{type:"boolean"},report:rs,error:{type:"string"}},required:["success"]},ns={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},os={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"]},ls={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},cancelled:{type:"array",items:{type:"string"}}},required:["success","message","cancelled"]},ss={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},removed:{type:"array",items:{type:"string"}}},required:["success","message","removed"]},as=tl.Rpc.define({id:"opencode-windows-scheduler",methods:{get_tasks:{input:xi,output:il},create_task:{input:nl,output:ol},delete_task:{input:ll,output:Bt},run_task:{input:sl,output:al},pause_task:{input:En,output:Bt},resume_task:{input:En,output:Bt},update_task:{input:Fl,output:Bl},get_task_logs:{input:pl,output:cl},get_history:{input:ul,output:gl},get_metrics:{input:ml,output:yl},get_dashboard_port:{input:bl,output:xl},get_platform:{input:vl,output:hl},dry_run:{input:Xl,output:qn},dry_run_all:{input:xi,output:Zl},get_matrix_results:{input:ts,output:is},cancel_matrix:{input:Wt,output:ls},cleanup_matrix_orphans:{input:xi,output:ss},cleanup_history:{input:El,output:Pl},get_analytics:{input:Al,output:Ol},expand_matrix_preview:{input:ns,output:os},get_workspaces:{input:Nl,output:Wl},add_workspace:{input:Ul,output:Pn},update_workspace:{input:Hl,output:Pn},delete_workspace:{input:Jl,output:Ql},export_tasks:{input:$l,output:wl},import_tasks:{input:_l,output:kl},get_settings:{input:Sl,output:Cl},save_settings:{input:zl,output:Tl},get_templates:{input:Il,output:Ll},save_template:{input:ql,output:Dl},delete_template:{input:jl,output:Gl},emit_event:{input:Yl,output:Kl},test_notification:{input:Ml,output:Rl}},events:{}});var ps=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>✏️"),cs=e.template("<span>📦 "),ds=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 (<!>)'),us=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 '),gs=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>👁️"),fs=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>⚡"),ms=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>📡"),ys=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>🧠 "),bs=e.template("<span style=font-size:12px;flex-shrink:0;cursor:help;color:#f5a623;white-space:nowrap>🚀 "),xs=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>🔒"),vs=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>🔗 Зависит от: "),hs=e.template("<div style=display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35><span>📦 Matrix: <!>/<!> успешных"),$s=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>"),ws=e.template("<span>→ "),_s=e.template("<div style=font-size:12px;color:#f5a623;font-weight:600;white-space:nowrap>🟡 Выполняется: <!> сек"),ks=e.template("<div style=font-size:12px;font-weight:600;white-space:nowrap>"),Ss=e.template("<button>⛔"),Cs=e.template("<button>🗑"),zs=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>✕'),Ts=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Запусков пока нет.'),Es=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> мс'),Ps=e.template("<span style=color:#c084fc;white-space:nowrap>🧠 "),As=e.template("<span style=whiteSpace:nowrap>⚡ pre: "),Os=e.template("<span style=whiteSpace:nowrap>⚡ post: "),Ms=e.template("<div style=margin-top:2px;color:#ff6b6b;font-size:11px;white-space:pre-wrap;word-break:break-word>"),Rs=e.template('<span title="Запущена следующая задача в цепочке"style=color:#5ac8fa;font-size:11px;white-space:nowrap>🔗 → '),Is=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>✕'),Ls=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Симуляция…'),qs=e.template('<div style="font-size:12px;color:#ff6b6b;padding:6px 0">❌ '),Ds=e.template("<div style=display:flex;flex-direction:column;gap:4px>"),js=e.template('<div style="font-size:11px;color:#f5a623;padding:4px 0">⚠ '),Gs=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>$ '),Fs=e.template("<span style=color:#5ac8fa;white-space:nowrap>📦 "),Bs=e.template("<span style=color:#ff9f0a;white-space:nowrap>↳ matrix "),Ns=e.template("<span style=cursor:help>🔒"),Ws=e.template("<span style=color:#8e8e93;white-space:nowrap>⏱ ~<!> с"),Us=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~<!> ток."),Hs=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~$"),Js=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ pre: "),Qs=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ post: "),Ys=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">Σ '),Vs=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;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>Задачи'),An=e.template("<div style=padding:16px;color:#ff3b30;font-size:13px>Ошибка UI: "),On=e.template("<option>📦 "),Xs=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="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px"><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><label style=font-size:12px;color:#e0e0e0;white-space:nowrap>Удалять записи старше, дней</label><input type=number min=0 style="width:70px;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>0 = не удалять по возрасту</span></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><label style=font-size:12px;color:#e0e0e0;white-space:nowrap>Хранить не более записей</label><input type=number min=0 style="width:80px;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>0 = без ограничения</span></div><div style=font-size:11px;color:#8e8e93>Последняя очистка: </div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><button></button><span style=font-size:11px;color:#8e8e93>Удаляются только завершённые записи; незавершённые запуски не трогаются.'),ea=e.template('<div style="display:flex;flex-direction:column;gap:6px;padding:0 14px 12px">'),ta=e.template('<div style="font-size:12px;color:#8e8e93;padding:4px 0">Workspace не добавлен. Задача без workspace использует рабочую директорию проекта.'),ra=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>🗑'),ia=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">➕ Создать задачу'),na=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>'),oa=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">'),la=e.template("<div style=font-size:11px;color:#f5a623>Сначала добавьте хотя бы один workspace."),sa=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">'),aa=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>"),pa=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>'),ca=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">'),da=e.template("<div style=color:#ff9f0a;font-weight:600>Будет создано <!> клон(а/ов):"),ua=e.template("<div style=color:#e0e0e0;word-break:break-all>"),ga=e.template("<span style=color:#f5a623>Выберите хотя бы один workspace — превью клонов появится здесь."),fa=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 — рабочая директория'),ma=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>'),ya=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.'),ba=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">'),xa=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">'),va=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">'),ha=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=&quot;my-project&quot; или 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.'),zr=e.template("<option>"),$a=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">'),wa=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">'),_a=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>🗑'),ka=e.template("<span style=font-size:11px;color:#ff3b30;font-weight:500;cursor:default>"),Sa=e.template("<option>Другой (<!>)"),Ca=e.template("<span style=font-size:12px;color:#8e8e93>Других задач пока нет"),vi=e.template("<label><input type=checkbox style=margin:0>"),za=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>"),Ea=e.template("<div>allowed: [<!>]"),Pa=e.template("<div>denied: [<!>]"),Aa=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>✕'),Ma=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: "),Ra=e.template("<div style=color:#8e8e93>🔒 allowed=[<!>] · denied=[<!>]"),Ia=e.template("<div style=color:#8e8e93>⚡ pre: "),La=e.template("<div style=color:#8e8e93>⚡ post: "),qa=e.template("<div style=color:#8e8e93>✅ QG: "),Da=e.template("<div style=color:#f5a623>⚠ "),ja=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>"),Ba=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">`),Na=e.template("<div style=white-space:pre-wrap;margin-bottom:2px>"),Wa=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 Ua(c){switch(c){case"running":return"#f5a623";case"success":return"#34c759";case"error":return"#ff3b30";case"partial":return"#ff9f0a";default:return"#8e8e93"}}const _e=5;function Mn(c){const _=typeof c=="number"&&Number.isFinite(c)?Math.min(10,Math.max(0,Math.floor(c))):_e;return _>=10?"Критический":_>=8?"Высокий":_<=3?"Низкий":"Обычный"}const Rn=[{value:2,label:"Низкий"},{value:5,label:"Обычный"},{value:8,label:"Высокий"},{value:10,label:"Критический"}];function D(c){return c instanceof Error?c.message:typeof c=="object"&&c!==null&&"message"in c?String(c.message):JSON.stringify(c)}function ct(c,_=150){const Ie=(c||"").split(/\r?\n/).map(Tr=>Tr.trim()).find(Boolean)??"";return Ie.length>_?Ie.slice(0,_-1).trimEnd()+"…":Ie}const hi=[{label:"Каждую минуту",value:"* * * * *"},{label:"Каждый час",value:"0 * * * *"},{label:"Каждый день в 09:00",value:"0 9 * * *"},{label:"Каждый понедельник в 10:00",value:"0 10 * * 1"},{label:"Свое расписание…",value:"__custom__"}],Ha=bi.Plugin.define({setup(c){const _=c.client.rpc(as),[Ie,Tr]=p.createSignal([]),[ee,Dn]=p.createSignal([]),[Er,jn]=p.createSignal(!1),[Je,ki]=p.createSignal("all"),[dt,Qe]=p.createSignal(!1),[Ye,ke]=p.createSignal(""),[Gn,Ke]=p.createSignal(""),[Pr,Ar]=p.createSignal(null),[ut,Si]=p.createSignal(!1),[Ci,Ut]=p.createSignal(""),[Or,Fn]=p.createSignal({total:0,success:0,error:0}),[Ht,zi]=p.createSignal(null),[Ti,Bn]=p.createSignal([]),Ei=[{label:"Свой промпт",value:"custom",prompt:""},{label:"Ночной сторож (тесты)",value:"night-watch",prompt:"Запусти ночные проверки: прогнали тесты, зафиксируй ошибки и составь краткий отчёт о состоянии репозитория."},{label:"Утренний дайджест",value:"morning-digest",prompt:"Собери утренний дайджест: какие изменения были за ночь, есть ли проваленные сборки, что требует внимания сегодня."},{label:"Гигиена кода",value:"code-hygiene",prompt:"Проведи аудит гигиены кода: найди неиспользуемые импорты, неиспользуемые переменные, лишние зависимости и предложи правки."}],[gt,Jt]=p.createSignal("custom"),[Qt,Nn]=p.createSignal([]),[Wn,Un]=p.createSignal(0);setInterval(()=>Un(r=>r+1),1e3);const[Hn,Mr]=p.createSignal(1),[ce,Rr]=p.createSignal(!1),[be,Ir]=p.createSignal(!1),[Lr,qr]=p.createSignal(!0),[Le,Dr]=p.createSignal(!1),[Pi,jr]=p.createSignal(""),[Gr,Jn]=p.createSignal(!0),[Yt,Ai]=p.createSignal(!1),[Kt,Vt]=p.createSignal(30),[Xt,Zt]=p.createSignal(5e3),[Fr,Br]=p.createSignal(null),[Oi,Nr]=p.createSignal(0),[Wr,Qn]=p.createSignal(!0),[er,Mi]=p.createSignal(!1),Ve=new Map;p.onCleanup(()=>{for(const r of Ve.values())clearInterval(r);Ve.clear()});const[Ur,Yn]=p.createSignal("Планировщик задач");async function Kn(){try{const r=await _.get_platform({});r?.title&&Yn(r.title)}catch(r){console.error("RPC Error (get_platform):",r)}}async function Vn(){try{const r=await _.get_settings({});Mr(r.maxConcurrent??1),Rr(!!r.winterMode);const t=r.notifications;Ir(!!t?.enabled),qr(t?.onlyOnError!==!1),Dr(!!t?.webhook?.enabled),jr(t?.webhook?.url??"");const i=r.history;Vt(Number(i?.retentionDays??30)),Zt(Number(i?.maxRecords??5e3)),Br(i?.lastCleanupAt??null),Nr(Number(i?.lastCleanupDeleted??0))}catch(r){console.error("RPC Error (get_settings):",r)}}function Xn(){return{enabled:be(),onlyOnError:Lr(),webhook:{enabled:Le(),url:(Pi()||"").trim()}}}function Ri(){return{retentionDays:Math.max(0,Math.floor(Number(Kt())||0)),maxRecords:Math.max(0,Math.floor(Number(Xt())||0)),lastCleanupAt:Fr(),lastCleanupDeleted:Math.max(0,Math.floor(Number(Oi())||0))}}async function ft(r){try{const t=await _.save_settings(r);if(r.maxConcurrent!==void 0&&Mr(t.maxConcurrent),r.winterMode!==void 0&&Rr(!!t.winterMode),r.notifications!==void 0){const i=t.notifications;Ir(!!i?.enabled),qr(i?.onlyOnError!==!1),Dr(!!i?.webhook?.enabled),jr(i?.webhook?.url??"")}if(r.history!==void 0){const i=t.history;Vt(Number(i?.retentionDays??30)),Zt(Number(i?.maxRecords??5e3)),Br(i?.lastCleanupAt??null),Nr(Number(i?.lastCleanupDeleted??0))}}catch(t){console.error("RPC Error (save_settings):",t),c.toast.show({title:"Не удалось сохранить настройки",variant:"error",description:D(t)})}}async function mt(){await ft({notifications:Xn()})}async function Ii(){await ft({history:Ri()})}async function Zn(){Mi(!0);try{await ft({history:Ri()});const r=await _.cleanup_history({}),i=(await _.get_settings({})).history;Vt(Number(i?.retentionDays??30)),Zt(Number(i?.maxRecords??5e3)),Br(i?.lastCleanupAt??null),Nr(Number(i?.lastCleanupDeleted??0)),c.toast.show({title:r.success?"Очистка истории завершена":"Очистка не удалась",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (cleanup_history):",r),c.toast.show({title:"Очистка не удалась",variant:"error",description:D(r)})}finally{Mi(!1)}}async function eo(){Ai(!0);try{await mt();const r=await _.test_notification({});c.toast.show({title:r.success?"Тестовое уведомление отправлено":"Тест не удался",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (test_notification):",r),c.toast.show({title:"Тест не удался",variant:"error",description:D(r)})}finally{Ai(!1)}}async function to(r){Mr(r),await ft({maxConcurrent:r})}async function ro(r){Rr(r),await ft({winterMode:r})}const[Hr,tr]=p.createSignal(null),[io,Jr]=p.createSignal(!1),[ie,rr]=p.createSignal(""),[Xe,Ze]=p.createSignal("* * * * *"),[Se,et]=p.createSignal(""),[Li,yt]=p.createSignal("* * * * *"),[Qr,bt]=p.createSignal(0),[Yr,xt]=p.createSignal(60),[vt,ht]=p.createSignal(""),[tt,$t]=p.createSignal(_e),[ir,wt]=p.createSignal(""),[rt,_t]=p.createSignal([]),[nr,kt]=p.createSignal(""),[or,St]=p.createSignal(""),[de,qe]=p.createSignal("cron"),[Kr,Ct]=p.createSignal(""),[Vr,zt]=p.createSignal(""),[Xr,Tt]=p.createSignal(""),[Et,Pt]=p.createSignal(""),[lr,it]=p.createSignal(""),[F,nt]=p.createSignal([]),[B,ot]=p.createSignal([]),[qi,Di]=p.createSignal(""),[Ce,sr]=p.createSignal(!1),[xe,At]=p.createSignal([]),[Zr,ar]=p.createSignal("parallel"),[ji,pr]=p.createSignal("continue"),[Gi,cr]=p.createSignal("summary"),[Fi,dr]=p.createSignal(!1),[Bi,ur]=p.createSignal(""),[ei,gr]=p.createSignal({}),[Ot,ti]=p.createSignal(!1),[ri,Ni]=p.createSignal(!1),[N,Mt]=p.createSignal(null),[Rt,ii]=p.createSignal(""),Wi=["bash","edit","write","read","grep","glob","webfetch"];function Ui(r,t){r==="allowed"?nt(i=>i.includes(t)?i.filter(a=>a!==t):[...i,t]):ot(i=>i.includes(t)?i.filter(a=>a!==t):[...i,t])}function Hi(r){const t=qi().trim();t&&(r==="allowed"?F().includes(t)||nt([...F(),t]):B().includes(t)||ot([...B(),t]),Di(""))}function no(r,t){At(i=>t?i.includes(r)?i:[...i,r]:i.filter(a=>a!==r))}function ni(r,t){const i=r.trim()||"task",a=t.trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-");return`${i}-matrix-${a||"workspace"}`}const oi=()=>xe().map(r=>ee().find(t=>t.id===r)).filter(r=>!!r).map(r=>ni(ie(),r.name));function It(r,t,i){gr(a=>{const J={...a[r]??{}};i.trim()?J[t]=i:delete J[t];const j={...a};return Object.keys(J).length>0?j[r]=J:delete j[r],j})}const oo=()=>Object.keys(ei()).length,Ji=()=>{if(!Ce())return;const r=Bi().trim(),t=r?Number(r):void 0,i=ei();return{workspaceIds:xe(),strategy:Zr(),failureMode:ji(),aggregation:Gi(),createAggregator:Fi(),...t!==void 0&&Number.isFinite(t)&&t>=1?{concurrency:Math.floor(t)}:{},...Object.keys(i).length>0?{overrides:i}:{}}};function fr(){sr(!1),At([]),ar("parallel"),pr("continue"),cr("summary"),dr(!1),ur(""),gr({})}function lo(){return`opencode run${vt().trim()?` --model ${vt().trim()}`:""} "${Se().replace(/\s+/g," ").trim()}"`}const[Ja,so]=p.createSignal(null),[mr,Qi]=p.createSignal(!1),[yr,Qa]=p.createSignal(!1),[Ya,ao]=p.createSignal(null);async function po(){Qi(!0);try{const r=await _.export_tasks({});if(!r.success){c.toast.show({title:"Ошибка экспорта",variant:"error",description:r.error});return}so(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),c.toast.show({title:`Экспортировано задач: ${r.count}`,variant:"success"})}catch(r){console.error("RPC Error (export_tasks):",r),c.toast.show({title:"Ошибка экспорта",variant:"error",description:D(r)})}finally{Qi(!1)}}function co(r){const i=r.target.files?.[0]??null;ao(i)}async function li(){try{const r=await _.get_templates({}),t=Array.isArray(r?.templates)?r.templates:[];Nn(t)}catch(r){console.error("RPC Error (get_templates):",r)}}async function br(){try{const r=await _.get_workspaces({}),t=Array.isArray(r?.workspaces)?r.workspaces:[];Dn(t)}catch(r){console.error("RPC Error (get_workspaces):",r)}}const Lt=()=>ee().find(r=>r.id===Ye());async function uo(){const r=(window.prompt("Путь к git-репозиторию (workspace)","")??"").trim();if(!r)return;const t=(window.prompt("Название workspace (необязательно)","")??"").trim();Qe(!0);try{const i=await _.add_workspace({path:r,...t?{name:t}:{}});if(!i.success){c.toast.show({title:"Ошибка добавления workspace",variant:"error",description:i.error??"Неизвестная ошибка"});return}await br(),i.workspace?.id&&ke(i.workspace.id),c.toast.show({title:"Workspace добавлен",variant:"success"})}catch(i){console.error("RPC Error (add_workspace):",i),c.toast.show({title:"Ошибка добавления workspace",variant:"error",description:ct(D(i))})}finally{Qe(!1)}}async function go(r){const t=(window.prompt("Путь к git-репозиторию",r.path)??"").trim();if(!t)return;const i=(window.prompt("Название workspace",r.name)??"").trim();Qe(!0);try{const a=await _.update_workspace({id:r.id,path:t,...i?{name:i}:{}});if(!a.success){c.toast.show({title:"Ошибка обновления workspace",variant:"error",description:a.error??"Неизвестная ошибка"});return}await br(),c.toast.show({title:"Workspace обновлён",variant:"success"})}catch(a){console.error("RPC Error (update_workspace):",a),c.toast.show({title:"Ошибка обновления workspace",variant:"error",description:ct(D(a))})}finally{Qe(!1)}}async function fo(r){if(window.confirm(`Удалить workspace "${r.name}"? Задачи сохранены, привязка будет очищена.`)){Qe(!0);try{const t=await _.delete_workspace({id:r.id});if(!t.success){c.toast.show({title:"Ошибка удаления workspace",variant:"error",description:t.message??"Неизвестная ошибка"});return}Ye()===r.id&&ke(""),Je()===r.id&&ki("all"),await br(),await ue(),c.toast.show({title:"Workspace удалён",variant:"success",description:t.message})}catch(t){console.error("RPC Error (delete_workspace):",t),c.toast.show({title:"Ошибка удаления workspace",variant:"error",description:ct(D(t))})}finally{Qe(!1)}}}const mo=r=>{if(Jt(r),r.startsWith("custom:")){const i=Qt().find(a=>`custom:${a.id}`===r);if(!i)return;if(et(i.prompt??""),i.schedule){Ze(i.schedule);const a=hi.find(J=>J.value===i.schedule);yt(a?a.value:"__custom__")}if(bt(i.retryCount??0),xt(i.retryDelay??60),wt(i.qualityGate??""),ht(i.model??""),$t(typeof i.priority=="number"?i.priority:_e),_t(Array.isArray(i.dependsOn)?i.dependsOn:[]),kt(i.beforeScript??""),St(i.afterScript??""),qe(i.triggerType==="file"?"file":i.triggerType==="mcp-event"?"mcp-event":"cron"),Ct(i.watchPath??""),zt(i.mcpEvent?.server??""),Tt(i.mcpEvent?.event??""),Pt(i.mcpEvent?.filter??""),it(i.workingDirectory??""),ke(i.workspaceId??""),nt(Array.isArray(i.allowedTools)?i.allowedTools:[]),ot(Array.isArray(i.deniedTools)?i.deniedTools:[]),i.matrix){sr(!0),At(Array.isArray(i.matrix.workspaceIds)?i.matrix.workspaceIds:[]),ar(i.matrix.strategy==="sequential"?"sequential":"parallel"),pr(i.matrix.failureMode==="stop"?"stop":"continue"),cr(i.matrix.aggregation==="per-task"?"per-task":"summary"),dr(!!i.matrix.createAggregator),ur(typeof i.matrix.concurrency=="number"?String(i.matrix.concurrency):"");const a=i.matrix.overrides;gr(a?{...a}:{})}else fr();return}const t=Ei.find(i=>i.value===r);t&&et(t.prompt)};async function yo(){if(!(Se()||"").trim()){c.toast.show({title:"Нечего сохранять",variant:"error",description:"Сначала заполните промпт — он обязателен для шаблона."});return}const r=(window.prompt("Название шаблона","")??"").trim();if(r)try{const t=await _.save_template({name:r,prompt:(Se()||"").trim(),schedule:(Xe()||"").trim(),timeoutSeconds:3600,model:(vt()||"").trim(),priority:tt(),retryCount:Qr(),retryDelay:Yr(),qualityGate:(ir()||"").trim(),beforeScript:(nr()||"").trim(),afterScript:(or()||"").trim(),dependsOn:rt(),triggerType:de(),mcpEvent:de()==="mcp-event"?{server:(Vr()||"").trim(),event:(Xr()||"").trim(),...Et().trim()?{filter:Et().trim()}:{}}:void 0,watchPath:(Kr()||"").trim(),workingDirectory:(lr()||"").trim(),workspaceId:(Ye()||"").trim()||void 0,allowedTools:F().length>0?F():void 0,deniedTools:B().length>0?B():void 0,matrix:Ji()});if(!t.success){c.toast.show({title:"Не удалось сохранить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}await li();const i=t.template;i?.id&&Jt(`custom:${i.id}`),c.toast.show({title:`Шаблон "${r}" сохранён`,variant:"success"})}catch(t){console.error("RPC Error (save_template):",t),c.toast.show({title:"Ошибка сохранения шаблона",variant:"error",description:D(t)})}}async function bo(r){if(window.confirm(`Удалить шаблон "${r.name}"?`))try{const t=await _.delete_template({id:r.id});if(!t.success){c.toast.show({title:"Не удалось удалить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}gt()===`custom:${r.id}`&&Jt("custom"),await li(),c.toast.show({title:`Шаблон "${r.name}" удалён`,variant:"success"})}catch(t){console.error("RPC Error (delete_template):",t),c.toast.show({title:"Ошибка удаления шаблона",variant:"error",description:D(t)})}}async function ue(){try{const r=await _.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:_e,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??""}));Tr(i),console.log("[GUI] jobs:",Ie()),await xo()}catch(r){console.error("RPC Error (get_tasks):",r),c.toast.show({title:"Ошибка загрузки задач",variant:"error",description:ct(D(r))})}}async function xo(){try{const r=await _.get_metrics({});Fn({total:r.total??0,success:r.success??0,error:r.error??0})}catch(r){console.error("RPC Error (get_metrics):",r)}}async function vo(r){zi(r);try{const t=await _.get_history({limit:10});Bn(t.records??[])}catch(t){console.error("RPC Error (get_history):",t),c.toast.show({title:"Ошибка загрузки истории",variant:"error",description:D(t)})}}async function ho(r){ti(!0),ii(r),Ni(!0),Mt(null);try{const t=await _.dry_run({taskName:r});Mt(t)}catch(t){console.error("RPC Error (dry_run):",t),Mt({success:!1,error:D(t),tasks:[],warnings:[]})}finally{Ni(!1)}}function Yi(){ti(!1),ii(""),Mt(null)}async function $o(){Si(!0),Ut("");try{const r=await _.create_task({name:(ie()||"").trim(),schedule:(Xe()||"").trim(),prompt:(Se()||"").trim(),model:(vt()||"").trim(),priority:tt(),retryCount:Qr(),retryDelay:Yr(),qualityGate:(ir()||"").trim(),beforeScript:(nr()||"").trim(),afterScript:(or()||"").trim(),dependsOn:rt(),triggerType:de(),mcpEvent:de()==="mcp-event"?{server:(Vr()||"").trim(),event:(Xr()||"").trim(),...Et().trim()?{filter:Et().trim()}:{}}:void 0,watchPath:(Kr()||"").trim(),workingDirectory:(lr()||"").trim(),workspaceId:(Ye()||"").trim()||void 0,allowedTools:F().length>0?F():void 0,deniedTools:B().length>0?B():void 0,matrix:Ji()});if(!r.success){const t=ct(r.message);Ut(t),c.toast.show({title:"Ошибка создания задачи",variant:"error",description:t});return}await new Promise(t=>setTimeout(t,500)),await ue(),rr(""),Ze("* * * * *"),et(""),yt("* * * * *"),bt(0),xt(60),wt(""),_t([]),ht(""),$t(_e),kt(""),St(""),qe("cron"),Ct(""),zt(""),Tt(""),Pt(""),it(""),ke(""),nt([]),ot([]),fr(),tr(null),Jt("custom"),c.toast.show({title:"Задача создана",variant:"success"})}catch(r){console.error("RPC Error (create_task):",r);const t=ct(D(r));Ut(t),c.toast.show({title:"Ошибка создания задачи",variant:"error",description:t})}finally{Si(!1)}}function wo(r){const t=new Date().toISOString(),i=Ve.get(r);i&&clearInterval(i);let a=0;const J=setInterval(()=>{if(a+=1,a>900){clearInterval(J),Ve.delete(r);return}(async()=>{try{const ve=((await _.get_history({limit:50})).records??[]).find(Te=>String(Te.taskName??"").toLowerCase()===r.toLowerCase()&&typeof Te.startedAt=="string"&&Te.startedAt>=t);if(!ve)return;clearInterval(J),Ve.delete(r);const Z=ve.status==="success",lt=((Number(ve.durationMs)||0)/1e3).toFixed(1),De=ve.error?`: ${ve.error}`:"";c.toast.show({title:Z?`Задача "${r}" выполнена`:`Задача "${r}" упала`,variant:Z?"success":"error",description:`${lt}s${De}`}),await ue()}catch(j){console.error("RPC Error (get_history):",j)}})()},2e3);Ve.set(r,J)}async function _o(r){if(!r||typeof r!="string"){console.error("[GUI] run_task aborted: empty task name");return}try{const t=await _.run_task({name:r});if(!t.success){c.toast.show({title:`Не удалось запустить "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:t.message||`Задача "${r}" запущена`,variant:"success"}),/уже выполняется/i.test(t.message||"")||wo(r),await ue()}catch(t){console.error("RPC Error (run_task):",t),c.toast.show({title:"Ошибка запуска",variant:"error",description:D(t)})}}async function ko(r){try{const t=await _.pause_task({name:r});if(!t.success){c.toast.show({title:`Не удалось поставить на паузу "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:`Задача "${r}" поставлена на паузу`,variant:"success"}),await ue()}catch(t){console.error("RPC Error (pause_task):",t),c.toast.show({title:"Ошибка паузы",variant:"error",description:D(t)})}}async function So(r){try{const t=await _.resume_task({name:r});if(!t.success){c.toast.show({title:`Не удалось возобновить "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:`Задача "${r}" возобновлена`,variant:"success"}),await ue()}catch(t){console.error("RPC Error (resume_task):",t),c.toast.show({title:"Ошибка возобновления",variant:"error",description:D(t)})}}async function Co(r){if(window.confirm(`Отменить выполняющиеся клоны матрицы "${r}"?`))try{const t=await _.cancel_matrix({name:r});if(!t.success){c.toast.show({title:"Не удалось отменить матрицу",variant:"error",description:t.message});return}c.toast.show({title:t.message,variant:"success"}),await ue()}catch(t){console.error("RPC Error (cancel_matrix):",t),c.toast.show({title:"Ошибка отмены матрицы",variant:"error",description:D(t)})}}async function zo(r){const i=Ie().find(a=>a.name===r)?.matrix?`Удалить матрицу "${r}" вместе со всеми клонами и агрегатором?`:`Удалить задачу "${r}"?`;if(window.confirm(i))try{const a=await _.delete_task({name:r});if(!a.success){c.toast.show({title:"Ошибка удаления",variant:"error",description:a.message});return}c.toast.show({title:`Задача "${r}" удалена`,variant:"success"}),Pr()===r&&(Ke(""),Ar(null)),Hr()?.name===r&&tr(null),await ue()}catch(a){console.error("RPC Error (delete_task):",a),c.toast.show({title:"Ошибка удаления",variant:"error",description:D(a)})}}async function To(r){Ar(r),Ke("Загрузка логов…");try{const t=await _.get_task_logs({name:r});if(!t.success){Ke(t.error||"Не удалось загрузить логи"),c.toast.show({title:"Ошибка чтения логов",variant:"error",description:t.error});return}Ke(t.logs||"(пусто)")}catch(t){console.error("RPC Error (get_task_logs):",t),Ke("Ошибка чтения логов: "+D(t))}}function Eo(r){tr(r),Jr(!1),rr(r.name),Ze(r.schedule),et(r.prompt??""),ht(r.model??""),$t(typeof r.priority=="number"?r.priority:_e),bt(r.retryCount??0),xt(r.retryDelay??60),wt(r.qualityGate??""),_t(Array.isArray(r.dependsOn)?r.dependsOn:[]),kt(r.beforeScript??""),St(r.afterScript??""),qe(r.triggerType??"cron"),Ct(r.watchPath??""),zt(r.mcpEvent?.server??""),Tt(r.mcpEvent?.event??""),Pt(r.mcpEvent?.filter??""),it(r.workingDirectory??""),ke(r.workspaceId??""),nt(Array.isArray(r.allowedTools)?r.allowedTools:[]),ot(Array.isArray(r.deniedTools)?r.deniedTools:[]),r.matrix?(sr(!0),At(Array.isArray(r.matrix.workspaceIds)?r.matrix.workspaceIds:[]),ar(r.matrix.strategy==="sequential"?"sequential":"parallel"),pr(r.matrix.failureMode==="stop"?"stop":"continue"),cr(r.matrix.aggregation==="per-task"?"per-task":"summary"),dr(!!r.matrix.createAggregator),ur(typeof r.matrix.concurrency=="number"?String(r.matrix.concurrency):""),gr(r.matrix.overrides?{...r.matrix.overrides}:{})):fr();const t=hi.find(i=>i.value===r.schedule);yt(t?t.value:"__custom__")}ue(),br(),Vn(),Kn(),li();const Po=setInterval(ue,5e3);p.onCleanup(()=>clearInterval(Po));const Ao=Li()==="__custom__",si=Hr()!==null,qt=()=>Ie()??[],ai=()=>{const r=Je();return r==="all"?qt():r==="none"?qt().filter(t=>!t.workspaceId):qt().filter(t=>t.workspaceId===r)},Ki=()=>{const r=(Hr()?.name??ie()).trim().toLowerCase();return qt().map(t=>t.name).filter(t=>t.trim().toLowerCase()!==r)};function Oo(r,t){_t(i=>t?i.some(a=>a.toLowerCase()===r.toLowerCase())?i:[...i,r]:i.filter(a=>a.toLowerCase()!==r.toLowerCase()))}const[Mo,Vi]=p.createSignal(null);function ze(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 U(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 Ro=r=>{const t=r.job;return!t||!t.name?null:(()=>{var i=ps(),a=i.firstChild,J=a.firstChild,j=J.firstChild,X=j.firstChild,ve=X.firstChild,Z=X.nextSibling,lt=Z.firstChild,De=lt.nextSibling,Te=De.nextSibling,Ee=Te.nextSibling;Ee.nextSibling;var xr=j.nextSibling,Pe=J.nextSibling,ge=Pe.firstChild,he=ge.nextSibling,$e=he.nextSibling,fe=$e.nextSibling,we=fe.nextSibling,je=we.nextSibling;return e.insert(ve,()=>t.name),e.insert(X,(()=>{var l=e.memo(()=>!!t.workspaceName);return()=>l()&&(()=>{var s=cs();return s.firstChild,e.insert(s,()=>t.workspaceName,null),e.effect(f=>{var E=`Workspace: ${t.workspaceName}${t.workingDirectory?` (${t.workingDirectory})`:""}`,z=`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 E!==f.e&&e.setAttribute(s,"title",f.e=E),f.t=e.style(s,z,f.t),f},{e:void 0,t:void 0}),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!(t.isMatrixParent&&t.matrix));return()=>l()&&(()=>{var s=ds(),f=s.firstChild,E=f.nextSibling;return E.nextSibling,e.insert(s,()=>t.matrix.workspaceIds.length,E),e.insert(s,(()=>{var z=e.memo(()=>!!t.matrix.concurrency);return()=>z()?` ⚙${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(X,(()=>{var l=e.memo(()=>!!t.matrixParentId);return()=>l()&&(()=>{var s=us();return s.firstChild,e.insert(s,()=>t.matrixParentId,null),e.effect(()=>e.setAttribute(s,"title",`Клон матрицы. Родитель: ${t.matrixParentId}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!t.watchPath);return()=>l()&&(()=>{var s=gs();return e.effect(()=>e.setAttribute(s,"title",`Отслеживание файла: ${t.watchPath}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!(t.beforeScript||t.afterScript));return()=>l()&&(()=>{var s=fs();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(X,(()=>{var l=e.memo(()=>t.triggerType==="mcp-event");return()=>l()&&(()=>{var s=ms();return e.effect(()=>e.setAttribute(s,"title",`MCP-событие: ${t.mcpEvent?.event??"—"}${t.mcpEvent?.filter?` (фильтр: ${t.mcpEvent.filter})`:""}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!t.model);return()=>l()&&(()=>{var s=ys();return s.firstChild,e.insert(s,()=>t.model,null),e.effect(()=>e.setAttribute(s,"title",`Модель LLM: ${t.model}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>typeof t.priority=="number"&&t.priority!==_e);return()=>l()&&(()=>{var s=bs();return s.firstChild,e.insert(s,()=>Mn(t.priority),null),e.effect(()=>e.setAttribute(s,"title",`Приоритет: ${Mn(t.priority)} (${t.priority})`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!(Array.isArray(t.allowedTools)&&t.allowedTools.length>0||Array.isArray(t.deniedTools)&&t.deniedTools.length>0));return()=>l()?(()=>{var s=xs();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(j,(()=>{var l=e.memo(()=>!!(Array.isArray(t.dependsOn)&&t.dependsOn.length>0));return()=>l()&&(()=>{var s=vs(),f=s.firstChild;return f.firstChild,e.insert(f,()=>t.dependsOn.join(" + "),null),s})()})(),Z),e.insert(j,(()=>{var l=e.memo(()=>!!(t.isMatrixParent&&t.matrixSummary));return()=>l()&&(()=>{var s=hs(),f=s.firstChild,E=f.firstChild,z=E.nextSibling,R=z.nextSibling,x=R.nextSibling;return x.nextSibling,e.insert(f,()=>t.matrixSummary.successCount,z),e.insert(f,()=>t.matrixSummary.totalCount,x),e.insert(f,(()=>{var m=e.memo(()=>t.matrixSummary.errorCount>0);return()=>m()?` · ❌ ${t.matrixSummary.errorCount}`:""})(),null),e.insert(f,(()=>{var m=e.memo(()=>t.matrixSummary.pendingCount>0);return()=>m()?` · ⏳ ${t.matrixSummary.pendingCount}`:""})(),null),e.effect(m=>{var k=t.matrixSummary.message,H=`cursor:help;color:${Ua(t.matrixSummary.status)};white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;return k!==m.e&&e.setAttribute(f,"title",m.e=k),m.t=e.style(f,H,m.t),m},{e:void 0,t:void 0}),s})()})(),Z),e.insert(Z,()=>Or().total,De),e.insert(Z,()=>Or().success,Ee),e.insert(Z,()=>Or().error,null),e.insert(j,(()=>{var l=e.memo(()=>!!(t.schedule||t.nextRun));return()=>l()&&(()=>{var s=$s(),f=s.firstChild;return e.insert(f,()=>t.schedule),e.insert(s,(()=>{var E=e.memo(()=>!!t.nextRun);return()=>E()&&(()=>{var z=ws();return z.firstChild,e.insert(z,()=>t.nextRun,null),z})()})(),null),s})()})(),null),e.insert(xr,(()=>{var l=e.memo(()=>t.status==="running");return()=>l()?(()=>{var s=_s(),f=s.firstChild,E=f.nextSibling;return E.nextSibling,e.insert(s,Wn,E),s})():(()=>{var s=ks();return e.insert(s,(()=>{var f=e.memo(()=>t.status==="success");return()=>f()?"🟢 Готова":e.memo(()=>t.status==="error")()?"🔴 Ошибка":t.status==="partial"?"🟠 Частично":"⚪ Пауза"})()),s})()})()),ge.addEventListener("mouseleave",l=>{U(l,!1),Vi(s=>s===t.name?null:s)}),ge.addEventListener("mouseenter",l=>{U(l,!0),ce()&&Vi(t.name)}),ge.$$click=()=>{_o(t.name)},e.insert(ge,()=>ce()&&Mo()===t.name?"❄️":"▶"),he.addEventListener("mouseleave",l=>U(l,!1)),he.addEventListener("mouseenter",l=>U(l,!0)),he.$$click=()=>{t.paused?So(t.name):ko(t.name)},e.insert(he,()=>t.paused?"▶":"⏸"),$e.addEventListener("mouseleave",l=>U(l,!1)),$e.addEventListener("mouseenter",l=>U(l,!0)),$e.$$click=()=>{To(t.name)},fe.addEventListener("mouseleave",l=>U(l,!1,Ot()&&Rt()===t.name)),fe.addEventListener("mouseenter",l=>U(l,!0,Ot()&&Rt()===t.name)),fe.$$click=()=>{ho(t.name)},we.addEventListener("mouseleave",l=>U(l,!1,Ht()===t.name)),we.addEventListener("mouseenter",l=>U(l,!0,Ht()===t.name)),we.$$click=()=>{vo(t.name)},je.addEventListener("mouseleave",l=>U(l,!1)),je.addEventListener("mouseenter",l=>U(l,!0)),je.$$click=()=>{Eo(t)},e.insert(Pe,(()=>{var l=e.memo(()=>!!t.matrix);return()=>l()&&(()=>{var s=Ss();return s.addEventListener("mouseleave",f=>U(f,!1)),s.addEventListener("mouseenter",f=>U(f,!0)),s.$$click=()=>{Co(t.name)},e.effect(f=>{var E=`Отменить выполняющиеся клоны матрицы "${t.name}"`,z=ze();return E!==f.e&&e.setAttribute(s,"title",f.e=E),f.t=e.style(s,z,f.t),f},{e:void 0,t:void 0}),s})()})(),null),e.insert(Pe,(()=>{var l=e.memo(()=>!t.matrixParentId);return()=>l()&&(()=>{var s=Cs();return s.addEventListener("mouseleave",f=>U(f,!1)),s.addEventListener("mouseenter",f=>U(f,!0)),s.$$click=()=>{zo(t.name)},e.effect(f=>{var E=t.matrix?`Удалить матрицу "${t.name}" вместе с клонами`:`Удалить "${t.name}"`,z=ze();return E!==f.e&&e.setAttribute(s,"title",f.e=E),f.t=e.style(s,z,f.t),f},{e:void 0,t:void 0}),s})()})(),null),e.insert(i,(()=>{var l=e.memo(()=>Ht()===t.name);return()=>l()&&(()=>{var s=zs(),f=s.firstChild,E=f.firstChild,z=E.nextSibling;return z.addEventListener("mouseleave",R=>{R.target.style.color="#8e8e93"}),z.addEventListener("mouseenter",R=>{R.target.style.color="#ffffff"}),z.$$click=()=>zi(null),e.insert(s,(()=>{var R=e.memo(()=>Ti().length===0);return()=>R()?Ts():Ti().map(x=>(()=>{var m=Es(),k=m.firstChild,H=k.nextSibling,se=H.nextSibling,Ae=se.firstChild;return e.insert(k,()=>new Date(x.startedAt).toLocaleString()),e.insert(H,()=>x.status==="success"?"✅ Успех":"❌ Ошибка"),e.insert(se,()=>x.durationMs,Ae),e.insert(m,(()=>{var A=e.memo(()=>!!x.model);return()=>A()&&(()=>{var $=Ps();return $.firstChild,e.insert($,()=>x.model,null),e.effect(()=>e.setAttribute($,"title",`Модель: ${x.model}`)),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!(x.preFlightStatus&&x.preFlightStatus!=="skipped"));return()=>A()&&(()=>{var $=As();return $.firstChild,e.insert($,()=>x.preFlightStatus==="success"?"✅":"❌",null),e.effect(O=>{var T=`Pre-flight: ${x.preFlightStatus}`,v=x.preFlightStatus==="success"?"#34c759":"#ff3b30";return T!==O.e&&e.setAttribute($,"title",O.e=T),v!==O.t&&e.setStyleProperty($,"color",O.t=v),O},{e:void 0,t:void 0}),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!(x.postFlightStatus&&x.postFlightStatus!=="skipped"));return()=>A()&&(()=>{var $=Os();return $.firstChild,e.insert($,()=>x.postFlightStatus==="success"?"✅":"❌",null),e.effect(O=>{var T=`Post-flight: ${x.postFlightStatus}`,v=x.postFlightStatus==="success"?"#34c759":"#ff3b30";return T!==O.e&&e.setAttribute($,"title",O.e=T),v!==O.t&&e.setStyleProperty($,"color",O.t=v),O},{e:void 0,t:void 0}),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!x.error);return()=>A()&&(()=>{var $=Ms();return e.insert($,()=>x.error),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!x.nextTask);return()=>A()&&(()=>{var $=Rs();return $.firstChild,e.insert($,()=>x.nextTask,null),$})()})(),null),e.effect(A=>{var $=x.startedAt+x.durationMs,O=x.status==="success"?"#34c759":"#ff3b30";return $!==A.e&&e.setAttribute(m,"key",A.e=$),O!==A.t&&e.setStyleProperty(H,"color",A.t=O),A},{e:void 0,t:void 0}),m})())})(),null),s})()})(),null),e.insert(i,(()=>{var l=e.memo(()=>!!(Ot()&&Rt()===t.name));return()=>l()&&(()=>{var s=Is(),f=s.firstChild,E=f.firstChild,z=E.nextSibling;return e.insert(f,()=>t.name,z),z.addEventListener("mouseleave",R=>{R.target.style.color="#8e8e93"}),z.addEventListener("mouseenter",R=>{R.target.style.color="#ffffff"}),z.$$click=()=>Yi(),e.insert(s,(()=>{var R=e.memo(()=>!!ri());return()=>R()&&Ls()})(),null),e.insert(s,(()=>{var R=e.memo(()=>!!(!ri()&&N()&&!N().success));return()=>R()&&(()=>{var x=qs();return x.firstChild,e.insert(x,()=>N().error??"Симуляция не удалась",null),x})()})(),null),e.insert(s,(()=>{var R=e.memo(()=>!!(!ri()&&N()&&N().success));return()=>R()&&(()=>{var x=Ds();return e.insert(x,(()=>{var m=e.memo(()=>!!(Array.isArray(N().warnings)&&N().warnings.length>0));return()=>m()&&(()=>{var k=js();return k.firstChild,e.insert(k,()=>N().warnings.map(H=>`· ${H}`).join(" | "),null),k})()})(),null),e.insert(x,()=>N().tasks.map(m=>(()=>{var k=Gs(),H=k.firstChild,se=H.firstChild,Ae=se.nextSibling;Ae.nextSibling;var A=H.nextSibling;A.firstChild;var $=A.nextSibling;$.firstChild;var O=$.nextSibling;return O.firstChild,e.insert(H,()=>(m.order??0)+1,Ae),e.insert(H,()=>m.trigger,null),e.insert(A,()=>m.name,null),e.insert(k,(()=>{var T=e.memo(()=>!!m.workspace);return()=>T()&&(()=>{var v=Fs();return v.firstChild,e.insert(v,()=>m.workspace.name,null),v})()})(),$),e.insert(k,(()=>{var T=e.memo(()=>!!m.matrixParent);return()=>T()&&(()=>{var v=Bs();return v.firstChild,e.insert(v,()=>m.matrixParent,null),v})()})(),$),e.insert($,()=>m.cwd||"(папка проекта)",null),e.insert(k,(()=>{var T=e.memo(()=>!!m.roleScoped);return()=>T()&&(()=>{var v=Ns();return e.effect(()=>e.setAttribute(v,"title",`allowed=[${(m.roleScoped.allowed??[]).join(", ")}] · denied=[${(m.roleScoped.denied??[]).join(", ")}]`)),v})()})(),O),e.insert(k,(()=>{var T=e.memo(()=>m.estimatedDurationSec!=null);return()=>T()&&(()=>{var v=Ws(),u=v.firstChild,d=u.nextSibling;return d.nextSibling,e.insert(v,()=>m.estimatedDurationSec,d),v})()})(),O),e.insert(k,(()=>{var T=e.memo(()=>m.estimatedTokens!=null);return()=>T()&&(()=>{var v=Us(),u=v.firstChild,d=u.nextSibling;return d.nextSibling,e.insert(v,()=>m.estimatedTokens,d),v})()})(),O),e.insert(k,(()=>{var T=e.memo(()=>m.estimatedCostUsd!=null);return()=>T()&&(()=>{var v=Hs();return v.firstChild,e.insert(v,()=>Number(m.estimatedCostUsd).toFixed(4),null),v})()})(),O),e.insert(O,()=>m.command,null),e.insert(k,(()=>{var T=e.memo(()=>!!m.preFlight);return()=>T()&&(()=>{var v=Js();return v.firstChild,e.insert(v,()=>m.preFlight,null),v})()})(),null),e.insert(k,(()=>{var T=e.memo(()=>!!m.postFlight);return()=>T()&&(()=>{var v=Qs();return v.firstChild,e.insert(v,()=>m.postFlight,null),v})()})(),null),e.insert(k,(()=>{var T=e.memo(()=>!!m.qualityGate);return()=>T()&&(()=>{var v=Ys();return v.firstChild,e.insert(v,()=>m.qualityGate,null),v})()})(),null),e.effect(()=>e.setAttribute(k,"key",`${m.name}-${m.order}`)),k})()),null),e.insert(x,(()=>{var m=e.memo(()=>!!(N().totals&&(N().totals.estimatedDurationSec!=null||N().totals.estimatedTokens!=null)));return()=>m()&&(()=>{var k=Ks();return k.firstChild,e.insert(k,()=>(N().totals.estimatedDurationSec??"—")+" с · "+(N().totals.estimatedTokens??"—")+" токенов"+(N().totals.estimatedCostUsd!=null?` · ~$${Number(N().totals.estimatedCostUsd).toFixed(4)}`:""),null),k})()})(),null),x})()})(),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 ${ce()?"rgba(135, 206, 250, 0.4)":"#333"}`,f=`Запустить "${t.name}"`,E=ze(),z=t.paused?`Возобновить "${t.name}"`:`Поставить на паузу "${t.name}"`,R=ze(),x=`Логи "${t.name}"`,m=ze(),k=`Dry-Run симуляция "${t.name}"`,H=ze(Ot()&&Rt()===t.name),se=`История "${t.name}"`,Ae=ze(Ht()===t.name),A=`Редактировать "${t.name}"`,$=ze();return l.e=e.style(i,s,l.e),f!==l.t&&e.setAttribute(ge,"title",l.t=f),l.a=e.style(ge,E,l.a),z!==l.o&&e.setAttribute(he,"title",l.o=z),l.i=e.style(he,R,l.i),x!==l.n&&e.setAttribute($e,"title",l.n=x),l.s=e.style($e,m,l.s),k!==l.h&&e.setAttribute(fe,"title",l.h=k),l.r=e.style(fe,H,l.r),se!==l.d&&e.setAttribute(we,"title",l.d=se),l.l=e.style(we,Ae,l.l),A!==l.u&&e.setAttribute(je,"title",l.u=A),l.c=e.style(je,$,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 c.add(bi.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(p.ErrorBoundary,{fallback:r=>(()=>{var t=An(),i=t.firstChild;return e.insert(t,()=>r.message,null),t})(),get children(){var r=Vs(),t=r.firstChild,i=t.firstChild,a=i.firstChild,J=i.nextSibling,j=J.firstChild,X=j.firstChild,ve=X.nextSibling,Z=j.nextSibling,lt=Z.nextSibling,De=lt.firstChild,Te=t.nextSibling,Ee=Te.firstChild,xr=Ee.nextSibling,Pe=xr.nextSibling,ge=Te.nextSibling,he=ge.firstChild,$e=he.nextSibling,fe=ge.nextSibling,we=fe.firstChild,je=we.firstChild,l=je.nextSibling,s=l.firstChild,f=fe.nextSibling,E=f.firstChild,z=E.firstChild,R=z.nextSibling,x=R.firstChild,m=x.nextSibling,k=f.nextSibling,H=k.firstChild,se=H.firstChild,Ae=se.firstChild,A=Ae.nextSibling,$=A.nextSibling,O=se.nextSibling,T=k.nextSibling,v=T.firstChild;return e.insert(a,(()=>{var u=e.memo(()=>!!ce());return()=>u()?`❄️ ${Ur()} ❄️`:Ur()})()),j.addEventListener("change",u=>ki(u.currentTarget.value)),e.insert(j,()=>ee().map(u=>(()=>{var d=On(),C=d.firstChild;return e.insert(d,()=>u.name,null),e.effect(()=>e.setAttribute(d,"key",u.id)),e.effect(()=>d.value=u.id),d})()),ve),Z.addEventListener("mouseleave",u=>{const d=u.currentTarget;d.style.borderColor="#333",d.style.background="#1e1e1e",d.style.color="#e0e0e0"}),Z.addEventListener("mouseenter",u=>{const d=u.currentTarget;d.style.borderColor="#5ac8fa",d.style.background="rgba(90,200,250,0.12)",d.style.color="#5ac8fa"}),Z.$$click=async()=>{const u=window.open("","_blank");let d=3782;try{const h=await _.get_dashboard_port({});h&&typeof h.port=="number"&&h.port>0&&(d=h.port)}catch(h){console.warn("[scheduler] Не удалось получить порт дашборда:",h)}const C="http://localhost:"+d;u?u.location.href=C:window.open(C,"_blank")},De.addEventListener("change",u=>{ro(u.currentTarget.checked)}),Ee.$$click=po,e.insert(Ee,()=>mr()?"Экспорт...":"Экспорт"),xr.addEventListener("change",co),Pe.$$click=()=>document.querySelector('input[type="file"]')?.click(),e.insert(Pe,()=>yr()?"Импорт...":"Импорт"),$e.addEventListener("change",u=>to(Number(u.currentTarget.value)||1)),we.$$click=()=>Jn(!Gr()),e.insert(l,(()=>{var u=e.memo(()=>!!be());return()=>u()?Lr()?"только ошибки":"все запуски":"выключены"})(),s),e.insert(s,()=>Gr()?"▾":"▴"),e.insert(fe,(()=>{var u=e.memo(()=>!Gr());return()=>u()&&(()=>{var d=Xs(),C=d.firstChild,h=C.firstChild,W=C.nextSibling,I=W.firstChild,G=W.nextSibling,L=G.firstChild,q=L.firstChild,Q=L.nextSibling,ne=G.nextSibling,Y=ne.firstChild;return h.addEventListener("change",b=>{Ir(b.currentTarget.checked),mt()}),I.addEventListener("change",b=>{qr(b.currentTarget.checked),mt()}),q.addEventListener("change",b=>{Dr(b.currentTarget.checked),mt()}),Q.addEventListener("change",()=>{mt()}),Q.$$input=b=>jr(b.currentTarget.value),Y.$$click=()=>{eo()},e.insert(Y,()=>Yt()?"Отправка...":"🧪 Тестовое уведомление"),e.effect(b=>{var Oe=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${be()?1:.5}`,me=!be(),Ge=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${be()?1:.5}`,Fe=!be(),K=!be()||!Le(),st=`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:${be()&&Le()?1:.5}`,Me=Yt()||!Le(),Be=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${Yt()||!Le()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${Yt()||!Le()?.6:1}`;return b.e=e.style(W,Oe,b.e),me!==b.t&&(I.disabled=b.t=me),b.a=e.style(L,Ge,b.a),Fe!==b.o&&(q.disabled=b.o=Fe),K!==b.i&&(Q.disabled=b.i=K),b.n=e.style(Q,st,b.n),Me!==b.s&&(Y.disabled=b.s=Me),b.h=e.style(Y,Be,b.h),b},{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(()=>h.checked=be()),e.effect(()=>I.checked=Lr()),e.effect(()=>q.checked=Le()),e.effect(()=>Q.value=Pi()||""),d})()})(),null),E.$$click=()=>Qn(!Wr()),e.insert(R,(()=>{var u=e.memo(()=>Kt()>0);return()=>u()?`старше ${Kt()} дн.`:"без срока"})(),x),e.insert(R,(()=>{var u=e.memo(()=>Xt()>0);return()=>u()?`до ${Xt()} записей`:"без лимита"})(),m),e.insert(m,()=>Wr()?"▾":"▴"),e.insert(f,(()=>{var u=e.memo(()=>!Wr());return()=>u()&&(()=>{var d=Zs(),C=d.firstChild,h=C.firstChild,W=h.nextSibling,I=C.nextSibling,G=I.firstChild,L=G.nextSibling,q=I.nextSibling,Q=q.firstChild,ne=q.nextSibling,Y=ne.firstChild;return W.addEventListener("change",b=>{Vt(Math.max(0,Math.floor(Number(b.currentTarget.value)||0))),Ii()}),L.addEventListener("change",b=>{Zt(Math.max(0,Math.floor(Number(b.currentTarget.value)||0))),Ii()}),e.insert(q,(()=>{var b=e.memo(()=>!!Fr());return()=>b()?`${new Date(Fr()).toLocaleString()} · удалено ${Oi()}`:"ещё не выполнялась"})(),null),Y.$$click=()=>{Zn()},e.insert(Y,()=>er()?"Очистка...":"🧹 Очистить сейчас"),e.effect(b=>{var Oe=er(),me=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${er()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${er()?.6:1}`;return Oe!==b.e&&(Y.disabled=b.e=Oe),b.t=e.style(Y,me,b.t),b},{e:void 0,t:void 0}),e.effect(()=>W.value=Kt()),e.effect(()=>L.value=Xt()),d})()})(),null),se.$$click=()=>jn(!Er()),e.insert(A,()=>ee().length),e.insert($,()=>Er()?"▾":"▴"),O.$$click=()=>{uo()},e.insert(k,(()=>{var u=e.memo(()=>!Er());return()=>u()&&(()=>{var d=ea();return e.insert(d,(()=>{var C=e.memo(()=>ee().length===0);return()=>C()?ta():ee().map(h=>(()=>{var W=ra(),I=W.firstChild,G=I.nextSibling,L=G.firstChild,q=L.firstChild,Q=L.nextSibling,ne=Q.nextSibling,Y=ne.firstChild,b=Y.nextSibling,Oe=b.nextSibling,me=G.nextSibling,Ge=me.firstChild,Fe=Ge.nextSibling;return e.insert(L,()=>h.name,null),e.insert(Q,()=>h.path),e.insert(ne,()=>h.gitBranch||"—",b),e.insert(ne,()=>h.gitRemote||"remote не задан",null),Ge.$$click=()=>{go(h)},Fe.$$click=()=>{fo(h)},e.effect(K=>{var st=`width:9px;height:9px;border-radius:50%;background:${h.color||"#5ac8fa"};flex-shrink:0`,Me=h.path,Be=dt(),vr=dt();return K.e=e.style(I,st,K.e),Me!==K.t&&e.setAttribute(Q,"title",K.t=Me),Be!==K.a&&(Ge.disabled=K.a=Be),vr!==K.o&&(Fe.disabled=K.o=vr),K},{e:void 0,t:void 0,a:void 0,o:void 0}),W})())})()),d})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!io());return()=>u()?(()=>{var d=ia();return d.addEventListener("mouseleave",C=>{const h=C.currentTarget;h.style.borderColor="#3a3a3a",h.style.background="#1e1e1e"}),d.addEventListener("mouseenter",C=>{const h=C.currentTarget;h.style.borderColor="#5ac8fa",h.style.background="#232326"}),d.$$click=()=>Jr(!1),d})():(()=>{var d=na(),C=d.firstChild,h=C.firstChild,W=h.nextSibling,I=W.firstChild,G=I.nextSibling,L=C.nextSibling,q=L.firstChild,Q=q.firstChild,ne=q.nextSibling,Y=L.nextSibling,b=Y.firstChild,Oe=b.nextSibling,me=Y.nextSibling,Ge=me.firstChild,Fe=Ge.nextSibling,K=Fe.firstChild,st=K.firstChild,Me=K.nextSibling,Be=Me.firstChild,vr=Me.nextSibling,Xi=vr.firstChild,Ne=me.nextSibling,Io=Ne.firstChild,pi=Io.nextSibling,Zi=Ne.nextSibling,Lo=Zi.firstChild,en=Lo.nextSibling,ci=Zi.nextSibling,qo=ci.firstChild,hr=qo.nextSibling,tn=ci.nextSibling,Do=tn.firstChild,rn=Do.nextSibling,nn=tn.nextSibling,jo=nn.firstChild,$r=jo.nextSibling,on=nn.nextSibling,Go=on.firstChild,ln=Go.nextSibling,sn=on.nextSibling,Fo=sn.firstChild,an=Fo.nextSibling,pn=sn.nextSibling,Bo=pn.firstChild,cn=Bo.nextSibling,dn=pn.nextSibling,No=dn.firstChild,un=No.nextSibling,gn=dn.nextSibling,Wo=gn.firstChild,fn=Wo.nextSibling,mn=gn.nextSibling,Uo=mn.firstChild,Ho=Uo.nextSibling,yn=mn.nextSibling,di=yn.firstChild,Ka=di.firstChild,bn=di.nextSibling,Jo=bn.firstChild,Qo=Jo.nextSibling,xn=Qo.nextSibling,Yo=xn.nextSibling,vn=Yo.nextSibling,Ko=vn.nextSibling,ui=Ko.firstChild,hn=ui.nextSibling,Vo=hn.nextSibling,$n=yn.nextSibling,wn=$n.firstChild,wr=wn.nextSibling;return e.insert(h,si?"Редактирование задачи":"Новая задача"),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=yo,G.addEventListener("mouseleave",o=>{const n=o.currentTarget;n.style.color="#a0a0a6",n.style.borderColor="#333"}),G.addEventListener("mouseenter",o=>{const n=o.currentTarget;n.style.color="#5ac8fa",n.style.borderColor="#5ac8fa"}),G.$$click=()=>Jr(!0),Q.addEventListener("change",o=>{const n=o.currentTarget.checked;sr(n),n&&(ke(""),xe().length===0&&At(ee().map(y=>y.id)))}),e.insert(L,(()=>{var o=e.memo(()=>!!Ce());return()=>o()&&(()=>{var n=oa(),y=n.firstChild,g=y.firstChild,w=g.firstChild,S=y.nextSibling,P=S.firstChild,te=P.firstChild,Re=te.nextSibling,Dt=P.nextSibling,We=Dt.firstChild,jt=We.nextSibling,re=Dt.nextSibling,M=re.firstChild,ye=M.nextSibling,Ue=S.nextSibling,_r=Ue.firstChild,Gt=Ue.nextSibling,_n=Gt.firstChild,gi=_n.nextSibling,kn=Gt.nextSibling;return e.insert(g,()=>xe().length,null),e.insert(y,(()=>{var V=e.memo(()=>ee().length===0);return()=>V()?la():(()=>{var oe=sa();return e.insert(oe,()=>ee().map(ae=>(()=>{var at=aa(),pt=at.firstChild,le=pt.nextSibling,Ft=le.firstChild,He=le.nextSibling;return pt.addEventListener("change",kr=>no(ae.id,kr.currentTarget.checked)),e.insert(le,()=>ae.name,null),e.insert(He,()=>ae.path),e.effect(kr=>e.style(le,`color:${ae.color||"#5ac8fa"}`,kr)),e.effect(()=>pt.checked=xe().includes(ae.id)),at})())),oe})()})(),null),Re.addEventListener("change",V=>ar(V.currentTarget.value==="sequential"?"sequential":"parallel")),jt.addEventListener("change",V=>pr(V.currentTarget.value==="stop"?"stop":"continue")),ye.addEventListener("change",V=>cr(V.currentTarget.value==="per-task"?"per-task":"summary")),_r.addEventListener("change",V=>dr(V.currentTarget.checked)),gi.$$input=V=>ur(V.currentTarget.value),e.insert(n,(()=>{var V=e.memo(()=>xe().length>0);return()=>V()&&(()=>{var oe=pa(),ae=oe.firstChild,at=ae.firstChild,pt=ae.nextSibling;return e.insert(ae,oo,null),e.insert(pt,()=>xe().map(le=>{const Ft=ee().find(Sr=>Sr.id===le);if(!Ft)return null;const He=ei()[le]??{},kr="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box";return(()=>{var Sr=ca(),Cr=Sr.firstChild,Xo=Cr.firstChild,Sn=Xo.nextSibling,Zo=Cr.nextSibling,fi=Zo.firstChild,Cn=fi.nextSibling,mi=Cn.firstChild,zn=mi.nextSibling,el=Cn.nextSibling,yi=el.firstChild,Tn=yi.nextSibling;return e.insert(Cr,()=>Ft.name,Sn),e.insert(Sn,()=>ni(ie(),Ft.name)),fi.$$input=pe=>It(le,"prompt",pe.currentTarget.value),mi.$$input=pe=>It(le,"model",pe.currentTarget.value),zn.$$input=pe=>It(le,"qualityGate",pe.currentTarget.value),yi.$$input=pe=>It(le,"beforeScript",pe.currentTarget.value),Tn.$$input=pe=>It(le,"afterScript",pe.currentTarget.value),e.effect(pe=>e.style(Cr,`font-size:12px;font-weight:600;margin-bottom:6px;color:${Ft.color||"#5ac8fa"}`,pe)),e.effect(()=>fi.value=He.prompt??""),e.effect(()=>mi.value=He.model??""),e.effect(()=>zn.value=He.qualityGate??""),e.effect(()=>yi.value=He.beforeScript??""),e.effect(()=>Tn.value=He.afterScript??""),Sr})()})),oe})()})(),kn),e.insert(kn,(()=>{var V=e.memo(()=>oi().length>0);return()=>V()?[(()=>{var oe=da(),ae=oe.firstChild,at=ae.nextSibling,pt=at.nextSibling;return e.insert(oe,()=>oi().length,at),oe})(),(()=>{var oe=ua();return e.insert(oe,()=>oi().join(", ")),oe})()]:ga()})()),e.effect(()=>e.setAttribute(gi,"placeholder",Zr()==="sequential"?"1 (sequential)":"без лимита")),e.effect(()=>Re.value=Zr()),e.effect(()=>jt.value=ji()),e.effect(()=>ye.value=Gi()),e.effect(()=>_r.checked=Fi()),e.effect(()=>gi.value=Bi()),n})()})(),null),e.insert(d,(()=>{var o=e.memo(()=>!Ce());return()=>o()&&(()=>{var n=fa(),y=n.firstChild,g=y.nextSibling,w=g.firstChild;return g.addEventListener("change",S=>{ke(S.currentTarget.value),S.currentTarget.value&&it("")}),e.insert(g,()=>ee().map(S=>(()=>{var P=On(),te=P.firstChild;return e.insert(P,()=>S.name,null),e.effect(()=>e.setAttribute(P,"key",S.id)),e.effect(()=>P.value=S.id),P})()),null),e.insert(n,(()=>{var S=e.memo(()=>!!Lt());return()=>S()&&(()=>{var P=ma(),te=P.firstChild,Re=te.firstChild,Dt=Re.nextSibling,We=te.nextSibling,jt=We.firstChild,re=jt.nextSibling,M=We.nextSibling,ye=M.firstChild,Ue=ye.nextSibling;return e.insert(Dt,()=>Lt().path),e.insert(re,()=>Lt().gitBranch||"—"),e.insert(Ue,()=>Lt().gitRemote||"—"),P})()})(),null),e.effect(()=>g.value=Ye()),n})()})(),Y),Oe.$$input=o=>rr(o.currentTarget.value),e.insert(d,(()=>{var o=e.memo(()=>!Ye()&&!Ce());return()=>o()&&(()=>{var n=ya(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>it(w.currentTarget.value),e.effect(()=>g.value=lr()||""),n})()})(),me),st.addEventListener("change",()=>qe("cron")),Be.addEventListener("change",()=>qe("file")),Xi.addEventListener("change",()=>qe("mcp-event")),e.insert(d,(()=>{var o=e.memo(()=>de()==="file");return()=>o()&&(()=>{var n=ba(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>Ct(w.currentTarget.value),e.effect(()=>g.value=Kr()||""),n})()})(),Ne),e.insert(d,(()=>{var o=e.memo(()=>de()==="mcp-event");return()=>o()&&[(()=>{var n=xa(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>zt(w.currentTarget.value),e.effect(()=>g.value=Vr()||""),n})(),(()=>{var n=va(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>Tt(w.currentTarget.value),e.effect(()=>g.value=Xr()||""),n})(),(()=>{var n=ha(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>Pt(w.currentTarget.value),e.effect(()=>g.value=Et()||""),n})()]})(),Ne),pi.addEventListener("change",o=>{const n=o.currentTarget.value;yt(n),n!=="__custom__"&&Ze(n)}),e.insert(pi,()=>hi.map(o=>(()=>{var n=zr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})())),e.insert(Ne,Ao&&(()=>{var o=$a(),n=o.firstChild,y=n.nextSibling;return y.$$input=g=>Ze(g.currentTarget.value),e.effect(()=>y.value=Xe()||""),o})(),null),e.insert(Ne,(()=>{var o=e.memo(()=>!!Ci());return()=>o()&&(()=>{var n=wa();return e.insert(n,Ci),n})()})(),null),en.$$input=o=>et(o.currentTarget.value),hr.addEventListener("change",o=>mo(o.currentTarget.value)),e.insert(hr,()=>Ei.map(o=>(()=>{var n=zr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})()),null),e.insert(hr,()=>Qt().map(o=>(()=>{var n=zr();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(ci,(()=>{var o=e.memo(()=>!!gt().startsWith("custom:"));return()=>o()&&(()=>{var n=_a(),y=n.firstChild,g=y.nextSibling;return e.insert(n,()=>Qt().map(w=>`custom:${w.id}`!==gt()?null:(()=>{var S=ka();return e.insert(S,()=>w.name),e.effect(()=>e.setAttribute(S,"key",w.id)),S})()),g),g.addEventListener("mouseleave",w=>{w.currentTarget.style.color="#ff3b30"}),g.addEventListener("mouseenter",w=>{w.currentTarget.style.color="#c92a2a"}),g.$$click=()=>{const w=Qt().find(S=>`custom:${S.id}`===gt());w&&bo(w)},n})()})(),null),rn.$$input=o=>ht(o.currentTarget.value),$r.addEventListener("change",o=>$t(Number(o.currentTarget.value)||_e)),e.insert($r,()=>Rn.map(o=>(()=>{var n=zr();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($r,(()=>{var o=e.memo(()=>!Rn.some(n=>n.value===tt()));return()=>o()&&(()=>{var n=Sa(),y=n.firstChild,g=y.nextSibling,w=g.nextSibling;return e.insert(n,tt,g),e.effect(()=>n.value=String(tt())),n})()})(),null),ln.$$input=o=>bt(Number(o.currentTarget.value)||0),an.$$input=o=>xt(Number(o.currentTarget.value)||60),cn.$$input=o=>wt(o.currentTarget.value),un.$$input=o=>kt(o.currentTarget.value),fn.$$input=o=>St(o.currentTarget.value),e.insert(Ho,(()=>{var o=e.memo(()=>Ki().length===0);return()=>o()?Ca():Ki().map(n=>(()=>{var y=vi(),g=y.firstChild;return g.addEventListener("change",w=>Oo(n,w.currentTarget.checked)),e.insert(y,n,null),e.effect(w=>e.style(y,`display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:14px;border:1px solid ${rt().includes(n)?"#5ac8fa":"#333"};background:${rt().includes(n)?"rgba(90,200,250,0.12)":"transparent"};color:${rt().includes(n)?"#5ac8fa":"#cfcfd2"};font-size:12px;cursor:pointer;user-select:none`,w)),e.effect(()=>g.checked=rt().includes(n)),y})())})()),e.insert(di,(()=>{var o=e.memo(()=>F().length>0||B().length>0);return()=>o()&&(()=>{var n=za(),y=n.firstChild,g=y.nextSibling,w=g.nextSibling,S=w.nextSibling,P=S.nextSibling;return e.insert(n,()=>F().length,g),e.insert(n,()=>B().length,S),n})()})(),null),e.insert(xn,()=>Wi.map(o=>(()=>{var n=vi(),y=n.firstChild;return y.addEventListener("change",()=>Ui("allowed",o)),e.insert(n,o,null),e.effect(g=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${F().includes(o)?"#34c759":"#333"};background:${F().includes(o)?"rgba(52,199,89,0.12)":"transparent"};color:${F().includes(o)?"#34c759":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,g)),e.effect(()=>y.checked=F().includes(o)),n})())),e.insert(vn,()=>Wi.map(o=>(()=>{var n=vi(),y=n.firstChild;return y.addEventListener("change",()=>Ui("denied",o)),e.insert(n,o,null),e.effect(g=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${B().includes(o)?"#ff3b30":"#333"};background:${B().includes(o)?"rgba(255,59,48,0.12)":"transparent"};color:${B().includes(o)?"#ff3b30":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,g)),e.effect(()=>y.checked=B().includes(o)),n})())),ui.$$input=o=>Di(o.currentTarget.value),hn.$$click=()=>Hi("allowed"),Vo.$$click=()=>Hi("denied"),e.insert(bn,(()=>{var o=e.memo(()=>F().length>0||B().length>0);return()=>o()&&(()=>{var n=Ta();return e.insert(n,(()=>{var y=e.memo(()=>F().length>0);return()=>y()&&(()=>{var g=Ea(),w=g.firstChild,S=w.nextSibling,P=S.nextSibling;return e.insert(g,()=>F().join(", "),S),g})()})(),null),e.insert(n,(()=>{var y=e.memo(()=>B().length>0);return()=>y()&&(()=>{var g=Pa(),w=g.firstChild,S=w.nextSibling,P=S.nextSibling;return e.insert(g,()=>B().join(", "),S),g})()})(),null),n})()})(),null),wn.$$click=()=>{ii("(форма)");const o={order:0,trigger:"manual",command:lo(),roleScoped:F().length>0||B().length>0?{allowed:F(),denied:B()}:null,preFlight:(nr()||"").trim()||null,postFlight:(or()||"").trim()||null,qualityGate:(ir()||"").trim()||null},n=xe().map(y=>ee().find(g=>g.id===y)).filter(y=>!!y).map((y,g)=>({...o,name:ni(ie(),y.name),order:g,cwd:y.path,matrixParent:ie()||"(без имени)"}));Mt({tasks:Ce()?n:[{...o,name:ie()||"(без имени)",cwd:Lt()?.path||(lr()||"").trim()||"(папка проекта)"}],totals:{},warnings:[...ie().trim()?[]:["Не указано имя — превью локальное (форма не сохранена)."],...Ce()?[`Matrix: будет создано ${n.length} клон(а/ов) по workspace; родитель сам не выполняется.`]:[]]}),ti(!0)},wr.$$click=$o,e.insert(wr,()=>ut()?"Создание...":si?"Сохранить":"Создать задачу"),e.insert($n,si&&(()=>{var o=Aa();return o.$$click=()=>{tr(null),rr(""),Ze("* * * * *"),et(""),ht(""),$t(_e),bt(0),xt(60),wt(""),_t([]),kt(""),St(""),qe("cron"),Ct(""),zt(""),Tt(""),Pt(""),it(""),ke(""),nt([]),ot([]),fr(),yt("* * * * *"),Ut("")},o})(),null),e.insert(d,(()=>{var o=e.memo(()=>!!(Ot()&&Rt()==="(форма)"));return()=>o()&&(()=>{var n=Oa(),y=n.firstChild,g=y.firstChild,w=g.nextSibling;return w.$$click=()=>Yi(),e.insert(n,()=>{const S=N();if(!S)return null;const P=S.tasks?.[0];return(()=>{var te=Ma(),Re=te.firstChild,Dt=Re.firstChild,We=Re.nextSibling,jt=We.firstChild;return e.insert(Re,()=>P?.command,null),e.insert(We,()=>P?.cwd,null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.roleScoped);return()=>re()&&(()=>{var M=Ra(),ye=M.firstChild,Ue=ye.nextSibling,_r=Ue.nextSibling,Gt=_r.nextSibling,_n=Gt.nextSibling;return e.insert(M,()=>(P.roleScoped.allowed??[]).join(", "),Ue),e.insert(M,()=>(P.roleScoped.denied??[]).join(", "),Gt),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.preFlight);return()=>re()&&(()=>{var M=Ia(),ye=M.firstChild;return e.insert(M,()=>P.preFlight,null),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.postFlight);return()=>re()&&(()=>{var M=La(),ye=M.firstChild;return e.insert(M,()=>P.postFlight,null),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.qualityGate);return()=>re()&&(()=>{var M=qa(),ye=M.firstChild;return e.insert(M,()=>P.qualityGate,null),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!(Array.isArray(S.warnings)&&S.warnings.length>0));return()=>re()&&(()=>{var M=Da(),ye=M.firstChild;return e.insert(M,()=>S.warnings.join(" | "),null),M})()})(),null),te})()},null),n})()})(),null),e.effect(o=>{var n=de()!=="cron"?"none":"block",y=ut()||!(ie()||"").trim()||!(Xe()||"").trim()||!(Se()||"").trim()||Ce()&&xe().length===0,g=`display:block;width:100%;padding:10px;margin-top:8px;background:${ut()?"#666":"#007acc"};color:white;border-radius:6px;border:none;cursor:${ut()||!(ie()||"").trim()||!(Xe()||"").trim()||!(Se()||"").trim()?"not-allowed":"pointer"};font-size:13px;font-weight:500;opacity:${ut()||!(ie()||"").trim()||!(Xe()||"").trim()||!(Se()||"").trim()?.6:1}`;return n!==o.e&&e.setStyleProperty(Ne,"display",o.e=n),y!==o.t&&(wr.disabled=o.t=y),o.a=e.style(wr,g,o.a),o},{e:void 0,t:void 0,a:void 0}),e.effect(()=>Q.checked=Ce()),e.effect(()=>Oe.value=ie()||""),e.effect(()=>st.checked=de()==="cron"),e.effect(()=>Be.checked=de()==="file"),e.effect(()=>Xi.checked=de()==="mcp-event"),e.effect(()=>pi.value=Li()),e.effect(()=>en.value=Se()||""),e.effect(()=>hr.value=gt()),e.effect(()=>rn.value=vt()||""),e.effect(()=>$r.value=String(tt())),e.effect(()=>ln.value=Qr()),e.effect(()=>an.value=Yr()),e.effect(()=>cn.value=ir()||""),e.effect(()=>un.value=nr()||""),e.effect(()=>fn.value=or()||""),e.effect(()=>ui.value=qi()),d})()})(),T),e.insert(T,(()=>{var u=e.memo(()=>Je()!=="all");return()=>u()&&(()=>{var d=ja(),C=d.firstChild,h=C.nextSibling,W=h.nextSibling,I=W.nextSibling,G=I.nextSibling;return e.insert(d,(()=>{var L=e.memo(()=>Je()==="none");return()=>L()?"без workspace":`📦 ${ee().find(q=>q.id===Je())?.name??"workspace"}`})(),h),e.insert(d,()=>ai().length,I),e.insert(d,()=>qt().length,null),d})()})(),null),e.insert(T,(()=>{var u=e.memo(()=>ai().length===0);return()=>u()?(()=>{var d=Ga(),C=d.firstChild,h=C.nextSibling;return e.insert(C,()=>ce()?"🎄":"📅"),e.insert(h,()=>ce()?"Задач пока нет. Самое время украсить ёлку!":"Нет активных задач. Создайте первую и доверьте рутину ИИ!"),d})():(()=>{var d=Fa();return e.insert(d,()=>ai().map(C=>e.createComponent(Ro,{get key(){return C.name},job:C}))),d})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!Pr());return()=>u()&&(()=>{var d=Ba(),C=d.firstChild,h=C.firstChild,W=h.firstChild,I=W.nextSibling,G=h.nextSibling,L=C.nextSibling;return e.insert(I,Pr),G.addEventListener("mouseleave",q=>{q.target.style.color="#8e8e93"}),G.addEventListener("mouseenter",q=>{q.target.style.color="#ff3b30"}),G.$$click=()=>{Ar(null),Ke("")},e.insert(L,()=>Gn().split(`
2
- `).map((q,Q)=>(()=>{var ne=Na();return e.setAttribute(ne,"key",Q),e.insert(ne,q),ne})())),d})()})(),null),e.effect(u=>{var d=`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:${ce()?"linear-gradient(180deg, #0f172a 0%, #000000 100%)":"#0f0f0f"}`,C=`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 ${ce()?"rgba(135, 206, 250, 0.5)":"#333"};background:${ce()?"rgba(135, 206, 250, 0.12)":"#1e1e1e"};color:#e0e0e0`,h=mr(),W=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${mr()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${mr()?.6:1};transition:background 0.18s ease`,I=yr(),G=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${yr()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${yr()?.6:1};transition:background 0.18s ease`,L=dt(),q=`padding:5px 10px;border-radius:6px;border:1px solid #333;background:#252526;color:${dt()?"#666":"#5ac8fa"};font-size:11px;font-weight:600;cursor:${dt()?"not-allowed":"pointer"}`;return u.e=e.style(r,d,u.e),u.t=e.style(lt,C,u.t),h!==u.a&&(Ee.disabled=u.a=h),u.o=e.style(Ee,W,u.o),I!==u.i&&(Pe.disabled=u.i=I),u.n=e.style(Pe,G,u.n),L!==u.s&&(O.disabled=u.s=L),u.h=e.style(O,q,u.h),u},{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(()=>j.value=Je()),e.effect(()=>De.checked=ce()),e.effect(()=>$e.value=Hn()),r}})})}catch(r){return console.error("GUI render error:",r),c.add(bi.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(p.ErrorBoundary,{fallback:t=>(()=>{var i=An();return i.firstChild,e.insert(i,()=>t.message,null),i})(),get children(){var t=Wa(),i=t.firstChild;return e.insert(i,Ur),t}})})}}});e.delegateEvents(["click","input"]);exports.default=Ha;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("solid-js/web"),p=require("solid-js"),Vn=require("@opencode/plugin/gui"),ta=require("@opencode/plugin/rpc"),Br={type:["object","null"],properties:{server:{type:"string"},event:{type:"string"},filter:{type:"string"}},required:["server","event"]},eo={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"]},ra={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"]},runAt:{type:["string","null"]},session:{type:["string","null"]},sessionId:{type:["string","null"]},sessionMaxRuns:{type:["number","null"]},mcpEvent:Br,watchPath:{type:["string","null"]},timezone:{type:["string","null"]},notBefore:{type:["string","null"]},notAfter:{type:["string","null"]},pausedUntil:{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:eo,matrixParentId:{type:["string","null"]},isMatrixParent:{type:"boolean"},paused:{type:"boolean"},orphaned:{type:"boolean"},runsTotal:{type:"number"},runsSuccess:{type:"number"},runsError:{type:"number"},runsPartial:{type:"number"},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"]},Qn={type:"object",properties:{},additionalProperties:!1},ia={type:"object",properties:{tasks:{type:"array",items:ra}},required:["tasks"]},na={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"},runAt:{type:"string"},delaySeconds:{type:"number"},session:{type:"string"},sessionMaxRuns:{type:"number"},mcpEvent:Br,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:eo,timezone:{type:"string"},notBefore:{type:"string"},notAfter:{type:"string"}},required:["name","prompt"]},oa={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Zi={type:"object",properties:{name:{type:"string"}},required:["name"]},la=Zi,sa=Zi,Nr={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},aa=Nr,pa=Zi,da={type:"object",properties:{success:{type:"boolean"},logs:{type:"string"},error:{type:"string"}},required:["success","logs"]},ca={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"]},ua={type:"object",properties:{limit:{type:"number"},taskName:{type:"string"},status:{type:"string"}},additionalProperties:!1},fa={type:"object",properties:{records:{type:"array",items:ca}},required:["records"]},ga={type:"object",properties:{total:{type:"number"},success:{type:"number"},error:{type:"number"}},required:["total","success","error"]},ya={type:"object",properties:{},additionalProperties:!1},ma=ga,ba={type:"object",properties:{},additionalProperties:!1},xa={type:"object",properties:{port:{type:["number","null"]}},required:["port"]},va={type:"object",properties:{},additionalProperties:!1},ha={type:"object",properties:{platform:{type:"string"},title:{type:"string"}},required:["platform","title"]},$a={type:"object",properties:{},additionalProperties:!1},wa={type:"object",properties:{success:{type:"boolean"},data:{type:"string"},count:{type:"number"},error:{type:"string"}},required:["success"]},_a={type:"object",properties:{data:{type:"string"}},required:["data"]},ka={type:"object",properties:{success:{type:"boolean"},imported:{type:"number"},errors:{type:"array",items:{type:"string"}},error:{type:"string"}},required:["success"]},Sa={type:"object",properties:{},additionalProperties:!1},to={type:"object",properties:{enabled:{type:"boolean"},onlyOnError:{type:"boolean"},webhook:{type:"object",properties:{enabled:{type:"boolean"},url:{type:"string"},timeoutMs:{type:"number"},retryCount:{type:"number"},retryDelayMs:{type:"number"}},required:["enabled","url"]},templates:{type:"object",properties:{success:{type:"string"},error:{type:"string"}},required:["success","error"]},filters:{type:"object",properties:{include:{type:"array",items:{type:"string"}},exclude:{type:"array",items:{type:"string"}}},required:["include","exclude"]},matrix:{type:"object",properties:{enabled:{type:"boolean"},onPartial:{type:"boolean"},onAllFailed:{type:"boolean"},stuckAfterMinutes:{type:"number"}},required:["enabled","onPartial","onAllFailed","stuckAfterMinutes"]},digest:{type:"object",properties:{enabled:{type:"boolean"},frequency:{type:"string",enum:["daily","weekly"]},time:{type:"string"},lastSentAt:{type:["string","null"]}},required:["enabled","frequency","time"]}},required:["enabled","onlyOnError"]},ro={type:"object",properties:{retentionDays:{type:"number"},maxRecords:{type:"number"},lastCleanupAt:{type:["string","null"]},lastCleanupDeleted:{type:"number"}},required:["retentionDays","maxRecords"]},Ca={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:to,history:ro},required:["maxConcurrent","winterMode","notifications"]},za={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:to,history:ro},additionalProperties:!1},Ta={type:"object",properties:{success:{type:"boolean"},maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:to,history:ro},required:["success","maxConcurrent","winterMode","notifications"]},Ea={type:"object",properties:{retentionDays:{type:"number"},maxRecords:{type:"number"}},additionalProperties:!1},Aa={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},deleted:{type:"number"},deletedByAge:{type:"number"},deletedByCount:{type:"number"},kept:{type:"number"},retentionDays:{type:"number"},maxRecords:{type:"number"},vacuumed:{type:"boolean"}},required:["success","message","deleted","kept"]},Pa={type:"object",properties:{days:{type:"number"},topLimit:{type:"number"}},additionalProperties:!1},Ma={type:"object",properties:{success:{type:"boolean"},report:{type:["object","null"]},error:{type:"string"}},required:["success","report"]},La={type:"object",properties:{},additionalProperties:!1},Ra={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Oa={type:"object",properties:{},additionalProperties:!1},Ia={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Ml={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:Br,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"]},qa={type:"object",properties:{},additionalProperties:!1},Da={type:"object",properties:{templates:{type:"array",items:Ml}},required:["templates"]},ja={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:Br,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},Na={type:"object",properties:{success:{type:"boolean"},template:Ml,error:{type:"string"}},required:["success"]},Ba={type:"object",properties:{id:{type:"string"}},required:["id"]},Fa={type:"object",properties:{success:{type:"boolean"},error:{type:"string"}},required:["success"]},Cl={type:"object",properties:{name:{type:"string"},until:{type:"string"}},required:["name"]},Ga={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"},runAt:{type:"string"},delaySeconds:{type:"number"},session:{type:"string"},sessionMaxRuns:{type:"number"},mcpEvent:Br,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:eo,timezone:{type:"string"},notBefore:{type:"string"},notAfter:{type:"string"}},required:["name"]},Wa=Nr,Ll={type:"object",properties:{id:{type:"string"},name:{type:"string"},path:{type:"string"},gitRemote:{type:["string","null"]},gitBranch:{type:["string","null"]},color:{type:["string","null"]},env:{type:["object","null"],additionalProperties:{type:"string"}},envFile:{type:["string","null"]},createdAt:{type:"string"}},required:["id","name","path","createdAt"]},Ua={type:"object",properties:{},additionalProperties:!1},Ha={type:"object",properties:{workspaces:{type:"array",items:Ll}},required:["workspaces"]},Ja={type:"object",properties:{name:{type:"string"},path:{type:"string"},color:{type:"string"},env:{type:["object","null"],additionalProperties:{type:"string"}},envFile:{type:["string","null"]}},required:["path"],additionalProperties:!1},zl={type:"object",properties:{success:{type:"boolean"},workspace:Ll,error:{type:"string"}},required:["success"]},Ya={type:"object",properties:{id:{type:"string"},name:{type:"string"},path:{type:"string"},color:{type:"string"},env:{type:["object","null"],additionalProperties:{type:"string"}},envFile:{type:["string","null"]}},required:["id"],additionalProperties:!1},Ka={type:"object",properties:{id:{type:"string"}},required:["id"]},Va={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success"]},Qa={type:"object",properties:{eventName:{type:"string"},payload:{type:["object","null","string","number","boolean","array"]}},required:["eventName"]},Za={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},triggered:{type:"array",items:{type:"string"}}},required:["success","triggered"]},Xa={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"]},Rl={type:"object",properties:{success:{type:"boolean"},taskName:{type:"string"},tasks:{type:"array",items:Xa},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"]},ep={type:"object",properties:{taskName:{type:"string"}},required:["taskName"],additionalProperties:!1},tp={type:"object",properties:{success:{type:"boolean"},reports:{type:"array",items:Rl}},required:["success","reports"]},rp={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"]},ip={type:"object",properties:{parentId:{type:"string"}},required:["parentId"],additionalProperties:!1},np={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:rp}},required:["parentId","totalCount","successCount","errorCount","status"]},op={type:"object",properties:{success:{type:"boolean"},report:np,error:{type:"string"}},required:["success"]},lp={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},sp={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"]},ap={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},cancelled:{type:"array",items:{type:"string"}}},required:["success","message","cancelled"]},pp={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},removed:{type:"array",items:{type:"string"}}},required:["success","message","removed"]},Ol={type:"object",properties:{name:{type:"string"},dir:{type:"string"},port:{type:["number","null"]},isDefault:{type:"boolean"},active:{type:"boolean"}},required:["name","dir","isDefault","active"]},dp={type:"object",properties:{},additionalProperties:!1},cp={type:"object",properties:{current:{type:"string"},pinnedByEnv:{type:"boolean"},profiles:{type:"array",items:Ol}},required:["current","pinnedByEnv","profiles"]},up={type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1},fp={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},current:{type:"string"},restartRequired:{type:"boolean"}},required:["success","message","current","restartRequired"]},gp={type:"object",properties:{name:{type:"string"},port:{type:"number"}},required:["name"],additionalProperties:!1},yp={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},profile:Ol,error:{type:"string"}},required:["success"]},mp={type:"object",properties:{name:{type:"string"}},required:["name"],additionalProperties:!1},bp={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},xp=ta.Rpc.define({id:"opencode-windows-scheduler",methods:{get_tasks:{input:Qn,output:ia},create_task:{input:na,output:oa},delete_task:{input:la,output:Nr},run_task:{input:sa,output:aa},pause_task:{input:Cl,output:Nr},resume_task:{input:Cl,output:Nr},update_task:{input:Ga,output:Wa},get_task_logs:{input:pa,output:da},get_history:{input:ua,output:fa},get_metrics:{input:ya,output:ma},get_dashboard_port:{input:ba,output:xa},get_platform:{input:va,output:ha},dry_run:{input:ep,output:Rl},dry_run_all:{input:Qn,output:tp},get_matrix_results:{input:ip,output:op},cancel_matrix:{input:Zi,output:ap},cleanup_matrix_orphans:{input:Qn,output:pp},cleanup_history:{input:Ea,output:Aa},get_analytics:{input:Pa,output:Ma},expand_matrix_preview:{input:lp,output:sp},get_workspaces:{input:Ua,output:Ha},add_workspace:{input:Ja,output:zl},update_workspace:{input:Ya,output:zl},delete_workspace:{input:Ka,output:Va},get_profiles:{input:dp,output:cp},set_profile:{input:up,output:fp},create_profile:{input:gp,output:yp},delete_profile:{input:mp,output:bp},export_tasks:{input:$a,output:wa},import_tasks:{input:_a,output:ka},get_settings:{input:Sa,output:Ca},save_settings:{input:za,output:Ta},get_templates:{input:qa,output:Da},save_template:{input:ja,output:Na},delete_template:{input:Ba,output:Fa},emit_event:{input:Qa,output:Za},test_notification:{input:La,output:Ra},send_digest:{input:Oa,output:Ia}},events:{}});var vp=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 title="Запуски именно этой задачи: успешные / частичные / ошибки и таймауты"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>✏️'),hp=e.template("<span>📦 "),$p=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 (<!>)'),wp=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 '),_p=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>👁️"),kp=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 #64d2ff;color:#64d2ff;background:rgba(100,210,255,0.12)">🌍 '),Sp=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 #bf5af2;color:#bf5af2;background:rgba(191,90,242,0.12)">🪟 <!>–'),Cp=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 #ffd60a;color:#ffd60a;background:rgba(255,214,10,0.12)">⏸ до '),zp=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>⚡"),Tp=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>📡"),Ep=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 #30d158;color:#30d158;background:rgba(48,209,88,0.12)">'),Ap=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>🧠 "),Pp=e.template("<span style=font-size:12px;flex-shrink:0;cursor:help;color:#f5a623;white-space:nowrap>🚀 "),Mp=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>🔒"),Lp=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>🔗 Зависит от: "),Rp=e.template("<div style=display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35><span>📦 Matrix: <!>/<!> успешных"),Op=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>"),Ip=e.template("<span>→ "),qp=e.template("<div style=font-size:12px;color:#f5a623;font-weight:600;white-space:nowrap>🟡 Выполняется: <!> сек"),Dp=e.template("<div style=font-size:12px;font-weight:600;white-space:nowrap>"),jp=e.template("<button>⛔"),Np=e.template("<button>🗑"),Bp=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>✕'),Fp=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Запусков пока нет.'),Gp=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> мс'),Wp=e.template("<span style=color:#c084fc;white-space:nowrap>🧠 "),Up=e.template("<span style=whiteSpace:nowrap>⚡ pre: "),Hp=e.template("<span style=whiteSpace:nowrap>⚡ post: "),Jp=e.template("<div style=margin-top:2px;color:#ff6b6b;font-size:11px;white-space:pre-wrap;word-break:break-word>"),Yp=e.template('<span title="Запущена следующая задача в цепочке"style=color:#5ac8fa;font-size:11px;white-space:nowrap>🔗 → '),Kp=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>✕'),Vp=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Симуляция…'),Qp=e.template('<div style="font-size:12px;color:#ff6b6b;padding:6px 0">❌ '),Zp=e.template("<div style=display:flex;flex-direction:column;gap:4px>"),Xp=e.template('<div style="font-size:11px;color:#f5a623;padding:4px 0">⚠ '),ed=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>$ '),td=e.template("<span style=color:#5ac8fa;white-space:nowrap>📦 "),rd=e.template("<span style=color:#ff9f0a;white-space:nowrap>↳ matrix "),id=e.template("<span style=cursor:help>🔒"),nd=e.template("<span style=color:#8e8e93;white-space:nowrap>⏱ ~<!> с"),od=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~<!> ток."),ld=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~$"),sd=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ pre: "),ad=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ post: "),pd=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>✅ QG: "),dd=e.template('<div style="font-size:11px;color:#b0b0b0;padding:4px 0">Σ '),cd=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 title="Суммарные метрики по всем задачам (включая архивные записи метрик)"style=margin-top:4px;font-size:11px;color:#8e8e93>📊 Всего по всем задачам: <!> · ✅ <!> · ❌ </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>👤 </button><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;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>Задачи'),Tl=e.template("<div style=padding:16px;color:#ff3b30;font-size:13px>Ошибка UI: "),El=e.template("<option>📦 "),ud=e.template('<div style="background:#1e1e1e;border:1px solid #333;border-radius:10px;padding:12px 14px;display:flex;flex-direction:column;gap:8px"><div style=display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap><div style=font-size:12px;font-weight:600;color:#e0e0e0>👤 Профили</div><button>+ Создать</button></div><div style=display:flex;flex-direction:column;gap:6px></div><div style=font-size:11px;color:#8e8e93>У каждого профиля своя БД, настройки, логи и порт дашборда. После переключения перезапустите OpenCode.'),fd=e.template("<div style=font-size:11px;color:#ffd60a>Профиль задан переменной OPENCODE_SCHEDULER_PROFILE. Переключение в GUI недоступно."),gd=e.template("<div style=display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px><span></span><span style=font-size:11px;color:#8e8e93></span><span style=font-size:11px;color:#8e8e93;overflow:hidden;text-overflow:ellipsis;max-width:340px>"),yd=e.template("<span style=font-size:11px;color:#34c759>активен"),md=e.template("<button>Переключить"),bd=e.template("<button>Удалить"),xd=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 style=display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:11px;color:#b0b0b0><span>Таймаут, мс:</span><input type=number min=1000 max=120000 step=1000 style="width:80px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><span>повторов:</span><input type=number min=0 max=5 style="width:56px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><span>пауза, мс:</span><input type=number min=100 max=60000 step=100 style="width:80px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"></div><div style=font-size:11px;color:#8e8e93>Повтор при сетевой ошибке, таймауте, 5xx и 429 (экспоненциальная пауза).</div></div><div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px"><div style=font-size:12px;color:#e0e0e0;font-weight:600>Фильтры по задачам</div><input type=text placeholder="Только эти задачи (через запятую, * — маска)"><input type=text placeholder="Исключить задачи (через запятую, * — маска)"><div style=font-size:11px;color:#8e8e93>Пустой список «только» = все задачи. Исключения важнее включений.</div></div><div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px"><div style=font-size:12px;color:#e0e0e0;font-weight:600>Шаблоны сообщений</div><input type=text placeholder="✅ Задача &quot;{task}&quot; выполнена ({duration})"><input type=text placeholder="❌ Задача &quot;{task}&quot; упала ({duration}){error}"><div style=font-size:11px;color:#8e8e93>Плейсхолдеры: {task} {status} {duration} {error} {emoji}. Пусто = шаблон по умолчанию.</div></div><div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px"><div style=font-size:12px;color:#e0e0e0;font-weight:600>Матрицы</div><label><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Уведомлять о завершении матриц</label><div><label style=display:flex;align-items:center;gap:6px;cursor:pointer><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>partial</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>все упали</label><span>зависший клон, мин:</span><input type=number min=0 max=10080 style="width:72px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"></div><div style=font-size:11px;color:#8e8e93>Клон, выполняющийся дольше указанного времени, уведомляется один раз. 0 — выключить.</div></div><div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px"><div style=font-size:12px;color:#e0e0e0;font-weight:600>Дайджест</div><label><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Отправлять дайджест</label><div><select style="padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><option value=daily>ежедневно</option><option value=weekly>еженедельно (Пн)</option></select><input type=time style="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></span></div><div style=font-size:11px;color:#8e8e93>Запуски, success rate, стоимость и топ ошибок за сутки/неделю.</div></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><button></button><button></button><span style=font-size:11px;color:#8e8e93>ntfy.sh не используется — только webhook.'),vd=e.template('<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px"><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><label style=font-size:12px;color:#e0e0e0;white-space:nowrap>Удалять записи старше, дней</label><input type=number min=0 style="width:70px;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>0 = не удалять по возрасту</span></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><label style=font-size:12px;color:#e0e0e0;white-space:nowrap>Хранить не более записей</label><input type=number min=0 style="width:80px;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>0 = без ограничения</span></div><div style=font-size:11px;color:#8e8e93>Последняя очистка: </div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><button></button><span style=font-size:11px;color:#8e8e93>Удаляются только завершённые записи; незавершённые запуски не трогаются.'),hd=e.template('<div style="display:flex;flex-direction:column;gap:6px;padding:0 14px 12px">'),$d=e.template('<div style="font-size:12px;color:#8e8e93;padding:4px 0">Workspace не добавлен. Задача без workspace использует рабочую директорию проекта.'),wd=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><span style=font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>env: </span></div><div style=display:flex;gap:4px;flex-shrink:0><button title="Env-переменные 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:#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>🗑'),_d=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">➕ Создать задачу'),kd=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;flex-wrap:wrap><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><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>Разово</label></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>Сессия OpenCode</label><div style=display:flex;gap:8px;flex-wrap:wrap><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=sessionMode style=accent-color:#007acc>Новая</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=sessionMode style=accent-color:#007acc>Переиспользовать</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=sessionMode style=accent-color:#007acc>Последняя (--continue)</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 style=display:block;width:100%;margin-top:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Часовой пояс (IANA)</label><input type=text list=iana-timezones 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"><datalist id=iana-timezones><option value=Europe/Moscow></option><option value=Europe/London></option><option value=Europe/Berlin></option><option value=America/New_York></option><option value=America/Los_Angeles></option><option value=Asia/Almaty></option><option value=Asia/Tokyo></option><option value=UTC></option></datalist><div style=display:block;margin-top:6px;font-size:11px;color:#808080>Другая зона — задача будится каждую минуту, cron проверяется с учётом пояса.</div></div><div style=display:block;width:100%;margin-top:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Окно запуска (необязательно)</label><div style=display:flex;gap:8px;align-items:center><input type=time title="Начало окна"style="display:block;flex:1;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"><span style=color:#808080;font-size:12px>—</span><input type=time title="Конец окна (может быть меньше начала)"style="display:block;flex:1;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;margin-top:6px;font-size:11px;color:#808080>Вне окна запуск переносится на его открытие, а не пропускается. Например 22:00 — 06:00.</div></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><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>'),Sd=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">'),Cd=e.template("<div style=font-size:11px;color:#f5a623>Сначала добавьте хотя бы один workspace."),zd=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">'),Td=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>"),Ed=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>'),Ad=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">'),Pd=e.template("<div style=color:#ff9f0a;font-weight:600>Будет создано <!> клон(а/ов):"),Md=e.template("<div style=color:#e0e0e0;word-break:break-all>"),Ld=e.template("<span style=color:#f5a623>Выберите хотя бы один workspace — превью клонов появится здесь."),Rd=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 — рабочая директория'),Od=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>'),Id=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.'),qd=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">'),Dd=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">'),jd=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">'),Nd=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=&quot;my-project&quot; или 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.'),Bd=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="2026-11-14T10:00:00.000Z или локальная дата"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:6px 0">Или задержка в секундах от нажатия кнопки «Создать задачу»:</div><input type=number min=1 placeholder="например, 3600"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>Приоритет у runAt: если задано время, delaySeconds игнорируется. После запуска задача больше не повторится.'),Fd=e.template('<div style=margin-top:8px><label style=display:block;margin-bottom:6px;font-size:11px;color:#8e8e93>Сколько запусков переживает сессия (sessionMaxRuns, необязательно)</label><input type=number min=1 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>sessionId генерируется плагином автоматически. При достижении лимита сессия удаляется, следующий запуск начинает чистую сессию.'),Qi=e.template("<option>"),Gd=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">'),Wd=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">'),Ud=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>🗑'),Hd=e.template("<span style=font-size:11px;color:#ff3b30;font-weight:500;cursor:default>"),Jd=e.template("<option>Другой (<!>)"),Yd=e.template("<span style=font-size:12px;color:#8e8e93>Других задач пока нет"),Zn=e.template("<label><input type=checkbox style=margin:0>"),Kd=e.template("<span style=color:#5ac8fa;font-size:11px;margin-left:6px>(<!> allowed · <!> denied)"),Vd=e.template("<div style=font-size:11px;color:#cfcfd2;margin-top:8px>"),Qd=e.template("<div>allowed: [<!>]"),Zd=e.template("<div>denied: [<!>]"),Xd=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%">Отмена'),ec=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>✕'),tc=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: "),rc=e.template("<div style=color:#8e8e93>🔒 allowed=[<!>] · denied=[<!>]"),ic=e.template("<div style=color:#8e8e93>⚡ pre: "),nc=e.template("<div style=color:#8e8e93>⚡ post: "),oc=e.template("<div style=color:#8e8e93>✅ QG: "),lc=e.template("<div style=color:#f5a623>⚠ "),sc=e.template("<div style=font-size:11px;color:#8e8e93;margin-bottom:8px>Фильтр: <!> · показано <!> из "),ac=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>'),pc=e.template("<div style=display:flex;flex-direction:column;gap:0>"),dc=e.template('<div style=position:fixed;inset:0;background:rgba(0,0,0,0.55);display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px><div style="width:min(540px,100%);background:#1e1e1e;border:1px solid #444;border-radius:10px;padding:16px;display:flex;flex-direction:column;gap:12px;box-shadow:0 12px 40px rgba(0,0,0,0.6)"><div style=font-size:13px;font-weight:600;color:#e0e0e0;white-space:pre-wrap></div><div style=display:flex;justify-content:flex-end;gap:8px><button style="padding:6px 14px;border-radius:6px;border:1px solid #3a3a3a;background:#262626;color:#e0e0e0;font-size:12px;cursor:pointer">Отмена</button><button style="padding:6px 14px;border-radius:6px;border:1px solid #0a84ff;background:#0a84ff;color:#fff;font-size:12px;font-weight:600;cursor:pointer">ОК'),cc=e.template(`<textarea autofocus rows=6 style="width:100%;box-sizing:border-box;resize:vertical;padding:8px 10px;border-radius:8px;border:1px solid #3a3a3a;background:#141414;color:#e0e0e0;font-family:Menlo, Monaco, 'Courier New', monospace;font-size:12px;outline:none">`),uc=e.template('<input autofocus style="width:100%;box-sizing:border-box;padding:8px 10px;border-radius:8px;border:1px solid #3a3a3a;background:#141414;color:#e0e0e0;font-size:13px;outline:none">'),fc=e.template("<div style=font-size:11px;color:#8e8e93>Ctrl+Enter — сохранить, Escape — отмена"),gc=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">`),yc=e.template("<div style=white-space:pre-wrap;margin-bottom:2px>"),mc=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 bc(c){switch(c){case"running":return"#f5a623";case"success":return"#34c759";case"error":return"#ff3b30";case"partial":return"#ff9f0a";default:return"#8e8e93"}}const Be=5;function Al(c){const w=typeof c=="number"&&Number.isFinite(c)?Math.min(10,Math.max(0,Math.floor(c))):Be;return w>=10?"Критический":w>=8?"Высокий":w<=3?"Низкий":"Обычный"}const Pl=[{value:2,label:"Низкий"},{value:5,label:"Обычный"},{value:8,label:"Высокий"},{value:10,label:"Критический"}];function U(c){return c instanceof Error?c.message:typeof c=="object"&&c!==null&&"message"in c?String(c.message):JSON.stringify(c)}function Ee(c,w=150){const Ze=(c||"").split(/\r?\n/).map(Xi=>Xi.trim()).find(Boolean)??"";return Ze.length>w?Ze.slice(0,w-1).trimEnd()+"…":Ze}const Xn=[{label:"Каждую минуту",value:"* * * * *"},{label:"Каждый час",value:"0 * * * *"},{label:"Каждый день в 09:00",value:"0 9 * * *"},{label:"Каждый понедельник в 10:00",value:"0 10 * * 1"},{label:"Свое расписание…",value:"__custom__"}],xc=Vn.Plugin.define({setup(c){const w=c.client.rpc(xp),[Ze,Xi]=p.createSignal([]),[se,Il]=p.createSignal([]),[en,ql]=p.createSignal(!1),[ct,io]=p.createSignal("all"),[ut,Fe]=p.createSignal(!1),[ft,Ge]=p.createSignal(""),[Dl,jl]=p.createSignal([]),[no,oo]=p.createSignal("default"),[gt,Nl]=p.createSignal(!1),[Fr,Bl]=p.createSignal(!1),[yt,mt]=p.createSignal(!1),[Fl,lo]=p.createSignal(!1),[tn,Gl]=p.createSignal(""),[Dt,rn]=p.createSignal("");let Gr=null;function We(r,t=""){return Gr?.(null),new Promise(i=>{Gr=i,Gl(r),rn(t),lo(!0)})}function Xe(r){const t=Gr;Gr=null,lo(!1),t?.(r)}const[Wl,bt]=p.createSignal(""),[nn,on]=p.createSignal(null),[jt,so]=p.createSignal(!1),[ao,Wr]=p.createSignal(""),[ln,Ul]=p.createSignal({total:0,success:0,error:0}),[Ur,po]=p.createSignal(null),[co,Hl]=p.createSignal([]),uo=[{label:"Свой промпт",value:"custom",prompt:""},{label:"Ночной сторож (тесты)",value:"night-watch",prompt:"Запусти ночные проверки: прогнали тесты, зафиксируй ошибки и составь краткий отчёт о состоянии репозитория."},{label:"Утренний дайджест",value:"morning-digest",prompt:"Собери утренний дайджест: какие изменения были за ночь, есть ли проваленные сборки, что требует внимания сегодня."},{label:"Гигиена кода",value:"code-hygiene",prompt:"Проведи аудит гигиены кода: найди неиспользуемые импорты, неиспользуемые переменные, лишние зависимости и предложи правки."}],[Nt,Hr]=p.createSignal("custom"),[Jr,Jl]=p.createSignal([]),[Yl,Kl]=p.createSignal(0);setInterval(()=>Kl(r=>r+1),1e3);const[Vl,sn]=p.createSignal(1),[we,an]=p.createSignal(!1),[A,fo]=p.createSignal(!1),[pn,go]=p.createSignal(!0),[ae,yo]=p.createSignal(!1),[mo,bo]=p.createSignal(""),[dn,Ql]=p.createSignal(!0),[Yr,xo]=p.createSignal(!1),[vo,ho]=p.createSignal(1e4),[$o,wo]=p.createSignal(2),[_o,ko]=p.createSignal(1e3),[So,Co]=p.createSignal(""),[zo,To]=p.createSignal(""),[Eo,Ao]=p.createSignal(""),[Po,Mo]=p.createSignal(""),[xt,Lo]=p.createSignal(!0),[Ro,Oo]=p.createSignal(!0),[Io,qo]=p.createSignal(!0),[Do,jo]=p.createSignal(60),[Bt,No]=p.createSignal(!1),[Bo,Fo]=p.createSignal("daily"),[Go,Wo]=p.createSignal("09:00"),[cn,Zl]=p.createSignal(null),[Kr,Uo]=p.createSignal(!1),[Vr,Qr]=p.createSignal(30),[Zr,Xr]=p.createSignal(5e3),[un,fn]=p.createSignal(null),[Ho,gn]=p.createSignal(0),[yn,Xl]=p.createSignal(!0),[ei,Jo]=p.createSignal(!1),vt=new Map;p.onCleanup(()=>{for(const r of vt.values())clearInterval(r);vt.clear()});const[mn,es]=p.createSignal("Планировщик задач");async function ts(){try{const r=await w.get_platform({});r?.title&&es(r.title)}catch(r){console.error("RPC Error (get_platform):",r)}}function Yo(r){fo(!!r?.enabled),go(r?.onlyOnError!==!1),yo(!!r?.webhook?.enabled),bo(r?.webhook?.url??""),ho(Number(r?.webhook?.timeoutMs??1e4)),wo(Number(r?.webhook?.retryCount??2)),ko(Number(r?.webhook?.retryDelayMs??1e3)),Co(r?.templates?.success??""),To(r?.templates?.error??""),Ao((r?.filters?.include??[]).join(", ")),Mo((r?.filters?.exclude??[]).join(", ")),Lo(r?.matrix?.enabled!==!1),Oo(r?.matrix?.onPartial!==!1),qo(r?.matrix?.onAllFailed!==!1),jo(Number(r?.matrix?.stuckAfterMinutes??60)),No(!!r?.digest?.enabled),Fo(r?.digest?.frequency==="weekly"?"weekly":"daily"),Wo(r?.digest?.time??"09:00"),Zl(r?.digest?.lastSentAt??null)}async function rs(){try{const r=await w.get_settings({});sn(r.maxConcurrent??1),an(!!r.winterMode),Yo(r.notifications);const t=r.history;Qr(Number(t?.retentionDays??30)),Xr(Number(t?.maxRecords??5e3)),fn(t?.lastCleanupAt??null),gn(Number(t?.lastCleanupDeleted??0))}catch(r){console.error("RPC Error (get_settings):",r)}}function is(){const r=t=>t.split(",").map(i=>i.trim()).filter(i=>i.length>0);return{enabled:A(),onlyOnError:pn(),webhook:{enabled:ae(),url:(mo()||"").trim(),timeoutMs:Math.max(1e3,Math.min(12e4,Math.floor(Number(vo())||1e4))),retryCount:Math.max(0,Math.min(5,Math.floor(Number($o())||0))),retryDelayMs:Math.max(100,Math.min(6e4,Math.floor(Number(_o())||1e3)))},templates:{success:So().trim(),error:zo().trim()},filters:{include:r(Eo()),exclude:r(Po())},matrix:{enabled:xt(),onPartial:Ro(),onAllFailed:Io(),stuckAfterMinutes:Math.max(0,Math.min(10080,Math.floor(Number(Do())||0)))},digest:{enabled:Bt(),frequency:Bo(),time:(Go()||"09:00").trim(),lastSentAt:cn()}}}function Ko(){return{retentionDays:Math.max(0,Math.floor(Number(Vr())||0)),maxRecords:Math.max(0,Math.floor(Number(Zr())||0)),lastCleanupAt:un(),lastCleanupDeleted:Math.max(0,Math.floor(Number(Ho())||0))}}async function Ft(r){try{const t=await w.save_settings(r);if(r.maxConcurrent!==void 0&&sn(t.maxConcurrent),r.winterMode!==void 0&&an(!!t.winterMode),r.notifications!==void 0&&Yo(t.notifications),r.history!==void 0){const i=t.history;Qr(Number(i?.retentionDays??30)),Xr(Number(i?.maxRecords??5e3)),fn(i?.lastCleanupAt??null),gn(Number(i?.lastCleanupDeleted??0))}}catch(t){console.error("RPC Error (save_settings):",t),c.toast.show({title:"Не удалось сохранить настройки",variant:"error",description:U(t)})}}async function Y(){await Ft({notifications:is()})}async function Vo(){await Ft({history:Ko()})}async function ns(){Jo(!0);try{await Ft({history:Ko()});const r=await w.cleanup_history({}),i=(await w.get_settings({})).history;Qr(Number(i?.retentionDays??30)),Xr(Number(i?.maxRecords??5e3)),fn(i?.lastCleanupAt??null),gn(Number(i?.lastCleanupDeleted??0)),c.toast.show({title:r.success?"Очистка истории завершена":"Очистка не удалась",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (cleanup_history):",r),c.toast.show({title:"Очистка не удалась",variant:"error",description:U(r)})}finally{Jo(!1)}}async function os(){xo(!0);try{await Y();const r=await w.test_notification({});c.toast.show({title:r.success?"Тестовое уведомление отправлено":"Тест не удался",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (test_notification):",r),c.toast.show({title:"Тест не удался",variant:"error",description:U(r)})}finally{xo(!1)}}async function ls(){Uo(!0);try{await Y();const r=await w.send_digest({});c.toast.show({title:r.success?"Дайджест отправлен":"Дайджест не отправлен",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (send_digest):",r),c.toast.show({title:"Дайджест не отправлен",variant:"error",description:U(r)})}finally{Uo(!1)}}async function ss(r){sn(r),await Ft({maxConcurrent:r})}async function as(r){an(r),await Ft({winterMode:r})}const[bn,ti]=p.createSignal(null),[ps,xn]=p.createSignal(!1),[_e,ri]=p.createSignal(""),[ii,ht]=p.createSignal("* * * * *"),[$t,wt]=p.createSignal(""),[Qo,Gt]=p.createSignal("* * * * *"),[ni,Wt]=p.createSignal(0),[oi,Ut]=p.createSignal(60),[Ht,Jt]=p.createSignal(""),[et,Yt]=p.createSignal(Be),[li,Kt]=p.createSignal(""),[tt,Vt]=p.createSignal([]),[si,Qt]=p.createSignal(""),[ai,Zt]=p.createSignal(""),[ne,Ue]=p.createSignal("cron"),[vn,Xt]=p.createSignal(""),[hn,pi]=p.createSignal(""),[di,ci]=p.createSignal(""),[Ae,_t]=p.createSignal("new"),[er,ui]=p.createSignal(""),[fi,tr]=p.createSignal(""),[gi,rr]=p.createSignal(""),[yi,ir]=p.createSignal(""),[$n,nr]=p.createSignal(""),[wn,or]=p.createSignal(""),[lr,sr]=p.createSignal(""),[mi,kt]=p.createSignal(""),[X,St]=p.createSignal([]),[ee,Ct]=p.createSignal([]),[Zo,Xo]=p.createSignal(""),[Pe,bi]=p.createSignal(!1),[Me,ar]=p.createSignal([]),[_n,xi]=p.createSignal("parallel"),[el,vi]=p.createSignal("continue"),[tl,hi]=p.createSignal("summary"),[rl,$i]=p.createSignal(!1),[wi,_i]=p.createSignal(""),[kn,ki]=p.createSignal({}),[pr,Sn]=p.createSignal(!1),[Cn,il]=p.createSignal(!1),[te,dr]=p.createSignal(null),[cr,zn]=p.createSignal(""),nl=["bash","edit","write","read","grep","glob","webfetch"];function ol(r,t){r==="allowed"?St(i=>i.includes(t)?i.filter(l=>l!==t):[...i,t]):Ct(i=>i.includes(t)?i.filter(l=>l!==t):[...i,t])}function ll(r){const t=Zo().trim();t&&(r==="allowed"?X().includes(t)||St([...X(),t]):ee().includes(t)||Ct([...ee(),t]),Xo(""))}function ds(r,t){ar(i=>t?i.includes(r)?i:[...i,r]:i.filter(l=>l!==r))}function Tn(r,t){const i=r.trim()||"task",l=t.trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-");return`${i}-matrix-${l||"workspace"}`}const En=()=>Me().map(r=>se().find(t=>t.id===r)).filter(r=>!!r).map(r=>Tn(_e(),r.name));function ur(r,t,i){ki(l=>{const N={...l[r]??{}};i.trim()?N[t]=i:delete N[t];const K={...l};return Object.keys(N).length>0?K[r]=N:delete K[r],K})}const cs=()=>Object.keys(kn()).length,sl=()=>{if(!Pe())return;const r=wi().trim(),t=r?Number(r):void 0,i=kn();return{workspaceIds:Me(),strategy:_n(),failureMode:el(),aggregation:tl(),createAggregator:rl(),...t!==void 0&&Number.isFinite(t)&&t>=1?{concurrency:Math.floor(t)}:{},...Object.keys(i).length>0?{overrides:i}:{}}};function Si(){bi(!1),ar([]),xi("parallel"),vi("continue"),hi("summary"),$i(!1),_i(""),ki({})}function us(){const r=Ht().trim()?` --model ${Ht().trim()}`:"",t=Ae()==="last"?" --continue":Ae()==="reuse"?" --session <id>":"";return`opencode run${r}${t} "${$t().replace(/\s+/g," ").trim()}"`}const[vc,fs]=p.createSignal(null),[Ci,al]=p.createSignal(!1),[zi,hc]=p.createSignal(!1),[$c,gs]=p.createSignal(null);async function ys(){al(!0);try{const r=await w.export_tasks({});if(!r.success){c.toast.show({title:"Ошибка экспорта",variant:"error",description:r.error});return}fs(r.data);const t=new Blob([r.data],{type:"application/json"}),i=URL.createObjectURL(t),l=document.createElement("a");l.href=i,l.download=`windows-scheduler-tasks-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(i),c.toast.show({title:`Экспортировано задач: ${r.count}`,variant:"success"})}catch(r){console.error("RPC Error (export_tasks):",r),c.toast.show({title:"Ошибка экспорта",variant:"error",description:U(r)})}finally{al(!1)}}function ms(r){const i=r.target.files?.[0]??null;gs(i)}async function An(){try{const r=await w.get_templates({}),t=Array.isArray(r?.templates)?r.templates:[];Jl(t)}catch(r){console.error("RPC Error (get_templates):",r)}}async function fr(){try{const r=await w.get_workspaces({}),t=Array.isArray(r?.workspaces)?r.workspaces:[];Il(t)}catch(r){console.error("RPC Error (get_workspaces):",r)}}const gr=()=>se().find(r=>r.id===ft());async function Ti(){try{const r=await w.get_profiles({}),t=Array.isArray(r?.profiles)?r.profiles:[];jl(t),r?.current&&oo(r.current),Nl(!!r?.pinnedByEnv)}catch(r){console.error("RPC Error (get_profiles):",r)}}async function bs(r){if(!(!r||r===no())){mt(!0);try{const t=await w.set_profile({name:r});if(!t.success){c.toast.show({title:"Не удалось переключить профиль",variant:"error",description:t.message??"Неизвестная ошибка"});return}oo(t.current??r),c.toast.show({title:"Профиль переключён",variant:"success",description:t.message}),await Ti()}catch(t){console.error("RPC Error (set_profile):",t),c.toast.show({title:"Ошибка переключения профиля",variant:"error",description:Ee(U(t))})}finally{mt(!1)}}}async function xs(){const r=(await We("Имя нового профиля (латиница, цифры, - и _)","")??"").trim();if(r){mt(!0);try{const t=await w.create_profile({name:r});if(!t.success){c.toast.show({title:"Не удалось создать профиль",variant:"error",description:t.message??"Неизвестная ошибка"});return}await Ti(),c.toast.show({title:"Профиль создан",variant:"success",description:t.message})}catch(t){console.error("RPC Error (create_profile):",t),c.toast.show({title:"Ошибка создания профиля",variant:"error",description:Ee(U(t))})}finally{mt(!1)}}}async function vs(r){if(!(!r||r==="default")&&window.confirm(`Удалить профиль "${r}" вместе с его БД, настройками и логами?`)){mt(!0);try{const t=await w.delete_profile({name:r});if(!t.success){c.toast.show({title:"Не удалось удалить профиль",variant:"error",description:t.message??"Неизвестная ошибка"});return}await Ti(),c.toast.show({title:"Профиль удалён",variant:"success"})}catch(t){console.error("RPC Error (delete_profile):",t),c.toast.show({title:"Ошибка удаления профиля",variant:"error",description:Ee(U(t))})}finally{mt(!1)}}}function hs(r){return r?Object.entries(r).map(([t,i])=>`${t}=${i}`).join(`
2
+ `):""}function $s(r){const t={};for(const i of r.split(/\r?\n/)){const l=i.trim();if(!l||l.startsWith("#"))continue;const N=l.indexOf("=");if(N<=0)return null;const K=l.slice(0,N).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(K))return null;t[K]=l.slice(N+1).trim()}return t}async function ws(r){const t=await We(`Env-переменные workspace, по одной в строке KEY=VALUE
3
+ (пустое поле — очистить)`,hs(r.env));if(t===null)return;const i=$s(t);if(!i){c.toast.show({title:"Неверный формат env",variant:"error",description:"Нужны строки KEY=VALUE, имя — латиница/цифры/_"});return}const l=await We("Путь к .env-файлу workspace (необязательно, пусто — без файла)",r.envFile??"");if(l!==null){Fe(!0);try{const N=await w.update_workspace({id:r.id,env:Object.keys(i).length?i:null,envFile:l.trim()||null});if(!N.success){c.toast.show({title:"Не удалось сохранить env",variant:"error",description:N.error??"Неизвестная ошибка"});return}await fr(),c.toast.show({title:"Env-переменные сохранены",variant:"success",description:"Секреты маскируются в логах"})}catch(N){console.error("RPC Error (update_workspace env):",N),c.toast.show({title:"Ошибка сохранения env",variant:"error",description:Ee(U(N))})}finally{Fe(!1)}}}async function _s(){const r=(await We("Путь к git-репозиторию (workspace)","")??"").trim();if(!r)return;const t=(await We("Название workspace (необязательно)","")??"").trim();Fe(!0);try{const i=await w.add_workspace({path:r,...t?{name:t}:{}});if(!i.success){c.toast.show({title:"Ошибка добавления workspace",variant:"error",description:i.error??"Неизвестная ошибка"});return}await fr(),i.workspace?.id&&Ge(i.workspace.id),c.toast.show({title:"Workspace добавлен",variant:"success"})}catch(i){console.error("RPC Error (add_workspace):",i),c.toast.show({title:"Ошибка добавления workspace",variant:"error",description:Ee(U(i))})}finally{Fe(!1)}}async function ks(r){const t=(await We("Путь к git-репозиторию",r.path)??"").trim();if(!t)return;const i=(await We("Название workspace",r.name)??"").trim();Fe(!0);try{const l=await w.update_workspace({id:r.id,path:t,...i?{name:i}:{}});if(!l.success){c.toast.show({title:"Ошибка обновления workspace",variant:"error",description:l.error??"Неизвестная ошибка"});return}await fr(),c.toast.show({title:"Workspace обновлён",variant:"success"})}catch(l){console.error("RPC Error (update_workspace):",l),c.toast.show({title:"Ошибка обновления workspace",variant:"error",description:Ee(U(l))})}finally{Fe(!1)}}async function Ss(r){if(window.confirm(`Удалить workspace "${r.name}"? Задачи сохранены, привязка будет очищена.`)){Fe(!0);try{const t=await w.delete_workspace({id:r.id});if(!t.success){c.toast.show({title:"Ошибка удаления workspace",variant:"error",description:t.message??"Неизвестная ошибка"});return}ft()===r.id&&Ge(""),ct()===r.id&&io("all"),await fr(),await ke(),c.toast.show({title:"Workspace удалён",variant:"success",description:t.message})}catch(t){console.error("RPC Error (delete_workspace):",t),c.toast.show({title:"Ошибка удаления workspace",variant:"error",description:Ee(U(t))})}finally{Fe(!1)}}}const Cs=r=>{if(Hr(r),r.startsWith("custom:")){const i=Jr().find(l=>`custom:${l.id}`===r);if(!i)return;if(wt(i.prompt??""),i.schedule){ht(i.schedule);const l=Xn.find(N=>N.value===i.schedule);Gt(l?l.value:"__custom__")}if(Wt(i.retryCount??0),Ut(i.retryDelay??60),Kt(i.qualityGate??""),Jt(i.model??""),Yt(typeof i.priority=="number"?i.priority:Be),Vt(Array.isArray(i.dependsOn)?i.dependsOn:[]),Qt(i.beforeScript??""),Zt(i.afterScript??""),Ue(i.triggerType==="file"?"file":i.triggerType==="mcp-event"?"mcp-event":"cron"),Xt(i.watchPath??""),tr(i.timezone??""),rr(i.notBefore??""),ir(i.notAfter??""),nr(i.mcpEvent?.server??""),or(i.mcpEvent?.event??""),sr(i.mcpEvent?.filter??""),kt(i.workingDirectory??""),Ge(i.workspaceId??""),St(Array.isArray(i.allowedTools)?i.allowedTools:[]),Ct(Array.isArray(i.deniedTools)?i.deniedTools:[]),i.matrix){bi(!0),ar(Array.isArray(i.matrix.workspaceIds)?i.matrix.workspaceIds:[]),xi(i.matrix.strategy==="sequential"?"sequential":"parallel"),vi(i.matrix.failureMode==="stop"?"stop":"continue"),hi(i.matrix.aggregation==="per-task"?"per-task":"summary"),$i(!!i.matrix.createAggregator),_i(typeof i.matrix.concurrency=="number"?String(i.matrix.concurrency):"");const l=i.matrix.overrides;ki(l?{...l}:{})}else Si();return}const t=uo.find(i=>i.value===r);t&&wt(t.prompt)};async function zs(){if(!($t()||"").trim()){c.toast.show({title:"Нечего сохранять",variant:"error",description:"Сначала заполните промпт — он обязателен для шаблона."});return}const r=(await We("Название шаблона","")??"").trim();if(r)try{const t=await w.save_template({name:r,prompt:($t()||"").trim(),schedule:(ii()||"").trim(),timeoutSeconds:3600,model:(Ht()||"").trim(),priority:et(),retryCount:ni(),retryDelay:oi(),qualityGate:(li()||"").trim(),beforeScript:(si()||"").trim(),afterScript:(ai()||"").trim(),dependsOn:tt(),triggerType:ne(),timezone:(fi()||"").trim()||void 0,notBefore:(gi()||"").trim()||void 0,notAfter:(yi()||"").trim()||void 0,mcpEvent:ne()==="mcp-event"?{server:($n()||"").trim(),event:(wn()||"").trim(),...lr().trim()?{filter:lr().trim()}:{}}:void 0,watchPath:(vn()||"").trim(),workingDirectory:(mi()||"").trim(),workspaceId:(ft()||"").trim()||void 0,allowedTools:X().length>0?X():void 0,deniedTools:ee().length>0?ee():void 0,matrix:sl()});if(!t.success){c.toast.show({title:"Не удалось сохранить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}await An();const i=t.template;i?.id&&Hr(`custom:${i.id}`),c.toast.show({title:`Шаблон "${r}" сохранён`,variant:"success"})}catch(t){console.error("RPC Error (save_template):",t),c.toast.show({title:"Ошибка сохранения шаблона",variant:"error",description:U(t)})}}async function Ts(r){if(window.confirm(`Удалить шаблон "${r.name}"?`))try{const t=await w.delete_template({id:r.id});if(!t.success){c.toast.show({title:"Не удалось удалить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}Nt()===`custom:${r.id}`&&Hr("custom"),await An(),c.toast.show({title:`Шаблон "${r.name}" удалён`,variant:"success"})}catch(t){console.error("RPC Error (delete_template):",t),c.toast.show({title:"Ошибка удаления шаблона",variant:"error",description:U(t)})}}async function ke(){try{const r=await w.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(l=>({name:l.name,schedule:l.schedule,status:l.status??"unknown",runsTotal:typeof l.runsTotal=="number"?l.runsTotal:0,runsSuccess:typeof l.runsSuccess=="number"?l.runsSuccess:0,runsError:typeof l.runsError=="number"?l.runsError:0,runsPartial:typeof l.runsPartial=="number"?l.runsPartial:0,nextRun:l.nextRun??void 0,paused:!!l.paused,orphaned:!!l.orphaned,retryCount:l.retryCount??0,retryDelay:l.retryDelay??60,qualityGate:l.qualityGate??void 0,dependsOn:Array.isArray(l.dependsOn)?l.dependsOn:void 0,model:l.model??void 0,priority:typeof l.priority=="number"?l.priority:Be,beforeScript:l.beforeScript??void 0,afterScript:l.afterScript??void 0,triggerType:l.triggerType??"cron",runAt:l.runAt??void 0,session:l.session??void 0,sessionMaxRuns:l.sessionMaxRuns??void 0,mcpEvent:l.mcpEvent??void 0,watchPath:l.watchPath??void 0,timezone:l.timezone??void 0,notBefore:l.notBefore??void 0,notAfter:l.notAfter??void 0,pausedUntil:l.pausedUntil??void 0,workingDirectory:l.workingDirectory??void 0,workspaceId:l.workspaceId??void 0,workspaceName:l.workspaceName??void 0,workspaceColor:l.workspaceColor??void 0,allowedTools:Array.isArray(l.allowedTools)?l.allowedTools:void 0,deniedTools:Array.isArray(l.deniedTools)?l.deniedTools:void 0,matrix:l.matrix??null,matrixParentId:l.matrixParentId??null,isMatrixParent:!!l.isMatrixParent,matrixSummary:l.matrixSummary??null,prompt:l.prompt??""}));Xi(i),console.log("[GUI] jobs:",Ze()),await Es()}catch(r){console.error("RPC Error (get_tasks):",r),c.toast.show({title:"Ошибка загрузки задач",variant:"error",description:Ee(U(r))})}}async function Es(){try{const r=await w.get_metrics({});Ul({total:r.total??0,success:r.success??0,error:r.error??0})}catch(r){console.error("RPC Error (get_metrics):",r)}}async function As(r){po(r);try{const t=await w.get_history({limit:10,taskName:r});Hl(t.records??[])}catch(t){console.error("RPC Error (get_history):",t),c.toast.show({title:"Ошибка загрузки истории",variant:"error",description:U(t)})}}async function Ps(r){Sn(!0),zn(r),il(!0),dr(null);try{const t=await w.dry_run({taskName:r});dr(t)}catch(t){console.error("RPC Error (dry_run):",t),dr({success:!1,error:U(t),tasks:[],warnings:[]})}finally{il(!1)}}function pl(){Sn(!1),zn(""),dr(null)}async function Ms(){so(!0),Wr("");try{const r=await w.create_task({name:(_e()||"").trim(),schedule:(ii()||"").trim(),prompt:($t()||"").trim(),model:(Ht()||"").trim(),priority:et(),retryCount:ni(),retryDelay:oi(),qualityGate:(li()||"").trim(),beforeScript:(si()||"").trim(),afterScript:(ai()||"").trim(),dependsOn:tt(),triggerType:ne(),session:Ae(),...Ae()==="reuse"&&(er()||"").trim()?{sessionMaxRuns:Number((er()||"").trim())}:{},...ne()==="once"?{runAt:(hn()||"").trim()||void 0,delaySeconds:(di()||"").trim()?Number(di().trim()):void 0}:{},timezone:(fi()||"").trim()||void 0,notBefore:(gi()||"").trim()||void 0,notAfter:(yi()||"").trim()||void 0,mcpEvent:ne()==="mcp-event"?{server:($n()||"").trim(),event:(wn()||"").trim(),...lr().trim()?{filter:lr().trim()}:{}}:void 0,watchPath:(vn()||"").trim(),workingDirectory:(mi()||"").trim(),workspaceId:(ft()||"").trim()||void 0,allowedTools:X().length>0?X():void 0,deniedTools:ee().length>0?ee():void 0,matrix:sl()});if(!r.success){const t=Ee(r.message);Wr(t),c.toast.show({title:"Ошибка создания задачи",variant:"error",description:t});return}await new Promise(t=>setTimeout(t,500)),await ke(),ri(""),ht("* * * * *"),wt(""),Gt("* * * * *"),Wt(0),Ut(60),Kt(""),Vt([]),Jt(""),Yt(Be),Qt(""),Zt(""),Ue("cron"),Xt(""),pi(""),ci(""),_t("new"),ui(""),tr(""),rr(""),ir(""),nr(""),or(""),sr(""),kt(""),Ge(""),St([]),Ct([]),Si(),ti(null),Hr("custom"),c.toast.show({title:"Задача создана",variant:"success"})}catch(r){console.error("RPC Error (create_task):",r);const t=Ee(U(r));Wr(t),c.toast.show({title:"Ошибка создания задачи",variant:"error",description:t})}finally{so(!1)}}function Ls(r){const t=new Date().toISOString(),i=vt.get(r);i&&clearInterval(i);let l=0;const N=setInterval(()=>{if(l+=1,l>900){clearInterval(N),vt.delete(r);return}(async()=>{try{const Se=((await w.get_history({limit:50})).records??[]).find(rt=>String(rt.taskName??"").toLowerCase()===r.toLowerCase()&&typeof rt.startedAt=="string"&&rt.startedAt>=t);if(!Se)return;clearInterval(N),vt.delete(r);const ce=Se.status==="success",zt=((Number(Se.durationMs)||0)/1e3).toFixed(1),mr=Se.error?`: ${Se.error}`:"";c.toast.show({title:ce?`Задача "${r}" выполнена`:`Задача "${r}" упала`,variant:ce?"success":"error",description:`${zt}s${mr}`}),await ke()}catch(K){console.error("RPC Error (get_history):",K)}})()},2e3);vt.set(r,N)}async function Rs(r){if(!r||typeof r!="string"){console.error("[GUI] run_task aborted: empty task name");return}try{const t=await w.run_task({name:r});if(!t.success){c.toast.show({title:`Не удалось запустить "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:t.message||`Задача "${r}" запущена`,variant:"success"}),/уже выполняется/i.test(t.message||"")||Ls(r),await ke()}catch(t){console.error("RPC Error (run_task):",t),c.toast.show({title:"Ошибка запуска",variant:"error",description:U(t)})}}async function Os(r){try{const t=await w.pause_task({name:r});if(!t.success){c.toast.show({title:`Не удалось поставить на паузу "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:`Задача "${r}" поставлена на паузу`,variant:"success"}),await ke()}catch(t){console.error("RPC Error (pause_task):",t),c.toast.show({title:"Ошибка паузы",variant:"error",description:U(t)})}}async function Is(r){try{const t=await w.resume_task({name:r});if(!t.success){c.toast.show({title:`Не удалось возобновить "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:`Задача "${r}" возобновлена`,variant:"success"}),await ke()}catch(t){console.error("RPC Error (resume_task):",t),c.toast.show({title:"Ошибка возобновления",variant:"error",description:U(t)})}}async function qs(r){if(window.confirm(`Отменить выполняющиеся клоны матрицы "${r}"?`))try{const t=await w.cancel_matrix({name:r});if(!t.success){c.toast.show({title:"Не удалось отменить матрицу",variant:"error",description:t.message});return}c.toast.show({title:t.message,variant:"success"}),await ke()}catch(t){console.error("RPC Error (cancel_matrix):",t),c.toast.show({title:"Ошибка отмены матрицы",variant:"error",description:U(t)})}}async function Ds(r){const i=Ze().find(l=>l.name===r)?.matrix?`Удалить матрицу "${r}" вместе со всеми клонами и агрегатором?`:`Удалить задачу "${r}"?`;if(window.confirm(i))try{const l=await w.delete_task({name:r});if(!l.success){c.toast.show({title:"Ошибка удаления",variant:"error",description:l.message});return}c.toast.show({title:`Задача "${r}" удалена`,variant:"success"}),nn()===r&&(bt(""),on(null)),bn()?.name===r&&ti(null),await ke()}catch(l){console.error("RPC Error (delete_task):",l),c.toast.show({title:"Ошибка удаления",variant:"error",description:U(l)})}}async function js(r){on(r),bt("Загрузка логов…");try{const t=await w.get_task_logs({name:r});if(!t.success){bt(t.error||"Не удалось загрузить логи"),c.toast.show({title:"Ошибка чтения логов",variant:"error",description:t.error});return}bt(t.logs||"(пусто)")}catch(t){console.error("RPC Error (get_task_logs):",t),bt("Ошибка чтения логов: "+U(t))}}function Ns(r){ti(r),xn(!1),ri(r.name),ht(r.schedule),wt(r.prompt??""),Jt(r.model??""),Yt(typeof r.priority=="number"?r.priority:Be),Wt(r.retryCount??0),Ut(r.retryDelay??60),Kt(r.qualityGate??""),Vt(Array.isArray(r.dependsOn)?r.dependsOn:[]),Qt(r.beforeScript??""),Zt(r.afterScript??""),Ue(r.triggerType??"cron"),Xt(r.watchPath??""),pi(r.runAt??""),ci(""),_t(r.session==="reuse"||r.session==="last"?r.session:"new"),ui(typeof r.sessionMaxRuns=="number"?String(r.sessionMaxRuns):""),tr(r.timezone??""),rr(r.notBefore??""),ir(r.notAfter??""),nr(r.mcpEvent?.server??""),or(r.mcpEvent?.event??""),sr(r.mcpEvent?.filter??""),kt(r.workingDirectory??""),Ge(r.workspaceId??""),St(Array.isArray(r.allowedTools)?r.allowedTools:[]),Ct(Array.isArray(r.deniedTools)?r.deniedTools:[]),r.matrix?(bi(!0),ar(Array.isArray(r.matrix.workspaceIds)?r.matrix.workspaceIds:[]),xi(r.matrix.strategy==="sequential"?"sequential":"parallel"),vi(r.matrix.failureMode==="stop"?"stop":"continue"),hi(r.matrix.aggregation==="per-task"?"per-task":"summary"),$i(!!r.matrix.createAggregator),_i(typeof r.matrix.concurrency=="number"?String(r.matrix.concurrency):""),ki(r.matrix.overrides?{...r.matrix.overrides}:{})):Si();const t=Xn.find(i=>i.value===r.schedule);Gt(t?t.value:"__custom__")}ke(),fr(),Ti(),rs(),ts(),An();const Bs=setInterval(ke,5e3);p.onCleanup(()=>clearInterval(Bs));const Fs=Qo()==="__custom__",Pn=bn()!==null,Gs=()=>{const r=(fi()||"").trim();if(!r)return!0;try{return new Intl.DateTimeFormat("en-US",{timeZone:r}),!0}catch{return!1}},Mn=(r,t,i)=>Number.isInteger(r)&&r>=t&&(i===void 0||r<=i),dl=()=>{const r=(_e()||"").trim();if(!r)return"Укажите имя задачи.";if(!($t()||"").trim())return"Укажите промпт.";if(ne()==="cron"&&!(ii()||"").trim())return"Укажите cron-расписание.";if(ne()==="once"&&!(hn()||"").trim()&&!(di()||"").trim())return"Укажите время запуска или задержку.";if(Pe()&&Me().length===0)return"Выберите хотя бы один workspace для матрицы.";if(Ae()==="reuse"&&(er()||"").trim()&&!/^[1-9]\d*$/.test(er().trim()))return"Лимит запусков сессии — целое положительное число.";if(Pe()&&(wi()||"").trim()&&!/^[1-9]\d*$/.test(wi().trim()))return"Concurrency матрицы — целое положительное число.";if((gi()||"").trim()===""!=((yi()||"").trim()===""))return"Окно запуска задаётся только парой «с/по».";if(!Gs())return"Неизвестная таймзона. Укажите IANA-пояс, например Europe/Moscow.";if(!Mn(et(),0,10))return"Приоритет — целое число от 0 до 10.";if(!Mn(ni(),0))return"Количество повторов — целое число ≥ 0.";if(!Mn(oi(),0))return"Задержка повтора — целое число секунд ≥ 0.";const t=r.toLowerCase();return tt().some(i=>i.trim().toLowerCase()===t)?"Задача не может зависеть от самой себя.":""},Ei=()=>dl()==="",yr=()=>Ze()??[],Ln=()=>{const r=ct();return r==="all"?yr():r==="none"?yr().filter(t=>!t.workspaceId):yr().filter(t=>t.workspaceId===r)},cl=()=>{const r=(bn()?.name??_e()).trim().toLowerCase();return yr().map(t=>t.name).filter(t=>t.trim().toLowerCase()!==r)};function Ws(r,t){Vt(i=>t?i.some(l=>l.toLowerCase()===r.toLowerCase())?i:[...i,r]:i.filter(l=>l.toLowerCase()!==r.toLowerCase()))}const[Us,ul]=p.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 ie(r,t,i=!1){const l=r.currentTarget;l&&(l.style.background=t?"rgba(255,255,255,0.09)":i?"rgba(90,200,250,0.16)":"transparent",l.style.borderColor=t?"#5ac8fa":i?"rgba(90,200,250,0.5)":"#333",l.style.color=t||i?"#5ac8fa":"#cfcfd2")}const Hs=r=>{const t=r.job;return!t||!t.name?null:(()=>{var i=vp(),l=i.firstChild,N=l.firstChild,K=N.firstChild,Q=K.firstChild,Se=Q.firstChild,ce=Q.nextSibling,zt=ce.firstChild,mr=zt.nextSibling,rt=mr.nextSibling,Je=rt.nextSibling,Rn=Je.nextSibling,Ai=Rn.nextSibling;Ai.nextSibling;var Le=K.nextSibling,Pi=N.nextSibling,ue=Pi.firstChild,xe=ue.nextSibling,Re=xe.nextSibling,Ce=Re.nextSibling,fe=Ce.nextSibling,Ye=fe.nextSibling;return e.insert(Se,()=>t.name),e.insert(Q,(()=>{var d=e.memo(()=>!!t.workspaceName);return()=>d()&&(()=>{var s=hp();return s.firstChild,e.insert(s,()=>t.workspaceName,null),e.effect(m=>{var M=`Workspace: ${t.workspaceName}${t.workingDirectory?` (${t.workingDirectory})`:""}`,L=`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 M!==m.e&&e.setAttribute(s,"title",m.e=M),m.t=e.style(s,L,m.t),m},{e:void 0,t:void 0}),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!(t.isMatrixParent&&t.matrix));return()=>d()&&(()=>{var s=$p(),m=s.firstChild,M=m.nextSibling;return M.nextSibling,e.insert(s,()=>t.matrix.workspaceIds.length,M),e.insert(s,(()=>{var L=e.memo(()=>!!t.matrix.concurrency);return()=>L()?` ⚙${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(Q,(()=>{var d=e.memo(()=>!!t.matrixParentId);return()=>d()&&(()=>{var s=wp();return s.firstChild,e.insert(s,()=>t.matrixParentId,null),e.effect(()=>e.setAttribute(s,"title",`Клон матрицы. Родитель: ${t.matrixParentId}`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!t.watchPath);return()=>d()&&(()=>{var s=_p();return e.effect(()=>e.setAttribute(s,"title",`Отслеживание файла: ${t.watchPath}`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!t.timezone);return()=>d()&&(()=>{var s=kp();return s.firstChild,e.insert(s,()=>t.timezone,null),e.effect(()=>e.setAttribute(s,"title",`Часовой пояс задачи: ${t.timezone}`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!(t.notBefore&&t.notAfter));return()=>d()&&(()=>{var s=Sp(),m=s.firstChild,M=m.nextSibling;return M.nextSibling,e.insert(s,()=>t.notBefore,M),e.insert(s,()=>t.notAfter,null),e.effect(()=>e.setAttribute(s,"title",`Окно запуска: ${t.notBefore}–${t.notAfter}. Вне окна запуск переносится на его открытие.`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!t.pausedUntil);return()=>d()&&(()=>{var s=Cp();return s.firstChild,e.insert(s,()=>new Date(t.pausedUntil).toLocaleDateString(),null),e.effect(()=>e.setAttribute(s,"title",`Пауза до ${new Date(t.pausedUntil).toLocaleString()} — задача включится автоматически.`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!(t.beforeScript||t.afterScript));return()=>d()&&(()=>{var s=zp();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(Q,(()=>{var d=e.memo(()=>t.triggerType==="mcp-event");return()=>d()&&(()=>{var s=Tp();return e.effect(()=>e.setAttribute(s,"title",`MCP-событие: ${t.mcpEvent?.event??"—"}${t.mcpEvent?.filter?` (фильтр: ${t.mcpEvent.filter})`:""}`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!(t.session&&t.session!=="new"));return()=>d()&&(()=>{var s=Ep();return e.insert(s,()=>t.session==="reuse"?"⟳ сессия":"↪ продолжение"),e.effect(()=>e.setAttribute(s,"title",t.session==="reuse"?`Переиспользуемая сессия OpenCode${t.sessionId?`: ${t.sessionId}`:""}`:"Продолжение последней сессии OpenCode (--continue)")),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!t.model);return()=>d()&&(()=>{var s=Ap();return s.firstChild,e.insert(s,()=>t.model,null),e.effect(()=>e.setAttribute(s,"title",`Модель LLM: ${t.model}`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>typeof t.priority=="number"&&t.priority!==Be);return()=>d()&&(()=>{var s=Pp();return s.firstChild,e.insert(s,()=>Al(t.priority),null),e.effect(()=>e.setAttribute(s,"title",`Приоритет: ${Al(t.priority)} (${t.priority})`)),s})()})(),null),e.insert(Q,(()=>{var d=e.memo(()=>!!(Array.isArray(t.allowedTools)&&t.allowedTools.length>0||Array.isArray(t.deniedTools)&&t.deniedTools.length>0));return()=>d()?(()=>{var s=Mp();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(K,(()=>{var d=e.memo(()=>!!(Array.isArray(t.dependsOn)&&t.dependsOn.length>0));return()=>d()&&(()=>{var s=Lp(),m=s.firstChild;return m.firstChild,e.insert(m,()=>t.dependsOn.join(" + "),null),s})()})(),ce),e.insert(K,(()=>{var d=e.memo(()=>!!(t.isMatrixParent&&t.matrixSummary));return()=>d()&&(()=>{var s=Rp(),m=s.firstChild,M=m.firstChild,L=M.nextSibling,H=L.nextSibling,k=H.nextSibling;return k.nextSibling,e.insert(m,()=>t.matrixSummary.successCount,L),e.insert(m,()=>t.matrixSummary.totalCount,k),e.insert(m,(()=>{var b=e.memo(()=>t.matrixSummary.errorCount>0);return()=>b()?` · ❌ ${t.matrixSummary.errorCount}`:""})(),null),e.insert(m,(()=>{var b=e.memo(()=>t.matrixSummary.pendingCount>0);return()=>b()?` · ⏳ ${t.matrixSummary.pendingCount}`:""})(),null),e.effect(b=>{var P=t.matrixSummary.message,V=`cursor:help;color:${bc(t.matrixSummary.status)};white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;return P!==b.e&&e.setAttribute(m,"title",b.e=P),b.t=e.style(m,V,b.t),b},{e:void 0,t:void 0}),s})()})(),ce),e.insert(ce,()=>t.runsTotal??0,mr),e.insert(ce,()=>t.runsSuccess??0,Je),e.insert(ce,()=>t.runsPartial??0,Ai),e.insert(ce,()=>t.runsError??0,null),e.insert(K,(()=>{var d=e.memo(()=>!!(t.schedule||t.nextRun));return()=>d()&&(()=>{var s=Op(),m=s.firstChild;return e.insert(m,()=>t.schedule),e.insert(s,(()=>{var M=e.memo(()=>!!t.nextRun);return()=>M()&&(()=>{var L=Ip();return L.firstChild,e.insert(L,()=>t.nextRun,null),L})()})(),null),s})()})(),null),e.insert(Le,(()=>{var d=e.memo(()=>t.status==="running");return()=>d()?(()=>{var s=qp(),m=s.firstChild,M=m.nextSibling;return M.nextSibling,e.insert(s,Yl,M),s})():(()=>{var s=Dp();return e.insert(s,(()=>{var m=e.memo(()=>!!t.orphaned);return()=>m()?"🧟 Нет в планировщике":e.memo(()=>!!t.paused)()?"⏸ Пауза":e.memo(()=>t.status==="success")()?"🟢 Готова":e.memo(()=>t.status==="error")()?"🔴 Ошибка":e.memo(()=>t.status==="partial")()?"🟠 Частично":t.status==="idle"?"⚪ Не запускалась":"⚪ Неизвестно"})()),s})()})()),ue.addEventListener("mouseleave",d=>{ie(d,!1),ul(s=>s===t.name?null:s)}),ue.addEventListener("mouseenter",d=>{ie(d,!0),we()&&ul(t.name)}),ue.$$click=()=>{Rs(t.name)},e.insert(ue,()=>we()&&Us()===t.name?"❄️":"▶"),xe.addEventListener("mouseleave",d=>ie(d,!1)),xe.addEventListener("mouseenter",d=>ie(d,!0)),xe.$$click=()=>{t.orphaned||(t.paused?Is(t.name):Os(t.name))},e.insert(xe,()=>t.paused?"▶":"⏸"),Re.addEventListener("mouseleave",d=>ie(d,!1)),Re.addEventListener("mouseenter",d=>ie(d,!0)),Re.$$click=()=>{js(t.name)},Ce.addEventListener("mouseleave",d=>ie(d,!1,pr()&&cr()===t.name)),Ce.addEventListener("mouseenter",d=>ie(d,!0,pr()&&cr()===t.name)),Ce.$$click=()=>{Ps(t.name)},fe.addEventListener("mouseleave",d=>ie(d,!1,Ur()===t.name)),fe.addEventListener("mouseenter",d=>ie(d,!0,Ur()===t.name)),fe.$$click=()=>{As(t.name)},Ye.addEventListener("mouseleave",d=>ie(d,!1)),Ye.addEventListener("mouseenter",d=>ie(d,!0)),Ye.$$click=()=>{Ns(t)},e.insert(Pi,(()=>{var d=e.memo(()=>!!t.matrix);return()=>d()&&(()=>{var s=jp();return s.addEventListener("mouseleave",m=>ie(m,!1)),s.addEventListener("mouseenter",m=>ie(m,!0)),s.$$click=()=>{qs(t.name)},e.effect(m=>{var M=`Отменить выполняющиеся клоны матрицы "${t.name}"`,L=He();return M!==m.e&&e.setAttribute(s,"title",m.e=M),m.t=e.style(s,L,m.t),m},{e:void 0,t:void 0}),s})()})(),null),e.insert(Pi,(()=>{var d=e.memo(()=>!t.matrixParentId);return()=>d()&&(()=>{var s=Np();return s.addEventListener("mouseleave",m=>ie(m,!1)),s.addEventListener("mouseenter",m=>ie(m,!0)),s.$$click=()=>{Ds(t.name)},e.effect(m=>{var M=t.matrix?`Удалить матрицу "${t.name}" вместе с клонами`:`Удалить "${t.name}"`,L=He();return M!==m.e&&e.setAttribute(s,"title",m.e=M),m.t=e.style(s,L,m.t),m},{e:void 0,t:void 0}),s})()})(),null),e.insert(i,(()=>{var d=e.memo(()=>Ur()===t.name);return()=>d()&&(()=>{var s=Bp(),m=s.firstChild,M=m.firstChild,L=M.nextSibling;return L.addEventListener("mouseleave",H=>{H.target.style.color="#8e8e93"}),L.addEventListener("mouseenter",H=>{H.target.style.color="#ffffff"}),L.$$click=()=>po(null),e.insert(s,(()=>{var H=e.memo(()=>co().length===0);return()=>H()?Fp():co().map(k=>(()=>{var b=Gp(),P=b.firstChild,V=P.nextSibling,Oe=V.nextSibling,Ie=Oe.firstChild;return e.insert(P,()=>new Date(k.startedAt).toLocaleString()),e.insert(V,()=>k.status==="success"?"✅ Успех":"❌ Ошибка"),e.insert(Oe,()=>k.durationMs,Ie),e.insert(b,(()=>{var B=e.memo(()=>!!k.model);return()=>B()&&(()=>{var S=Wp();return S.firstChild,e.insert(S,()=>k.model,null),e.effect(()=>e.setAttribute(S,"title",`Модель: ${k.model}`)),S})()})(),null),e.insert(b,(()=>{var B=e.memo(()=>!!(k.preFlightStatus&&k.preFlightStatus!=="skipped"));return()=>B()&&(()=>{var S=Up();return S.firstChild,e.insert(S,()=>k.preFlightStatus==="success"?"✅":"❌",null),e.effect(j=>{var q=`Pre-flight: ${k.preFlightStatus}`,v=k.preFlightStatus==="success"?"#34c759":"#ff3b30";return q!==j.e&&e.setAttribute(S,"title",j.e=q),v!==j.t&&e.setStyleProperty(S,"color",j.t=v),j},{e:void 0,t:void 0}),S})()})(),null),e.insert(b,(()=>{var B=e.memo(()=>!!(k.postFlightStatus&&k.postFlightStatus!=="skipped"));return()=>B()&&(()=>{var S=Hp();return S.firstChild,e.insert(S,()=>k.postFlightStatus==="success"?"✅":"❌",null),e.effect(j=>{var q=`Post-flight: ${k.postFlightStatus}`,v=k.postFlightStatus==="success"?"#34c759":"#ff3b30";return q!==j.e&&e.setAttribute(S,"title",j.e=q),v!==j.t&&e.setStyleProperty(S,"color",j.t=v),j},{e:void 0,t:void 0}),S})()})(),null),e.insert(b,(()=>{var B=e.memo(()=>!!k.error);return()=>B()&&(()=>{var S=Jp();return e.insert(S,()=>k.error),S})()})(),null),e.insert(b,(()=>{var B=e.memo(()=>!!k.nextTask);return()=>B()&&(()=>{var S=Yp();return S.firstChild,e.insert(S,()=>k.nextTask,null),S})()})(),null),e.effect(B=>{var S=k.startedAt+k.durationMs,j=k.status==="success"?"#34c759":"#ff3b30";return S!==B.e&&e.setAttribute(b,"key",B.e=S),j!==B.t&&e.setStyleProperty(V,"color",B.t=j),B},{e:void 0,t:void 0}),b})())})(),null),s})()})(),null),e.insert(i,(()=>{var d=e.memo(()=>!!(pr()&&cr()===t.name));return()=>d()&&(()=>{var s=Kp(),m=s.firstChild,M=m.firstChild,L=M.nextSibling;return e.insert(m,()=>t.name,L),L.addEventListener("mouseleave",H=>{H.target.style.color="#8e8e93"}),L.addEventListener("mouseenter",H=>{H.target.style.color="#ffffff"}),L.$$click=()=>pl(),e.insert(s,(()=>{var H=e.memo(()=>!!Cn());return()=>H()&&Vp()})(),null),e.insert(s,(()=>{var H=e.memo(()=>!!(!Cn()&&te()&&!te().success));return()=>H()&&(()=>{var k=Qp();return k.firstChild,e.insert(k,()=>te().error??"Симуляция не удалась",null),k})()})(),null),e.insert(s,(()=>{var H=e.memo(()=>!!(!Cn()&&te()&&te().success));return()=>H()&&(()=>{var k=Zp();return e.insert(k,(()=>{var b=e.memo(()=>!!(Array.isArray(te().warnings)&&te().warnings.length>0));return()=>b()&&(()=>{var P=Xp();return P.firstChild,e.insert(P,()=>te().warnings.map(V=>`· ${V}`).join(" | "),null),P})()})(),null),e.insert(k,()=>te().tasks.map(b=>(()=>{var P=ed(),V=P.firstChild,Oe=V.firstChild,Ie=Oe.nextSibling;Ie.nextSibling;var B=V.nextSibling;B.firstChild;var S=B.nextSibling;S.firstChild;var j=S.nextSibling;return j.firstChild,e.insert(V,()=>(b.order??0)+1,Ie),e.insert(V,()=>b.trigger,null),e.insert(B,()=>b.name,null),e.insert(P,(()=>{var q=e.memo(()=>!!b.workspace);return()=>q()&&(()=>{var v=td();return v.firstChild,e.insert(v,()=>b.workspace.name,null),v})()})(),S),e.insert(P,(()=>{var q=e.memo(()=>!!b.matrixParent);return()=>q()&&(()=>{var v=rd();return v.firstChild,e.insert(v,()=>b.matrixParent,null),v})()})(),S),e.insert(S,()=>b.cwd||"(папка проекта)",null),e.insert(P,(()=>{var q=e.memo(()=>!!b.roleScoped);return()=>q()&&(()=>{var v=id();return e.effect(()=>e.setAttribute(v,"title",`allowed=[${(b.roleScoped.allowed??[]).join(", ")}] · denied=[${(b.roleScoped.denied??[]).join(", ")}]`)),v})()})(),j),e.insert(P,(()=>{var q=e.memo(()=>b.estimatedDurationSec!=null);return()=>q()&&(()=>{var v=nd(),it=v.firstChild,nt=it.nextSibling;return nt.nextSibling,e.insert(v,()=>b.estimatedDurationSec,nt),v})()})(),j),e.insert(P,(()=>{var q=e.memo(()=>b.estimatedTokens!=null);return()=>q()&&(()=>{var v=od(),it=v.firstChild,nt=it.nextSibling;return nt.nextSibling,e.insert(v,()=>b.estimatedTokens,nt),v})()})(),j),e.insert(P,(()=>{var q=e.memo(()=>b.estimatedCostUsd!=null);return()=>q()&&(()=>{var v=ld();return v.firstChild,e.insert(v,()=>Number(b.estimatedCostUsd).toFixed(4),null),v})()})(),j),e.insert(j,()=>b.command,null),e.insert(P,(()=>{var q=e.memo(()=>!!b.preFlight);return()=>q()&&(()=>{var v=sd();return v.firstChild,e.insert(v,()=>b.preFlight,null),v})()})(),null),e.insert(P,(()=>{var q=e.memo(()=>!!b.postFlight);return()=>q()&&(()=>{var v=ad();return v.firstChild,e.insert(v,()=>b.postFlight,null),v})()})(),null),e.insert(P,(()=>{var q=e.memo(()=>!!b.qualityGate);return()=>q()&&(()=>{var v=pd();return v.firstChild,e.insert(v,()=>b.qualityGate,null),v})()})(),null),e.effect(()=>e.setAttribute(P,"key",`${b.name}-${b.order}`)),P})()),null),e.insert(k,(()=>{var b=e.memo(()=>!!(te().totals&&(te().totals.estimatedDurationSec!=null||te().totals.estimatedTokens!=null)));return()=>b()&&(()=>{var P=dd();return P.firstChild,e.insert(P,()=>(te().totals.estimatedDurationSec??"—")+" с · "+(te().totals.estimatedTokens??"—")+" токенов"+(te().totals.estimatedCostUsd!=null?` · ~$${Number(te().totals.estimatedCostUsd).toFixed(4)}`:""),null),P})()})(),null),k})()})(),null),s})()})(),null),e.effect(d=>{var s=`background:#252526;border-radius:10px;padding:16px;margin-bottom:12px;display:flex;flex-direction:column;gap:10px;border:1px solid ${we()?"rgba(135, 206, 250, 0.4)":"#333"}`,m=`Запустить "${t.name}"`,M=He(),L=!!t.orphaned,H=t.orphaned?`Задача "${t.name}" отсутствует в планировщике ОС — пауза недоступна`:t.paused?`Возобновить "${t.name}"`:`Поставить на паузу "${t.name}"`,k=He(),b=`Логи "${t.name}"`,P=He(),V=`Dry-Run симуляция "${t.name}"`,Oe=He(pr()&&cr()===t.name),Ie=`История "${t.name}"`,B=He(Ur()===t.name),S=`Редактировать "${t.name}"`,j=He();return d.e=e.style(i,s,d.e),m!==d.t&&e.setAttribute(ue,"title",d.t=m),d.a=e.style(ue,M,d.a),L!==d.o&&(xe.disabled=d.o=L),H!==d.i&&e.setAttribute(xe,"title",d.i=H),d.n=e.style(xe,k,d.n),b!==d.s&&e.setAttribute(Re,"title",d.s=b),d.h=e.style(Re,P,d.h),V!==d.r&&e.setAttribute(Ce,"title",d.r=V),d.d=e.style(Ce,Oe,d.d),Ie!==d.l&&e.setAttribute(fe,"title",d.l=Ie),d.u=e.style(fe,B,d.u),S!==d.c&&e.setAttribute(Ye,"title",d.c=S),d.w=e.style(Ye,j,d.w),d},{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,w:void 0}),i})()};try{return c.add(Vn.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(p.ErrorBoundary,{fallback:r=>(()=>{var t=Tl(),i=t.firstChild;return e.insert(t,()=>r.message,null),t})(),get children(){var r=cd(),t=r.firstChild,i=t.firstChild,l=i.firstChild,N=l.nextSibling,K=N.nextSibling,Q=K.firstChild,Se=Q.nextSibling,ce=Se.nextSibling,zt=ce.nextSibling,mr=zt.nextSibling,rt=i.nextSibling,Je=rt.firstChild,Rn=Je.firstChild,Ai=Rn.nextSibling,Le=Je.nextSibling,Pi=Le.firstChild,ue=Le.nextSibling,xe=ue.nextSibling,Re=xe.firstChild,Ce=t.nextSibling,fe=Ce.firstChild,Ye=fe.nextSibling,d=Ye.nextSibling,s=Ce.nextSibling,m=s.firstChild,M=m.nextSibling,L=s.nextSibling,H=L.firstChild,k=H.firstChild,b=k.nextSibling,P=b.firstChild,V=L.nextSibling,Oe=V.firstChild,Ie=Oe.firstChild,B=Ie.nextSibling,S=B.firstChild,j=S.nextSibling,q=V.nextSibling,v=q.firstChild,it=v.firstChild,nt=it.firstChild,fl=nt.nextSibling,Js=fl.nextSibling,On=it.nextSibling,Mi=q.nextSibling,wc=Mi.firstChild;return e.insert(l,(()=>{var u=e.memo(()=>!!we());return()=>u()?`❄️ ${mn()} ❄️`:mn()})()),e.insert(K,()=>ln().total,Se),e.insert(K,()=>ln().success,zt),e.insert(K,()=>ln().error,null),Je.addEventListener("change",u=>io(u.currentTarget.value)),e.insert(Je,()=>se().map(u=>(()=>{var g=El(),_=g.firstChild;return e.insert(g,()=>u.name,null),e.effect(()=>e.setAttribute(g,"key",u.id)),e.effect(()=>g.value=u.id),g})()),Ai),Le.$$click=()=>Bl(u=>!u),e.insert(Le,no,null),e.insert(Le,()=>gt()?" 🔒":"",null),ue.addEventListener("mouseleave",u=>{const g=u.currentTarget;g.style.borderColor="#333",g.style.background="#1e1e1e",g.style.color="#e0e0e0"}),ue.addEventListener("mouseenter",u=>{const g=u.currentTarget;g.style.borderColor="#5ac8fa",g.style.background="rgba(90,200,250,0.12)",g.style.color="#5ac8fa"}),ue.$$click=async()=>{const u=window.open("","_blank");let g=3782;try{const x=await w.get_dashboard_port({});x&&typeof x.port=="number"&&x.port>0&&(g=x.port)}catch(x){console.warn("[scheduler] Не удалось получить порт дашборда:",x)}const _="http://localhost:"+g;u?u.location.href=_:window.open(_,"_blank")},Re.addEventListener("change",u=>{as(u.currentTarget.checked)}),e.insert(r,(()=>{var u=e.memo(()=>!!Fr());return()=>u()&&(()=>{var g=ud(),_=g.firstChild,x=_.firstChild,F=x.nextSibling,I=_.nextSibling;return F.$$click=()=>{xs()},e.insert(g,(()=>{var h=e.memo(()=>!!gt());return()=>h()&&fd()})(),I),e.insert(I,()=>Dl().map(h=>(()=>{var T=gd(),C=T.firstChild,z=C.nextSibling,Z=z.nextSibling;return e.insert(C,()=>h.name,null),e.insert(C,()=>h.isDefault?" (по умолчанию)":"",null),e.insert(z,(()=>{var G=e.memo(()=>!!h.port);return()=>G()?`порт ${h.port}`:"порт по умолчанию"})()),e.insert(Z,()=>h.dir),e.insert(T,(()=>{var G=e.memo(()=>!!h.active);return()=>G()?yd():(()=>{var R=md();return R.$$click=()=>{bs(h.name)},e.effect(D=>{var re=yt()||gt(),ge=`padding:2px 8px;border-radius:6px;border:1px solid #333;background:#262626;color:#e0e0e0;font-size:11px;cursor:${yt()||gt()?"not-allowed":"pointer"};opacity:${gt()?.5:1}`;return re!==D.e&&(R.disabled=D.e=re),D.t=e.style(R,ge,D.t),D},{e:void 0,t:void 0}),R})()})(),null),e.insert(T,(()=>{var G=e.memo(()=>!h.isDefault&&!h.active);return()=>G()&&(()=>{var R=bd();return R.$$click=()=>{vs(h.name)},e.effect(D=>{var re=yt(),ge=`padding:2px 8px;border-radius:6px;border:1px solid rgba(255,59,48,0.4);background:rgba(255,59,48,0.12);color:#ff3b30;font-size:11px;cursor:${yt()?"not-allowed":"pointer"}`;return re!==D.e&&(R.disabled=D.e=re),D.t=e.style(R,ge,D.t),D},{e:void 0,t:void 0}),R})()})(),null),e.effect(G=>{var R=`font-weight:${h.active?700:400};color:${h.active?"#bf5af2":"#e0e0e0"}`,D=h.dir;return G.e=e.style(C,R,G.e),D!==G.t&&e.setAttribute(Z,"title",G.t=D),G},{e:void 0,t:void 0}),T})())),e.effect(h=>{var T=yt(),C=`padding:4px 10px;border-radius:6px;border:1px solid #333;background:#262626;color:#e0e0e0;font-size:11px;cursor:${yt()?"not-allowed":"pointer"}`;return T!==h.e&&(F.disabled=h.e=T),h.t=e.style(F,C,h.t),h},{e:void 0,t:void 0}),g})()})(),Ce),fe.$$click=ys,e.insert(fe,()=>Ci()?"Экспорт...":"Экспорт"),Ye.addEventListener("change",ms),d.$$click=()=>document.querySelector('input[type="file"]')?.click(),e.insert(d,()=>zi()?"Импорт...":"Импорт"),M.addEventListener("change",u=>ss(Number(u.currentTarget.value)||1)),H.$$click=()=>Ql(!dn()),e.insert(b,(()=>{var u=e.memo(()=>!!A());return()=>u()?pn()?"только ошибки":"все запуски":"выключены"})(),P),e.insert(P,()=>dn()?"▾":"▴"),e.insert(L,(()=>{var u=e.memo(()=>!dn());return()=>u()&&(()=>{var g=xd(),_=g.firstChild,x=_.firstChild,F=_.nextSibling,I=F.firstChild,h=F.nextSibling,T=h.firstChild,C=T.firstChild,z=T.nextSibling,Z=z.nextSibling,G=Z.nextSibling,R=G.firstChild,D=R.nextSibling,re=D.nextSibling,ge=re.nextSibling,br=ge.nextSibling,ve=br.nextSibling,qe=h.nextSibling,ot=qe.firstChild,J=ot.nextSibling,ze=J.nextSibling,Ke=qe.nextSibling,Tt=Ke.firstChild,ye=Tt.nextSibling,oe=ye.nextSibling,Li=Ke.nextSibling,In=Li.firstChild,Et=In.nextSibling,At=Et.firstChild,xr=Et.nextSibling,vr=xr.firstChild,hr=vr.firstChild,$r=vr.nextSibling,De=$r.firstChild,qn=$r.nextSibling,je=qn.nextSibling,lt=Li.nextSibling,Dn=lt.firstChild,Pt=Dn.nextSibling,wr=Pt.firstChild,Ri=Pt.nextSibling,Mt=Ri.firstChild,Ne=Mt.nextSibling,jn=Ne.nextSibling,Oi=lt.nextSibling,Ve=Oi.firstChild,Lt=Ve.nextSibling;return x.addEventListener("change",a=>{fo(a.currentTarget.checked),Y()}),I.addEventListener("change",a=>{go(a.currentTarget.checked),Y()}),C.addEventListener("change",a=>{yo(a.currentTarget.checked),Y()}),z.addEventListener("change",()=>{Y()}),z.$$input=a=>bo(a.currentTarget.value),D.addEventListener("change",()=>{Y()}),D.$$input=a=>ho(Number(a.currentTarget.value)||1e4),ge.addEventListener("change",()=>{Y()}),ge.$$input=a=>wo(Number(a.currentTarget.value)||0),ve.addEventListener("change",()=>{Y()}),ve.$$input=a=>ko(Number(a.currentTarget.value)||1e3),J.addEventListener("change",()=>{Y()}),J.$$input=a=>Ao(a.currentTarget.value),ze.addEventListener("change",()=>{Y()}),ze.$$input=a=>Mo(a.currentTarget.value),ye.addEventListener("change",()=>{Y()}),ye.$$input=a=>Co(a.currentTarget.value),oe.addEventListener("change",()=>{Y()}),oe.$$input=a=>To(a.currentTarget.value),At.addEventListener("change",a=>{Lo(a.currentTarget.checked),Y()}),hr.addEventListener("change",a=>{Oo(a.currentTarget.checked),Y()}),De.addEventListener("change",a=>{qo(a.currentTarget.checked),Y()}),je.addEventListener("change",()=>{Y()}),je.$$input=a=>jo(Number(a.currentTarget.value)||0),wr.addEventListener("change",a=>{No(a.currentTarget.checked),Y()}),Mt.addEventListener("change",a=>{Fo(a.currentTarget.value==="weekly"?"weekly":"daily"),Y()}),Ne.addEventListener("change",()=>{Y()}),Ne.$$input=a=>Wo(a.currentTarget.value),e.insert(jn,(()=>{var a=e.memo(()=>!!cn());return()=>a()?`последняя отправка: ${new Date(cn()).toLocaleString()}`:"ещё не отправлялся"})()),Ve.$$click=()=>{os()},e.insert(Ve,()=>Yr()?"Отправка...":"🧪 Тестовое уведомление"),Lt.$$click=()=>{ls()},e.insert(Lt,()=>Kr()?"Отправка...":"📊 Отправить дайджест сейчас"),e.effect(a=>{var _r=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${A()?1:.5}`,Ii=!A(),Rt=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${A()?1:.5}`,kr=!A(),qi=!A()||!ae(),Di=`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:${A()&&ae()?1:.5}`,Sr=!A()||!ae(),ji=!A()||!ae(),st=!A()||!ae(),Cr=!A(),Nn=`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:${A()?1:.5}`,zr=!A(),Ni=`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:${A()?1:.5}`,Bi=!A(),Fi=`display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;opacity:${A()?1:.5}`,Tr=!A(),Bn=`display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;opacity:${A()?1:.5}`,Gi=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${A()?1:.5}`,Er=!A(),Fn=`display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:12px;color:#b0b0b0;opacity:${A()&&xt()?1:.5}`,Ar=!A()||!xt(),Pr=!A()||!xt(),Wi=!A()||!xt(),Ui=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${A()?1:.5}`,Mr=!A(),Gn=`display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;color:#b0b0b0;opacity:${A()&&Bt()?1:.5}`,Hi=!A()||!Bt(),Lr=!A()||!Bt(),Ot=Yr()||!ae(),gl=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${Yr()||!ae()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${Yr()||!ae()?.6:1}`,Rr=Kr()||!ae(),Wn=`padding:6px 12px;background:#2d7d46;color:white;border:none;border-radius:6px;cursor:${Kr()||!ae()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${Kr()||!ae()?.6:1}`;return a.e=e.style(F,_r,a.e),Ii!==a.t&&(I.disabled=a.t=Ii),a.a=e.style(T,Rt,a.a),kr!==a.o&&(C.disabled=a.o=kr),qi!==a.i&&(z.disabled=a.i=qi),a.n=e.style(z,Di,a.n),Sr!==a.s&&(D.disabled=a.s=Sr),ji!==a.h&&(ge.disabled=a.h=ji),st!==a.r&&(ve.disabled=a.r=st),Cr!==a.d&&(J.disabled=a.d=Cr),a.l=e.style(J,Nn,a.l),zr!==a.u&&(ze.disabled=a.u=zr),a.c=e.style(ze,Ni,a.c),Bi!==a.w&&(ye.disabled=a.w=Bi),a.m=e.style(ye,Fi,a.m),Tr!==a.f&&(oe.disabled=a.f=Tr),a.y=e.style(oe,Bn,a.y),a.g=e.style(Et,Gi,a.g),Er!==a.p&&(At.disabled=a.p=Er),a.b=e.style(xr,Fn,a.b),Ar!==a.T&&(hr.disabled=a.T=Ar),Pr!==a.A&&(De.disabled=a.A=Pr),Wi!==a.O&&(je.disabled=a.O=Wi),a.I=e.style(Pt,Ui,a.I),Mr!==a.S&&(wr.disabled=a.S=Mr),a.W=e.style(Ri,Gn,a.W),Hi!==a.C&&(Mt.disabled=a.C=Hi),Lr!==a.B&&(Ne.disabled=a.B=Lr),Ot!==a.v&&(Ve.disabled=a.v=Ot),a.k=e.style(Ve,gl,a.k),Rr!==a.x&&(Lt.disabled=a.x=Rr),a.j=e.style(Lt,Wn,a.j),a},{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,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0,b:void 0,T:void 0,A:void 0,O:void 0,I:void 0,S:void 0,W:void 0,C:void 0,B:void 0,v:void 0,k:void 0,x:void 0,j:void 0}),e.effect(()=>x.checked=A()),e.effect(()=>I.checked=pn()),e.effect(()=>C.checked=ae()),e.effect(()=>z.value=mo()||""),e.effect(()=>D.value=vo()),e.effect(()=>ge.value=$o()),e.effect(()=>ve.value=_o()),e.effect(()=>J.value=Eo()||""),e.effect(()=>ze.value=Po()||""),e.effect(()=>ye.value=So()||""),e.effect(()=>oe.value=zo()||""),e.effect(()=>At.checked=xt()),e.effect(()=>hr.checked=Ro()),e.effect(()=>De.checked=Io()),e.effect(()=>je.value=Do()),e.effect(()=>wr.checked=Bt()),e.effect(()=>Mt.value=Bo()),e.effect(()=>Ne.value=Go()),g})()})(),null),Oe.$$click=()=>Xl(!yn()),e.insert(B,(()=>{var u=e.memo(()=>Vr()>0);return()=>u()?`старше ${Vr()} дн.`:"без срока"})(),S),e.insert(B,(()=>{var u=e.memo(()=>Zr()>0);return()=>u()?`до ${Zr()} записей`:"без лимита"})(),j),e.insert(j,()=>yn()?"▾":"▴"),e.insert(V,(()=>{var u=e.memo(()=>!yn());return()=>u()&&(()=>{var g=vd(),_=g.firstChild,x=_.firstChild,F=x.nextSibling,I=_.nextSibling,h=I.firstChild,T=h.nextSibling,C=I.nextSibling,z=C.firstChild,Z=C.nextSibling,G=Z.firstChild;return F.addEventListener("change",R=>{Qr(Math.max(0,Math.floor(Number(R.currentTarget.value)||0))),Vo()}),T.addEventListener("change",R=>{Xr(Math.max(0,Math.floor(Number(R.currentTarget.value)||0))),Vo()}),e.insert(C,(()=>{var R=e.memo(()=>!!un());return()=>R()?`${new Date(un()).toLocaleString()} · удалено ${Ho()}`:"ещё не выполнялась"})(),null),G.$$click=()=>{ns()},e.insert(G,()=>ei()?"Очистка...":"🧹 Очистить сейчас"),e.effect(R=>{var D=ei(),re=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${ei()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${ei()?.6:1}`;return D!==R.e&&(G.disabled=R.e=D),R.t=e.style(G,re,R.t),R},{e:void 0,t:void 0}),e.effect(()=>F.value=Vr()),e.effect(()=>T.value=Zr()),g})()})(),null),it.$$click=()=>ql(!en()),e.insert(fl,()=>se().length),e.insert(Js,()=>en()?"▾":"▴"),On.$$click=()=>{_s()},e.insert(q,(()=>{var u=e.memo(()=>!en());return()=>u()&&(()=>{var g=hd();return e.insert(g,(()=>{var _=e.memo(()=>se().length===0);return()=>_()?$d():se().map(x=>(()=>{var F=wd(),I=F.firstChild,h=I.nextSibling,T=h.firstChild,C=T.firstChild,z=T.nextSibling,Z=z.nextSibling,G=Z.firstChild,R=G.nextSibling,D=R.nextSibling,re=Z.nextSibling,ge=re.firstChild,br=h.nextSibling,ve=br.firstChild,qe=ve.nextSibling,ot=qe.nextSibling;return e.insert(T,()=>x.name,null),e.insert(z,()=>x.path),e.insert(Z,()=>x.gitBranch||"—",R),e.insert(Z,()=>x.gitRemote||"remote не задан",null),e.insert(re,(()=>{var J=e.memo(()=>!!x.env);return()=>J()?`${Object.keys(x.env).length} перем.`:"—"})(),null),e.insert(re,()=>x.envFile?" · .env-файл":"",null),ve.$$click=()=>{ws(x)},qe.$$click=()=>{ks(x)},ot.$$click=()=>{Ss(x)},e.effect(J=>{var ze=`width:9px;height:9px;border-radius:50%;background:${x.color||"#5ac8fa"};flex-shrink:0`,Ke=x.path,Tt=ut(),ye=ut(),oe=ut();return J.e=e.style(I,ze,J.e),Ke!==J.t&&e.setAttribute(z,"title",J.t=Ke),Tt!==J.a&&(ve.disabled=J.a=Tt),ye!==J.o&&(qe.disabled=J.o=ye),oe!==J.i&&(ot.disabled=J.i=oe),J},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),F})())})()),g})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!ps());return()=>u()?(()=>{var g=_d();return g.addEventListener("mouseleave",_=>{const x=_.currentTarget;x.style.borderColor="#3a3a3a",x.style.background="#1e1e1e"}),g.addEventListener("mouseenter",_=>{const x=_.currentTarget;x.style.borderColor="#5ac8fa",x.style.background="#232326"}),g.$$click=()=>xn(!1),g})():(()=>{var g=kd(),_=g.firstChild,x=_.firstChild,F=x.nextSibling,I=F.firstChild,h=I.nextSibling,T=_.nextSibling,C=T.firstChild,z=C.firstChild,Z=C.nextSibling,G=T.nextSibling,R=G.firstChild,D=R.nextSibling,re=G.nextSibling,ge=re.firstChild,br=ge.nextSibling,ve=br.firstChild,qe=ve.firstChild,ot=ve.nextSibling,J=ot.firstChild,ze=ot.nextSibling,Ke=ze.firstChild,Tt=ze.nextSibling,ye=Tt.firstChild,oe=re.nextSibling,Li=oe.firstChild,In=Li.nextSibling,Et=In.firstChild,At=Et.firstChild,xr=Et.nextSibling,vr=xr.firstChild,hr=xr.nextSibling,$r=hr.firstChild,De=oe.nextSibling,qn=De.firstChild,je=qn.nextSibling,lt=je.nextSibling,Dn=lt.firstChild,Pt=Dn.nextSibling,wr=lt.nextSibling,Ri=wr.firstChild,Mt=Ri.nextSibling,Ne=Mt.firstChild,jn=Ne.nextSibling,Oi=jn.nextSibling,Ve=De.nextSibling,Lt=Ve.firstChild,a=Lt.nextSibling,_r=Ve.nextSibling,Ii=_r.firstChild,Rt=Ii.nextSibling,kr=_r.nextSibling,qi=kr.firstChild,Di=qi.nextSibling,Sr=kr.nextSibling,ji=Sr.firstChild,st=ji.nextSibling,Cr=Sr.nextSibling,Nn=Cr.firstChild,zr=Nn.nextSibling,Ni=Cr.nextSibling,Bi=Ni.firstChild,Fi=Bi.nextSibling,Tr=Ni.nextSibling,Bn=Tr.firstChild,Gi=Bn.nextSibling,Er=Tr.nextSibling,Fn=Er.firstChild,Ar=Fn.nextSibling,Pr=Er.nextSibling,Wi=Pr.firstChild,Ui=Wi.nextSibling,Mr=Pr.nextSibling,Gn=Mr.firstChild,Hi=Gn.nextSibling,Lr=Mr.nextSibling,Ot=Lr.firstChild,gl=Ot.firstChild,Rr=Ot.nextSibling,Wn=Rr.firstChild,Ys=Wn.nextSibling,yl=Ys.nextSibling,Ks=yl.nextSibling,ml=Ks.nextSibling,Vs=ml.nextSibling,Un=Vs.firstChild,bl=Un.nextSibling,Qs=bl.nextSibling,xl=Lr.nextSibling,vl=xl.firstChild,Or=vl.nextSibling;return e.insert(x,Pn?"Редактирование задачи":"Новая задача"),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=zs,h.addEventListener("mouseleave",o=>{const n=o.currentTarget;n.style.color="#a0a0a6",n.style.borderColor="#333"}),h.addEventListener("mouseenter",o=>{const n=o.currentTarget;n.style.color="#5ac8fa",n.style.borderColor="#5ac8fa"}),h.$$click=()=>xn(!0),z.addEventListener("change",o=>{const n=o.currentTarget.checked;bi(n),n&&(Ge(""),Me().length===0&&ar(se().map(y=>y.id)))}),e.insert(T,(()=>{var o=e.memo(()=>!!Pe());return()=>o()&&(()=>{var n=Sd(),y=n.firstChild,f=y.firstChild,$=f.firstChild,E=y.nextSibling,O=E.firstChild,pe=O.firstChild,Qe=pe.nextSibling,Ir=O.nextSibling,at=Ir.firstChild,qr=at.nextSibling,de=Ir.nextSibling,W=de.firstChild,Te=W.nextSibling,pt=E.nextSibling,Ji=pt.firstChild,Dr=pt.nextSibling,hl=Dr.firstChild,Hn=hl.nextSibling,$l=Dr.nextSibling;return e.insert(f,()=>Me().length,null),e.insert(y,(()=>{var le=e.memo(()=>se().length===0);return()=>le()?Cd():(()=>{var me=zd();return e.insert(me,()=>se().map(he=>(()=>{var It=Td(),qt=It.firstChild,be=qt.nextSibling,jr=be.firstChild,dt=be.nextSibling;return qt.addEventListener("change",Yi=>ds(he.id,Yi.currentTarget.checked)),e.insert(be,()=>he.name,null),e.insert(dt,()=>he.path),e.effect(Yi=>e.style(be,`color:${he.color||"#5ac8fa"}`,Yi)),e.effect(()=>qt.checked=Me().includes(he.id)),It})())),me})()})(),null),Qe.addEventListener("change",le=>xi(le.currentTarget.value==="sequential"?"sequential":"parallel")),qr.addEventListener("change",le=>vi(le.currentTarget.value==="stop"?"stop":"continue")),Te.addEventListener("change",le=>hi(le.currentTarget.value==="per-task"?"per-task":"summary")),Ji.addEventListener("change",le=>$i(le.currentTarget.checked)),Hn.$$input=le=>_i(le.currentTarget.value),e.insert(n,(()=>{var le=e.memo(()=>Me().length>0);return()=>le()&&(()=>{var me=Ed(),he=me.firstChild,It=he.firstChild,qt=he.nextSibling;return e.insert(he,cs,null),e.insert(qt,()=>Me().map(be=>{const jr=se().find(Ki=>Ki.id===be);if(!jr)return null;const dt=kn()[be]??{},Yi="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box";return(()=>{var Ki=Ad(),Vi=Ki.firstChild,Zs=Vi.firstChild,wl=Zs.nextSibling,Xs=Vi.nextSibling,Jn=Xs.firstChild,_l=Jn.nextSibling,Yn=_l.firstChild,kl=Yn.nextSibling,ea=_l.nextSibling,Kn=ea.firstChild,Sl=Kn.nextSibling;return e.insert(Vi,()=>jr.name,wl),e.insert(wl,()=>Tn(_e(),jr.name)),Jn.$$input=$e=>ur(be,"prompt",$e.currentTarget.value),Yn.$$input=$e=>ur(be,"model",$e.currentTarget.value),kl.$$input=$e=>ur(be,"qualityGate",$e.currentTarget.value),Kn.$$input=$e=>ur(be,"beforeScript",$e.currentTarget.value),Sl.$$input=$e=>ur(be,"afterScript",$e.currentTarget.value),e.effect($e=>e.style(Vi,`font-size:12px;font-weight:600;margin-bottom:6px;color:${jr.color||"#5ac8fa"}`,$e)),e.effect(()=>Jn.value=dt.prompt??""),e.effect(()=>Yn.value=dt.model??""),e.effect(()=>kl.value=dt.qualityGate??""),e.effect(()=>Kn.value=dt.beforeScript??""),e.effect(()=>Sl.value=dt.afterScript??""),Ki})()})),me})()})(),$l),e.insert($l,(()=>{var le=e.memo(()=>En().length>0);return()=>le()?[(()=>{var me=Pd(),he=me.firstChild,It=he.nextSibling,qt=It.nextSibling;return e.insert(me,()=>En().length,It),me})(),(()=>{var me=Md();return e.insert(me,()=>En().join(", ")),me})()]:Ld()})()),e.effect(()=>e.setAttribute(Hn,"placeholder",_n()==="sequential"?"1 (sequential)":"без лимита")),e.effect(()=>Qe.value=_n()),e.effect(()=>qr.value=el()),e.effect(()=>Te.value=tl()),e.effect(()=>Ji.checked=rl()),e.effect(()=>Hn.value=wi()),n})()})(),null),e.insert(g,(()=>{var o=e.memo(()=>!Pe());return()=>o()&&(()=>{var n=Rd(),y=n.firstChild,f=y.nextSibling,$=f.firstChild;return f.addEventListener("change",E=>{Ge(E.currentTarget.value),E.currentTarget.value&&kt("")}),e.insert(f,()=>se().map(E=>(()=>{var O=El(),pe=O.firstChild;return e.insert(O,()=>E.name,null),e.effect(()=>e.setAttribute(O,"key",E.id)),e.effect(()=>O.value=E.id),O})()),null),e.insert(n,(()=>{var E=e.memo(()=>!!gr());return()=>E()&&(()=>{var O=Od(),pe=O.firstChild,Qe=pe.firstChild,Ir=Qe.nextSibling,at=pe.nextSibling,qr=at.firstChild,de=qr.nextSibling,W=at.nextSibling,Te=W.firstChild,pt=Te.nextSibling;return e.insert(Ir,()=>gr().path),e.insert(de,()=>gr().gitBranch||"—"),e.insert(pt,()=>gr().gitRemote||"—"),O})()})(),null),e.effect(()=>f.value=ft()),n})()})(),G),D.$$input=o=>ri(o.currentTarget.value),e.insert(g,(()=>{var o=e.memo(()=>!ft()&&!Pe());return()=>o()&&(()=>{var n=Id(),y=n.firstChild,f=y.nextSibling;return f.$$input=$=>kt($.currentTarget.value),e.effect(()=>f.value=mi()||""),n})()})(),re),qe.addEventListener("change",()=>Ue("cron")),J.addEventListener("change",()=>Ue("file")),Ke.addEventListener("change",()=>Ue("mcp-event")),ye.addEventListener("change",()=>Ue("once")),e.insert(g,(()=>{var o=e.memo(()=>ne()==="file");return()=>o()&&(()=>{var n=qd(),y=n.firstChild,f=y.nextSibling;return f.$$input=$=>Xt($.currentTarget.value),e.effect(()=>f.value=vn()||""),n})()})(),oe),e.insert(g,(()=>{var o=e.memo(()=>ne()==="mcp-event");return()=>o()&&[(()=>{var n=Dd(),y=n.firstChild,f=y.nextSibling;return f.$$input=$=>nr($.currentTarget.value),e.effect(()=>f.value=$n()||""),n})(),(()=>{var n=jd(),y=n.firstChild,f=y.nextSibling;return f.$$input=$=>or($.currentTarget.value),e.effect(()=>f.value=wn()||""),n})(),(()=>{var n=Nd(),y=n.firstChild,f=y.nextSibling;return f.$$input=$=>sr($.currentTarget.value),e.effect(()=>f.value=lr()||""),n})()]})(),oe),e.insert(g,(()=>{var o=e.memo(()=>ne()==="once");return()=>o()&&(()=>{var n=Bd(),y=n.firstChild,f=y.nextSibling,$=f.nextSibling,E=$.nextSibling;return f.$$input=O=>pi(O.currentTarget.value),E.$$input=O=>ci(O.currentTarget.value),e.effect(()=>f.value=hn()||""),e.effect(()=>E.value=di()||""),n})()})(),oe),At.addEventListener("change",()=>_t("new")),vr.addEventListener("change",()=>_t("reuse")),$r.addEventListener("change",()=>_t("last")),e.insert(oe,(()=>{var o=e.memo(()=>Ae()==="reuse");return()=>o()&&(()=>{var n=Fd(),y=n.firstChild,f=y.nextSibling;return f.$$input=$=>ui($.currentTarget.value),e.effect(()=>f.value=er()||""),n})()})(),null),je.addEventListener("change",o=>{const n=o.currentTarget.value;Gt(n),n!=="__custom__"&&ht(n)}),e.insert(je,()=>Xn.map(o=>(()=>{var n=Qi();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})())),e.insert(De,Fs&&(()=>{var o=Gd(),n=o.firstChild,y=n.nextSibling;return y.$$input=f=>ht(f.currentTarget.value),e.effect(()=>y.value=ii()||""),o})(),lt),e.insert(De,(()=>{var o=e.memo(()=>!!ao());return()=>o()&&(()=>{var n=Wd();return e.insert(n,ao),n})()})(),lt),Pt.$$input=o=>tr(o.currentTarget.value),Ne.$$input=o=>rr(o.currentTarget.value),Oi.$$input=o=>ir(o.currentTarget.value),a.$$input=o=>wt(o.currentTarget.value),Rt.addEventListener("change",o=>Cs(o.currentTarget.value)),e.insert(Rt,()=>uo.map(o=>(()=>{var n=Qi();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})()),null),e.insert(Rt,()=>Jr().map(o=>(()=>{var n=Qi();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(_r,(()=>{var o=e.memo(()=>!!Nt().startsWith("custom:"));return()=>o()&&(()=>{var n=Ud(),y=n.firstChild,f=y.nextSibling;return e.insert(n,()=>Jr().map($=>`custom:${$.id}`!==Nt()?null:(()=>{var E=Hd();return e.insert(E,()=>$.name),e.effect(()=>e.setAttribute(E,"key",$.id)),E})()),f),f.addEventListener("mouseleave",$=>{$.currentTarget.style.color="#ff3b30"}),f.addEventListener("mouseenter",$=>{$.currentTarget.style.color="#c92a2a"}),f.$$click=()=>{const $=Jr().find(E=>`custom:${E.id}`===Nt());$&&Ts($)},n})()})(),null),Di.$$input=o=>Jt(o.currentTarget.value),st.addEventListener("change",o=>Yt(Number(o.currentTarget.value)||Be)),e.insert(st,()=>Pl.map(o=>(()=>{var n=Qi();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(st,(()=>{var o=e.memo(()=>!Pl.some(n=>n.value===et()));return()=>o()&&(()=>{var n=Jd(),y=n.firstChild,f=y.nextSibling,$=f.nextSibling;return e.insert(n,et,f),e.effect(()=>n.value=String(et())),n})()})(),null),zr.$$input=o=>Wt(Number(o.currentTarget.value)||0),Fi.$$input=o=>Ut(Number(o.currentTarget.value)||60),Gi.$$input=o=>Kt(o.currentTarget.value),Ar.$$input=o=>Qt(o.currentTarget.value),Ui.$$input=o=>Zt(o.currentTarget.value),e.insert(Hi,(()=>{var o=e.memo(()=>cl().length===0);return()=>o()?Yd():cl().map(n=>(()=>{var y=Zn(),f=y.firstChild;return f.addEventListener("change",$=>Ws(n,$.currentTarget.checked)),e.insert(y,n,null),e.effect($=>e.style(y,`display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:14px;border:1px solid ${tt().includes(n)?"#5ac8fa":"#333"};background:${tt().includes(n)?"rgba(90,200,250,0.12)":"transparent"};color:${tt().includes(n)?"#5ac8fa":"#cfcfd2"};font-size:12px;cursor:pointer;user-select:none`,$)),e.effect(()=>f.checked=tt().includes(n)),y})())})()),e.insert(Ot,(()=>{var o=e.memo(()=>X().length>0||ee().length>0);return()=>o()&&(()=>{var n=Kd(),y=n.firstChild,f=y.nextSibling,$=f.nextSibling,E=$.nextSibling,O=E.nextSibling;return e.insert(n,()=>X().length,f),e.insert(n,()=>ee().length,E),n})()})(),null),e.insert(yl,()=>nl.map(o=>(()=>{var n=Zn(),y=n.firstChild;return y.addEventListener("change",()=>ol("allowed",o)),e.insert(n,o,null),e.effect(f=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${X().includes(o)?"#34c759":"#333"};background:${X().includes(o)?"rgba(52,199,89,0.12)":"transparent"};color:${X().includes(o)?"#34c759":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,f)),e.effect(()=>y.checked=X().includes(o)),n})())),e.insert(ml,()=>nl.map(o=>(()=>{var n=Zn(),y=n.firstChild;return y.addEventListener("change",()=>ol("denied",o)),e.insert(n,o,null),e.effect(f=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${ee().includes(o)?"#ff3b30":"#333"};background:${ee().includes(o)?"rgba(255,59,48,0.12)":"transparent"};color:${ee().includes(o)?"#ff3b30":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,f)),e.effect(()=>y.checked=ee().includes(o)),n})())),Un.$$input=o=>Xo(o.currentTarget.value),bl.$$click=()=>ll("allowed"),Qs.$$click=()=>ll("denied"),e.insert(Rr,(()=>{var o=e.memo(()=>X().length>0||ee().length>0);return()=>o()&&(()=>{var n=Vd();return e.insert(n,(()=>{var y=e.memo(()=>X().length>0);return()=>y()&&(()=>{var f=Qd(),$=f.firstChild,E=$.nextSibling,O=E.nextSibling;return e.insert(f,()=>X().join(", "),E),f})()})(),null),e.insert(n,(()=>{var y=e.memo(()=>ee().length>0);return()=>y()&&(()=>{var f=Zd(),$=f.firstChild,E=$.nextSibling,O=E.nextSibling;return e.insert(f,()=>ee().join(", "),E),f})()})(),null),n})()})(),null),vl.$$click=()=>{zn("(форма)");const o={order:0,trigger:"manual",command:us(),roleScoped:X().length>0||ee().length>0?{allowed:X(),denied:ee()}:null,preFlight:(si()||"").trim()||null,postFlight:(ai()||"").trim()||null,qualityGate:(li()||"").trim()||null},n=Me().map(y=>se().find(f=>f.id===y)).filter(y=>!!y).map((y,f)=>({...o,name:Tn(_e(),y.name),order:f,cwd:y.path,matrixParent:_e()||"(без имени)"}));dr({tasks:Pe()?n:[{...o,name:_e()||"(без имени)",cwd:gr()?.path||(mi()||"").trim()||"(папка проекта)"}],totals:{},warnings:[..._e().trim()?[]:["Не указано имя — превью локальное (форма не сохранена)."],...Pe()?[`Matrix: будет создано ${n.length} клон(а/ов) по workspace; родитель сам не выполняется.`]:[]]}),Sn(!0)},Or.$$click=Ms,e.insert(Or,()=>jt()?"Создание...":Pn?"Сохранить":"Создать задачу"),e.insert(xl,Pn&&(()=>{var o=Xd();return o.$$click=()=>{ti(null),ri(""),ht("* * * * *"),wt(""),Jt(""),Yt(Be),Wt(0),Ut(60),Kt(""),Vt([]),Qt(""),Zt(""),Ue("cron"),Xt(""),pi(""),ci(""),_t("new"),ui(""),tr(""),rr(""),ir(""),nr(""),or(""),sr(""),kt(""),Ge(""),St([]),Ct([]),Si(),Gt("* * * * *"),Wr("")},o})(),null),e.insert(g,(()=>{var o=e.memo(()=>!!(pr()&&cr()==="(форма)"));return()=>o()&&(()=>{var n=ec(),y=n.firstChild,f=y.firstChild,$=f.nextSibling;return $.$$click=()=>pl(),e.insert(n,()=>{const E=te();if(!E)return null;const O=E.tasks?.[0];return(()=>{var pe=tc(),Qe=pe.firstChild,Ir=Qe.firstChild,at=Qe.nextSibling,qr=at.firstChild;return e.insert(Qe,()=>O?.command,null),e.insert(at,()=>O?.cwd,null),e.insert(pe,(()=>{var de=e.memo(()=>!!O?.roleScoped);return()=>de()&&(()=>{var W=rc(),Te=W.firstChild,pt=Te.nextSibling,Ji=pt.nextSibling,Dr=Ji.nextSibling,hl=Dr.nextSibling;return e.insert(W,()=>(O.roleScoped.allowed??[]).join(", "),pt),e.insert(W,()=>(O.roleScoped.denied??[]).join(", "),Dr),W})()})(),null),e.insert(pe,(()=>{var de=e.memo(()=>!!O?.preFlight);return()=>de()&&(()=>{var W=ic(),Te=W.firstChild;return e.insert(W,()=>O.preFlight,null),W})()})(),null),e.insert(pe,(()=>{var de=e.memo(()=>!!O?.postFlight);return()=>de()&&(()=>{var W=nc(),Te=W.firstChild;return e.insert(W,()=>O.postFlight,null),W})()})(),null),e.insert(pe,(()=>{var de=e.memo(()=>!!O?.qualityGate);return()=>de()&&(()=>{var W=oc(),Te=W.firstChild;return e.insert(W,()=>O.qualityGate,null),W})()})(),null),e.insert(pe,(()=>{var de=e.memo(()=>!!(Array.isArray(E.warnings)&&E.warnings.length>0));return()=>de()&&(()=>{var W=lc(),Te=W.firstChild;return e.insert(W,()=>E.warnings.join(" | "),null),W})()})(),null),pe})()},null),n})()})(),null),e.effect(o=>{var n=ne()!=="cron"?"none":"block",y=jt()||!Ei(),f=Ei()?void 0:dl(),$=`display:block;width:100%;padding:10px;margin-top:8px;background:${jt()?"#666":"#007acc"};color:white;border-radius:6px;border:none;cursor:${jt()||!Ei()?"not-allowed":"pointer"};font-size:13px;font-weight:500;opacity:${jt()||!Ei()?.6:1}`;return n!==o.e&&e.setStyleProperty(De,"display",o.e=n),y!==o.t&&(Or.disabled=o.t=y),f!==o.a&&e.setAttribute(Or,"title",o.a=f),o.o=e.style(Or,$,o.o),o},{e:void 0,t:void 0,a:void 0,o:void 0}),e.effect(()=>z.checked=Pe()),e.effect(()=>D.value=_e()||""),e.effect(()=>qe.checked=ne()==="cron"),e.effect(()=>J.checked=ne()==="file"),e.effect(()=>Ke.checked=ne()==="mcp-event"),e.effect(()=>ye.checked=ne()==="once"),e.effect(()=>At.checked=Ae()==="new"),e.effect(()=>vr.checked=Ae()==="reuse"),e.effect(()=>$r.checked=Ae()==="last"),e.effect(()=>je.value=Qo()),e.effect(()=>Pt.value=fi()||""),e.effect(()=>Ne.value=gi()||""),e.effect(()=>Oi.value=yi()||""),e.effect(()=>a.value=$t()||""),e.effect(()=>Rt.value=Nt()),e.effect(()=>Di.value=Ht()||""),e.effect(()=>st.value=String(et())),e.effect(()=>zr.value=ni()),e.effect(()=>Fi.value=oi()),e.effect(()=>Gi.value=li()||""),e.effect(()=>Ar.value=si()||""),e.effect(()=>Ui.value=ai()||""),e.effect(()=>Un.value=Zo()),g})()})(),Mi),e.insert(Mi,(()=>{var u=e.memo(()=>ct()!=="all");return()=>u()&&(()=>{var g=sc(),_=g.firstChild,x=_.nextSibling,F=x.nextSibling,I=F.nextSibling,h=I.nextSibling;return e.insert(g,(()=>{var T=e.memo(()=>ct()==="none");return()=>T()?"без workspace":`📦 ${se().find(C=>C.id===ct())?.name??"workspace"}`})(),x),e.insert(g,()=>Ln().length,I),e.insert(g,()=>yr().length,null),g})()})(),null),e.insert(Mi,(()=>{var u=e.memo(()=>Ln().length===0);return()=>u()?(()=>{var g=ac(),_=g.firstChild,x=_.nextSibling;return e.insert(_,()=>we()?"🎄":"📅"),e.insert(x,()=>we()?"Задач пока нет. Самое время украсить ёлку!":"Нет активных задач. Создайте первую и доверьте рутину ИИ!"),g})():(()=>{var g=pc();return e.insert(g,()=>Ln().map(_=>e.createComponent(Hs,{get key(){return _.name},job:_}))),g})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!Fl());return()=>u()&&(()=>{var g=dc(),_=g.firstChild,x=_.firstChild,F=x.nextSibling,I=F.firstChild,h=I.nextSibling;return g.$$click=()=>Xe(null),_.$$click=T=>T.stopPropagation(),e.insert(x,tn),e.insert(_,(()=>{var T=e.memo(()=>!!tn().includes("KEY=VALUE"));return()=>T()?(()=>{var C=cc();return C.$$keydown=z=>{z.key==="Escape"&&Xe(null),z.key==="Enter"&&(z.ctrlKey||z.metaKey)&&(z.preventDefault(),Xe(Dt())),z.stopPropagation()},C.$$input=z=>rn(z.currentTarget.value),e.effect(()=>C.value=Dt()),C})():(()=>{var C=uc();return C.$$keydown=z=>{z.key==="Escape"&&Xe(null),z.key==="Enter"&&(z.preventDefault(),Xe(Dt())),z.stopPropagation()},C.$$input=z=>rn(z.currentTarget.value),e.effect(()=>C.value=Dt()),C})()})(),F),I.$$click=()=>Xe(null),h.$$click=()=>Xe(Dt()),e.insert(_,(()=>{var T=e.memo(()=>!!tn().includes("KEY=VALUE"));return()=>T()&&fc()})(),null),g})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!nn());return()=>u()&&(()=>{var g=gc(),_=g.firstChild,x=_.firstChild,F=x.firstChild,I=F.nextSibling,h=x.nextSibling,T=_.nextSibling;return e.insert(I,nn),h.addEventListener("mouseleave",C=>{C.target.style.color="#8e8e93"}),h.addEventListener("mouseenter",C=>{C.target.style.color="#ff3b30"}),h.$$click=()=>{on(null),bt("")},e.insert(T,()=>Wl().split(`
4
+ `).map((C,z)=>(()=>{var Z=yc();return e.setAttribute(Z,"key",z),e.insert(Z,C),Z})())),g})()})(),null),e.effect(u=>{var g=`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:${we()?"linear-gradient(180deg, #0f172a 0%, #000000 100%)":"#0f0f0f"}`,_=gt()?"Профиль задан переменной окружения OPENCODE_SCHEDULER_PROFILE — переключение в GUI недоступно":"Профили: отдельные БД, настройки и порт дашборда",x=`display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;cursor:pointer;font-size:12px;user-select:none;white-space:nowrap;border:1px solid ${Fr()?"#bf5af2":"#333"};background:${Fr()?"rgba(191,90,242,0.12)":"#1e1e1e"};color:${Fr()?"#bf5af2":"#e0e0e0"}`,F=`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 ${we()?"rgba(135, 206, 250, 0.5)":"#333"};background:${we()?"rgba(135, 206, 250, 0.12)":"#1e1e1e"};color:#e0e0e0`,I=Ci(),h=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${Ci()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${Ci()?.6:1};transition:background 0.18s ease`,T=zi(),C=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${zi()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${zi()?.6:1};transition:background 0.18s ease`,z=ut(),Z=`padding:5px 10px;border-radius:6px;border:1px solid #333;background:#252526;color:${ut()?"#666":"#5ac8fa"};font-size:11px;font-weight:600;cursor:${ut()?"not-allowed":"pointer"}`;return u.e=e.style(r,g,u.e),_!==u.t&&e.setAttribute(Le,"title",u.t=_),u.a=e.style(Le,x,u.a),u.o=e.style(xe,F,u.o),I!==u.i&&(fe.disabled=u.i=I),u.n=e.style(fe,h,u.n),T!==u.s&&(d.disabled=u.s=T),u.h=e.style(d,C,u.h),z!==u.r&&(On.disabled=u.r=z),u.d=e.style(On,Z,u.d),u},{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}),e.effect(()=>Je.value=ct()),e.effect(()=>Re.checked=we()),e.effect(()=>M.value=Vl()),r}})})}catch(r){return console.error("GUI render error:",r),c.add(Vn.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(p.ErrorBoundary,{fallback:t=>(()=>{var i=Tl();return i.firstChild,e.insert(i,()=>t.message,null),i})(),get children(){var t=mc(),i=t.firstChild;return e.insert(i,mn),t}})})}}});e.delegateEvents(["click","input","keydown"]);exports.default=xc;