@blxzer/cursor-trellis 0.4.2 → 0.4.3

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 (315) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +23 -14
  3. package/README.zh-CN.md +14 -10
  4. package/bin/smart-search.js +10 -2
  5. package/dist/cli/index.d.ts.map +1 -1
  6. package/dist/cli/index.js +36 -15
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/commands/init.d.ts +1 -1
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +42 -153
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/migrate.d.ts +10 -0
  13. package/dist/commands/migrate.d.ts.map +1 -0
  14. package/dist/commands/migrate.js +38 -0
  15. package/dist/commands/migrate.js.map +1 -0
  16. package/dist/commands/update.d.ts +5 -0
  17. package/dist/commands/update.d.ts.map +1 -1
  18. package/dist/commands/update.js +137 -40
  19. package/dist/commands/update.js.map +1 -1
  20. package/dist/configurators/cursor.d.ts +2 -1
  21. package/dist/configurators/cursor.d.ts.map +1 -1
  22. package/dist/configurators/cursor.js +4 -2
  23. package/dist/configurators/cursor.js.map +1 -1
  24. package/dist/configurators/index.js +4 -4
  25. package/dist/configurators/index.js.map +1 -1
  26. package/dist/configurators/shared.d.ts +8 -0
  27. package/dist/configurators/shared.d.ts.map +1 -1
  28. package/dist/configurators/shared.js +27 -1
  29. package/dist/configurators/shared.js.map +1 -1
  30. package/dist/configurators/workflow.d.ts +0 -9
  31. package/dist/configurators/workflow.d.ts.map +1 -1
  32. package/dist/configurators/workflow.js +2 -4
  33. package/dist/configurators/workflow.js.map +1 -1
  34. package/dist/constants/paths.d.ts +9 -0
  35. package/dist/constants/paths.d.ts.map +1 -1
  36. package/dist/constants/paths.js +13 -0
  37. package/dist/constants/paths.js.map +1 -1
  38. package/dist/migrations/manifests/0.3.0.json +1 -1
  39. package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/skills-and-commands.md +2 -4
  40. package/dist/templates/common/bundled-skills/cstl-skill-creator/SKILL.md +10 -7
  41. package/dist/templates/common/bundled-skills/cstl-skill-creator/references/authoring-rules.md +93 -19
  42. package/dist/templates/common/bundled-skills/cstl-skill-creator/references/general-authoring.md +189 -0
  43. package/dist/templates/common/bundled-skills/cstl-skill-creator/references/review-checklist.md +10 -5
  44. package/dist/templates/common/commands/continue.md +5 -4
  45. package/dist/templates/common/index.d.ts +20 -0
  46. package/dist/templates/common/index.d.ts.map +1 -1
  47. package/dist/templates/common/index.js +21 -2
  48. package/dist/templates/common/index.js.map +1 -1
  49. package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +179 -0
  50. package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +149 -0
  51. package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +903 -0
  52. package/dist/templates/cursor/agents/cstl-research.md +1 -1
  53. package/dist/templates/cursor/fixtures/expected-rules.d.ts +1 -1
  54. package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -1
  55. package/dist/templates/cursor/fixtures/expected-rules.js +7 -24
  56. package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
  57. package/dist/templates/cursor/hooks.json +4 -0
  58. package/dist/templates/cursor/index.d.ts +1 -1
  59. package/dist/templates/cursor/index.js +1 -1
  60. package/dist/templates/cursor/rules/cstl-bootstrap.mdc +17 -0
  61. package/dist/templates/markdown/agents.md +15 -10
  62. package/dist/templates/markdown/framework/cursor-native-modes-guide.md.txt +12 -9
  63. package/dist/templates/markdown/framework/cursor-subagent-policy.md.txt +62 -126
  64. package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +4 -6
  65. package/dist/templates/markdown/framework/execution-strategy.md.txt +2 -0
  66. package/dist/templates/markdown/framework/index.md.txt +4 -0
  67. package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +4 -3
  68. package/dist/templates/markdown/framework/middleware-protocol.md.txt +83 -0
  69. package/dist/templates/markdown/framework/parallel-first-execution.md.txt +78 -0
  70. package/dist/templates/markdown/framework/release-boundary.md.txt +30 -0
  71. package/dist/templates/markdown/framework/retrieval-daily-guide.md.txt +1 -1
  72. package/dist/templates/markdown/framework/upgrade.md.txt +15 -0
  73. package/dist/templates/markdown/index.d.ts +4 -0
  74. package/dist/templates/markdown/index.d.ts.map +1 -1
  75. package/dist/templates/markdown/index.js +17 -0
  76. package/dist/templates/markdown/index.js.map +1 -1
  77. package/dist/templates/markdown/spec/guides/index.md.txt +0 -6
  78. package/dist/templates/shared-hooks/event-bridge.py +60 -0
  79. package/dist/templates/shared-hooks/index.d.ts +1 -1
  80. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  81. package/dist/templates/shared-hooks/index.js +1 -0
  82. package/dist/templates/shared-hooks/index.js.map +1 -1
  83. package/dist/templates/shared-hooks/session-start.py +18 -1
  84. package/dist/templates/trellis/CONTEXT.md +63 -3
  85. package/dist/templates/trellis/gitignore.txt +39 -39
  86. package/dist/templates/trellis/index.d.ts +12 -0
  87. package/dist/templates/trellis/index.d.ts.map +1 -1
  88. package/dist/templates/trellis/index.js +73 -15
  89. package/dist/templates/trellis/index.js.map +1 -1
  90. package/dist/templates/trellis/pool/README.md +12 -3
  91. package/dist/templates/trellis/pool/plan.md +24 -5
  92. package/dist/templates/trellis/scripts/common/adapter_middleware.py +158 -0
  93. package/dist/templates/trellis/scripts/common/artifact_locale.py +12 -3
  94. package/dist/templates/trellis/scripts/common/cursor_retrieval_env.py +5 -2
  95. package/dist/templates/trellis/scripts/common/full_quality.py +237 -0
  96. package/dist/templates/trellis/scripts/common/git.py +6 -0
  97. package/dist/templates/trellis/scripts/common/git_context.py +17 -5
  98. package/dist/templates/trellis/scripts/common/kernel_command.py +367 -0
  99. package/dist/templates/trellis/scripts/common/lite_context.py +280 -0
  100. package/dist/templates/trellis/scripts/common/ondemand_topology.py +225 -0
  101. package/dist/templates/trellis/scripts/common/parent_orchestration.py +1 -1
  102. package/dist/templates/trellis/scripts/common/pool_store.py +16 -4
  103. package/dist/templates/trellis/scripts/common/retrieval_agent_instructions.py +2 -2
  104. package/dist/templates/trellis/scripts/common/session_context.py +28 -2
  105. package/dist/templates/trellis/scripts/common/task_gates.py +73 -12
  106. package/dist/templates/trellis/scripts/common/task_map.py +42 -9
  107. package/dist/templates/trellis/scripts/common/task_store.py +286 -56
  108. package/dist/templates/trellis/scripts/common/test_adapter_middleware.py +56 -0
  109. package/dist/templates/trellis/scripts/common/test_depends_mode_block.py +9 -0
  110. package/dist/templates/trellis/scripts/common/test_full_quality.py +197 -0
  111. package/dist/templates/trellis/scripts/common/test_kernel_command.py +326 -0
  112. package/dist/templates/trellis/scripts/common/test_lite_path.py +190 -0
  113. package/dist/templates/trellis/scripts/common/test_ondemand_topology.py +122 -0
  114. package/dist/templates/trellis/scripts/common/test_pool_store.py +17 -0
  115. package/dist/templates/trellis/scripts/common/test_task_store_kernel_patch.py +163 -0
  116. package/dist/templates/trellis/scripts/common/workflow_phase.py +3 -0
  117. package/dist/templates/trellis/scripts/get_context.py +1 -0
  118. package/dist/templates/trellis/scripts/pool.py +5 -0
  119. package/dist/templates/trellis/scripts/task.py +83 -7
  120. package/dist/templates/trellis/workflow.md +100 -18
  121. package/dist/utils/cursor-retrieval-env.d.ts +2 -1
  122. package/dist/utils/cursor-retrieval-env.d.ts.map +1 -1
  123. package/dist/utils/cursor-retrieval-env.js +3 -2
  124. package/dist/utils/cursor-retrieval-env.js.map +1 -1
  125. package/dist/utils/cursor2plus-residue-cleanup.d.ts +38 -0
  126. package/dist/utils/cursor2plus-residue-cleanup.d.ts.map +1 -0
  127. package/dist/utils/cursor2plus-residue-cleanup.js +145 -0
  128. package/dist/utils/cursor2plus-residue-cleanup.js.map +1 -0
  129. package/dist/utils/manifest-prune.d.ts.map +1 -1
  130. package/dist/utils/manifest-prune.js +7 -2
  131. package/dist/utils/manifest-prune.js.map +1 -1
  132. package/dist/utils/p36-upgrade.d.ts +62 -0
  133. package/dist/utils/p36-upgrade.d.ts.map +1 -0
  134. package/dist/utils/p36-upgrade.js +160 -0
  135. package/dist/utils/p36-upgrade.js.map +1 -0
  136. package/dist/utils/project-capabilities.d.ts +1 -12
  137. package/dist/utils/project-capabilities.d.ts.map +1 -1
  138. package/dist/utils/project-capabilities.js +3 -100
  139. package/dist/utils/project-capabilities.js.map +1 -1
  140. package/dist/utils/readiness.d.ts +10 -0
  141. package/dist/utils/readiness.d.ts.map +1 -1
  142. package/dist/utils/readiness.js +58 -26
  143. package/dist/utils/readiness.js.map +1 -1
  144. package/dist/utils/retrieval-agent-instructions.js +1 -1
  145. package/dist/utils/retrieval-agent-instructions.js.map +1 -1
  146. package/dist/utils/template-hash.d.ts.map +1 -1
  147. package/dist/utils/template-hash.js +11 -1
  148. package/dist/utils/template-hash.js.map +1 -1
  149. package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
  150. package/dist/utils/uninstall-scrubbers.js +52 -14
  151. package/dist/utils/uninstall-scrubbers.js.map +1 -1
  152. package/dist/utils/update-rollout-report.d.ts +14 -0
  153. package/dist/utils/update-rollout-report.d.ts.map +1 -1
  154. package/dist/utils/update-rollout-report.js +1 -0
  155. package/dist/utils/update-rollout-report.js.map +1 -1
  156. package/dist/utils/workflow-ownership.d.ts +1 -1
  157. package/dist/utils/workflow-ownership.js +4 -4
  158. package/dist/utils/workflow-ownership.js.map +1 -1
  159. package/package.json +5 -4
  160. package/scripts/postinstall.js +6 -7
  161. package/dist/commands/campaign/canvas-render.d.ts +0 -68
  162. package/dist/commands/campaign/canvas-render.d.ts.map +0 -1
  163. package/dist/commands/campaign/canvas-render.js +0 -414
  164. package/dist/commands/campaign/canvas-render.js.map +0 -1
  165. package/dist/commands/campaign/compose.d.ts +0 -15
  166. package/dist/commands/campaign/compose.d.ts.map +0 -1
  167. package/dist/commands/campaign/compose.js +0 -110
  168. package/dist/commands/campaign/compose.js.map +0 -1
  169. package/dist/commands/campaign/index.d.ts +0 -13
  170. package/dist/commands/campaign/index.d.ts.map +0 -1
  171. package/dist/commands/campaign/index.js +0 -134
  172. package/dist/commands/campaign/index.js.map +0 -1
  173. package/dist/commands/campaign/kind-map.d.ts +0 -6
  174. package/dist/commands/campaign/kind-map.d.ts.map +0 -1
  175. package/dist/commands/campaign/kind-map.js +0 -21
  176. package/dist/commands/campaign/kind-map.js.map +0 -1
  177. package/dist/commands/campaign/mcp-server.d.ts +0 -6
  178. package/dist/commands/campaign/mcp-server.d.ts.map +0 -1
  179. package/dist/commands/campaign/mcp-server.js +0 -167
  180. package/dist/commands/campaign/mcp-server.js.map +0 -1
  181. package/dist/commands/campaign/render.d.ts +0 -5
  182. package/dist/commands/campaign/render.d.ts.map +0 -1
  183. package/dist/commands/campaign/render.js +0 -103
  184. package/dist/commands/campaign/render.js.map +0 -1
  185. package/dist/commands/campaign/trellis-load.d.ts +0 -13
  186. package/dist/commands/campaign/trellis-load.d.ts.map +0 -1
  187. package/dist/commands/campaign/trellis-load.js +0 -122
  188. package/dist/commands/campaign/trellis-load.js.map +0 -1
  189. package/dist/commands/campaign/types.d.ts +0 -61
  190. package/dist/commands/campaign/types.d.ts.map +0 -1
  191. package/dist/commands/campaign/types.js +0 -3
  192. package/dist/commands/campaign/types.js.map +0 -1
  193. package/dist/commands/goal/index.d.ts +0 -3
  194. package/dist/commands/goal/index.d.ts.map +0 -1
  195. package/dist/commands/goal/index.js +0 -159
  196. package/dist/commands/goal/index.js.map +0 -1
  197. package/dist/commands/goal/review.d.ts +0 -6
  198. package/dist/commands/goal/review.d.ts.map +0 -1
  199. package/dist/commands/goal/review.js +0 -28
  200. package/dist/commands/goal/review.js.map +0 -1
  201. package/dist/commands/rpc/client.d.ts +0 -51
  202. package/dist/commands/rpc/client.d.ts.map +0 -1
  203. package/dist/commands/rpc/client.js +0 -147
  204. package/dist/commands/rpc/client.js.map +0 -1
  205. package/dist/commands/rpc/index.d.ts +0 -10
  206. package/dist/commands/rpc/index.d.ts.map +0 -1
  207. package/dist/commands/rpc/index.js +0 -157
  208. package/dist/commands/rpc/index.js.map +0 -1
  209. package/dist/commands/rpc/serve.d.ts +0 -23
  210. package/dist/commands/rpc/serve.d.ts.map +0 -1
  211. package/dist/commands/rpc/serve.js +0 -60
  212. package/dist/commands/rpc/serve.js.map +0 -1
  213. package/dist/commands/rpc/smoke.d.ts +0 -16
  214. package/dist/commands/rpc/smoke.d.ts.map +0 -1
  215. package/dist/commands/rpc/smoke.js +0 -92
  216. package/dist/commands/rpc/smoke.js.map +0 -1
  217. package/dist/commands/sdk/index.d.ts +0 -9
  218. package/dist/commands/sdk/index.d.ts.map +0 -1
  219. package/dist/commands/sdk/index.js +0 -58
  220. package/dist/commands/sdk/index.js.map +0 -1
  221. package/dist/commands/sdk/run.d.ts +0 -42
  222. package/dist/commands/sdk/run.d.ts.map +0 -1
  223. package/dist/commands/sdk/run.js +0 -220
  224. package/dist/commands/sdk/run.js.map +0 -1
  225. package/dist/commands/sdk/status.d.ts +0 -14
  226. package/dist/commands/sdk/status.d.ts.map +0 -1
  227. package/dist/commands/sdk/status.js +0 -69
  228. package/dist/commands/sdk/status.js.map +0 -1
  229. package/dist/configurators/cursor2plus-local.d.ts +0 -6
  230. package/dist/configurators/cursor2plus-local.d.ts.map +0 -1
  231. package/dist/configurators/cursor2plus-local.js +0 -21
  232. package/dist/configurators/cursor2plus-local.js.map +0 -1
  233. package/dist/goal/action-packet.d.ts +0 -89
  234. package/dist/goal/action-packet.d.ts.map +0 -1
  235. package/dist/goal/action-packet.js +0 -113
  236. package/dist/goal/action-packet.js.map +0 -1
  237. package/dist/goal/audit.d.ts +0 -14
  238. package/dist/goal/audit.d.ts.map +0 -1
  239. package/dist/goal/audit.js +0 -12
  240. package/dist/goal/audit.js.map +0 -1
  241. package/dist/goal/constants.d.ts +0 -26
  242. package/dist/goal/constants.d.ts.map +0 -1
  243. package/dist/goal/constants.js +0 -24
  244. package/dist/goal/constants.js.map +0 -1
  245. package/dist/goal/paths.d.ts +0 -8
  246. package/dist/goal/paths.d.ts.map +0 -1
  247. package/dist/goal/paths.js +0 -36
  248. package/dist/goal/paths.js.map +0 -1
  249. package/dist/goal/preflight.d.ts +0 -21
  250. package/dist/goal/preflight.d.ts.map +0 -1
  251. package/dist/goal/preflight.js +0 -97
  252. package/dist/goal/preflight.js.map +0 -1
  253. package/dist/goal/review-seam.d.ts +0 -44
  254. package/dist/goal/review-seam.d.ts.map +0 -1
  255. package/dist/goal/review-seam.js +0 -153
  256. package/dist/goal/review-seam.js.map +0 -1
  257. package/dist/goal/reviewer-rules.d.ts +0 -13
  258. package/dist/goal/reviewer-rules.d.ts.map +0 -1
  259. package/dist/goal/reviewer-rules.js +0 -153
  260. package/dist/goal/reviewer-rules.js.map +0 -1
  261. package/dist/goal/reviewer.d.ts +0 -9
  262. package/dist/goal/reviewer.d.ts.map +0 -1
  263. package/dist/goal/reviewer.js +0 -54
  264. package/dist/goal/reviewer.js.map +0 -1
  265. package/dist/goal/runtime.d.ts +0 -32
  266. package/dist/goal/runtime.d.ts.map +0 -1
  267. package/dist/goal/runtime.js +0 -242
  268. package/dist/goal/runtime.js.map +0 -1
  269. package/dist/goal/sdk-client.d.ts +0 -10
  270. package/dist/goal/sdk-client.d.ts.map +0 -1
  271. package/dist/goal/sdk-client.js +0 -34
  272. package/dist/goal/sdk-client.js.map +0 -1
  273. package/dist/goal/state.d.ts +0 -40
  274. package/dist/goal/state.d.ts.map +0 -1
  275. package/dist/goal/state.js +0 -37
  276. package/dist/goal/state.js.map +0 -1
  277. package/dist/goal/task-triggers.d.ts +0 -15
  278. package/dist/goal/task-triggers.d.ts.map +0 -1
  279. package/dist/goal/task-triggers.js +0 -23
  280. package/dist/goal/task-triggers.js.map +0 -1
  281. package/dist/goal/walls.d.ts +0 -12
  282. package/dist/goal/walls.d.ts.map +0 -1
  283. package/dist/goal/walls.js +0 -65
  284. package/dist/goal/walls.js.map +0 -1
  285. package/dist/goal/worker-prompt.d.ts +0 -13
  286. package/dist/goal/worker-prompt.d.ts.map +0 -1
  287. package/dist/goal/worker-prompt.js +0 -41
  288. package/dist/goal/worker-prompt.js.map +0 -1
  289. package/dist/goal/worker.d.ts +0 -42
  290. package/dist/goal/worker.d.ts.map +0 -1
  291. package/dist/goal/worker.js +0 -180
  292. package/dist/goal/worker.js.map +0 -1
  293. package/dist/templates/common/bundled-skills/cstl-cursor2plus-setup/SKILL.md +0 -63
  294. package/dist/templates/cursor/commands/cursor2plus-setup.md +0 -82
  295. package/dist/templates/cursor/rules/cstl-cursor-modes.mdc +0 -32
  296. package/dist/templates/cursor/rules/cstl-session-rename.mdc +0 -31
  297. package/dist/templates/cursor/rules/cstl-subagent-dispatch.mdc +0 -34
  298. package/dist/templates/cursor/rules/cstl-triage.mdc +0 -36
  299. package/dist/templates/cursor/rules/retrieval-routing.mdc +0 -78
  300. package/dist/templates/trellis/local/README.md +0 -85
  301. package/dist/templates/trellis/local/config.local.json.example +0 -6
  302. package/dist/templates/trellis/local/index.d.ts +0 -8
  303. package/dist/templates/trellis/local/index.d.ts.map +0 -1
  304. package/dist/templates/trellis/local/index.js +0 -15
  305. package/dist/templates/trellis/local/index.js.map +0 -1
  306. package/dist/templates/trellis/local/patch_wpelc8.py +0 -421
  307. package/dist/templates/trellis/local/smoke.py +0 -94
  308. package/dist/templates/trellis/local/subagent-models.json.example +0 -4
  309. package/dist/templates/trellis/local/trellis-task-models.json.example +0 -10
  310. package/dist/templates/trellis/local/trellis-task-models.json5.example +0 -45
  311. package/dist/templates/trellis/local/trellis_task_models_config.py +0 -200
  312. package/dist/utils/cursor-sdk-gate.d.ts +0 -10
  313. package/dist/utils/cursor-sdk-gate.d.ts.map +0 -1
  314. package/dist/utils/cursor-sdk-gate.js +0 -32
  315. package/dist/utils/cursor-sdk-gate.js.map +0 -1
@@ -1,54 +0,0 @@
1
- import { deriveH3Allowed, safeParseGoalActionPacket, validateGoalReviewDecision, } from "./action-packet.js";
2
- import { evaluateReviewerRules } from "./reviewer-rules.js";
3
- function buildL1Ready(packet, evaluation) {
4
- return {
5
- time: new Date().toISOString(),
6
- action: packet.proposed_action.slice(0, 200),
7
- axes: evaluation.axes,
8
- reviewer: "cstl-goal-reviewer",
9
- decision: evaluation.decision,
10
- rollback_hint: evaluation.hard_deny_hit != null
11
- ? `Do not execute; reroute away from ${evaluation.hard_deny_hit}.`
12
- : "Revert local edits or undo git commit if outcome is wrong.",
13
- };
14
- }
15
- export function reviewGoalActionPacket(input) {
16
- const packetResult = safeParseGoalActionPacket(input);
17
- if (!packetResult.valid) {
18
- return {
19
- valid: false,
20
- invalid_reason: packetResult.invalid_reason,
21
- };
22
- }
23
- const packet = packetResult.packet;
24
- const evaluation = evaluateReviewerRules(packet);
25
- const l1_ready = buildL1Ready(packet, evaluation);
26
- const decisionPayload = {
27
- schema_version: 1,
28
- decision: evaluation.decision,
29
- axes: evaluation.axes,
30
- hard_deny_hit: evaluation.hard_deny_hit,
31
- constraints: evaluation.constraints,
32
- alternative: evaluation.alternative ?? null,
33
- rationale: evaluation.rationale,
34
- l1_ready,
35
- h3_allowed: deriveH3Allowed({
36
- schema_version: 1,
37
- decision: evaluation.decision,
38
- axes: evaluation.axes,
39
- hard_deny_hit: evaluation.hard_deny_hit,
40
- rationale: evaluation.rationale,
41
- l1_ready,
42
- }),
43
- };
44
- const decisionResult = validateGoalReviewDecision(decisionPayload);
45
- if (!decisionResult.valid) {
46
- return {
47
- valid: false,
48
- invalid_reason: decisionResult.invalid_reason,
49
- };
50
- }
51
- return { valid: true, decision: decisionResult.decision };
52
- }
53
- export { validateGoalReviewDecision };
54
- //# sourceMappingURL=reviewer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../src/goal/reviewer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGf,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAQ5D,SAAS,YAAY,C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IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,QAAQ;SACT,CAAC;KACH,CAAC;IAEF,MAAM,cAAc,GAAG,0BAA0B,CAAC,eAAe,CAAC,CAAC;IACnE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC1B,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,cAAc,EAAE,cAAc,CAAC,cAAc;SAC9C,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC;AAC5D,CAAC;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -1,32 +0,0 @@
1
- import { proposePreflight } from "./preflight.js";
2
- import { type ReviewCaller } from "./review-seam.js";
3
- import { type GoalState } from "./state.js";
4
- import { type GoalWorkerKind } from "./worker.js";
5
- export interface GoalPreflightOptions {
6
- cwd: string;
7
- goal: string;
8
- window?: boolean;
9
- goalId?: string;
10
- }
11
- export interface GoalAcceptOptions {
12
- cwd: string;
13
- goalId: string;
14
- }
15
- export interface GoalRunOptions {
16
- cwd: string;
17
- goalId: string;
18
- mockWorker?: boolean;
19
- worker?: GoalWorkerKind;
20
- maxSteps?: number;
21
- }
22
- export declare function runGoalPreflight(opts: GoalPreflightOptions): {
23
- goalId: string;
24
- result: ReturnType<typeof proposePreflight>;
25
- };
26
- export declare function acceptGoalPreflight(opts: GoalAcceptOptions): GoalState;
27
- export declare function pauseGoal(cwd: string, goalId: string, reason: string): GoalState;
28
- export declare function crashGoal(cwd: string, goalId: string, reason: string): GoalState;
29
- export declare function runGoalLoop(opts: GoalRunOptions, reviewCaller?: ReviewCaller): Promise<GoalState>;
30
- export declare function goalStatus(cwd: string, goalId: string): GoalState;
31
- export declare function listGoalRuns(cwd: string): string[];
32
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,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IAAI,EAAE,cAAc,EACpB,YAAY,GAAE,YAQb,GACA,OAAO,CAAC,SAAS,CAAC,CAuHpB;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAEjE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOlD"}
@@ -1,242 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { spawnSync } from "node:child_process";
4
- import { appendAuditLine } from "./audit.js";
5
- import { detectRunMode, proposePreflight, renderContractMarkdown } from "./preflight.js";
6
- import { ensureGoalRunDir, goalContractPath, goalRunsRoot, newGoalId, } from "./paths.js";
7
- import { applyReviewDecision, minimalReviewFallback, packAction, recordL1, recordL2, writePacketFiles, } from "./review-seam.js";
8
- import { reviewGoalActionPacket } from "./reviewer.js";
9
- import { createDraftState, readGoalState, writeGoalState, } from "./state.js";
10
- import { evaluateTaskTriggers, shouldCreateGoalRootTask } from "./task-triggers.js";
11
- import { checkWalls, markNoProgressRound, markProgress } from "./walls.js";
12
- import { buildWorkerTurnContext, resolveWorkerAdapter, } from "./worker.js";
13
- import { DIR_NAMES } from "../constants/paths.js";
14
- import { workflowPath } from "../utils/workflow-dir.js";
15
- function runnerAvailable() {
16
- return process.env.CSTL_GOAL_FORCE_WINDOW !== "1";
17
- }
18
- export function runGoalPreflight(opts) {
19
- const goalId = opts.goalId ?? newGoalId();
20
- const mode = detectRunMode({
21
- forceWindow: opts.window === true,
22
- runnerAvailable: runnerAvailable(),
23
- });
24
- const result = proposePreflight(opts.goal, mode);
25
- ensureGoalRunDir(opts.cwd, goalId);
26
- let state = createDraftState(goalId, opts.goal, mode);
27
- state.lifecycle = result.ok ? "preflight_pending" : "draft";
28
- writeGoalState(opts.cwd, state);
29
- return { goalId, result };
30
- }
31
- export function acceptGoalPreflight(opts) {
32
- const state = readGoalState(opts.cwd, opts.goalId);
33
- if (state.lifecycle !== "preflight_pending") {
34
- throw new Error(`Goal ${opts.goalId} is not awaiting preflight acceptance`);
35
- }
36
- const proposal = proposePreflight(state.goal_text, state.mode);
37
- if (!proposal.ok) {
38
- throw new Error(`Cannot accept preflight: ${proposal.reason}`);
39
- }
40
- const contract = {
41
- goalText: state.goal_text,
42
- doneWhen: proposal.doneWhen,
43
- evidenceHow: proposal.evidenceHow,
44
- acceptedAt: new Date().toISOString(),
45
- };
46
- fs.writeFileSync(goalContractPath(opts.cwd, opts.goalId), renderContractMarkdown(proposal, state.goal_text), "utf-8");
47
- let next = {
48
- ...state,
49
- lifecycle: "running",
50
- contract,
51
- started_at: new Date().toISOString(),
52
- last_progress_at: new Date().toISOString(),
53
- };
54
- const hits = evaluateTaskTriggers(next, {
55
- l1Count: 0,
56
- justAcceptedPreflight: true,
57
- });
58
- if (shouldCreateGoalRootTask(hits)) {
59
- next.task_dir = createGoalRootTask(opts.cwd, next);
60
- appendAuditLine(opts.cwd, next.goal_id, "L0", `goal-root task ${next.task_dir}`);
61
- }
62
- writeGoalState(opts.cwd, next);
63
- return next;
64
- }
65
- function createGoalRootTask(cwd, state) {
66
- const slug = `goal-${state.goal_id.replace(/^goal-/, "")}`;
67
- const scripts = workflowPath(cwd, DIR_NAMES.SCRIPTS);
68
- const taskPy = scripts ? path.join(scripts, "task.py") : null;
69
- const title = `goal: ${state.goal_text.slice(0, 80)}`;
70
- if (taskPy && fs.existsSync(taskPy)) {
71
- const proc = spawnSync(process.platform === "win32" ? "python" : "python3", [taskPy, "create", title, "--slug", slug, "--package", "cursor-trellis"], { cwd, encoding: "utf-8" });
72
- if (proc.status === 0) {
73
- const taskDir = workflowPath(cwd, "tasks", slug);
74
- if (taskDir && fs.existsSync(path.join(taskDir, "task.json"))) {
75
- patchGoalMeta(taskDir, state.goal_id);
76
- return taskDir;
77
- }
78
- }
79
- }
80
- const fallbackDir = workflowPath(cwd, "tasks", slug);
81
- if (!fallbackDir)
82
- throw new Error("Cannot resolve tasks directory");
83
- fs.mkdirSync(fallbackDir, { recursive: true });
84
- fs.writeFileSync(path.join(fallbackDir, "task.json"), `${JSON.stringify({
85
- id: slug,
86
- title,
87
- status: "in_progress",
88
- meta: { created_by: "cstl-goal", goal_id: state.goal_id },
89
- }, null, 2)}\n`, "utf-8");
90
- fs.writeFileSync(path.join(fallbackDir, "prd.md"), `# ${title}\n\nGoal-root task for ${state.goal_id}.\n`, "utf-8");
91
- return fallbackDir;
92
- }
93
- function patchGoalMeta(taskDir, goalId) {
94
- const file = path.join(taskDir, "task.json");
95
- if (!fs.existsSync(file))
96
- return;
97
- const data = JSON.parse(fs.readFileSync(file, "utf-8"));
98
- const meta = typeof data.meta === "object" && data.meta !== null
99
- ? data.meta
100
- : {};
101
- meta.created_by = "cstl-goal";
102
- meta.goal_id = goalId;
103
- data.meta = meta;
104
- data.status = "in_progress";
105
- fs.writeFileSync(file, `${JSON.stringify(data, null, 2)}\n`, "utf-8");
106
- }
107
- export function pauseGoal(cwd, goalId, reason) {
108
- const state = readGoalState(cwd, goalId);
109
- const hits = evaluateTaskTriggers(state, { l1Count: 0, aboutToPause: true });
110
- if (hits.length > 0 && state.task_dir) {
111
- appendVerifySnippet(state.task_dir, `pause: ${reason}`);
112
- }
113
- recordL2(cwd, goalId, reason);
114
- const next = { ...state, lifecycle: "paused" };
115
- writeGoalState(cwd, next);
116
- return next;
117
- }
118
- export function crashGoal(cwd, goalId, reason) {
119
- const state = readGoalState(cwd, goalId);
120
- recordL2(cwd, goalId, reason);
121
- if (state.task_dir)
122
- appendVerifySnippet(state.task_dir, `crash-wall: ${reason}`);
123
- const next = { ...state, lifecycle: "crashed" };
124
- writeGoalState(cwd, next);
125
- return next;
126
- }
127
- function appendVerifySnippet(taskDir, line) {
128
- const verify = path.join(taskDir, "verify.md");
129
- if (!fs.existsSync(taskDir)) {
130
- return;
131
- }
132
- const stamp = new Date().toISOString();
133
- const chunk = `\n## Goal runtime (${stamp})\n\n- ${line}\n`;
134
- if (fs.existsSync(verify)) {
135
- fs.appendFileSync(verify, chunk, "utf-8");
136
- }
137
- else {
138
- fs.writeFileSync(verify, `# verify\n${chunk}`, "utf-8");
139
- }
140
- }
141
- export async function runGoalLoop(opts, reviewCaller = async (packetPath) => {
142
- const raw = JSON.parse(fs.readFileSync(packetPath, "utf-8"));
143
- const result = reviewGoalActionPacket(raw);
144
- if (!result.valid || !result.decision) {
145
- // Invalid packet / decision: fall back so walls can retry or pause.
146
- return minimalReviewFallback(raw);
147
- }
148
- return result.decision;
149
- }) {
150
- let state = readGoalState(opts.cwd, opts.goalId);
151
- if (state.lifecycle !== "running") {
152
- throw new Error(`Goal ${opts.goalId} is not running (lifecycle=${state.lifecycle})`);
153
- }
154
- const maxSteps = opts.maxSteps ?? 3;
155
- let packetSeq = 1;
156
- for (let step = 0; step < maxSteps; step += 1) {
157
- const wall = checkWalls(state);
158
- if (!wall.ok) {
159
- return crashGoal(opts.cwd, state.goal_id, wall.reason);
160
- }
161
- state = {
162
- ...state,
163
- worker_turns: state.worker_turns + 1,
164
- total_turns: state.total_turns + 1,
165
- };
166
- if (state.mode === "window" && !opts.mockWorker && opts.worker !== "mock") {
167
- appendAuditLine(opts.cwd, state.goal_id, "L0", "window mode — continue in IDE agent; close window stops run");
168
- writeGoalState(opts.cwd, state);
169
- return state;
170
- }
171
- const adapter = resolveWorkerAdapter({
172
- mockWorker: opts.mockWorker,
173
- worker: opts.worker,
174
- });
175
- state = { ...state, last_worker_adapter: adapter.id };
176
- appendAuditLine(opts.cwd, state.goal_id, "L0", `worker ${adapter.id} turn ${step + 1} start`);
177
- const turnResult = await adapter.runTurn(buildWorkerTurnContext(opts.cwd, state, step + 1));
178
- appendAuditLine(opts.cwd, state.goal_id, "L0", turnResult.summary);
179
- if (turnResult.kind === "error") {
180
- state = markNoProgressRound(state);
181
- writeGoalState(opts.cwd, state);
182
- continue;
183
- }
184
- if (turnResult.kind === "status") {
185
- state = markProgress(state);
186
- writeGoalState(opts.cwd, state);
187
- continue;
188
- }
189
- const sampleAction = turnResult.packet ??
190
- packAction(state, {
191
- summary: "Run focused validation for goal step",
192
- kind: "shell",
193
- digest: "pnpm test goal/",
194
- axes: { A: false, B: false, C: true },
195
- hardDenyCandidates: [],
196
- });
197
- const packetPath = writePacketFiles(opts.cwd, state.goal_id, packetSeq, sampleAction).requestPath;
198
- let reviewAttempts = 0;
199
- let applied = false;
200
- while (reviewAttempts <= state.walls.maxReviewRetries && !applied) {
201
- const decision = await reviewCaller(packetPath);
202
- writePacketFiles(opts.cwd, state.goal_id, packetSeq, sampleAction, decision);
203
- const outcome = applyReviewDecision(state, sampleAction, decision, sampleAction.action_kind);
204
- state = outcome.state;
205
- if (outcome.result.action === "retry_review") {
206
- reviewAttempts += 1;
207
- continue;
208
- }
209
- recordL1(opts.cwd, state.goal_id, decision);
210
- applied = true;
211
- if (outcome.result.action === "crash_wall") {
212
- return crashGoal(opts.cwd, state.goal_id, outcome.result.reason);
213
- }
214
- if (outcome.result.action === "reroute") {
215
- state = markNoProgressRound(state);
216
- }
217
- else {
218
- state = markProgress(state);
219
- }
220
- }
221
- if (!applied) {
222
- return pauseGoal(opts.cwd, state.goal_id, "review retries exhausted");
223
- }
224
- packetSeq += 1;
225
- writeGoalState(opts.cwd, state);
226
- }
227
- writeGoalState(opts.cwd, state);
228
- return state;
229
- }
230
- export function goalStatus(cwd, goalId) {
231
- return readGoalState(cwd, goalId);
232
- }
233
- export function listGoalRuns(cwd) {
234
- const runsRoot = goalRunsRoot(cwd);
235
- if (!fs.existsSync(runsRoot))
236
- return [];
237
- return fs
238
- .readdirSync(runsRoot, { withFileTypes: true })
239
- .filter((d) => d.isDirectory())
240
- .map((d) => d.name);
241
- }
242
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/goal/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SA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AC,QAAQ,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SAC9C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
@@ -1,10 +0,0 @@
1
- export interface CursorAgentOutcome {
2
- status: string;
3
- result: string;
4
- }
5
- /**
6
- * Call @cursor/sdk Agent.prompt against a local cwd.
7
- * Requires CURSOR_API_KEY in the current process (never logged).
8
- */
9
- export declare function promptCursorAgent(prompt: string, cwd: string): Promise<CursorAgentOutcome>;
10
- //# sourceMappingURL=sdk-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../../src/goal/sdk-client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAaD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,kBAAkB,CAAC,CAmC7B"}
@@ -1,34 +0,0 @@
1
- import { cursorApiKeySetupGuide, hasCursorApiKey } from "../utils/cursor-sdk-gate.js";
2
- /**
3
- * Call @cursor/sdk Agent.prompt against a local cwd.
4
- * Requires CURSOR_API_KEY in the current process (never logged).
5
- */
6
- export async function promptCursorAgent(prompt, cwd) {
7
- if (!hasCursorApiKey()) {
8
- throw new Error([
9
- "Live goal worker requires CURSOR_API_KEY (and prior user consent to use it).",
10
- "Use --mock-worker for offline/CI runs.",
11
- cursorApiKeySetupGuide(),
12
- ].join(" "));
13
- }
14
- const apiKey = process.env.CURSOR_API_KEY.trim();
15
- let Agent;
16
- try {
17
- const dynamicImport = new Function("specifier", "return import(specifier)");
18
- const mod = await dynamicImport("@cursor/sdk");
19
- Agent = mod.Agent;
20
- }
21
- catch {
22
- throw new Error("@cursor/sdk is not installed. After explicit consent, add the optional dependency, or use --mock-worker.");
23
- }
24
- const outcome = await Agent.prompt(prompt, {
25
- apiKey,
26
- model: { id: "composer-2.5" },
27
- local: { cwd },
28
- });
29
- return {
30
- status: outcome.status ?? "unknown",
31
- result: outcome.result ?? "",
32
- };
33
- }
34
- //# sourceMappingURL=sdk-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk-client.js","sourceRoot":"","sources":["../../src/goal/sdk-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAkBtF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,GAAW;IAEX,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb;YACE,8EAA8E;YAC9E,wCAAwC;YACxC,sBAAsB,EAAE;SACzB,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAe,CAAC,IAAI,EAAE,CAAC;IAClD,IAAI,KAAkB,CAAC;IACvB,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,IAAI,QAAQ,CAChC,WAAW,EACX,0BAA0B,CAC+B,CAAC;QAC5D,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,CAAC;QAC/C,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE;QACzC,MAAM;QACN,KAAK,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE;QAC7B,KAAK,EAAE,EAAE,GAAG,EAAE;KACf,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,SAAS;QACnC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC7B,CAAC;AACJ,CAAC"}
@@ -1,40 +0,0 @@
1
- import type { GoalLifecycleState, GoalRunMode } from "./constants.js";
2
- export interface GoalContract {
3
- goalText: string;
4
- doneWhen: string[];
5
- evidenceHow: string;
6
- acceptedAt: string;
7
- }
8
- export interface GoalWallCounters {
9
- wallClockSeconds: number;
10
- noProgressSeconds: number;
11
- noProgressRounds: number;
12
- workerTurnLimit: number;
13
- totalTurnLimit: number;
14
- workerTurnTimeoutMs: number;
15
- maxReroutes: number;
16
- maxReviewRetries: number;
17
- }
18
- export interface GoalState {
19
- goal_id: string;
20
- lifecycle: GoalLifecycleState;
21
- mode: GoalRunMode;
22
- goal_text: string;
23
- contract?: GoalContract;
24
- task_dir: string | null;
25
- started_at: string | null;
26
- last_progress_at: string | null;
27
- worker_turns: number;
28
- total_turns: number;
29
- no_progress_rounds: number;
30
- reroute_counts: Record<string, number>;
31
- walls: GoalWallCounters;
32
- channel_name: string | null;
33
- last_worker_adapter?: GoalWorkerKind | null;
34
- }
35
- export type GoalWorkerKind = "sdk" | "mock";
36
- export declare function defaultWalls(mode: GoalRunMode): GoalWallCounters;
37
- export declare function createDraftState(goalId: string, goalText: string, mode: GoalRunMode): GoalState;
38
- export declare function readGoalState(cwd: string, goalId: string): GoalState;
39
- export declare function writeGoalState(cwd: string, state: GoalState): void;
40
- //# sourceMappingURL=state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/goal/state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAItE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW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AAM,EAAE,MAAM,GAAG,SAAS,CAMpE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAIlE"}
@@ -1,37 +0,0 @@
1
- import fs from "node:fs";
2
- import { GOAL_WALL_DEFAULTS } from "./constants.js";
3
- import { goalStatePath } from "./paths.js";
4
- export function defaultWalls(mode) {
5
- return { ...GOAL_WALL_DEFAULTS[mode] };
6
- }
7
- export function createDraftState(goalId, goalText, mode) {
8
- return {
9
- goal_id: goalId,
10
- lifecycle: "draft",
11
- mode,
12
- goal_text: goalText,
13
- task_dir: null,
14
- started_at: null,
15
- last_progress_at: null,
16
- worker_turns: 0,
17
- total_turns: 0,
18
- no_progress_rounds: 0,
19
- reroute_counts: {},
20
- walls: defaultWalls(mode),
21
- channel_name: null,
22
- last_worker_adapter: null,
23
- };
24
- }
25
- export function readGoalState(cwd, goalId) {
26
- const file = goalStatePath(cwd, goalId);
27
- if (!fs.existsSync(file)) {
28
- throw new Error(`Goal state not found: ${file}`);
29
- }
30
- return JSON.parse(fs.readFileSync(file, "utf-8"));
31
- }
32
- export function writeGoalState(cwd, state) {
33
- const file = goalStatePath(cwd, state.goal_id);
34
- fs.mkdirSync(file.replace(/[/\\][^/\\]+$/, ""), { recursive: true });
35
- fs.writeFileSync(file, `${JSON.stringify(state, null, 2)}\n`, "utf-8");
36
- }
37
- //# sourceMappingURL=state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/goal/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAwC3C,MAAM,UAAU,YAAY,CAAC,IAAiB;IAC5C,OAAO,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,MA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- import type { GoalState } from "./state.js";
2
- export type TaskTriggerId = "T-1" | "T-2" | "T-3" | "T-4" | "T-5";
3
- export interface TaskTriggerHit {
4
- id: TaskTriggerId;
5
- reason: string;
6
- }
7
- export declare function evaluateTaskTriggers(state: GoalState, ctx: {
8
- l1Count: number;
9
- estimatedHours?: number;
10
- independentDeliverables?: number;
11
- aboutToPause?: boolean;
12
- justAcceptedPreflight?: boolean;
13
- }): TaskTriggerHit[];
14
- export declare function shouldCreateGoalRootTask(hits: TaskTriggerHit[]): boolean;
15
- //# sourceMappingURL=task-triggers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-triggers.d.ts","sourceRoot":"","sources":["../../src/goal/task-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,aAAa,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,GACA,cAAc,EAAE,CAwBlB;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAExE"}
@@ -1,23 +0,0 @@
1
- export function evaluateTaskTriggers(state, ctx) {
2
- const hits = [];
3
- if (ctx.justAcceptedPreflight) {
4
- hits.push({ id: "T-5", reason: "preflight accepted — goal-root task required" });
5
- }
6
- if ((ctx.estimatedHours ?? 0) > 1) {
7
- hits.push({ id: "T-1", reason: "estimated or elapsed >1h" });
8
- }
9
- if ((ctx.independentDeliverables ?? 0) >= 2) {
10
- hits.push({ id: "T-2", reason: "≥2 independent deliverables planned" });
11
- }
12
- if (ctx.l1Count >= 1 && !state.task_dir) {
13
- hits.push({ id: "T-3", reason: "≥1 L1 audit without bound task_dir" });
14
- }
15
- if (ctx.aboutToPause) {
16
- hits.push({ id: "T-4", reason: "pause or crash-wall imminent" });
17
- }
18
- return hits;
19
- }
20
- export function shouldCreateGoalRootTask(hits) {
21
- return hits.some((h) => h.id === "T-5" || h.id === "T-3");
22
- }
23
- //# sourceMappingURL=task-triggers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-triggers.js","sourceRoot":"","sources":["../../src/goal/task-triggers.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,oBAAoB,CAClC,KAAgB,EAChB,GAMC;IAED,MAAM,IAAI,GAAqB,EAAE,CAAC;IAElC,IAAI,GAAG,CAAC,qBAAqB,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,8CAA8C,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,0BAA0B,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,uBAAuB,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,qCAAqC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oCAAoC,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAAsB;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC;AAC5D,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { GoalState } from "./state.js";
2
- export type WallCheckResult = {
3
- ok: true;
4
- } | {
5
- ok: false;
6
- reason: string;
7
- crash: true;
8
- };
9
- export declare function checkWalls(state: GoalState, nowMs?: number): WallCheckResult;
10
- export declare function markProgress(state: GoalState, nowMs?: number): GoalState;
11
- export declare function markNoProgressRound(state: GoalState): GoalState;
12
- //# sourceMappingURL=walls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"walls.d.ts","sourceRoot":"","sources":["../../src/goal/walls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAC;AAa/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,SAAa,GAAG,eAAe,CA+ChF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,SAAa,GAAG,SAAS,CAM5E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAK/D"}
@@ -1,65 +0,0 @@
1
- function elapsedSeconds(state, nowMs) {
2
- if (!state.started_at)
3
- return 0;
4
- return Math.max(0, (nowMs - Date.parse(state.started_at)) / 1000);
5
- }
6
- function noProgressSeconds(state, nowMs) {
7
- const anchor = state.last_progress_at ?? state.started_at;
8
- if (!anchor)
9
- return 0;
10
- return Math.max(0, (nowMs - Date.parse(anchor)) / 1000);
11
- }
12
- export function checkWalls(state, nowMs = Date.now()) {
13
- const w = state.walls;
14
- if (state.started_at && elapsedSeconds(state, nowMs) >= w.wallClockSeconds) {
15
- return {
16
- ok: false,
17
- crash: true,
18
- reason: `wall-clock reached (${w.wallClockSeconds}s)`,
19
- };
20
- }
21
- if (state.worker_turns >= w.workerTurnLimit) {
22
- return {
23
- ok: false,
24
- crash: true,
25
- reason: `worker turn hard-cap (${w.workerTurnLimit})`,
26
- };
27
- }
28
- if (state.total_turns >= w.totalTurnLimit) {
29
- return {
30
- ok: false,
31
- crash: true,
32
- reason: `total turn hard-cap (${w.totalTurnLimit})`,
33
- };
34
- }
35
- if (state.started_at &&
36
- noProgressSeconds(state, nowMs) >= w.noProgressSeconds) {
37
- return {
38
- ok: false,
39
- crash: true,
40
- reason: `no-progress wall (${w.noProgressSeconds}s)`,
41
- };
42
- }
43
- if (state.no_progress_rounds >= w.noProgressRounds) {
44
- return {
45
- ok: false,
46
- crash: true,
47
- reason: `no-progress rounds (${w.noProgressRounds})`,
48
- };
49
- }
50
- return { ok: true };
51
- }
52
- export function markProgress(state, nowMs = Date.now()) {
53
- return {
54
- ...state,
55
- last_progress_at: new Date(nowMs).toISOString(),
56
- no_progress_rounds: 0,
57
- };
58
- }
59
- export function markNoProgressRound(state) {
60
- return {
61
- ...state,
62
- no_progress_rounds: state.no_progress_rounds + 1,
63
- };
64
- }
65
- //# sourceMappingURL=walls.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"walls.js","sourceRoot":"","sources":["../../src/goal/walls.ts"],"names":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