|
|
@@ -19,26 +19,17 @@ namespace ClankerSaddle.Services {
|
|
|
public const string GOAL_FAILED = "failed";
|
|
|
public const string GOAL_CANCELLED = "cancelled";
|
|
|
|
|
|
- /**
|
|
|
- * Valid goal block types (plan 15 C1: the values of the goal-run
|
|
|
- * task's `task_blocks.type` rows — question, rfc, plan and the
|
|
|
- * completion review).
|
|
|
- */
|
|
|
- public const string GOAL_BLOCK_QUESTION = "question";
|
|
|
- public const string GOAL_BLOCK_RFC = "rfc";
|
|
|
- public const string GOAL_BLOCK_PLAN = "plan";
|
|
|
- public const string GOAL_BLOCK_COMPLETION = "completion";
|
|
|
-
|
|
|
/**
|
|
|
* Whether a run-task block row is THE completion review. The review is
|
|
|
* raised from two paths — the web's completion raise (kind
|
|
|
- * {@link GOAL_BLOCK_COMPLETION}) and the daemon's done-park (kind
|
|
|
- * "review") — which adopt each other so only one row ever exists;
|
|
|
- * every completion-verdict/narrative surface matches both kinds.
|
|
|
+ * {@link BLOCK_COMPLETION}) and the daemon's done-park (kind
|
|
|
+ * {@link BLOCK_REVIEW}) — which adopt each other so only one row
|
|
|
+ * ever exists; every completion-verdict/narrative surface matches
|
|
|
+ * both kinds.
|
|
|
*/
|
|
|
private static bool is_completion_row(TaskBlock block) {
|
|
|
- return block.block_type == GOAL_BLOCK_COMPLETION
|
|
|
- || block.block_type == "review";
|
|
|
+ return block.block_type == BLOCK_COMPLETION
|
|
|
+ || block.block_type == BLOCK_REVIEW;
|
|
|
}
|
|
|
|
|
|
/** Task kinds (the `tasks.kind` wire values). */
|
|
|
@@ -390,12 +381,12 @@ namespace ClankerSaddle.Services {
|
|
|
// only appears once the previous one was answered
|
|
|
// (rejected → the agent revises).
|
|
|
TaskBlock? raised = yield raise_run_block(((!)goal), "Plan submitted for review",
|
|
|
- GOAL_BLOCK_PLAN, null, markdown, true);
|
|
|
+ BLOCK_PLAN, null, markdown, true);
|
|
|
if (raised == null || ((!)raised).answer != null) {
|
|
|
// No pending submission: a fresh revision supersedes
|
|
|
// the answered history.
|
|
|
raised = yield raise_run_block(((!)goal), "Plan submitted for review",
|
|
|
- GOAL_BLOCK_PLAN, null, markdown, false);
|
|
|
+ BLOCK_PLAN, null, markdown, false);
|
|
|
}
|
|
|
if (raised == null) {
|
|
|
return null;
|
|
|
@@ -415,7 +406,7 @@ namespace ClankerSaddle.Services {
|
|
|
string block_type, string[]? options = null, string? body = null) throws Error {
|
|
|
var goal = yield require_goal(goal_id);
|
|
|
TaskBlock? raised = yield raise_run_block(((!)goal), question,
|
|
|
- block_type.length > 0 ? block_type : GOAL_BLOCK_QUESTION,
|
|
|
+ block_type.length > 0 ? block_type : BLOCK_QUESTION,
|
|
|
options, body, false);
|
|
|
if (raised == null) {
|
|
|
return null;
|
|
|
@@ -449,7 +440,7 @@ namespace ClankerSaddle.Services {
|
|
|
// done-park "review" block IS this review) — one row,
|
|
|
// whichever path landed first.
|
|
|
TaskBlock? raised = yield raise_run_block(((!)goal), "Goal completion report",
|
|
|
- GOAL_BLOCK_COMPLETION, null, report, true);
|
|
|
+ BLOCK_COMPLETION, null, report, true);
|
|
|
if (raised == null) {
|
|
|
return null;
|
|
|
}
|
|
|
@@ -552,7 +543,7 @@ namespace ClankerSaddle.Services {
|
|
|
// unanswered row past the pulse is exactly the stale-pile
|
|
|
// shape plan 14 B3 defended against with mirror sweeps.
|
|
|
// With one row there is nothing left to sweep.
|
|
|
- if (((!)block).block_type == GOAL_BLOCK_PLAN) {
|
|
|
+ if (((!)block).block_type == BLOCK_PLAN) {
|
|
|
if (answer == NOTICE_PLAN_APPROVED) {
|
|
|
if (((!)block).body != null && ((!)block).body.length > 0) {
|
|
|
((!)goal).plan = ((!)block).body;
|
|
|
@@ -646,12 +637,12 @@ namespace ClankerSaddle.Services {
|
|
|
// done-park "review" kind, different question strings) — an
|
|
|
// unanswered row of EITHER kind IS the pending review; adopt
|
|
|
// it rather than raising a twin.
|
|
|
- bool review_family = block_type == GOAL_BLOCK_COMPLETION
|
|
|
- || block_type == "review";
|
|
|
+ bool review_family = block_type == BLOCK_COMPLETION
|
|
|
+ || block_type == BLOCK_REVIEW;
|
|
|
foreach (var existing in yield tasks.list_blocks(((!)run).id)) {
|
|
|
if (review_family && existing.answer == null
|
|
|
- && (existing.block_type == GOAL_BLOCK_COMPLETION
|
|
|
- || existing.block_type == "review")) {
|
|
|
+ && (existing.block_type == BLOCK_COMPLETION
|
|
|
+ || existing.block_type == BLOCK_REVIEW)) {
|
|
|
return existing;
|
|
|
}
|
|
|
bool same = dedupe_on_type
|
|
|
@@ -800,7 +791,7 @@ namespace ClankerSaddle.Services {
|
|
|
if (run != null) {
|
|
|
foreach (var block in yield tasks.list_blocks(((!)run).id)) {
|
|
|
if (block.created_at != null) {
|
|
|
- if (block.block_type == GOAL_BLOCK_PLAN) {
|
|
|
+ if (block.block_type == BLOCK_PLAN) {
|
|
|
rows.add(new NarrativeRow() {
|
|
|
kind = "plan-submitted", at = block.created_at,
|
|
|
text = @"Plan revision #$(block.id) submitted for review" });
|
|
|
@@ -815,7 +806,7 @@ namespace ClankerSaddle.Services {
|
|
|
}
|
|
|
}
|
|
|
if (block.answered_at != null) {
|
|
|
- if (block.block_type == GOAL_BLOCK_PLAN) {
|
|
|
+ if (block.block_type == BLOCK_PLAN) {
|
|
|
bool approved = block.answer == NOTICE_PLAN_APPROVED;
|
|
|
rows.add(new NarrativeRow() {
|
|
|
kind = approved ? "plan-approved" : "plan-rejected",
|