@kynetic-ai/spec 0.1.2 → 0.4.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 +107 -0
- package/dist/cli/batch-exec.d.ts.map +1 -0
- package/dist/cli/batch-exec.js +706 -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 +141 -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 +58 -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 +534 -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 +547 -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 +1109 -170
- 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 +810 -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 +1267 -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 +56 -0
- package/dist/cli/commands/skill-install.d.ts.map +1 -0
- package/dist/cli/commands/skill-install.js +509 -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 +584 -350
- 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 +225 -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 +483 -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 +237 -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 +402 -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 +457 -0
- package/dist/parser/config.d.ts.map +1 -0
- package/dist/parser/config.js +373 -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 +197 -0
- package/dist/parser/plan-document.d.ts.map +1 -0
- package/dist/parser/plan-document.js +341 -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 +301 -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 +94 -0
- package/dist/ralph/subagent.d.ts.map +1 -0
- package/dist/ralph/subagent.js +193 -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 +97 -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 +8 -2
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +42 -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 +241 -1
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +810 -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 +55 -0
- package/dist/strings/errors.d.ts.map +1 -1
- package/dist/strings/errors.js +138 -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/triage/actions.d.ts +27 -0
- package/dist/triage/actions.d.ts.map +1 -0
- package/dist/triage/actions.js +95 -0
- package/dist/triage/actions.js.map +1 -0
- package/dist/triage/constants.d.ts +6 -0
- package/dist/triage/constants.d.ts.map +1 -0
- package/dist/triage/constants.js +7 -0
- package/dist/triage/constants.js.map +1 -0
- package/dist/triage/index.d.ts +3 -0
- package/dist/triage/index.d.ts.map +1 -0
- package/dist/triage/index.js +3 -0
- package/dist/triage/index.js.map +1 -0
- 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/create-workflow/SKILL.md +235 -0
- package/plugin/plugins/kspec/skills/help/SKILL.md +42 -0
- package/plugin/plugins/kspec/skills/observations/SKILL.md +143 -0
- package/plugin/plugins/kspec/skills/plan/SKILL.md +343 -0
- package/plugin/plugins/kspec/skills/reflect/SKILL.md +161 -0
- package/plugin/plugins/kspec/skills/review/SKILL.md +193 -0
- package/plugin/plugins/kspec/skills/task-work/SKILL.md +303 -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/plugin/plugins/kspec/skills/triage-automation/SKILL.md +140 -0
- package/plugin/plugins/kspec/skills/triage-inbox/SKILL.md +232 -0
- package/plugin/plugins/kspec/skills/writing-specs/SKILL.md +340 -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/create-workflow/SKILL.md +228 -0
- package/templates/skills/help/SKILL.md +37 -0
- package/templates/skills/manifest.yaml +60 -0
- package/templates/skills/observations/SKILL.md +137 -0
- package/templates/skills/plan/SKILL.md +336 -0
- package/templates/skills/reflect/SKILL.md +155 -0
- package/templates/skills/review/SKILL.md +186 -0
- package/templates/skills/task-work/SKILL.md +296 -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/templates/skills/triage-automation/SKILL.md +134 -0
- package/templates/skills/triage-inbox/SKILL.md +225 -0
- package/templates/skills/writing-specs/SKILL.md +333 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Wrap-Up Agent Module
|
|
3
|
+
*
|
|
4
|
+
* Handles spawning a wrap-up subagent when the ralph loop exits.
|
|
5
|
+
* The wrap-up agent ensures the workspace is in a clean state:
|
|
6
|
+
* - Identifies uncommitted changes and reports what they relate to
|
|
7
|
+
* - Commits, stashes, or flags changes for human review
|
|
8
|
+
* - Produces a brief exit summary
|
|
9
|
+
*
|
|
10
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit
|
|
11
|
+
*/
|
|
12
|
+
import type { AgentAdapter } from "../agents/adapters.js";
|
|
13
|
+
import { type SpawnedAgent } from "../agents/spawner.js";
|
|
14
|
+
import { type GitWorkingTree } from "../utils/git.js";
|
|
15
|
+
/**
|
|
16
|
+
* Exit reason for ralph loop.
|
|
17
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-1
|
|
18
|
+
*/
|
|
19
|
+
export type ExitReason = "no_tasks" | "end_loop_signal" | "max_iterations" | "error" | "max_failures" | "explicit_tasks_done";
|
|
20
|
+
/**
|
|
21
|
+
* Context provided to the wrap-up agent.
|
|
22
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-2
|
|
23
|
+
*/
|
|
24
|
+
export interface WrapUpContext {
|
|
25
|
+
/** Why the loop is exiting */
|
|
26
|
+
exitReason: ExitReason;
|
|
27
|
+
/** Session ID for reference */
|
|
28
|
+
sessionId: string;
|
|
29
|
+
/** Current iteration number */
|
|
30
|
+
iteration: number;
|
|
31
|
+
/** Max iterations configured */
|
|
32
|
+
maxIterations: number;
|
|
33
|
+
/** Working tree status from git */
|
|
34
|
+
workingTree: GitWorkingTree;
|
|
35
|
+
/** Tasks that were in progress when loop ended */
|
|
36
|
+
inProgressTasks: Array<{
|
|
37
|
+
ref: string;
|
|
38
|
+
title: string;
|
|
39
|
+
}>;
|
|
40
|
+
/** Tasks that were pending review when loop ended */
|
|
41
|
+
pendingReviewTasks: Array<{
|
|
42
|
+
ref: string;
|
|
43
|
+
title: string;
|
|
44
|
+
}>;
|
|
45
|
+
/** Recent task refs worked on this session (for relating changes) */
|
|
46
|
+
recentTaskRefs: string[];
|
|
47
|
+
/** Error message if exit was due to error */
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Result of running the wrap-up agent.
|
|
52
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-4, ac-5
|
|
53
|
+
*/
|
|
54
|
+
export interface WrapUpResult {
|
|
55
|
+
/** Whether wrap-up completed successfully */
|
|
56
|
+
success: boolean;
|
|
57
|
+
/** Whether the wrap-up agent timed out */
|
|
58
|
+
timedOut: boolean;
|
|
59
|
+
/** Error message if failed */
|
|
60
|
+
error?: string;
|
|
61
|
+
/** Whether wrap-up was skipped (e.g., clean working tree, nothing to do) */
|
|
62
|
+
skipped: boolean;
|
|
63
|
+
/** Reason for skipping if skipped */
|
|
64
|
+
skipReason?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Options for running the wrap-up agent.
|
|
68
|
+
*/
|
|
69
|
+
export interface WrapUpOptions {
|
|
70
|
+
/** Whether to auto-approve tool requests */
|
|
71
|
+
yolo: boolean;
|
|
72
|
+
/** Working directory */
|
|
73
|
+
cwd: string;
|
|
74
|
+
/** Tool request handler */
|
|
75
|
+
handleRequest: (client: SpawnedAgent["client"], reqId: string | number, method: string, params: unknown) => Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Default wrap-up agent timeout: 2 minutes.
|
|
79
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-5
|
|
80
|
+
*/
|
|
81
|
+
export declare const DEFAULT_WRAPUP_TIMEOUT: number;
|
|
82
|
+
/** Output prefix for wrap-up agent */
|
|
83
|
+
export declare const WRAPUP_AGENT_PREFIX = "[WRAP-UP]";
|
|
84
|
+
/**
|
|
85
|
+
* Build wrap-up context from current state.
|
|
86
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-2
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildWrapUpContext(exitReason: ExitReason, sessionId: string, iteration: number, maxIterations: number, inProgressTasks: Array<{
|
|
89
|
+
ref: string;
|
|
90
|
+
title: string;
|
|
91
|
+
}>, pendingReviewTasks: Array<{
|
|
92
|
+
ref: string;
|
|
93
|
+
title: string;
|
|
94
|
+
}>, recentTaskRefs: string[], cwd?: string, errorMessage?: string): WrapUpContext;
|
|
95
|
+
/**
|
|
96
|
+
* Check if wrap-up is needed.
|
|
97
|
+
* Wrap-up is skipped if working tree is clean and no in-progress tasks.
|
|
98
|
+
*
|
|
99
|
+
* Key insight: wrap-up's job is to handle uncommitted changes and summarize
|
|
100
|
+
* task state. If the working tree is clean and no tasks are in progress,
|
|
101
|
+
* there's nothing for wrap-up to do regardless of exit reason.
|
|
102
|
+
*/
|
|
103
|
+
export declare function isWrapUpNeeded(context: WrapUpContext): {
|
|
104
|
+
needed: boolean;
|
|
105
|
+
reason?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Build the prompt for the wrap-up agent.
|
|
109
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-2, ac-3, ac-4
|
|
110
|
+
*/
|
|
111
|
+
export declare function buildWrapUpPrompt(context: WrapUpContext): string;
|
|
112
|
+
/**
|
|
113
|
+
* Run the wrap-up agent.
|
|
114
|
+
*
|
|
115
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-1 (spawn), ac-2 (inspect),
|
|
116
|
+
* ac-3 (handle changes), ac-4 (summary), ac-5 (timeout)
|
|
117
|
+
*
|
|
118
|
+
* @param adapter - Agent adapter to use for spawning
|
|
119
|
+
* @param context - Wrap-up context
|
|
120
|
+
* @param options - Runtime options
|
|
121
|
+
* @param timeout - Timeout in ms (default: 2 minutes)
|
|
122
|
+
* @returns Result indicating success/failure/timeout/skipped
|
|
123
|
+
*/
|
|
124
|
+
export declare function runWrapUpAgent(adapter: AgentAdapter, context: WrapUpContext, options: WrapUpOptions, timeout?: number): Promise<WrapUpResult>;
|
|
125
|
+
//# sourceMappingURL=wrap-up.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-up.d.ts","sourceRoot":"","sources":["../../src/ralph/wrap-up.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAS5E;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,iBAAiB,GACjB,gBAAgB,GAChB,OAAO,GACP,cAAc,GACd,qBAAqB,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,mCAA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AAE,MAAM,EACrB,eAAe,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,kBAAkB,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EACzD,cAAc,EAAE,MAAM,EAAE,EACxB,GAAG,CAAC,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB,aAAa,CAcf;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAkBA;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAmGhE;AAMD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE,MAA+B,GACvC,OAAO,CAAC,YAAY,CAAC,CA0FvB"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Wrap-Up Agent Module
|
|
3
|
+
*
|
|
4
|
+
* Handles spawning a wrap-up subagent when the ralph loop exits.
|
|
5
|
+
* The wrap-up agent ensures the workspace is in a clean state:
|
|
6
|
+
* - Identifies uncommitted changes and reports what they relate to
|
|
7
|
+
* - Commits, stashes, or flags changes for human review
|
|
8
|
+
* - Produces a brief exit summary
|
|
9
|
+
*
|
|
10
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit
|
|
11
|
+
*/
|
|
12
|
+
import { spawnAndInitialize } from "../agents/spawner.js";
|
|
13
|
+
import { getWorkingTreeStatus } from "../utils/git.js";
|
|
14
|
+
import { createTranslator } from "./events.js";
|
|
15
|
+
import { createPrefixedRenderer } from "./cli-renderer.js";
|
|
16
|
+
import { RALPH_PROMPT_TIMEOUT } from "./subagent.js";
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Constants
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Default wrap-up agent timeout: 2 minutes.
|
|
22
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-5
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_WRAPUP_TIMEOUT = 2 * 60 * 1000;
|
|
25
|
+
/** Output prefix for wrap-up agent */
|
|
26
|
+
export const WRAPUP_AGENT_PREFIX = "[WRAP-UP]";
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// Context Builder
|
|
29
|
+
// ============================================================================
|
|
30
|
+
/**
|
|
31
|
+
* Build wrap-up context from current state.
|
|
32
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-2
|
|
33
|
+
*/
|
|
34
|
+
export function buildWrapUpContext(exitReason, sessionId, iteration, maxIterations, inProgressTasks, pendingReviewTasks, recentTaskRefs, cwd, errorMessage) {
|
|
35
|
+
const workingTree = getWorkingTreeStatus(cwd);
|
|
36
|
+
return {
|
|
37
|
+
exitReason,
|
|
38
|
+
sessionId,
|
|
39
|
+
iteration,
|
|
40
|
+
maxIterations,
|
|
41
|
+
workingTree,
|
|
42
|
+
inProgressTasks,
|
|
43
|
+
pendingReviewTasks,
|
|
44
|
+
recentTaskRefs,
|
|
45
|
+
errorMessage,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Check if wrap-up is needed.
|
|
50
|
+
* Wrap-up is skipped if working tree is clean and no in-progress tasks.
|
|
51
|
+
*
|
|
52
|
+
* Key insight: wrap-up's job is to handle uncommitted changes and summarize
|
|
53
|
+
* task state. If the working tree is clean and no tasks are in progress,
|
|
54
|
+
* there's nothing for wrap-up to do regardless of exit reason.
|
|
55
|
+
*/
|
|
56
|
+
export function isWrapUpNeeded(context) {
|
|
57
|
+
// Always need wrap-up if there are uncommitted changes
|
|
58
|
+
if (!context.workingTree.clean) {
|
|
59
|
+
return { needed: true };
|
|
60
|
+
}
|
|
61
|
+
// Need wrap-up if there are tasks still in progress
|
|
62
|
+
if (context.inProgressTasks.length > 0) {
|
|
63
|
+
return { needed: true };
|
|
64
|
+
}
|
|
65
|
+
// Clean tree, no in-progress tasks - nothing to clean up
|
|
66
|
+
// This applies even for error exits - if there's nothing to clean,
|
|
67
|
+
// spawning a wrap-up agent just adds latency without benefit
|
|
68
|
+
return {
|
|
69
|
+
needed: false,
|
|
70
|
+
reason: "Working tree is clean and no tasks in progress",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// Prompt Builder
|
|
75
|
+
// ============================================================================
|
|
76
|
+
/**
|
|
77
|
+
* Build the prompt for the wrap-up agent.
|
|
78
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-2, ac-3, ac-4
|
|
79
|
+
*/
|
|
80
|
+
export function buildWrapUpPrompt(context) {
|
|
81
|
+
const exitReasonDescriptions = {
|
|
82
|
+
no_tasks: "No automation-eligible tasks available",
|
|
83
|
+
end_loop_signal: "Agent explicitly requested end of loop",
|
|
84
|
+
max_iterations: `Reached maximum iterations (${context.maxIterations})`,
|
|
85
|
+
error: `Error occurred: ${context.errorMessage || "Unknown error"}`,
|
|
86
|
+
max_failures: "Reached maximum consecutive failures",
|
|
87
|
+
explicit_tasks_done: "All explicitly scoped tasks completed or blocked",
|
|
88
|
+
};
|
|
89
|
+
const workingTreeSection = context.workingTree.clean
|
|
90
|
+
? "**Working tree is clean.** No uncommitted changes."
|
|
91
|
+
: `**Uncommitted changes detected:**
|
|
92
|
+
|
|
93
|
+
Staged (${context.workingTree.staged.length}):
|
|
94
|
+
${context.workingTree.staged.length > 0 ? context.workingTree.staged.map((f) => ` - ${f.path} (${f.status})`).join("\n") : " (none)"}
|
|
95
|
+
|
|
96
|
+
Unstaged (${context.workingTree.unstaged.length}):
|
|
97
|
+
${context.workingTree.unstaged.length > 0 ? context.workingTree.unstaged.map((f) => ` - ${f.path} (${f.status})`).join("\n") : " (none)"}
|
|
98
|
+
|
|
99
|
+
Untracked (${context.workingTree.untracked.length}):
|
|
100
|
+
${context.workingTree.untracked.length > 0 ? context.workingTree.untracked.map((f) => ` - ${f}`).join("\n") : " (none)"}`;
|
|
101
|
+
const taskStateSection = `
|
|
102
|
+
**In-progress tasks (${context.inProgressTasks.length}):**
|
|
103
|
+
${context.inProgressTasks.length > 0 ? context.inProgressTasks.map((t) => ` - ${t.ref}: ${t.title}`).join("\n") : " (none)"}
|
|
104
|
+
|
|
105
|
+
**Pending review tasks (${context.pendingReviewTasks.length}):**
|
|
106
|
+
${context.pendingReviewTasks.length > 0 ? context.pendingReviewTasks.map((t) => ` - ${t.ref}: ${t.title}`).join("\n") : " (none)"}
|
|
107
|
+
|
|
108
|
+
**Recent task refs worked this session:**
|
|
109
|
+
${context.recentTaskRefs.length > 0 ? context.recentTaskRefs.map((r) => ` - ${r}`).join("\n") : " (none)"}`;
|
|
110
|
+
return `# Ralph Wrap-Up Agent
|
|
111
|
+
|
|
112
|
+
You are a wrap-up agent spawned at the end of a ralph automation session.
|
|
113
|
+
Your job is to ensure the workspace is in a clean state before the process terminates.
|
|
114
|
+
|
|
115
|
+
## Exit Information
|
|
116
|
+
|
|
117
|
+
**Session ID:** \`${context.sessionId}\`
|
|
118
|
+
**Iteration:** ${context.iteration} of ${context.maxIterations}
|
|
119
|
+
**Exit Reason:** ${exitReasonDescriptions[context.exitReason]}
|
|
120
|
+
|
|
121
|
+
## Working Tree Status
|
|
122
|
+
|
|
123
|
+
${workingTreeSection}
|
|
124
|
+
|
|
125
|
+
## Task State
|
|
126
|
+
${taskStateSection}
|
|
127
|
+
|
|
128
|
+
## Instructions
|
|
129
|
+
|
|
130
|
+
Your responsibilities are:
|
|
131
|
+
|
|
132
|
+
### 1. Handle Uncommitted Changes (if any)
|
|
133
|
+
|
|
134
|
+
For each uncommitted change, determine what to do:
|
|
135
|
+
|
|
136
|
+
- **If changes relate to a known task** (match file patterns to recent task refs):
|
|
137
|
+
- Commit them with an appropriate message including the task ref
|
|
138
|
+
- Example: \`git commit -m "wip: partial work on @task-ref\\n\\nRalph session ended before completion."\`
|
|
139
|
+
|
|
140
|
+
- **If changes are test files, build artifacts, or generated code:**
|
|
141
|
+
- Commit them if they look intentional
|
|
142
|
+
- Or add to .gitignore if they shouldn't be tracked
|
|
143
|
+
|
|
144
|
+
- **If changes are unclear or potentially destructive:**
|
|
145
|
+
- Stash them with a descriptive message: \`git stash push -m "ralph-wrapup: [description]"\`
|
|
146
|
+
- Or flag them for human review by leaving uncommitted but documenting
|
|
147
|
+
|
|
148
|
+
**CRITICAL:** Do NOT discard any work. Every change must be preserved somehow (commit, stash, or documented).
|
|
149
|
+
|
|
150
|
+
### 2. Produce Exit Summary
|
|
151
|
+
|
|
152
|
+
After handling any changes, output a brief summary:
|
|
153
|
+
|
|
154
|
+
\`\`\`
|
|
155
|
+
=== RALPH SESSION EXIT SUMMARY ===
|
|
156
|
+
Session: ${context.sessionId}
|
|
157
|
+
Exit reason: [reason]
|
|
158
|
+
Changes handled: [what was committed/stashed/flagged]
|
|
159
|
+
Tasks in progress: [list or "none"]
|
|
160
|
+
Tasks pending review: [list or "none"]
|
|
161
|
+
Human attention needed: [yes/no - if yes, explain what needs attention]
|
|
162
|
+
\`\`\`
|
|
163
|
+
|
|
164
|
+
### 3. Exit
|
|
165
|
+
|
|
166
|
+
Once cleanup is complete and summary is output, stop. Do not start new work.
|
|
167
|
+
|
|
168
|
+
## Timeout Warning
|
|
169
|
+
|
|
170
|
+
You have 2 minutes to complete wrap-up. If you cannot complete in time, prioritize:
|
|
171
|
+
1. Preserving uncommitted changes (stash if can't commit quickly)
|
|
172
|
+
2. Outputting a minimal summary
|
|
173
|
+
|
|
174
|
+
Do not let wrap-up block shutdown indefinitely.
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
// ============================================================================
|
|
178
|
+
// Wrap-Up Runner
|
|
179
|
+
// ============================================================================
|
|
180
|
+
/**
|
|
181
|
+
* Run the wrap-up agent.
|
|
182
|
+
*
|
|
183
|
+
* AC: @ralph-wrap-up-agent-on-loop-exit ac-1 (spawn), ac-2 (inspect),
|
|
184
|
+
* ac-3 (handle changes), ac-4 (summary), ac-5 (timeout)
|
|
185
|
+
*
|
|
186
|
+
* @param adapter - Agent adapter to use for spawning
|
|
187
|
+
* @param context - Wrap-up context
|
|
188
|
+
* @param options - Runtime options
|
|
189
|
+
* @param timeout - Timeout in ms (default: 2 minutes)
|
|
190
|
+
* @returns Result indicating success/failure/timeout/skipped
|
|
191
|
+
*/
|
|
192
|
+
export async function runWrapUpAgent(adapter, context, options, timeout = DEFAULT_WRAPUP_TIMEOUT) {
|
|
193
|
+
// Check if wrap-up is needed
|
|
194
|
+
const { needed, reason } = isWrapUpNeeded(context);
|
|
195
|
+
if (!needed) {
|
|
196
|
+
return {
|
|
197
|
+
success: true,
|
|
198
|
+
timedOut: false,
|
|
199
|
+
skipped: true,
|
|
200
|
+
skipReason: reason,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const prompt = buildWrapUpPrompt(context);
|
|
204
|
+
let agent = null;
|
|
205
|
+
try {
|
|
206
|
+
// AC: @ralph-wrap-up-agent-on-loop-exit ac-1 - Spawn wrap-up agent
|
|
207
|
+
agent = await spawnAndInitialize(adapter, {
|
|
208
|
+
cwd: options.cwd,
|
|
209
|
+
clientOptions: {
|
|
210
|
+
clientInfo: {
|
|
211
|
+
name: "kspec-ralph-wrapup",
|
|
212
|
+
version: "1.0.0",
|
|
213
|
+
},
|
|
214
|
+
methodTimeouts: {
|
|
215
|
+
"session/prompt": RALPH_PROMPT_TIMEOUT,
|
|
216
|
+
"session/resume": RALPH_PROMPT_TIMEOUT,
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
// Set up streaming output with prefix
|
|
221
|
+
const translator = createTranslator();
|
|
222
|
+
const renderer = createPrefixedRenderer(WRAPUP_AGENT_PREFIX);
|
|
223
|
+
agent.client.on("update", (_sid, update) => {
|
|
224
|
+
const event = translator.translate(update);
|
|
225
|
+
if (event) {
|
|
226
|
+
renderer.render(event);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
// Set up tool request handler
|
|
230
|
+
agent.client.on("request", (reqId, method, params) => {
|
|
231
|
+
options
|
|
232
|
+
.handleRequest(agent.client, reqId, method, params)
|
|
233
|
+
.catch((err) => {
|
|
234
|
+
agent.client.respondError(reqId, -32000, err.message);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
// Create ACP session
|
|
238
|
+
const acpSessionId = await agent.client.newSession({
|
|
239
|
+
cwd: options.cwd,
|
|
240
|
+
mcpServers: [],
|
|
241
|
+
});
|
|
242
|
+
// AC: @ralph-wrap-up-agent-on-loop-exit ac-5 - Timeout handling
|
|
243
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
244
|
+
setTimeout(() => reject(new Error("WRAPUP_TIMEOUT")), timeout);
|
|
245
|
+
});
|
|
246
|
+
// Send prompt and wait for completion
|
|
247
|
+
const promptPromise = agent.client.prompt({
|
|
248
|
+
sessionId: acpSessionId,
|
|
249
|
+
prompt: [{ type: "text", text: prompt }],
|
|
250
|
+
});
|
|
251
|
+
// Race between completion and timeout
|
|
252
|
+
await Promise.race([promptPromise, timeoutPromise]);
|
|
253
|
+
return { success: true, timedOut: false, skipped: false };
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
const error = err;
|
|
257
|
+
// AC: @ralph-wrap-up-agent-on-loop-exit ac-5 - Timeout detection
|
|
258
|
+
if (error.message === "WRAPUP_TIMEOUT") {
|
|
259
|
+
return { success: false, timedOut: true, skipped: false };
|
|
260
|
+
}
|
|
261
|
+
return { success: false, timedOut: false, skipped: false, error: error.message };
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
// Always clean up the agent process
|
|
265
|
+
if (agent) {
|
|
266
|
+
agent.kill();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=wrap-up.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-up.js","sourceRoot":"","sources":["../../src/ralph/wrap-up.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,oBAAoB,EAAuB,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA6ErD,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpD,sCAAsC;AACtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAE/C,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAsB,EACtB,SAAiB,EACjB,SAAiB,EACjB,aAAqB,EACrB,eAAsD,EACtD,kBAAyD,EACzD,cAAwB,EACxB,GAAY,EACZ,YAAqB;IAErB,MAAM,WAAW,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAE9C,OAAO;QACL,UAAU;QACV,SAAS;QACT,SAAS;QACT,aAAa;QACb,WAAW;QACX,eAAe;QACf,kBAAkB;QAClB,cAAc;QACd,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,OAAsB;IAInD,uDAAuD;IACvD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC/B,OAAO,EA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AAC;YACxC,SAAS,EAAE,YAAY;YACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;SACzC,CAAC,CAAC;QAEH,sCAAsC;QACtC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;QAEpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,GAAY,CAAC;QAE3B,iEAAiE;QACjE,IAAI,KAAK,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;YACvC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5D,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IACnF,CAAC;YAAS,CAAC;QACT,oCAAoC;QACpC,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Schema for a single command in a batch execution payload.
|
|
4
|
+
*
|
|
5
|
+
* AC: @batch-command-schema ac-command-field — command is a string command path
|
|
6
|
+
* AC: @batch-command-schema ac-args-mapping — args map to CLI parameters
|
|
7
|
+
* AC: @batch-command-schema ac-id-field — optional correlation id
|
|
8
|
+
*/
|
|
9
|
+
export declare const BatchCommandSchema: z.ZodObject<{
|
|
10
|
+
/** CLI command path, e.g. "task add" or "item note" */
|
|
11
|
+
command: z.ZodString;
|
|
12
|
+
/** Arguments/options keyed by flag name (without --) or positional arg name */
|
|
13
|
+
args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
14
|
+
/** Optional correlation ID for matching results to commands */
|
|
15
|
+
id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
command: string;
|
|
18
|
+
args: Record<string, unknown>;
|
|
19
|
+
id?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
command: string;
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
args?: Record<string, unknown> | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export type BatchCommand = z.infer<typeof BatchCommandSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* Schema for the full batch input — an array of commands.
|
|
28
|
+
* Must contain at least one command.
|
|
29
|
+
*/
|
|
30
|
+
export declare const BatchInputSchema: z.ZodArray<z.ZodObject<{
|
|
31
|
+
/** CLI command path, e.g. "task add" or "item note" */
|
|
32
|
+
command: z.ZodString;
|
|
33
|
+
/** Arguments/options keyed by flag name (without --) or positional arg name */
|
|
34
|
+
args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
35
|
+
/** Optional correlation ID for matching results to commands */
|
|
36
|
+
id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
command: string;
|
|
39
|
+
args: Record<string, unknown>;
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
command: string;
|
|
43
|
+
id?: string | undefined;
|
|
44
|
+
args?: Record<string, unknown> | undefined;
|
|
45
|
+
}>, "many">;
|
|
46
|
+
export type BatchInput = z.infer<typeof BatchInputSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Result of executing a single batch command.
|
|
49
|
+
*/
|
|
50
|
+
export interface BatchCommandResult {
|
|
51
|
+
/** Index in the original batch array */
|
|
52
|
+
index: number;
|
|
53
|
+
/** Correlation ID if provided */
|
|
54
|
+
id?: string;
|
|
55
|
+
/** The command path that was executed */
|
|
56
|
+
command: string;
|
|
57
|
+
/** Whether execution succeeded */
|
|
58
|
+
success: boolean;
|
|
59
|
+
/** Command output on success */
|
|
60
|
+
output?: unknown;
|
|
61
|
+
/** Error message on failure */
|
|
62
|
+
error?: string;
|
|
63
|
+
/** Suggested correction (e.g. closest arg name) */
|
|
64
|
+
suggestion?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Summary counts for batch execution.
|
|
68
|
+
*/
|
|
69
|
+
export interface BatchExecSummary {
|
|
70
|
+
total: number;
|
|
71
|
+
succeeded: number;
|
|
72
|
+
failed: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Execution mode for batch commands.
|
|
76
|
+
* - "atomic": all-or-nothing with temp copy (default)
|
|
77
|
+
* - "immediate": per-command commits, no rollback
|
|
78
|
+
*/
|
|
79
|
+
export type BatchExecMode = "atomic" | "immediate";
|
|
80
|
+
/**
|
|
81
|
+
* Complete result of a batch execution.
|
|
82
|
+
*/
|
|
83
|
+
export interface BatchExecResult {
|
|
84
|
+
/** Overall success (true only if all commands succeeded) */
|
|
85
|
+
success: boolean;
|
|
86
|
+
/** Execution mode used */
|
|
87
|
+
mode: BatchExecMode;
|
|
88
|
+
/** Aggregate counts */
|
|
89
|
+
summary: BatchExecSummary;
|
|
90
|
+
/** Per-command results */
|
|
91
|
+
results: BatchCommandResult[];
|
|
92
|
+
/** True if failure was due to pre-validation errors (unknown command, unknown arg, etc.) */
|
|
93
|
+
validationFailed?: boolean;
|
|
94
|
+
/** True when result is from --dry-run (no changes applied) */
|
|
95
|
+
dry_run?: boolean;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/schema/batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,K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IAC5F,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Schema for a single command in a batch execution payload.
|
|
4
|
+
*
|
|
5
|
+
* AC: @batch-command-schema ac-command-field — command is a string command path
|
|
6
|
+
* AC: @batch-command-schema ac-args-mapping — args map to CLI parameters
|
|
7
|
+
* AC: @batch-command-schema ac-id-field — optional correlation id
|
|
8
|
+
*/
|
|
9
|
+
export const BatchCommandSchema = z.object({
|
|
10
|
+
/** CLI command path, e.g. "task add" or "item note" */
|
|
11
|
+
command: z.string().min(1, "Command path is required"),
|
|
12
|
+
/** Arguments/options keyed by flag name (without --) or positional arg name */
|
|
13
|
+
args: z.record(z.string(), z.unknown()).default({}),
|
|
14
|
+
/** Optional correlation ID for matching results to commands */
|
|
15
|
+
id: z.string().optional(),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Schema for the full batch input — an array of commands.
|
|
19
|
+
* Must contain at least one command.
|
|
20
|
+
*/
|
|
21
|
+
export const BatchInputSchema = z
|
|
22
|
+
.array(BatchCommandSchema)
|
|
23
|
+
.min(1, "Batch must contain at least one command");
|
|
24
|
+
//# sourceMappingURL=batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.js","sourceRoot":"","sources":["../../src/schema/batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,uDAAuD;IACvD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;IACtD,+EAA+E;IAC/E,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD,+DAA+D;IAC/D,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1B,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,KAAK,CAAC,kBAAkB,CAAC;KACzB,GAAG,CAAC,CAAC,EAAE,yCAAyC,CAAC,CAAC"}
|
package/dist/schema/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* ULID pattern - 26 character Crockford base32
|
|
4
4
|
* Excludes I, L, O, U to avoid confusion with 1, 1, 0, V
|
|
@@ -19,7 +19,7 @@ export declare const PrioritySchema: z.ZodUnion<[z.ZodEnum<["high", "medium", "l
|
|
|
19
19
|
export declare const DateTimeSchema: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
20
20
|
export declare const MaturitySchema: z.ZodEnum<["draft", "proposed", "stable", "deferred", "deprecated"]>;
|
|
21
21
|
export declare const ImplementationStatusSchema: z.ZodEnum<["not_started", "in_progress", "implemented", "verified"]>;
|
|
22
|
-
export declare const TaskStatusSchema: z.ZodEnum<["pending", "in_progress", "pending_review", "blocked", "completed", "cancelled"]>;
|
|
22
|
+
export declare const TaskStatusSchema: z.ZodEnum<["pending", "in_progress", "pending_review", "needs_work", "blocked", "completed", "cancelled"]>;
|
|
23
23
|
export declare const TaskTypeSchema: z.ZodEnum<["epic", "task", "bug", "spike", "infra"]>;
|
|
24
24
|
export declare const ItemTypeSchema: z.ZodEnum<["module", "feature", "requirement", "constraint", "decision", "task", "trait"]>;
|
|
25
25
|
export declare const VcsRefSchema: z.ZodObject<{
|
|
@@ -43,4 +43,10 @@ export type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
|
43
43
|
export type TaskType = z.infer<typeof TaskTypeSchema>;
|
|
44
44
|
export type ItemType = z.infer<typeof ItemTypeSchema>;
|
|
45
45
|
export type VcsRef = z.infer<typeof VcsRefSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* Normalize a reference string to ensure @ prefix.
|
|
48
|
+
* Apply at CLI input boundaries before constructing TaskInput/SpecItemInput.
|
|
49
|
+
* Prevents bare refs from failing RefSchema validation and causing silent data loss.
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeRefInput(ref: string): string;
|
|
46
52
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,WAAW,QAA8B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,WAAW,QAAsB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,UAAU,QAAqB,CAAC;AAG7C,eAAO,MAAM,UAAU,aAAuD,CAAC;AAC/E,eAAO,MAAM,UAAU,aAAuD,CAAC;AAC/E,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,WAAW,QAA8B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,WAAW,QAAsB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,UAAU,QAAqB,CAAC;AAG7C,eAAO,MAAM,UAAU,aAAuD,CAAC;AAC/E,eAAO,MAAM,UAAU,aAAuD,CAAC;AAC/E,eAAO,MAAM,SAAS,aAE0B,CAAC;AAGjD,eAAO,MAAM,cAAc,iEAGzB,CAAC;AAGH,eAAO,MAAM,cAAc,wCAGzB,C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