@riddledc/riddle-proof 0.5.10 → 0.5.12
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 +7 -0
- package/dist/{chunk-GVPCSXN7.js → chunk-7ZJAUEUN.js} +3 -0
- package/dist/{chunk-VSEKLCNU.js → chunk-F6VFKS7K.js} +1 -1
- package/dist/{chunk-7KP34QRG.js → chunk-URO4JVMA.js} +1 -1
- package/dist/engine-harness.cjs +5 -0
- package/dist/engine-harness.js +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.js +3 -3
- package/dist/openclaw.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/dist/runner.js +2 -2
- package/dist/state.cjs +5 -0
- package/dist/state.js +1 -1
- package/dist/types.d.cts +2 -0
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/runtime/lib/setup.py +112 -0
package/README.md
CHANGED
|
@@ -91,6 +91,13 @@ Set `RIDDLE_PROOF_WORKTREE_ROOT` to choose an explicit location. Set
|
|
|
91
91
|
`RIDDLE_PROOF_USE_WORKSPACE_WORKTREE_ROOT=1` to keep the previous behavior of
|
|
92
92
|
placing proof worktrees next to the active repository.
|
|
93
93
|
|
|
94
|
+
When local scratch storage is low, setup prunes stale
|
|
95
|
+
`riddle-proof-*` worktrees from the scratch root before creating the next run.
|
|
96
|
+
This preserves the dependency cache for speed while avoiding old failed runs
|
|
97
|
+
filling `/tmp`. Set `RIDDLE_PROOF_KEEP_SCRATCH_WORKTREES=1` to disable that
|
|
98
|
+
cleanup for debugging, or tune the low-space threshold with
|
|
99
|
+
`RIDDLE_PROOF_MIN_SCRATCH_FREE_MB`.
|
|
100
|
+
|
|
94
101
|
## Capture Diagnostics
|
|
95
102
|
|
|
96
103
|
`@riddledc/riddle-proof/diagnostics` standardizes the evidence contract around
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compactRecord,
|
|
3
|
+
isTerminalStatus,
|
|
3
4
|
nonEmptyString,
|
|
4
5
|
recordValue
|
|
5
6
|
} from "./chunk-TMMKRKY5.js";
|
|
@@ -172,6 +173,8 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
172
173
|
return compactRecord({
|
|
173
174
|
run_id: runId,
|
|
174
175
|
status: state.status,
|
|
176
|
+
is_terminal: isTerminalStatus(state.status),
|
|
177
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
175
178
|
current_stage: state.current_stage ?? null,
|
|
176
179
|
state_path: state.state_path ?? null,
|
|
177
180
|
worktree_path: state.worktree_path ?? null,
|
package/dist/engine-harness.cjs
CHANGED
|
@@ -2623,6 +2623,9 @@ var import_node_path3 = __toESM(require("path"), 1);
|
|
|
2623
2623
|
var import_node_crypto2 = __toESM(require("crypto"), 1);
|
|
2624
2624
|
|
|
2625
2625
|
// src/result.ts
|
|
2626
|
+
function isTerminalStatus(status) {
|
|
2627
|
+
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
2628
|
+
}
|
|
2626
2629
|
function isSuccessfulStatus(status) {
|
|
2627
2630
|
return status !== "blocked" && status !== "failed";
|
|
2628
2631
|
}
|
|
@@ -2966,6 +2969,8 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
2966
2969
|
return compactRecord({
|
|
2967
2970
|
run_id: runId,
|
|
2968
2971
|
status: state.status,
|
|
2972
|
+
is_terminal: isTerminalStatus(state.status),
|
|
2973
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
2969
2974
|
current_stage: state.current_stage ?? null,
|
|
2970
2975
|
state_path: state.state_path ?? null,
|
|
2971
2976
|
worktree_path: state.worktree_path ?? null,
|
package/dist/engine-harness.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
createDisabledRiddleProofAgentAdapter,
|
|
3
3
|
readRiddleProofRunStatus,
|
|
4
4
|
runRiddleProofEngineHarness
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-URO4JVMA.js";
|
|
6
|
+
import "./chunk-7ZJAUEUN.js";
|
|
7
7
|
import "./chunk-TMMKRKY5.js";
|
|
8
8
|
export {
|
|
9
9
|
createDisabledRiddleProofAgentAdapter,
|
package/dist/index.cjs
CHANGED
|
@@ -3022,6 +3022,8 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
3022
3022
|
return compactRecord({
|
|
3023
3023
|
run_id: runId,
|
|
3024
3024
|
status: state.status,
|
|
3025
|
+
is_terminal: isTerminalStatus(state.status),
|
|
3026
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
3025
3027
|
current_stage: state.current_stage ?? null,
|
|
3026
3028
|
state_path: state.state_path ?? null,
|
|
3027
3029
|
worktree_path: state.worktree_path ?? null,
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
createDisabledRiddleProofAgentAdapter,
|
|
14
14
|
readRiddleProofRunStatus,
|
|
15
15
|
runRiddleProofEngineHarness
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-URO4JVMA.js";
|
|
17
17
|
import {
|
|
18
18
|
runRiddleProof
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-F6VFKS7K.js";
|
|
20
20
|
import {
|
|
21
21
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
22
22
|
appendRunEvent,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
normalizePrLifecycleState,
|
|
29
29
|
normalizeRunParams,
|
|
30
30
|
setRunStatus
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-7ZJAUEUN.js";
|
|
32
32
|
import {
|
|
33
33
|
applyTerminalMetadata,
|
|
34
34
|
compactRecord,
|
package/dist/openclaw.js
CHANGED
|
@@ -262,7 +262,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
262
262
|
blocking?: boolean;
|
|
263
263
|
details?: Record<string, unknown>;
|
|
264
264
|
ok: boolean;
|
|
265
|
-
action: "setup" | "recon" | "author" | "implement" | "verify" | "
|
|
265
|
+
action: "ship" | "setup" | "recon" | "author" | "implement" | "verify" | "run";
|
|
266
266
|
state_path: string;
|
|
267
267
|
stage: any;
|
|
268
268
|
summary: string;
|
|
@@ -342,7 +342,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
342
342
|
continueWithStage?: WorkflowStage | null;
|
|
343
343
|
blocking?: boolean;
|
|
344
344
|
details?: Record<string, unknown>;
|
|
345
|
-
action: "setup" | "recon" | "author" | "implement" | "verify" | "
|
|
345
|
+
action: "ship" | "setup" | "recon" | "author" | "implement" | "verify" | "run";
|
|
346
346
|
state_path: string;
|
|
347
347
|
stage: any;
|
|
348
348
|
checkpoint: string;
|
|
@@ -589,7 +589,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
589
589
|
error?: undefined;
|
|
590
590
|
} | {
|
|
591
591
|
ok: boolean;
|
|
592
|
-
action: "setup" | "recon" | "author" | "implement" | "verify" | "
|
|
592
|
+
action: "ship" | "setup" | "recon" | "author" | "implement" | "verify" | "run";
|
|
593
593
|
state_path: string;
|
|
594
594
|
stage: any;
|
|
595
595
|
summary: string;
|
|
@@ -262,7 +262,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
262
262
|
blocking?: boolean;
|
|
263
263
|
details?: Record<string, unknown>;
|
|
264
264
|
ok: boolean;
|
|
265
|
-
action: "setup" | "recon" | "author" | "implement" | "verify" | "
|
|
265
|
+
action: "ship" | "setup" | "recon" | "author" | "implement" | "verify" | "run";
|
|
266
266
|
state_path: string;
|
|
267
267
|
stage: any;
|
|
268
268
|
summary: string;
|
|
@@ -342,7 +342,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
342
342
|
continueWithStage?: WorkflowStage | null;
|
|
343
343
|
blocking?: boolean;
|
|
344
344
|
details?: Record<string, unknown>;
|
|
345
|
-
action: "setup" | "recon" | "author" | "implement" | "verify" | "
|
|
345
|
+
action: "ship" | "setup" | "recon" | "author" | "implement" | "verify" | "run";
|
|
346
346
|
state_path: string;
|
|
347
347
|
stage: any;
|
|
348
348
|
checkpoint: string;
|
|
@@ -589,7 +589,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
589
589
|
error?: undefined;
|
|
590
590
|
} | {
|
|
591
591
|
ok: boolean;
|
|
592
|
-
action: "setup" | "recon" | "author" | "implement" | "verify" | "
|
|
592
|
+
action: "ship" | "setup" | "recon" | "author" | "implement" | "verify" | "run";
|
|
593
593
|
state_path: string;
|
|
594
594
|
stage: any;
|
|
595
595
|
summary: string;
|
package/dist/runner.js
CHANGED
package/dist/state.cjs
CHANGED
|
@@ -34,6 +34,9 @@ __export(state_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(state_exports);
|
|
35
35
|
|
|
36
36
|
// src/result.ts
|
|
37
|
+
function isTerminalStatus(status) {
|
|
38
|
+
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
39
|
+
}
|
|
37
40
|
function compactRecord(input) {
|
|
38
41
|
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
|
|
39
42
|
}
|
|
@@ -212,6 +215,8 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
212
215
|
return compactRecord({
|
|
213
216
|
run_id: runId,
|
|
214
217
|
status: state.status,
|
|
218
|
+
is_terminal: isTerminalStatus(state.status),
|
|
219
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
215
220
|
current_stage: state.current_stage ?? null,
|
|
216
221
|
state_path: state.state_path ?? null,
|
|
217
222
|
worktree_path: state.worktree_path ?? null,
|
package/dist/state.js
CHANGED
package/dist/types.d.cts
CHANGED
|
@@ -146,6 +146,8 @@ interface RiddleProofRunResult {
|
|
|
146
146
|
interface RiddleProofRunStatusSnapshot {
|
|
147
147
|
run_id: string;
|
|
148
148
|
status: RiddleProofStatus;
|
|
149
|
+
is_terminal?: boolean;
|
|
150
|
+
monitor_should_continue?: boolean;
|
|
149
151
|
current_stage?: RiddleProofStage | null;
|
|
150
152
|
state_path?: string | null;
|
|
151
153
|
worktree_path?: string | null;
|
package/dist/types.d.ts
CHANGED
|
@@ -146,6 +146,8 @@ interface RiddleProofRunResult {
|
|
|
146
146
|
interface RiddleProofRunStatusSnapshot {
|
|
147
147
|
run_id: string;
|
|
148
148
|
status: RiddleProofStatus;
|
|
149
|
+
is_terminal?: boolean;
|
|
150
|
+
monitor_should_continue?: boolean;
|
|
149
151
|
current_stage?: RiddleProofStage | null;
|
|
150
152
|
state_path?: string | null;
|
|
151
153
|
worktree_path?: string | null;
|
package/package.json
CHANGED
package/runtime/lib/setup.py
CHANGED
|
@@ -170,6 +170,113 @@ def resolve_worktree_root(repo_dir):
|
|
|
170
170
|
return os.path.join(tempfile.gettempdir(), '.riddle-proof-worktrees')
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
def env_flag(name, default=False):
|
|
174
|
+
raw = os.environ.get(name, '').strip().lower()
|
|
175
|
+
if raw in ('1', 'true', 'yes', 'on'):
|
|
176
|
+
return True
|
|
177
|
+
if raw in ('0', 'false', 'no', 'off'):
|
|
178
|
+
return False
|
|
179
|
+
return default
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def env_int(name, default):
|
|
183
|
+
raw = os.environ.get(name, '').strip()
|
|
184
|
+
try:
|
|
185
|
+
value = int(raw)
|
|
186
|
+
except Exception:
|
|
187
|
+
return default
|
|
188
|
+
return value if value > 0 else default
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def disk_free_bytes(path):
|
|
192
|
+
probe = path
|
|
193
|
+
while probe and not os.path.exists(probe):
|
|
194
|
+
parent = os.path.dirname(probe)
|
|
195
|
+
if parent == probe:
|
|
196
|
+
break
|
|
197
|
+
probe = parent
|
|
198
|
+
try:
|
|
199
|
+
return shutil.disk_usage(probe or tempfile.gettempdir()).free
|
|
200
|
+
except Exception:
|
|
201
|
+
return 0
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def prune_scratch_worktrees(worktree_root, keep_dirs, repo_dir):
|
|
205
|
+
report = {
|
|
206
|
+
'requested': True,
|
|
207
|
+
'worktree_root': worktree_root,
|
|
208
|
+
'removed': [],
|
|
209
|
+
'errors': [],
|
|
210
|
+
}
|
|
211
|
+
if env_flag('RIDDLE_PROOF_KEEP_SCRATCH_WORKTREES', False):
|
|
212
|
+
report['skipped'] = 'RIDDLE_PROOF_KEEP_SCRATCH_WORKTREES'
|
|
213
|
+
return report
|
|
214
|
+
if not worktree_root:
|
|
215
|
+
report['skipped'] = 'missing_worktree_root'
|
|
216
|
+
return report
|
|
217
|
+
|
|
218
|
+
root = os.path.abspath(os.path.expanduser(worktree_root))
|
|
219
|
+
temp_root = os.path.abspath(tempfile.gettempdir())
|
|
220
|
+
if root in ('/', temp_root) or not root.endswith('.riddle-proof-worktrees'):
|
|
221
|
+
report['skipped'] = 'unsafe_worktree_root'
|
|
222
|
+
return report
|
|
223
|
+
if not os.path.isdir(root):
|
|
224
|
+
report['skipped'] = 'worktree_root_missing'
|
|
225
|
+
return report
|
|
226
|
+
|
|
227
|
+
min_free_bytes = env_int('RIDDLE_PROOF_MIN_SCRATCH_FREE_MB', 2048) * 1024 * 1024
|
|
228
|
+
free_before = disk_free_bytes(root)
|
|
229
|
+
report['free_before_bytes'] = free_before
|
|
230
|
+
report['min_free_bytes'] = min_free_bytes
|
|
231
|
+
if free_before >= min_free_bytes:
|
|
232
|
+
report['skipped'] = 'enough_free_space'
|
|
233
|
+
return report
|
|
234
|
+
|
|
235
|
+
keep = set(os.path.abspath(os.path.expanduser(p)) for p in keep_dirs if p)
|
|
236
|
+
candidates = []
|
|
237
|
+
for name in os.listdir(root):
|
|
238
|
+
if not name.startswith('riddle-proof-'):
|
|
239
|
+
continue
|
|
240
|
+
path = os.path.join(root, name)
|
|
241
|
+
resolved = os.path.abspath(path)
|
|
242
|
+
if resolved in keep or not os.path.isdir(path):
|
|
243
|
+
continue
|
|
244
|
+
try:
|
|
245
|
+
mtime = os.path.getmtime(path)
|
|
246
|
+
except Exception:
|
|
247
|
+
mtime = 0
|
|
248
|
+
candidates.append((mtime, path))
|
|
249
|
+
candidates.sort()
|
|
250
|
+
|
|
251
|
+
for _, path in candidates:
|
|
252
|
+
if disk_free_bytes(root) >= min_free_bytes:
|
|
253
|
+
break
|
|
254
|
+
removed_by_git = False
|
|
255
|
+
git_error = ''
|
|
256
|
+
if repo_dir and os.path.exists(os.path.join(repo_dir, '.git')):
|
|
257
|
+
remove_result = sp.run(
|
|
258
|
+
'git worktree remove --force ' + shell_quote(path),
|
|
259
|
+
shell=True,
|
|
260
|
+
cwd=repo_dir,
|
|
261
|
+
capture_output=True,
|
|
262
|
+
text=True,
|
|
263
|
+
)
|
|
264
|
+
removed_by_git = remove_result.returncode == 0
|
|
265
|
+
if remove_result.returncode != 0 and os.path.exists(path):
|
|
266
|
+
git_error = (remove_result.stderr or remove_result.stdout or '')[:300]
|
|
267
|
+
if os.path.exists(path):
|
|
268
|
+
shutil.rmtree(path, ignore_errors=True)
|
|
269
|
+
if not os.path.exists(path):
|
|
270
|
+
report['removed'].append({'path': path, 'via': 'git' if removed_by_git else 'filesystem'})
|
|
271
|
+
elif git_error:
|
|
272
|
+
report['errors'].append({'path': path, 'git_error': git_error})
|
|
273
|
+
|
|
274
|
+
if repo_dir and os.path.exists(os.path.join(repo_dir, '.git')):
|
|
275
|
+
git('git worktree prune', repo_dir)
|
|
276
|
+
report['free_after_bytes'] = disk_free_bytes(root)
|
|
277
|
+
return report
|
|
278
|
+
|
|
279
|
+
|
|
173
280
|
def cleanup_legacy_branch_worktrees(repo_dir, branch_name):
|
|
174
281
|
if not repo_dir or not os.path.exists(os.path.join(repo_dir, '.git')):
|
|
175
282
|
return
|
|
@@ -370,6 +477,11 @@ s['worktree_root'] = WORKTREE_ROOT
|
|
|
370
477
|
save_state(s)
|
|
371
478
|
print('Prepared workspace via ' + setup.get('source', 'workspace_core') + ': ' + repo_dir)
|
|
372
479
|
os.makedirs(WORKTREE_ROOT, exist_ok=True)
|
|
480
|
+
scratch_cleanup = prune_scratch_worktrees(WORKTREE_ROOT, (BEFORE_DIR, AFTER_DIR), repo_dir)
|
|
481
|
+
if scratch_cleanup.get('removed') or scratch_cleanup.get('errors'):
|
|
482
|
+
print('Scratch cleanup: removed ' + str(len(scratch_cleanup.get('removed') or [])) + ' stale proof worktree(s)')
|
|
483
|
+
s['scratch_cleanup'] = scratch_cleanup
|
|
484
|
+
save_state(s)
|
|
373
485
|
cleanup_legacy_branch_worktrees(repo_dir, base_branch)
|
|
374
486
|
|
|
375
487
|
# Clean any stale worktrees for this run and the legacy fixed paths
|