@kynetic-ai/spec 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +250 -17
- package/dist/acp/client.d.ts +18 -4
- package/dist/acp/client.d.ts.map +1 -1
- package/dist/acp/client.js +44 -26
- package/dist/acp/client.js.map +1 -1
- package/dist/acp/framing.d.ts +2 -2
- package/dist/acp/framing.d.ts.map +1 -1
- package/dist/acp/framing.js +37 -29
- package/dist/acp/framing.js.map +1 -1
- package/dist/acp/index.d.ts +6 -7
- package/dist/acp/index.d.ts.map +1 -1
- package/dist/acp/index.js +3 -3
- package/dist/acp/index.js.map +1 -1
- package/dist/acp/types.d.ts +5 -5
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js +18 -18
- package/dist/acp/types.js.map +1 -1
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/adapters.js +24 -13
- package/dist/agents/adapters.js.map +1 -1
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.js +2 -2
- package/dist/agents/spawner.d.ts +4 -4
- package/dist/agents/spawner.d.ts.map +1 -1
- package/dist/agents/spawner.js +6 -6
- package/dist/agents/spawner.js.map +1 -1
- package/dist/cli/batch-context.d.ts +43 -0
- package/dist/cli/batch-context.d.ts.map +1 -0
- package/dist/cli/batch-context.js +93 -0
- package/dist/cli/batch-context.js.map +1 -0
- package/dist/cli/batch-exec.d.ts +116 -0
- package/dist/cli/batch-exec.d.ts.map +1 -0
- package/dist/cli/batch-exec.js +694 -0
- package/dist/cli/batch-exec.js.map +1 -0
- package/dist/cli/batch.d.ts +4 -2
- package/dist/cli/batch.d.ts.map +1 -1
- package/dist/cli/batch.js +15 -14
- package/dist/cli/batch.js.map +1 -1
- package/dist/cli/command-annotations.d.ts +23 -0
- package/dist/cli/command-annotations.d.ts.map +1 -0
- package/dist/cli/command-annotations.js +27 -0
- package/dist/cli/command-annotations.js.map +1 -0
- package/dist/cli/commands/agents.d.ts +46 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/agents.js +377 -0
- package/dist/cli/commands/agents.js.map +1 -0
- package/dist/cli/commands/batch.d.ts +20 -0
- package/dist/cli/commands/batch.d.ts.map +1 -0
- package/dist/cli/commands/batch.js +214 -0
- package/dist/cli/commands/batch.js.map +1 -0
- package/dist/cli/commands/clone-for-testing.d.ts +1 -1
- package/dist/cli/commands/clone-for-testing.d.ts.map +1 -1
- package/dist/cli/commands/clone-for-testing.js +37 -47
- package/dist/cli/commands/clone-for-testing.js.map +1 -1
- package/dist/cli/commands/derive.d.ts +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +140 -88
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +11 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +152 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/export.d.ts +12 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +134 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/help.d.ts +1 -1
- package/dist/cli/commands/help.d.ts.map +1 -1
- package/dist/cli/commands/help.js +163 -37
- package/dist/cli/commands/help.js.map +1 -1
- package/dist/cli/commands/inbox.d.ts +1 -1
- package/dist/cli/commands/inbox.d.ts.map +1 -1
- package/dist/cli/commands/inbox.js +178 -56
- package/dist/cli/commands/inbox.js.map +1 -1
- package/dist/cli/commands/index.d.ts +31 -19
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +31 -19
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +5 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +108 -57
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/item.d.ts +1 -1
- package/dist/cli/commands/item.d.ts.map +1 -1
- package/dist/cli/commands/item.js +557 -274
- package/dist/cli/commands/item.js.map +1 -1
- package/dist/cli/commands/link.d.ts +1 -1
- package/dist/cli/commands/link.d.ts.map +1 -1
- package/dist/cli/commands/link.js +55 -46
- package/dist/cli/commands/link.js.map +1 -1
- package/dist/cli/commands/log.d.ts +1 -1
- package/dist/cli/commands/log.d.ts.map +1 -1
- package/dist/cli/commands/log.js +57 -51
- package/dist/cli/commands/log.js.map +1 -1
- package/dist/cli/commands/merge-driver.d.ts +19 -0
- package/dist/cli/commands/merge-driver.d.ts.map +1 -0
- package/dist/cli/commands/merge-driver.js +398 -0
- package/dist/cli/commands/merge-driver.js.map +1 -0
- package/dist/cli/commands/meta.d.ts +1 -1
- package/dist/cli/commands/meta.d.ts.map +1 -1
- package/dist/cli/commands/meta.js +533 -399
- package/dist/cli/commands/meta.js.map +1 -1
- package/dist/cli/commands/module.d.ts +1 -1
- package/dist/cli/commands/module.d.ts.map +1 -1
- package/dist/cli/commands/module.js +30 -25
- package/dist/cli/commands/module.js.map +1 -1
- package/dist/cli/commands/plan-import.d.ts +11 -0
- package/dist/cli/commands/plan-import.d.ts.map +1 -0
- package/dist/cli/commands/plan-import.js +516 -0
- package/dist/cli/commands/plan-import.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +10 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +421 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/ralph.d.ts +1 -1
- package/dist/cli/commands/ralph.d.ts.map +1 -1
- package/dist/cli/commands/ralph.js +1097 -169
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/refs.d.ts +13 -0
- package/dist/cli/commands/refs.d.ts.map +1 -0
- package/dist/cli/commands/refs.js +283 -0
- package/dist/cli/commands/refs.js.map +1 -0
- package/dist/cli/commands/search.d.ts +1 -1
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +199 -37
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/serve.d.ts +10 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +491 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/session.d.ts +25 -6
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +811 -127
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/setup-seeding.d.ts +81 -0
- package/dist/cli/commands/setup-seeding.d.ts.map +1 -0
- package/dist/cli/commands/setup-seeding.js +292 -0
- package/dist/cli/commands/setup-seeding.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +77 -3
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +1233 -274
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/shadow.d.ts +1 -1
- package/dist/cli/commands/shadow.d.ts.map +1 -1
- package/dist/cli/commands/shadow.js +70 -50
- package/dist/cli/commands/shadow.js.map +1 -1
- package/dist/cli/commands/skill-crud.d.ts +58 -0
- package/dist/cli/commands/skill-crud.d.ts.map +1 -0
- package/dist/cli/commands/skill-crud.js +753 -0
- package/dist/cli/commands/skill-crud.js.map +1 -0
- package/dist/cli/commands/skill-diff.d.ts +27 -0
- package/dist/cli/commands/skill-diff.d.ts.map +1 -0
- package/dist/cli/commands/skill-diff.js +840 -0
- package/dist/cli/commands/skill-diff.js.map +1 -0
- package/dist/cli/commands/skill-install.d.ts +53 -0
- package/dist/cli/commands/skill-install.d.ts.map +1 -0
- package/dist/cli/commands/skill-install.js +452 -0
- package/dist/cli/commands/skill-install.js.map +1 -0
- package/dist/cli/commands/skill.d.ts +20 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +36 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/task.d.ts +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +569 -346
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts +26 -1
- package/dist/cli/commands/tasks.d.ts.map +1 -1
- package/dist/cli/commands/tasks.js +227 -122
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/trait.d.ts +1 -1
- package/dist/cli/commands/trait.d.ts.map +1 -1
- package/dist/cli/commands/trait.js +166 -101
- package/dist/cli/commands/trait.js.map +1 -1
- package/dist/cli/commands/triage.d.ts +7 -0
- package/dist/cli/commands/triage.d.ts.map +1 -0
- package/dist/cli/commands/triage.js +569 -0
- package/dist/cli/commands/triage.js.map +1 -0
- package/dist/cli/commands/util.d.ts +7 -0
- package/dist/cli/commands/util.d.ts.map +1 -0
- package/dist/cli/commands/util.js +30 -0
- package/dist/cli/commands/util.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +264 -83
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts +16 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +851 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/exit-codes.d.ts +7 -0
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +26 -18
- package/dist/cli/exit-codes.js.map +1 -1
- package/dist/cli/help/content.d.ts.map +1 -1
- package/dist/cli/help/content.js +86 -71
- package/dist/cli/help/content.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +131 -19
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/introspection.d.ts +6 -2
- package/dist/cli/introspection.d.ts.map +1 -1
- package/dist/cli/introspection.js +11 -8
- package/dist/cli/introspection.js.map +1 -1
- package/dist/cli/output.d.ts +64 -4
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +235 -85
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/parse-utils.d.ts +21 -0
- package/dist/cli/parse-utils.d.ts.map +1 -0
- package/dist/cli/parse-utils.js +32 -0
- package/dist/cli/parse-utils.js.map +1 -0
- package/dist/cli/pid-utils.d.ts +72 -0
- package/dist/cli/pid-utils.d.ts.map +1 -0
- package/dist/cli/pid-utils.js +174 -0
- package/dist/cli/pid-utils.js.map +1 -0
- package/dist/cli/suggest.d.ts.map +1 -1
- package/dist/cli/suggest.js +1 -2
- package/dist/cli/suggest.js.map +1 -1
- package/dist/cli/validators.d.ts +43 -0
- package/dist/cli/validators.d.ts.map +1 -0
- package/dist/cli/validators.js +84 -0
- package/dist/cli/validators.js.map +1 -0
- package/dist/daemon/index.ts +52 -0
- package/dist/daemon/middleware/project-context.ts +126 -0
- package/dist/daemon/pid.ts +179 -0
- package/dist/daemon/project-context.ts +343 -0
- package/dist/daemon/routes/inbox.ts +164 -0
- package/dist/daemon/routes/items.ts +322 -0
- package/dist/daemon/routes/meta.ts +118 -0
- package/dist/daemon/routes/projects.ts +162 -0
- package/dist/daemon/routes/tasks.ts +327 -0
- package/dist/daemon/routes/triage.ts +468 -0
- package/dist/daemon/routes/validation.ts +248 -0
- package/dist/daemon/server.ts +408 -0
- package/dist/daemon/watcher.ts +195 -0
- package/dist/daemon/websocket/handler.ts +138 -0
- package/dist/daemon/websocket/heartbeat.ts +71 -0
- package/dist/daemon/websocket/pubsub.ts +125 -0
- package/dist/daemon/websocket/types.ts +66 -0
- package/dist/export/html.d.ts +19 -0
- package/dist/export/html.d.ts.map +1 -0
- package/dist/export/html.js +239 -0
- package/dist/export/html.js.map +1 -0
- package/dist/export/index.d.ts +10 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +10 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/json.d.ts +24 -0
- package/dist/export/json.d.ts.map +1 -0
- package/dist/export/json.js +198 -0
- package/dist/export/json.js.map +1 -0
- package/dist/export/triage.d.ts +51 -0
- package/dist/export/triage.d.ts.map +1 -0
- package/dist/export/triage.js +83 -0
- package/dist/export/triage.js.map +1 -0
- package/dist/export/types.d.ts +122 -0
- package/dist/export/types.d.ts.map +1 -0
- package/dist/export/types.js +9 -0
- package/dist/export/types.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/claude-plugin-registry.d.ts +66 -0
- package/dist/lib/claude-plugin-registry.d.ts.map +1 -0
- package/dist/lib/claude-plugin-registry.js +318 -0
- package/dist/lib/claude-plugin-registry.js.map +1 -0
- package/dist/merge/arrays.d.ts +87 -0
- package/dist/merge/arrays.d.ts.map +1 -0
- package/dist/merge/arrays.js +164 -0
- package/dist/merge/arrays.js.map +1 -0
- package/dist/merge/file-type.d.ts +32 -0
- package/dist/merge/file-type.d.ts.map +1 -0
- package/dist/merge/file-type.js +70 -0
- package/dist/merge/file-type.js.map +1 -0
- package/dist/merge/index.d.ts +14 -0
- package/dist/merge/index.d.ts.map +1 -0
- package/dist/merge/index.js +11 -0
- package/dist/merge/index.js.map +1 -0
- package/dist/merge/objects.d.ts +46 -0
- package/dist/merge/objects.d.ts.map +1 -0
- package/dist/merge/objects.js +193 -0
- package/dist/merge/objects.js.map +1 -0
- package/dist/merge/parse.d.ts +23 -0
- package/dist/merge/parse.d.ts.map +1 -0
- package/dist/merge/parse.js +78 -0
- package/dist/merge/parse.js.map +1 -0
- package/dist/merge/resolve.d.ts +66 -0
- package/dist/merge/resolve.d.ts.map +1 -0
- package/dist/merge/resolve.js +189 -0
- package/dist/merge/resolve.js.map +1 -0
- package/dist/merge/types.d.ts +82 -0
- package/dist/merge/types.d.ts.map +1 -0
- package/dist/merge/types.js +8 -0
- package/dist/merge/types.js.map +1 -0
- package/dist/parser/agent-data-sections.d.ts +53 -0
- package/dist/parser/agent-data-sections.d.ts.map +1 -0
- package/dist/parser/agent-data-sections.js +118 -0
- package/dist/parser/agent-data-sections.js.map +1 -0
- package/dist/parser/alignment.d.ts +4 -4
- package/dist/parser/alignment.d.ts.map +1 -1
- package/dist/parser/alignment.js +27 -22
- package/dist/parser/alignment.js.map +1 -1
- package/dist/parser/assess.d.ts +5 -5
- package/dist/parser/assess.d.ts.map +1 -1
- package/dist/parser/assess.js +36 -32
- package/dist/parser/assess.js.map +1 -1
- package/dist/parser/config.d.ts +351 -0
- package/dist/parser/config.d.ts.map +1 -0
- package/dist/parser/config.js +326 -0
- package/dist/parser/config.js.map +1 -0
- package/dist/parser/convention-validation.d.ts +1 -1
- package/dist/parser/convention-validation.d.ts.map +1 -1
- package/dist/parser/convention-validation.js +21 -16
- package/dist/parser/convention-validation.js.map +1 -1
- package/dist/parser/coverage-cache.d.ts +49 -0
- package/dist/parser/coverage-cache.d.ts.map +1 -0
- package/dist/parser/coverage-cache.js +123 -0
- package/dist/parser/coverage-cache.js.map +1 -0
- package/dist/parser/daemon-status.d.ts +37 -0
- package/dist/parser/daemon-status.d.ts.map +1 -0
- package/dist/parser/daemon-status.js +67 -0
- package/dist/parser/daemon-status.js.map +1 -0
- package/dist/parser/doctor.d.ts +107 -0
- package/dist/parser/doctor.d.ts.map +1 -0
- package/dist/parser/doctor.js +366 -0
- package/dist/parser/doctor.js.map +1 -0
- package/dist/parser/fix.d.ts +1 -1
- package/dist/parser/fix.d.ts.map +1 -1
- package/dist/parser/fix.js +31 -27
- package/dist/parser/fix.js.map +1 -1
- package/dist/parser/index.d.ts +16 -11
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +16 -11
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/items.d.ts +8 -2
- package/dist/parser/items.d.ts.map +1 -1
- package/dist/parser/items.js +71 -35
- package/dist/parser/items.js.map +1 -1
- package/dist/parser/meta.d.ts +167 -9
- package/dist/parser/meta.d.ts.map +1 -1
- package/dist/parser/meta.js +379 -46
- package/dist/parser/meta.js.map +1 -1
- package/dist/parser/plan-document.d.ts +189 -0
- package/dist/parser/plan-document.d.ts.map +1 -0
- package/dist/parser/plan-document.js +340 -0
- package/dist/parser/plan-document.js.map +1 -0
- package/dist/parser/plans.d.ts +59 -0
- package/dist/parser/plans.d.ts.map +1 -0
- package/dist/parser/plans.js +239 -0
- package/dist/parser/plans.js.map +1 -0
- package/dist/parser/refs.d.ts +22 -9
- package/dist/parser/refs.d.ts.map +1 -1
- package/dist/parser/refs.js +102 -50
- package/dist/parser/refs.js.map +1 -1
- package/dist/parser/setup-status.d.ts +71 -0
- package/dist/parser/setup-status.d.ts.map +1 -0
- package/dist/parser/setup-status.js +269 -0
- package/dist/parser/setup-status.js.map +1 -0
- package/dist/parser/shadow.d.ts +150 -19
- package/dist/parser/shadow.d.ts.map +1 -1
- package/dist/parser/shadow.js +548 -187
- package/dist/parser/shadow.js.map +1 -1
- package/dist/parser/skill-render.d.ts +317 -0
- package/dist/parser/skill-render.d.ts.map +1 -0
- package/dist/parser/skill-render.js +943 -0
- package/dist/parser/skill-render.js.map +1 -0
- package/dist/parser/traits.d.ts +3 -3
- package/dist/parser/traits.d.ts.map +1 -1
- package/dist/parser/traits.js +2 -2
- package/dist/parser/traits.js.map +1 -1
- package/dist/parser/validate-skills.d.ts +32 -0
- package/dist/parser/validate-skills.d.ts.map +1 -0
- package/dist/parser/validate-skills.js +202 -0
- package/dist/parser/validate-skills.js.map +1 -0
- package/dist/parser/validate.d.ts +45 -3
- package/dist/parser/validate.d.ts.map +1 -1
- package/dist/parser/validate.js +622 -105
- package/dist/parser/validate.js.map +1 -1
- package/dist/parser/yaml.d.ts +83 -19
- package/dist/parser/yaml.d.ts.map +1 -1
- package/dist/parser/yaml.js +478 -173
- package/dist/parser/yaml.js.map +1 -1
- package/dist/ralph/cli-renderer.d.ts +8 -1
- package/dist/ralph/cli-renderer.d.ts.map +1 -1
- package/dist/ralph/cli-renderer.js +105 -34
- package/dist/ralph/cli-renderer.js.map +1 -1
- package/dist/ralph/events.d.ts +10 -10
- package/dist/ralph/events.d.ts.map +1 -1
- package/dist/ralph/events.js +277 -98
- package/dist/ralph/events.js.map +1 -1
- package/dist/ralph/index.d.ts +5 -2
- package/dist/ralph/index.d.ts.map +1 -1
- package/dist/ralph/index.js +9 -3
- package/dist/ralph/index.js.map +1 -1
- package/dist/ralph/loop-errors.d.ts +83 -0
- package/dist/ralph/loop-errors.d.ts.map +1 -0
- package/dist/ralph/loop-errors.js +150 -0
- package/dist/ralph/loop-errors.js.map +1 -0
- package/dist/ralph/subagent.d.ts +83 -0
- package/dist/ralph/subagent.d.ts.map +1 -0
- package/dist/ralph/subagent.js +174 -0
- package/dist/ralph/subagent.js.map +1 -0
- package/dist/ralph/wrap-up.d.ts +125 -0
- package/dist/ralph/wrap-up.d.ts.map +1 -0
- package/dist/ralph/wrap-up.js +270 -0
- package/dist/ralph/wrap-up.js.map +1 -0
- package/dist/schema/batch.d.ts +95 -0
- package/dist/schema/batch.d.ts.map +1 -0
- package/dist/schema/batch.js +24 -0
- package/dist/schema/batch.js.map +1 -0
- package/dist/schema/common.d.ts +2 -2
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +34 -31
- package/dist/schema/common.js.map +1 -1
- package/dist/schema/inbox.d.ts +12 -12
- package/dist/schema/inbox.js +4 -4
- package/dist/schema/inbox.js.map +1 -1
- package/dist/schema/index.d.ts +8 -5
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +8 -5
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/meta.d.ts +1454 -27
- package/dist/schema/meta.d.ts.map +1 -1
- package/dist/schema/meta.js +198 -21
- package/dist/schema/meta.js.map +1 -1
- package/dist/schema/plan.d.ts +285 -0
- package/dist/schema/plan.d.ts.map +1 -0
- package/dist/schema/plan.js +81 -0
- package/dist/schema/plan.js.map +1 -0
- package/dist/schema/spec.d.ts +72 -33
- package/dist/schema/spec.d.ts.map +1 -1
- package/dist/schema/spec.js +22 -9
- package/dist/schema/spec.js.map +1 -1
- package/dist/schema/task.d.ts +172 -161
- package/dist/schema/task.d.ts.map +1 -1
- package/dist/schema/task.js +21 -12
- package/dist/schema/task.js.map +1 -1
- package/dist/schema/triage.d.ts +266 -0
- package/dist/schema/triage.d.ts.map +1 -0
- package/dist/schema/triage.js +134 -0
- package/dist/schema/triage.js.map +1 -0
- package/dist/sessions/index.d.ts +2 -2
- package/dist/sessions/index.d.ts.map +1 -1
- package/dist/sessions/index.js +3 -3
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/store.d.ts +233 -1
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +628 -31
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/types.d.ts +10 -10
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/sessions/types.js +10 -9
- package/dist/sessions/types.js.map +1 -1
- package/dist/strings/errors.d.ts +51 -0
- package/dist/strings/errors.d.ts.map +1 -1
- package/dist/strings/errors.js +136 -106
- package/dist/strings/errors.js.map +1 -1
- package/dist/strings/guidance.d.ts.map +1 -1
- package/dist/strings/guidance.js +16 -16
- package/dist/strings/guidance.js.map +1 -1
- package/dist/strings/index.d.ts +4 -4
- package/dist/strings/index.d.ts.map +1 -1
- package/dist/strings/index.js +4 -4
- package/dist/strings/index.js.map +1 -1
- package/dist/strings/labels.d.ts +4 -0
- package/dist/strings/labels.d.ts.map +1 -1
- package/dist/strings/labels.js +45 -41
- package/dist/strings/labels.js.map +1 -1
- package/dist/strings/validation.d.ts.map +1 -1
- package/dist/strings/validation.js +71 -71
- package/dist/strings/validation.js.map +1 -1
- package/dist/utils/commit.d.ts +1 -1
- package/dist/utils/commit.d.ts.map +1 -1
- package/dist/utils/commit.js +28 -26
- package/dist/utils/commit.js.map +1 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +40 -38
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/grep.js +11 -11
- package/dist/utils/grep.js.map +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/time.js +10 -10
- package/dist/utils/time.js.map +1 -1
- package/package.json +28 -5
- package/plugin/.claude-plugin/marketplace.json +17 -0
- package/plugin/.claude-plugin/plugin.json +5 -0
- package/plugin/plugins/kspec/skills/help/SKILL.md +42 -0
- package/plugin/plugins/kspec/skills/triage/SKILL.md +206 -0
- package/plugin/plugins/kspec/skills/triage/docs/automation.md +120 -0
- package/plugin/plugins/kspec/skills/triage/docs/inbox.md +144 -0
- package/plugin/plugins/kspec/skills/triage/docs/observations.md +85 -0
- package/templates/agents-sections/01-quick-start.md +22 -0
- package/templates/agents-sections/02-shadow-branch.md +34 -0
- package/templates/agents-sections/03-task-lifecycle.md +48 -0
- package/templates/agents-sections/04-pr-workflow.md +17 -0
- package/templates/agents-sections/05-commit-convention.md +27 -0
- package/templates/agents-sections/06-ralph-loop.md +45 -0
- package/templates/hooks/pre-commit +34 -0
- package/templates/skills/help/SKILL.md +37 -0
- package/templates/skills/manifest.yaml +15 -0
- package/templates/skills/triage/SKILL.md +199 -0
- package/templates/skills/triage/docs/automation.md +120 -0
- package/templates/skills/triage/docs/inbox.md +144 -0
- package/templates/skills/triage/docs/observations.md +85 -0
package/dist/ralph/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Event translation and rendering for the ralph autonomous task loop.
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export { type
|
|
6
|
+
export { createCliRenderer, createPrefixedRenderer, type RalphRenderer, } from "./cli-renderer.js";
|
|
7
|
+
export { type AgentMessageData, type AgentThoughtData, createTranslator, type RalphEvent, type RalphEventData, type RalphEventType, type RalphTranslator, type StatusData, type ToolResultData, type ToolStartData, type ToolUpdateData, } from "./events.js";
|
|
8
|
+
export { buildSubagentPrompt, DEFAULT_SUBAGENT_PREFIX, DEFAULT_SUBAGENT_TIMEOUT, RALPH_PROMPT_TIMEOUT, runSubagent, type SubagentConfig, type SubagentContext, type SubagentOptions, type SubagentResult, } from "./subagent.js";
|
|
9
|
+
export { createFailureNote, getTaskFailureCount, hasTaskProgress, isIterationFailure, parseFailureCount, processFailedIteration, shouldEscalate, type TaskFailureResult, } from "./loop-errors.js";
|
|
10
|
+
export { buildWrapUpContext, buildWrapUpPrompt, DEFAULT_WRAPUP_TIMEOUT, type ExitReason, isWrapUpNeeded, runWrapUpAgent, WRAPUP_AGENT_PREFIX, type WrapUpContext, type WrapUpOptions, type WrapUpResult, } from "./wrap-up.js";
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ralph/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ralph/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,UAAU,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC"}
|
package/dist/ralph/index.js
CHANGED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Event translation and rendering for the ralph autonomous task loop.
|
|
5
5
|
*/
|
|
6
|
-
// Event types and translator
|
|
7
|
-
export { createTranslator, } from './events.js';
|
|
8
6
|
// CLI renderer
|
|
9
|
-
export { createCliRenderer } from
|
|
7
|
+
export { createCliRenderer, createPrefixedRenderer, } from "./cli-renderer.js";
|
|
8
|
+
// Event types and translator
|
|
9
|
+
export { createTranslator, } from "./events.js";
|
|
10
|
+
// Subagent spawning
|
|
11
|
+
export { buildSubagentPrompt, DEFAULT_SUBAGENT_PREFIX, DEFAULT_SUBAGENT_TIMEOUT, RALPH_PROMPT_TIMEOUT, runSubagent, } from "./subagent.js";
|
|
12
|
+
// Loop error handling
|
|
13
|
+
export { createFailureNote, getTaskFailureCount, hasTaskProgress, isIterationFailure, parseFailureCount, processFailedIteration, shouldEscalate, } from "./loop-errors.js";
|
|
14
|
+
// Wrap-up agent
|
|
15
|
+
export { buildWrapUpContext, buildWrapUpPrompt, DEFAULT_WRAPUP_TIMEOUT, isWrapUpNeeded, runWrapUpAgent, WRAPUP_AGENT_PREFIX, } from "./wrap-up.js";
|
|
10
16
|
//# sourceMappingURL=index.js.map
|
package/dist/ralph/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ralph/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6BAA6B;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ralph/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAC3B,6BAA6B;AAC7B,OAAO,EAGL,gBAAgB,GASjB,MAAM,aAAa,CAAC;AACrB,oBAAoB;AACpB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,WAAW,GAKZ,MAAM,eAAe,CAAC;AACvB,sBAAsB;AACtB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAC1B,gBAAgB;AAChB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EAEtB,cAAc,EACd,cAAc,EACd,mBAAmB,GAIpB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loop mode error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Tracks per-task failures with [LOOP-FAIL:N] prefix in notes.
|
|
5
|
+
* Escalates to automation:needs_review after 3 failures.
|
|
6
|
+
*/
|
|
7
|
+
import type { Task } from "../schema/task.js";
|
|
8
|
+
/**
|
|
9
|
+
* Parse the failure count from a [LOOP-FAIL:N] prefixed note.
|
|
10
|
+
* Returns 0 if no match found.
|
|
11
|
+
*
|
|
12
|
+
* AC: @loop-mode-error-handling ac-4
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseFailureCount(noteContent: string): number;
|
|
15
|
+
/**
|
|
16
|
+
* Get the current failure count for a task by examining its notes.
|
|
17
|
+
* Returns the highest failure count found, or 0 if no failures recorded.
|
|
18
|
+
*
|
|
19
|
+
* AC: @loop-mode-error-handling ac-4
|
|
20
|
+
*/
|
|
21
|
+
export declare function getTaskFailureCount(task: Task): number;
|
|
22
|
+
/**
|
|
23
|
+
* Create a failure note with [LOOP-FAIL:N] prefix.
|
|
24
|
+
* Increments N based on prior failure count.
|
|
25
|
+
*
|
|
26
|
+
* AC: @loop-mode-error-handling ac-1, ac-3, ac-4
|
|
27
|
+
*/
|
|
28
|
+
export declare function createFailureNote(taskRef: string, errorDescription: string, priorFailureCount: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Check if failure count has reached the escalation threshold.
|
|
31
|
+
* Threshold is 3 failures.
|
|
32
|
+
*
|
|
33
|
+
* AC: @loop-mode-error-handling ac-5
|
|
34
|
+
*/
|
|
35
|
+
export declare function shouldEscalate(failureCount: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Determine if an iteration result represents a failure.
|
|
38
|
+
*
|
|
39
|
+
* Failures include:
|
|
40
|
+
* - Tests fail
|
|
41
|
+
* - PR blocked
|
|
42
|
+
* - Exception thrown
|
|
43
|
+
* - Agent reports cannot complete
|
|
44
|
+
*
|
|
45
|
+
* AC: @loop-mode-error-handling ac-7
|
|
46
|
+
*/
|
|
47
|
+
export declare function isIterationFailure(result: {
|
|
48
|
+
succeeded?: boolean;
|
|
49
|
+
error?: Error;
|
|
50
|
+
stopReason?: string;
|
|
51
|
+
}): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Check if an in_progress task has made progress in this iteration.
|
|
54
|
+
* Progress is indicated by new notes added after the startTime.
|
|
55
|
+
*
|
|
56
|
+
* AC: @loop-mode-error-handling ac-8
|
|
57
|
+
*/
|
|
58
|
+
export declare function hasTaskProgress(task: Task, iterationStartTime: Date): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Result of processing a failed iteration for a task.
|
|
61
|
+
*/
|
|
62
|
+
export interface TaskFailureResult {
|
|
63
|
+
taskRef: string;
|
|
64
|
+
failureCount: number;
|
|
65
|
+
escalated: boolean;
|
|
66
|
+
noteAdded: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Process failed iteration for tasks that were in progress.
|
|
70
|
+
* Adds LOOP-FAIL notes for tasks without progress and escalates at threshold.
|
|
71
|
+
*
|
|
72
|
+
* This function should be called after an iteration fails to track per-task failures.
|
|
73
|
+
*
|
|
74
|
+
* AC: @loop-mode-error-handling ac-1, ac-2, ac-3, ac-4, ac-5, ac-8
|
|
75
|
+
*
|
|
76
|
+
* @param tasksInProgress - Tasks that were in_progress at iteration start
|
|
77
|
+
* @param currentTasks - Current state of all tasks (after iteration)
|
|
78
|
+
* @param iterationStartTime - When the iteration started
|
|
79
|
+
* @param errorDescription - Description of what went wrong
|
|
80
|
+
* @returns Array of results for each processed task
|
|
81
|
+
*/
|
|
82
|
+
export declare function processFailedIteration(tasksInProgress: Task[], currentTasks: Task[], iterationStartTime: Date, errorDescription: string): TaskFailureResult[];
|
|
83
|
+
//# sourceMappingURL=loop-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-errors.d.ts","sourceRoot":"","sources":["../../src/ralph/loop-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CActD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAiBV;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,IAAI,GACvB,OAAO,CAiBT;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,IAAI,EAAE,EACvB,YAAY,EAAE,IAAI,EAAE,EACpB,kBAAkB,EAAE,IAAI,EACxB,gBAAgB,EAAE,MAAM,GACvB,iBAAiB,EAAE,CAuCrB"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loop mode error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Tracks per-task failures with [LOOP-FAIL:N] prefix in notes.
|
|
5
|
+
* Escalates to automation:needs_review after 3 failures.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parse the failure count from a [LOOP-FAIL:N] prefixed note.
|
|
9
|
+
* Returns 0 if no match found.
|
|
10
|
+
*
|
|
11
|
+
* AC: @loop-mode-error-handling ac-4
|
|
12
|
+
*/
|
|
13
|
+
export function parseFailureCount(noteContent) {
|
|
14
|
+
const match = noteContent.match(/^\[LOOP-FAIL:(\d+)\]/);
|
|
15
|
+
return match ? Number.parseInt(match[1], 10) : 0;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the current failure count for a task by examining its notes.
|
|
19
|
+
* Returns the highest failure count found, or 0 if no failures recorded.
|
|
20
|
+
*
|
|
21
|
+
* AC: @loop-mode-error-handling ac-4
|
|
22
|
+
*/
|
|
23
|
+
export function getTaskFailureCount(task) {
|
|
24
|
+
if (!task.notes || task.notes.length === 0) {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
let maxCount = 0;
|
|
28
|
+
for (const note of task.notes) {
|
|
29
|
+
const count = parseFailureCount(note.content);
|
|
30
|
+
if (count > maxCount) {
|
|
31
|
+
maxCount = count;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return maxCount;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a failure note with [LOOP-FAIL:N] prefix.
|
|
38
|
+
* Increments N based on prior failure count.
|
|
39
|
+
*
|
|
40
|
+
* AC: @loop-mode-error-handling ac-1, ac-3, ac-4
|
|
41
|
+
*/
|
|
42
|
+
export function createFailureNote(taskRef, errorDescription, priorFailureCount) {
|
|
43
|
+
const newCount = priorFailureCount + 1;
|
|
44
|
+
return `[LOOP-FAIL:${newCount}] Task ${taskRef} failed: ${errorDescription}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if failure count has reached the escalation threshold.
|
|
48
|
+
* Threshold is 3 failures.
|
|
49
|
+
*
|
|
50
|
+
* AC: @loop-mode-error-handling ac-5
|
|
51
|
+
*/
|
|
52
|
+
export function shouldEscalate(failureCount) {
|
|
53
|
+
return failureCount >= 3;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Determine if an iteration result represents a failure.
|
|
57
|
+
*
|
|
58
|
+
* Failures include:
|
|
59
|
+
* - Tests fail
|
|
60
|
+
* - PR blocked
|
|
61
|
+
* - Exception thrown
|
|
62
|
+
* - Agent reports cannot complete
|
|
63
|
+
*
|
|
64
|
+
* AC: @loop-mode-error-handling ac-7
|
|
65
|
+
*/
|
|
66
|
+
export function isIterationFailure(result) {
|
|
67
|
+
// Explicit success flag
|
|
68
|
+
if (result.succeeded === false) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
// Error was thrown
|
|
72
|
+
if (result.error) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
// Agent cancelled (stopped working)
|
|
76
|
+
if (result.stopReason === "cancelled") {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if an in_progress task has made progress in this iteration.
|
|
83
|
+
* Progress is indicated by new notes added after the startTime.
|
|
84
|
+
*
|
|
85
|
+
* AC: @loop-mode-error-handling ac-8
|
|
86
|
+
*/
|
|
87
|
+
export function hasTaskProgress(task, iterationStartTime) {
|
|
88
|
+
if (!task.notes || task.notes.length === 0) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
// Check if any notes were created after iteration start
|
|
92
|
+
for (const note of task.notes) {
|
|
93
|
+
const noteTime = new Date(note.created_at);
|
|
94
|
+
if (noteTime > iterationStartTime) {
|
|
95
|
+
// Exclude LOOP-FAIL notes from progress check
|
|
96
|
+
if (!note.content.startsWith("[LOOP-FAIL:")) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Process failed iteration for tasks that were in progress.
|
|
105
|
+
* Adds LOOP-FAIL notes for tasks without progress and escalates at threshold.
|
|
106
|
+
*
|
|
107
|
+
* This function should be called after an iteration fails to track per-task failures.
|
|
108
|
+
*
|
|
109
|
+
* AC: @loop-mode-error-handling ac-1, ac-2, ac-3, ac-4, ac-5, ac-8
|
|
110
|
+
*
|
|
111
|
+
* @param tasksInProgress - Tasks that were in_progress at iteration start
|
|
112
|
+
* @param currentTasks - Current state of all tasks (after iteration)
|
|
113
|
+
* @param iterationStartTime - When the iteration started
|
|
114
|
+
* @param errorDescription - Description of what went wrong
|
|
115
|
+
* @returns Array of results for each processed task
|
|
116
|
+
*/
|
|
117
|
+
export function processFailedIteration(tasksInProgress, currentTasks, iterationStartTime, errorDescription) {
|
|
118
|
+
const results = [];
|
|
119
|
+
// Create a map of current task state for quick lookup
|
|
120
|
+
const currentTaskMap = new Map();
|
|
121
|
+
for (const task of currentTasks) {
|
|
122
|
+
currentTaskMap.set(task._ulid, task);
|
|
123
|
+
}
|
|
124
|
+
// Process each task that was in progress
|
|
125
|
+
for (const originalTask of tasksInProgress) {
|
|
126
|
+
const currentTask = currentTaskMap.get(originalTask._ulid);
|
|
127
|
+
// Skip if task no longer exists or is no longer in_progress
|
|
128
|
+
// (it may have been completed/cancelled/submitted during the iteration)
|
|
129
|
+
if (!currentTask || currentTask.status !== "in_progress") {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
// Check if task made progress
|
|
133
|
+
const madeProgress = hasTaskProgress(currentTask, iterationStartTime);
|
|
134
|
+
// AC: @loop-mode-error-handling ac-8
|
|
135
|
+
// If task is still in_progress but made no progress, count as implicit failure
|
|
136
|
+
if (!madeProgress) {
|
|
137
|
+
const priorCount = getTaskFailureCount(currentTask);
|
|
138
|
+
const newCount = priorCount + 1;
|
|
139
|
+
const escalate = shouldEscalate(newCount);
|
|
140
|
+
results.push({
|
|
141
|
+
taskRef: currentTask._ulid,
|
|
142
|
+
failureCount: newCount,
|
|
143
|
+
escalated: escalate,
|
|
144
|
+
noteAdded: true, // Note will be added by caller
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return results;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=loop-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-errors.js","sourceRoot":"","sources":["../../src/ralph/loop-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,U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AC/E,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,UAAU,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;YACpD,MAAM,QAAQ,GAAG,UAAU,GAAG,CAAC,CAAC;YAChC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;YAE1C,OAAO,CAAC,IAAI,CAAC;gBACX,OAAO,EAAE,WAAW,CAAC,KAAK;gBAC1B,YAAY,EAAE,QAAQ;gBACtB,SAAS,EAAE,QAAQ;gBACnB,SAAS,EAAE,IAAI,EAAE,+BAA+B;aACjD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Subagent Module
|
|
3
|
+
*
|
|
4
|
+
* Handles spawning and running subagents for dedicated tasks like PR review.
|
|
5
|
+
* Subagents run sequentially - ralph waits for completion before continuing.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentAdapter } from "../agents/adapters.js";
|
|
8
|
+
import { type SpawnedAgent } from "../agents/spawner.js";
|
|
9
|
+
/**
|
|
10
|
+
* Context provided to a subagent for its task.
|
|
11
|
+
* AC: @ralph-subagent-spawning ac-10
|
|
12
|
+
*/
|
|
13
|
+
export interface SubagentContext {
|
|
14
|
+
/** Task reference (e.g., @task-slug) */
|
|
15
|
+
taskRef: string;
|
|
16
|
+
/** Full task details from kspec task get */
|
|
17
|
+
taskDetails: Record<string, unknown>;
|
|
18
|
+
/** Linked spec with acceptance criteria, if spec_ref exists */
|
|
19
|
+
specWithACs: Record<string, unknown> | null;
|
|
20
|
+
/** Current git branch */
|
|
21
|
+
gitBranch: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for subagent execution.
|
|
25
|
+
*/
|
|
26
|
+
export interface SubagentConfig {
|
|
27
|
+
/** Timeout in milliseconds (default: 20 minutes) */
|
|
28
|
+
timeout: number;
|
|
29
|
+
/** Output prefix for distinguishing subagent output */
|
|
30
|
+
outputPrefix: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of running a subagent.
|
|
34
|
+
*/
|
|
35
|
+
export interface SubagentResult {
|
|
36
|
+
/** Whether the subagent completed successfully */
|
|
37
|
+
success: boolean;
|
|
38
|
+
/** Whether the subagent timed out */
|
|
39
|
+
timedOut: boolean;
|
|
40
|
+
/** Error message if failed */
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Options for running a subagent.
|
|
45
|
+
*/
|
|
46
|
+
export interface SubagentOptions {
|
|
47
|
+
/** Whether to auto-approve tool requests */
|
|
48
|
+
yolo: boolean;
|
|
49
|
+
/** Working directory */
|
|
50
|
+
cwd: string;
|
|
51
|
+
/** Tool request handler */
|
|
52
|
+
handleRequest: (client: SpawnedAgent["client"], reqId: string | number, method: string, params: unknown) => Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/** Default subagent timeout: 20 minutes */
|
|
55
|
+
export declare const DEFAULT_SUBAGENT_TIMEOUT: number;
|
|
56
|
+
/** Default output prefix for subagent */
|
|
57
|
+
export declare const DEFAULT_SUBAGENT_PREFIX = "[REVIEW SUBAGENT]";
|
|
58
|
+
/**
|
|
59
|
+
* Default ACP prompt timeout for ralph agents: 30 minutes.
|
|
60
|
+
* The framing layer default (5 min) is too aggressive — API slowness,
|
|
61
|
+
* extended thinking, and large context processing can exceed it even
|
|
62
|
+
* with the keepalive mechanism (which resets on tool calls/notifications).
|
|
63
|
+
*/
|
|
64
|
+
export declare const RALPH_PROMPT_TIMEOUT: number;
|
|
65
|
+
/**
|
|
66
|
+
* Build the prompt for a PR review subagent.
|
|
67
|
+
* AC: @ralph-subagent-spawning ac-2, ac-10, ac-12
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildSubagentPrompt(context: SubagentContext): string;
|
|
70
|
+
/**
|
|
71
|
+
* Run a subagent for a dedicated task.
|
|
72
|
+
*
|
|
73
|
+
* AC: @ralph-subagent-spawning ac-1 (spawn), ac-3 (sequential), ac-4 (output),
|
|
74
|
+
* ac-9 (timeout), ac-11 (prefix)
|
|
75
|
+
*
|
|
76
|
+
* @param adapter - Agent adapter to use for spawning
|
|
77
|
+
* @param context - Task context for the subagent
|
|
78
|
+
* @param config - Subagent configuration (timeout, prefix)
|
|
79
|
+
* @param options - Runtime options (cwd, request handler)
|
|
80
|
+
* @returns Result indicating success/failure/timeout
|
|
81
|
+
*/
|
|
82
|
+
export declare function runSubagent(adapter: AgentAdapter, context: SubagentContext, config: SubagentConfig, options: SubagentOptions): Promise<SubagentResult>;
|
|
83
|
+
//# sourceMappingURL=subagent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../src/ralph/subagent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAS7E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5C,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,aAAa,EAAE,CACb,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,EAC9B,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAMD,2CAA2C;AAC3C,eAAO,MAAM,wBAAwB,QAAiB,CAAC;AAEvD,yCAAyC;AACzC,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAiB,CAAC;AAMnD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CA2DpE;AAMD;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAmFzB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Subagent Module
|
|
3
|
+
*
|
|
4
|
+
* Handles spawning and running subagents for dedicated tasks like PR review.
|
|
5
|
+
* Subagents run sequentially - ralph waits for completion before continuing.
|
|
6
|
+
*/
|
|
7
|
+
import { spawnAndInitialize } from "../agents/spawner.js";
|
|
8
|
+
import { createTranslator } from "./events.js";
|
|
9
|
+
import { createPrefixedRenderer } from "./cli-renderer.js";
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Default Configuration
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/** Default subagent timeout: 20 minutes */
|
|
14
|
+
export const DEFAULT_SUBAGENT_TIMEOUT = 20 * 60 * 1000;
|
|
15
|
+
/** Default output prefix for subagent */
|
|
16
|
+
export const DEFAULT_SUBAGENT_PREFIX = "[REVIEW SUBAGENT]";
|
|
17
|
+
/**
|
|
18
|
+
* Default ACP prompt timeout for ralph agents: 30 minutes.
|
|
19
|
+
* The framing layer default (5 min) is too aggressive — API slowness,
|
|
20
|
+
* extended thinking, and large context processing can exceed it even
|
|
21
|
+
* with the keepalive mechanism (which resets on tool calls/notifications).
|
|
22
|
+
*/
|
|
23
|
+
export const RALPH_PROMPT_TIMEOUT = 30 * 60 * 1000;
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Prompt Builder
|
|
26
|
+
// ============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Build the prompt for a PR review subagent.
|
|
29
|
+
* AC: @ralph-subagent-spawning ac-2, ac-10, ac-12
|
|
30
|
+
*/
|
|
31
|
+
export function buildSubagentPrompt(context) {
|
|
32
|
+
const specSection = context.specWithACs
|
|
33
|
+
? `
|
|
34
|
+
## Linked Spec with Acceptance Criteria
|
|
35
|
+
|
|
36
|
+
\`\`\`json
|
|
37
|
+
${JSON.stringify(context.specWithACs, null, 2)}
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
**Verify all ACs have test coverage before merging.**
|
|
41
|
+
`
|
|
42
|
+
: "";
|
|
43
|
+
return `# PR Review Subagent
|
|
44
|
+
|
|
45
|
+
You are a subagent spawned by ralph to REVIEW a PR and merge it only if clean.
|
|
46
|
+
|
|
47
|
+
## Role Boundary
|
|
48
|
+
|
|
49
|
+
You are a REVIEWER, not a fixer. Your responsibilities:
|
|
50
|
+
- Review code quality, AC coverage (own + trait), spec alignment
|
|
51
|
+
- Post findings as inline PR comments with severity (MUST-FIX:, SHOULD-FIX:, SUGGESTION:)
|
|
52
|
+
- Merge the PR ONLY if all quality gates pass (no MUST-FIX or SHOULD-FIX items)
|
|
53
|
+
- Complete the task after merge
|
|
54
|
+
|
|
55
|
+
You MUST NOT:
|
|
56
|
+
- Fix code issues yourself
|
|
57
|
+
- Push commits to the PR branch
|
|
58
|
+
- Add or modify tests
|
|
59
|
+
- Make any code changes
|
|
60
|
+
|
|
61
|
+
If you find issues:
|
|
62
|
+
1. Post them as inline PR comments with severity prefix
|
|
63
|
+
2. Transition the task to needs_work: \`kspec task needs-work ${context.taskRef} --reason "findings..."\`
|
|
64
|
+
3. Exit — the worker agent will fix issues in the next iteration
|
|
65
|
+
|
|
66
|
+
## Context
|
|
67
|
+
|
|
68
|
+
- **Task:** \`${context.taskRef}\`
|
|
69
|
+
- **Branch:** \`${context.gitBranch}\`
|
|
70
|
+
|
|
71
|
+
### Task Details
|
|
72
|
+
|
|
73
|
+
\`\`\`json
|
|
74
|
+
${JSON.stringify(context.taskDetails, null, 2)}
|
|
75
|
+
\`\`\`
|
|
76
|
+
${specSection}
|
|
77
|
+
## Instructions
|
|
78
|
+
|
|
79
|
+
Run the PR review skill:
|
|
80
|
+
|
|
81
|
+
\`\`\`
|
|
82
|
+
/pr-review ${context.taskRef}
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
The skill defines all review steps, quality gates, and merge criteria. Follow it completely.
|
|
86
|
+
|
|
87
|
+
Do NOT start new work. Do NOT fix code. Your only job is reviewing this task's PR, posting findings, and merging if clean.
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
// ============================================================================
|
|
91
|
+
// Subagent Runner
|
|
92
|
+
// ============================================================================
|
|
93
|
+
/**
|
|
94
|
+
* Run a subagent for a dedicated task.
|
|
95
|
+
*
|
|
96
|
+
* AC: @ralph-subagent-spawning ac-1 (spawn), ac-3 (sequential), ac-4 (output),
|
|
97
|
+
* ac-9 (timeout), ac-11 (prefix)
|
|
98
|
+
*
|
|
99
|
+
* @param adapter - Agent adapter to use for spawning
|
|
100
|
+
* @param context - Task context for the subagent
|
|
101
|
+
* @param config - Subagent configuration (timeout, prefix)
|
|
102
|
+
* @param options - Runtime options (cwd, request handler)
|
|
103
|
+
* @returns Result indicating success/failure/timeout
|
|
104
|
+
*/
|
|
105
|
+
export async function runSubagent(adapter, context, config, options) {
|
|
106
|
+
const prompt = buildSubagentPrompt(context);
|
|
107
|
+
let agent = null;
|
|
108
|
+
try {
|
|
109
|
+
// AC: @ralph-subagent-spawning ac-1 - Spawn new ACP process
|
|
110
|
+
agent = await spawnAndInitialize(adapter, {
|
|
111
|
+
cwd: options.cwd,
|
|
112
|
+
clientOptions: {
|
|
113
|
+
clientInfo: {
|
|
114
|
+
name: "kspec-ralph-subagent",
|
|
115
|
+
version: "1.0.0",
|
|
116
|
+
},
|
|
117
|
+
methodTimeouts: {
|
|
118
|
+
"session/prompt": RALPH_PROMPT_TIMEOUT,
|
|
119
|
+
"session/resume": RALPH_PROMPT_TIMEOUT,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
// AC: @ralph-subagent-spawning ac-4, ac-11 - Prefixed renderer for output
|
|
124
|
+
const translator = createTranslator();
|
|
125
|
+
const renderer = createPrefixedRenderer(config.outputPrefix);
|
|
126
|
+
// Set up streaming update handler
|
|
127
|
+
agent.client.on("update", (_sid, update) => {
|
|
128
|
+
const event = translator.translate(update);
|
|
129
|
+
if (event) {
|
|
130
|
+
renderer.render(event);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// Set up tool request handler
|
|
134
|
+
agent.client.on("request", (reqId, method, params) => {
|
|
135
|
+
options
|
|
136
|
+
.handleRequest(agent.client, reqId, method, params)
|
|
137
|
+
.catch((err) => {
|
|
138
|
+
agent.client.respondError(reqId, -32000, err.message);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
// Create ACP session
|
|
142
|
+
const acpSessionId = await agent.client.newSession({
|
|
143
|
+
cwd: options.cwd,
|
|
144
|
+
mcpServers: [],
|
|
145
|
+
});
|
|
146
|
+
// AC: @ralph-subagent-spawning ac-9 - Timeout handling
|
|
147
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
148
|
+
setTimeout(() => reject(new Error("SUBAGENT_TIMEOUT")), config.timeout);
|
|
149
|
+
});
|
|
150
|
+
// AC: @ralph-subagent-spawning ac-3 - Ralph waits for completion
|
|
151
|
+
const promptPromise = agent.client.prompt({
|
|
152
|
+
sessionId: acpSessionId,
|
|
153
|
+
prompt: [{ type: "text", text: prompt }],
|
|
154
|
+
});
|
|
155
|
+
// Race between completion and timeout
|
|
156
|
+
await Promise.race([promptPromise, timeoutPromise]);
|
|
157
|
+
return { success: true, timedOut: false };
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
const error = err;
|
|
161
|
+
// AC: @ralph-subagent-spawning ac-9 - Timeout detection
|
|
162
|
+
if (error.message === "SUBAGENT_TIMEOUT") {
|
|
163
|
+
return { success: false, timedOut: true };
|
|
164
|
+
}
|
|
165
|
+
return { success: false, timedOut: false, error: error.message };
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
// Always clean up the agent process
|
|
169
|
+
if (agent) {
|
|
170
|
+
agent.kill();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=subagent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent.js","sourceRoot":"","sources":["../../src/ralph/subagent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AA4D3D,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,2CAA2C;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD,yCAAyC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE3D;;;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