@try-works/dsh-recursive-mode 0.4.4 → 0.4.5
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/lib/errors.d.ts +12 -0
- package/lib/goals-projection.d.ts +34 -4
- package/lib/index.js +471 -41
- package/lib/recursive_ask.tool.d.ts +60 -0
- package/lib/recursive_init.tool.d.ts +15 -0
- package/lib/run-start.d.ts +55 -0
- package/lib/runtime.d.ts +137 -31
- package/package.json +1 -1
- package/scripts/test-recursive-mode-smoke.ts +5 -1
- package/src/errors.ts +12 -0
- package/src/goals-projection.ts +48 -7
- package/src/index.ts +9 -0
- package/src/recursive_ask.tool.ts +218 -17
- package/src/recursive_init.tool.ts +16 -1
- package/src/run-start.ts +123 -0
- package/src/runtime.ts +157 -14
package/lib/errors.d.ts
CHANGED
|
@@ -133,6 +133,18 @@ export declare const TOOL_ERRORS: {
|
|
|
133
133
|
readonly problem: "the run has unresolved delegated work, so this phase cannot lock yet";
|
|
134
134
|
readonly next: "call recursive_status to see the pending delegation, have the child write its reply.md, then lock again";
|
|
135
135
|
};
|
|
136
|
+
readonly RUN_START_NO_CHANNEL: {
|
|
137
|
+
readonly code: "RM5502";
|
|
138
|
+
readonly klass: "runtime";
|
|
139
|
+
readonly problem: "the run-start gate needs an answer, and this composition mounts no user-questions channel to ask one directly";
|
|
140
|
+
readonly next: string;
|
|
141
|
+
};
|
|
142
|
+
readonly RUN_START_UNANSWERED: {
|
|
143
|
+
readonly code: "RM5503";
|
|
144
|
+
readonly klass: "runtime";
|
|
145
|
+
readonly problem: "the user-questions channel mounted in this composition refused the run-start question, so no person was asked";
|
|
146
|
+
readonly next: string;
|
|
147
|
+
};
|
|
136
148
|
readonly RUNTIME_REFUSED: {
|
|
137
149
|
readonly code: "RM5501";
|
|
138
150
|
readonly klass: "runtime";
|
|
@@ -81,12 +81,42 @@ export declare function isRunGoal(goal: GoalViewLike | undefined, runId: string)
|
|
|
81
81
|
* Sync a run's durable goal to the requested phase. Safe: never touches a goal
|
|
82
82
|
* whose objective is not this run's marker, and never re-creates over a
|
|
83
83
|
* non-complete foreign goal.
|
|
84
|
+
*
|
|
85
|
+
* ⚠ `approved` IS THE PHASE-0 GATE, and it defaults to the SAFE direction. A goal is not a label:
|
|
86
|
+
* `create` returns an ARMED view and the harness starts driving autonomous goal rounds for the
|
|
87
|
+
* session, so creating one is starting the run. The owner's rule is that phase 0 requires explicit
|
|
88
|
+
* approval, which means the projection must be unable to arm anything on its own — hence a default of
|
|
89
|
+
* `false` and an explicit refusal in EVERY branch that would call `create`, including the two
|
|
90
|
+
* replace-a-completed-goal branches (an unapproved run cannot have reached `complete`, but "cannot
|
|
91
|
+
* happen" is what the single unguarded branch relied on too).
|
|
92
|
+
*
|
|
93
|
+
* ⚠ AND IT IS REACHED ON ORDINARY WORK, so the unapproved path is QUIET AND IDEMPOTENT: no goal is
|
|
94
|
+
* created, nothing is written, no error is thrown, and the run's artifacts are untouched. The caller
|
|
95
|
+
* reads {@link RUN_START_NOT_APPROVED} to tell "this run has not been started yet" apart from a real
|
|
96
|
+
* failure, so a normal phase step never surfaces a warning.
|
|
97
|
+
*
|
|
98
|
+
* `approved` is passed IN rather than read here because this module is pure: it takes the goal service
|
|
99
|
+
* seam and nothing else, and the plugin's own filesystem reads live in the runtime (see
|
|
100
|
+
* `RecursiveRuntime.readRunStartApproval`).
|
|
101
|
+
*/
|
|
102
|
+
export declare function syncRunGoal(service: GoalServiceLike | undefined | null, agent: AgentHandle, runId: string, runState: RunState, approved?: boolean): SyncResult;
|
|
103
|
+
/**
|
|
104
|
+
* Block the current run goal (used on a gate-block). Never touches a foreign goal.
|
|
105
|
+
*
|
|
106
|
+
* ⚠ A RUN THAT WAS NEVER STARTED HAS NO GOAL TO BLOCK, so this reports the unapproved state in the
|
|
107
|
+
* same words as {@link syncRunGoal} rather than "no current goal to block": the caller's question is
|
|
108
|
+
* "why is there no goal", and the answer must not depend on which entry point happened to ask.
|
|
84
109
|
*/
|
|
85
|
-
export declare function syncRunGoal(service: GoalServiceLike | undefined | null, agent: AgentHandle, runId: string, runState: RunState): SyncResult;
|
|
86
|
-
/** Block the current run goal (used on a gate-block). Never touches a foreign goal. */
|
|
87
110
|
export declare function blockRunGoal(service: GoalServiceLike | undefined | null, agent: AgentHandle, runId: string, reason: {
|
|
88
111
|
code: string;
|
|
89
112
|
message: string;
|
|
90
113
|
}): SyncResult;
|
|
91
|
-
/**
|
|
92
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Bridge a run's blocked goal back to active (used on a reopen).
|
|
116
|
+
*
|
|
117
|
+
* ⚠ REOPEN IS NOT A BACK DOOR TO STARTING A RUN. It routes through {@link syncRunGoal}, so a reopen of
|
|
118
|
+
* an unapproved run cannot create the goal that init deliberately withheld. An APPROVED run is
|
|
119
|
+
* unaffected: its approval outlives the reopen, because the approval is a durable line in the run's
|
|
120
|
+
* own Phase 0 artifact rather than a value held in memory (verified in `tests/run-start-approval.spec.ts`).
|
|
121
|
+
*/
|
|
122
|
+
export declare function resumeRunGoal(service: GoalServiceLike | undefined | null, agent: AgentHandle, runId: string, approved?: boolean): SyncResult;
|