prizmkit 1.1.190 → 1.1.192
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/bin/create-prizmkit.js +4 -4
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
- package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
- package/bundled/adapters/antigravity/paths.js +14 -0
- package/bundled/adapters/antigravity/rules-adapter.js +54 -0
- package/bundled/adapters/antigravity/skill-adapter.js +38 -0
- package/bundled/adapters/codex/skill-adapter.js +28 -8
- package/bundled/adapters/cursor/skill-adapter.js +13 -4
- package/bundled/adapters/pi/skill-adapter.js +28 -7
- package/bundled/dev-pipeline/.env.example +4 -12
- package/bundled/dev-pipeline/README.md +21 -15
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -6
- package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +29 -70
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +125 -67
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +89 -442
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +93 -49
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +49 -18
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +206 -151
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +2 -23
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +15 -134
- package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +68 -83
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -29
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +282 -217
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +124 -122
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +369 -154
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +3 -3
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2780 -0
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -101
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
- package/bundled/dev-pipeline/scripts/check-session-status.py +43 -19
- package/bundled/dev-pipeline/scripts/continuation.py +6 -4
- package/bundled/dev-pipeline/scripts/detect-stuck.py +28 -28
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +8 -2
- package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2328
- package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
- package/bundled/dev-pipeline/scripts/prompt_framework.py +56 -9
- package/bundled/dev-pipeline/scripts/status_common.py +591 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +227 -65
- package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
- package/bundled/dev-pipeline/scripts/utils.py +10 -15
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -4
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
- package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
- package/bundled/dev-pipeline/tests/_helpers.py +418 -0
- package/bundled/dev-pipeline/tests/conftest.py +45 -1
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
- package/bundled/dev-pipeline/tests/test_auto_skip.py +4 -69
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +126 -1
- package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +257 -0
- package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +500 -0
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +59 -117
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +12 -10
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +561 -3094
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +7 -8
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -1
- package/bundled/dev-pipeline/tests/test_reset_modes.py +15 -27
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +54 -139
- package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +766 -0
- package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +1257 -0
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +97 -20
- package/bundled/dev-pipeline/tests/test_session_launch.py +1101 -0
- package/bundled/dev-pipeline/tests/test_stream_progress.py +585 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +490 -2006
- package/bundled/dev-pipeline/tests/test_utils.py +3 -3
- package/bundled/rules/USAGE.md +1 -0
- package/bundled/skills/_metadata.json +9 -63
- package/bundled/skills/app-planner/SKILL.md +32 -303
- package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
- package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
- package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
- package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
- package/bundled/skills/bug-planner/SKILL.md +54 -435
- package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/bug-planner/references/input-formats.md +32 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-planner/SKILL.md +60 -439
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
- package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
- package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
- package/bundled/skills/feature-workflow/SKILL.md +1 -2
- package/bundled/skills/prizmkit/SKILL.md +7 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +25 -128
- package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
- package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
- package/bundled/skills/prizmkit-test/SKILL.md +25 -133
- package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
- package/bundled/skills/recovery-workflow/SKILL.md +7 -7
- package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
- package/bundled/skills/recovery-workflow/references/detection.md +1 -3
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
- package/bundled/templates/project-memory-template.md +1 -2
- package/package.json +1 -1
- package/src/ai-cli-launch.js +1 -1
- package/src/clean.js +40 -4
- package/src/config.js +64 -4
- package/src/detect-platform.js +10 -6
- package/src/external-skills.js +2 -2
- package/src/index.js +1 -0
- package/src/manifest.js +1 -1
- package/src/platforms.js +6 -2
- package/src/prompts.js +11 -3
- package/src/scaffold.js +87 -11
- package/src/upgrade.js +9 -3
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
- package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
- package/bundled/skills/refactor-planner/SKILL.md +0 -467
- package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
- package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
- package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
- package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
- package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
- package/bundled/skills/refactor-workflow/SKILL.md +0 -205
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
-
import os
|
|
7
|
-
import shutil
|
|
8
6
|
import threading
|
|
9
7
|
import time
|
|
10
|
-
from dataclasses import dataclass
|
|
8
|
+
from dataclasses import dataclass
|
|
11
9
|
from pathlib import Path
|
|
12
10
|
|
|
11
|
+
from .atomic_io import write_json_atomic
|
|
13
12
|
from .processes import ProcessHandle, is_process_running, terminate_process_tree
|
|
14
13
|
|
|
15
14
|
|
|
@@ -25,6 +24,7 @@ class HeartbeatConfig:
|
|
|
25
24
|
stale_after_seconds: float = 300
|
|
26
25
|
kill_after_seconds: float = 600
|
|
27
26
|
grace_seconds: float = 10
|
|
27
|
+
active_tool_max_silence_seconds: float | None = None
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
@dataclass(frozen=True)
|
|
@@ -38,6 +38,8 @@ class HeartbeatState:
|
|
|
38
38
|
log_size: int = 0
|
|
39
39
|
progress_signature: str = ""
|
|
40
40
|
child_activity_signature: str = ""
|
|
41
|
+
tool_silent_since_epoch: float | None = None
|
|
42
|
+
fatal_error_code: str = ""
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
@dataclass(frozen=True)
|
|
@@ -59,16 +61,22 @@ def _file_size(path: Path | None) -> int:
|
|
|
59
61
|
return 0
|
|
60
62
|
|
|
61
63
|
|
|
62
|
-
def
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
def _read_progress_observation(path: Path | None) -> tuple[str, str, bool, str] | None:
|
|
65
|
+
"""Read progress.json once; return None on transient read/decode failure."""
|
|
66
|
+
if path is None:
|
|
67
|
+
return "", "", False, ""
|
|
65
68
|
try:
|
|
69
|
+
if not path.is_file():
|
|
70
|
+
return "", "", False, ""
|
|
66
71
|
data = json.loads(path.read_text(encoding="utf-8"))
|
|
67
|
-
except (OSError, json.JSONDecodeError):
|
|
68
|
-
return
|
|
72
|
+
except (OSError, UnicodeDecodeError, json.JSONDecodeError):
|
|
73
|
+
return None
|
|
74
|
+
if not isinstance(data, dict):
|
|
75
|
+
return None
|
|
69
76
|
current_tool = data.get("current_tool")
|
|
70
77
|
tool_active = isinstance(current_tool, str) and bool(current_tool.strip())
|
|
71
78
|
child_signature = str(data.get("child_activity_signature") or "")
|
|
79
|
+
fatal_error_code = str(data.get("fatal_error_code") or "")
|
|
72
80
|
subagent_statistics = data.get("subagent_statistics")
|
|
73
81
|
if not isinstance(subagent_statistics, dict):
|
|
74
82
|
subagent_statistics = {}
|
|
@@ -81,12 +89,20 @@ def _progress_signature(path: Path | None) -> tuple[str, str, bool]:
|
|
|
81
89
|
int(subagent_statistics.get("spawned") or 0),
|
|
82
90
|
child_signature,
|
|
83
91
|
int(data.get("child_total_bytes") or 0),
|
|
84
|
-
|
|
92
|
+
fatal_error_code,
|
|
85
93
|
data.get("terminal_result_text") or "",
|
|
86
94
|
],
|
|
87
95
|
separators=(",", ":"),
|
|
88
96
|
)
|
|
89
|
-
return signature, child_signature, tool_active
|
|
97
|
+
return signature, child_signature, tool_active, fatal_error_code
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _effective_active_tool_ceiling(config: HeartbeatConfig) -> float | None:
|
|
101
|
+
if config.active_tool_max_silence_seconds is not None:
|
|
102
|
+
return max(0.0, float(config.active_tool_max_silence_seconds))
|
|
103
|
+
if config.kill_after_seconds > 0:
|
|
104
|
+
return max(float(config.kill_after_seconds) * 3.0, 1800.0)
|
|
105
|
+
return None
|
|
90
106
|
|
|
91
107
|
|
|
92
108
|
def observe_heartbeat_state(
|
|
@@ -96,20 +112,51 @@ def observe_heartbeat_state(
|
|
|
96
112
|
"""Observe log/progress activity and compute staleness."""
|
|
97
113
|
now = time.time()
|
|
98
114
|
log_size = _file_size(config.session_log)
|
|
99
|
-
|
|
115
|
+
obs = _read_progress_observation(config.progress_file)
|
|
116
|
+
if obs is None:
|
|
117
|
+
progress_signature = previous.progress_signature if previous else ""
|
|
118
|
+
child_signature = previous.child_activity_signature if previous else ""
|
|
119
|
+
tool_active = False
|
|
120
|
+
fatal_error_code = previous.fatal_error_code if previous else ""
|
|
121
|
+
else:
|
|
122
|
+
progress_signature, child_signature, tool_active, fatal_error_code = obs
|
|
123
|
+
|
|
100
124
|
prev_log_size = previous.log_size if previous else 0
|
|
101
|
-
|
|
125
|
+
real_progress = (
|
|
102
126
|
previous is None
|
|
103
127
|
or log_size > prev_log_size
|
|
104
128
|
or (progress_signature and progress_signature != previous.progress_signature)
|
|
105
129
|
or (child_signature and child_signature != previous.child_activity_signature)
|
|
106
|
-
or tool_active
|
|
107
130
|
)
|
|
131
|
+
|
|
132
|
+
tool_silent_since: float | None = None
|
|
133
|
+
tool_deferred = False
|
|
134
|
+
if real_progress:
|
|
135
|
+
tool_deferred = tool_active
|
|
136
|
+
if tool_active:
|
|
137
|
+
tool_silent_since = now
|
|
138
|
+
elif tool_active:
|
|
139
|
+
prior_since = previous.tool_silent_since_epoch if previous else None
|
|
140
|
+
tool_silent_since = (
|
|
141
|
+
prior_since
|
|
142
|
+
if prior_since is not None
|
|
143
|
+
else (previous.last_seen_epoch if previous and previous.last_seen_epoch is not None else now)
|
|
144
|
+
)
|
|
145
|
+
ceiling = _effective_active_tool_ceiling(config)
|
|
146
|
+
if ceiling is None or (now - tool_silent_since) < ceiling:
|
|
147
|
+
tool_deferred = True
|
|
148
|
+
|
|
149
|
+
progressed = real_progress or tool_deferred
|
|
108
150
|
if progressed:
|
|
109
151
|
last_seen_epoch = now
|
|
110
152
|
stale_seconds = 0.0
|
|
111
153
|
else:
|
|
112
|
-
|
|
154
|
+
if tool_active and tool_silent_since is not None:
|
|
155
|
+
last_seen_epoch = tool_silent_since
|
|
156
|
+
else:
|
|
157
|
+
last_seen_epoch = (
|
|
158
|
+
previous.last_seen_epoch if previous and previous.last_seen_epoch is not None else now
|
|
159
|
+
)
|
|
113
160
|
stale_seconds = max(0.0, now - last_seen_epoch)
|
|
114
161
|
stale = bool(config.stale_after_seconds > 0 and stale_seconds >= config.stale_after_seconds)
|
|
115
162
|
details = "progress" if progressed else "no progress"
|
|
@@ -121,6 +168,8 @@ def observe_heartbeat_state(
|
|
|
121
168
|
log_size=log_size,
|
|
122
169
|
progress_signature=progress_signature,
|
|
123
170
|
child_activity_signature=child_signature,
|
|
171
|
+
tool_silent_since_epoch=tool_silent_since,
|
|
172
|
+
fatal_error_code=fatal_error_code,
|
|
124
173
|
)
|
|
125
174
|
|
|
126
175
|
|
|
@@ -133,16 +182,6 @@ def _marker_number(value: float) -> int | float:
|
|
|
133
182
|
return int(normalized) if normalized.is_integer() else normalized
|
|
134
183
|
|
|
135
184
|
|
|
136
|
-
def _progress_fatal_error_code(path: Path | None) -> str:
|
|
137
|
-
if path is None or not path.is_file():
|
|
138
|
-
return ""
|
|
139
|
-
try:
|
|
140
|
-
data = json.loads(path.read_text(encoding="utf-8"))
|
|
141
|
-
except (OSError, json.JSONDecodeError):
|
|
142
|
-
return ""
|
|
143
|
-
return str(data.get("fatal_error_code") or "")
|
|
144
|
-
|
|
145
|
-
|
|
146
185
|
def write_stale_marker(
|
|
147
186
|
marker_dir: Path,
|
|
148
187
|
*,
|
|
@@ -151,7 +190,7 @@ def write_stale_marker(
|
|
|
151
190
|
threshold: float,
|
|
152
191
|
fatal_error_code: str | None = None,
|
|
153
192
|
) -> Path:
|
|
154
|
-
"""Write a stale/fatal marker compatible with
|
|
193
|
+
"""Write a stale/fatal marker compatible with expected artifact shape."""
|
|
155
194
|
marker_dir.mkdir(parents=True, exist_ok=True)
|
|
156
195
|
marker_path = marker_dir / "stale-kill.json"
|
|
157
196
|
payload = {
|
|
@@ -162,7 +201,7 @@ def write_stale_marker(
|
|
|
162
201
|
}
|
|
163
202
|
if fatal_error_code:
|
|
164
203
|
payload["fatal_error_code"] = fatal_error_code
|
|
165
|
-
marker_path
|
|
204
|
+
write_json_atomic(marker_path, payload, indent=None, sort_keys=True, ensure_ascii=True, fsync=False)
|
|
166
205
|
return marker_path
|
|
167
206
|
|
|
168
207
|
|
|
@@ -173,7 +212,7 @@ def write_fatal_marker(
|
|
|
173
212
|
stale_seconds: float,
|
|
174
213
|
threshold: float,
|
|
175
214
|
) -> tuple[Path, Path]:
|
|
176
|
-
"""Write
|
|
215
|
+
"""Write fatal-error and stale-kill marker files."""
|
|
177
216
|
marker_dir.mkdir(parents=True, exist_ok=True)
|
|
178
217
|
payload = {
|
|
179
218
|
"killed_at": _utc_marker_time(),
|
|
@@ -184,9 +223,8 @@ def write_fatal_marker(
|
|
|
184
223
|
}
|
|
185
224
|
fatal_path = marker_dir / "fatal-error.json"
|
|
186
225
|
stale_path = marker_dir / "stale-kill.json"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
stale_path.write_text(encoded, encoding="utf-8")
|
|
226
|
+
write_json_atomic(fatal_path, payload, indent=None, sort_keys=True, ensure_ascii=True, fsync=False)
|
|
227
|
+
write_json_atomic(stale_path, payload, indent=None, sort_keys=True, ensure_ascii=True, fsync=False)
|
|
190
228
|
return fatal_path, stale_path
|
|
191
229
|
|
|
192
230
|
|
|
@@ -220,50 +258,56 @@ class HeartbeatMonitor:
|
|
|
220
258
|
if not is_process_running(self.handle):
|
|
221
259
|
break
|
|
222
260
|
self._state = observe_heartbeat_state(self.config, self._state)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
261
|
+
write_json_atomic(
|
|
262
|
+
self.config.heartbeat_file,
|
|
263
|
+
{
|
|
264
|
+
"last_seen_epoch": self._state.last_seen_epoch,
|
|
265
|
+
"stale": self._state.stale,
|
|
266
|
+
"stale_seconds": self._state.stale_seconds,
|
|
267
|
+
"details": self._state.details,
|
|
268
|
+
},
|
|
269
|
+
indent=None,
|
|
270
|
+
sort_keys=True,
|
|
271
|
+
ensure_ascii=True,
|
|
272
|
+
fsync=False,
|
|
235
273
|
)
|
|
236
|
-
fatal_error_code =
|
|
274
|
+
fatal_error_code = self._state.fatal_error_code
|
|
237
275
|
if fatal_error_code:
|
|
238
|
-
marker_dir = self.config.marker_dir or (
|
|
276
|
+
marker_dir = self.config.marker_dir or (
|
|
277
|
+
self.config.session_log.parent if self.config.session_log else self.config.heartbeat_file.parent
|
|
278
|
+
)
|
|
239
279
|
_fatal_path, self._marker_path = write_fatal_marker(
|
|
240
280
|
marker_dir,
|
|
241
281
|
fatal_error_code=fatal_error_code,
|
|
242
282
|
stale_seconds=self._state.stale_seconds,
|
|
243
283
|
threshold=self.config.stale_after_seconds,
|
|
244
284
|
)
|
|
245
|
-
terminate_process_tree(self.handle, fatal_error_code, grace_seconds=self.config.grace_seconds)
|
|
246
285
|
self._killed = True
|
|
247
286
|
self._reason = fatal_error_code
|
|
287
|
+
terminate_process_tree(self.handle, fatal_error_code, grace_seconds=self.config.grace_seconds)
|
|
248
288
|
break
|
|
249
|
-
should_kill = bool(
|
|
289
|
+
should_kill = bool(
|
|
290
|
+
self.config.kill_after_seconds > 0 and self._state.stale_seconds >= self.config.kill_after_seconds
|
|
291
|
+
)
|
|
250
292
|
if should_kill:
|
|
251
|
-
marker_dir = self.config.marker_dir or (
|
|
293
|
+
marker_dir = self.config.marker_dir or (
|
|
294
|
+
self.config.session_log.parent if self.config.session_log else self.config.heartbeat_file.parent
|
|
295
|
+
)
|
|
252
296
|
self._marker_path = write_stale_marker(
|
|
253
297
|
marker_dir,
|
|
254
298
|
reason="stale_session",
|
|
255
299
|
stale_seconds=self._state.stale_seconds,
|
|
256
300
|
threshold=self.config.kill_after_seconds,
|
|
257
301
|
)
|
|
258
|
-
terminate_process_tree(self.handle, "stale_session", grace_seconds=self.config.grace_seconds)
|
|
259
302
|
self._killed = True
|
|
260
303
|
self._reason = "stale_session"
|
|
304
|
+
terminate_process_tree(self.handle, "stale_session", grace_seconds=self.config.grace_seconds)
|
|
261
305
|
break
|
|
262
306
|
|
|
263
307
|
def stop(self) -> HeartbeatStopResult:
|
|
264
308
|
self._stop_event.set()
|
|
265
309
|
if self._thread is not None:
|
|
266
|
-
self._thread.join(timeout=max(
|
|
310
|
+
self._thread.join(timeout=max(2.0, self.config.grace_seconds + 2.0))
|
|
267
311
|
return HeartbeatStopResult(
|
|
268
312
|
killed=self._killed,
|
|
269
313
|
reason=self._reason,
|
|
@@ -16,23 +16,21 @@ UTILITY_ENTRYPOINTS = {
|
|
|
16
16
|
"detect-stuck": "scripts/detect-stuck.py",
|
|
17
17
|
"generate-bootstrap-prompt": "scripts/generate-bootstrap-prompt.py",
|
|
18
18
|
"generate-bugfix-prompt": "scripts/generate-bugfix-prompt.py",
|
|
19
|
-
"generate-refactor-prompt": "scripts/generate-refactor-prompt.py",
|
|
20
19
|
"init-bugfix-pipeline": "scripts/init-bugfix-pipeline.py",
|
|
21
20
|
"init-change-artifact": "scripts/init-change-artifact.py",
|
|
22
21
|
"init-pipeline": "scripts/init-pipeline.py",
|
|
23
|
-
"init-refactor-pipeline": "scripts/init-refactor-pipeline.py",
|
|
24
22
|
"parse-stream-progress": "scripts/parse-stream-progress.py",
|
|
25
23
|
"patch-completion-notes": "scripts/patch-completion-notes.py",
|
|
26
24
|
"prizmkit-runtime-helper": "scripts/prizmkit-runtime-helper.py",
|
|
27
25
|
"update-bug-status": "scripts/update-bug-status.py",
|
|
28
26
|
"update-checkpoint": "scripts/update-checkpoint.py",
|
|
29
27
|
"update-feature-status": "scripts/update-feature-status.py",
|
|
30
|
-
"update-refactor-status": "scripts/update-refactor-status.py",
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
UTILITY_LIBRARY_ONLY = {
|
|
34
31
|
"continuation.py": "shared continuation helpers imported by prompt generators",
|
|
35
32
|
"prompt_framework.py": "shared prompt rendering and checkpoint helpers imported by prompt generators",
|
|
33
|
+
"status_common.py": "shared status, continuation, and auto-skip helpers imported by status updaters",
|
|
36
34
|
"utils.py": "shared utility helpers imported by runtime scripts",
|
|
37
35
|
}
|
|
38
36
|
|
|
@@ -19,10 +19,8 @@ class RuntimePaths:
|
|
|
19
19
|
specs_dir: Path
|
|
20
20
|
feature_plan: Path
|
|
21
21
|
bugfix_plan: Path
|
|
22
|
-
refactor_plan: Path
|
|
23
22
|
feature_state_dir: Path
|
|
24
23
|
bugfix_state_dir: Path
|
|
25
|
-
refactor_state_dir: Path
|
|
26
24
|
layout: str
|
|
27
25
|
|
|
28
26
|
def path_values(self) -> tuple[Path, ...]:
|
|
@@ -37,10 +35,8 @@ class RuntimePaths:
|
|
|
37
35
|
self.specs_dir,
|
|
38
36
|
self.feature_plan,
|
|
39
37
|
self.bugfix_plan,
|
|
40
|
-
self.refactor_plan,
|
|
41
38
|
self.feature_state_dir,
|
|
42
39
|
self.bugfix_state_dir,
|
|
43
|
-
self.refactor_state_dir,
|
|
44
40
|
)
|
|
45
41
|
|
|
46
42
|
|
|
@@ -99,9 +95,7 @@ def resolve_runtime_paths(
|
|
|
99
95
|
specs_dir=specs_dir,
|
|
100
96
|
feature_plan=plans_dir / "feature-list.json",
|
|
101
97
|
bugfix_plan=plans_dir / "bug-fix-list.json",
|
|
102
|
-
refactor_plan=plans_dir / "refactor-list.json",
|
|
103
98
|
feature_state_dir=state_dir / "features",
|
|
104
99
|
bugfix_state_dir=state_dir / "bugfix",
|
|
105
|
-
refactor_state_dir=state_dir / "refactor",
|
|
106
100
|
layout=layout,
|
|
107
101
|
)
|
|
@@ -4,23 +4,43 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
import os
|
|
7
|
+
import shlex
|
|
7
8
|
import shutil
|
|
8
9
|
from collections.abc import Mapping
|
|
9
10
|
from dataclasses import dataclass
|
|
10
11
|
from pathlib import Path
|
|
11
12
|
|
|
12
|
-
SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi", "cursor")
|
|
13
|
-
PLATFORM_IDS = ("codebuddy", "claude", "codex", "pi", "cursor")
|
|
13
|
+
SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi", "cursor", "antigravity")
|
|
14
|
+
PLATFORM_IDS = ("codebuddy", "claude", "codex", "pi", "cursor", "antigravity")
|
|
14
15
|
PLATFORM_INPUT_HELP = (
|
|
15
|
-
"codebuddy, claude, codex, pi, cursor, a comma-separated list of those, or all"
|
|
16
|
+
"codebuddy, claude, codex, pi, cursor, antigravity, a comma-separated list of those, or all"
|
|
16
17
|
)
|
|
17
|
-
|
|
18
|
+
CLI_BY_PLATFORM = {
|
|
18
19
|
"codebuddy": "cbc",
|
|
19
20
|
"claude": "claude",
|
|
20
21
|
"codex": "codex",
|
|
21
22
|
"pi": "pi",
|
|
22
23
|
"cursor": "agent",
|
|
24
|
+
"antigravity": "agy",
|
|
23
25
|
}
|
|
26
|
+
_CLI_BY_PLATFORM = CLI_BY_PLATFORM
|
|
27
|
+
INSTALLED_PLATFORM_ORDER = ("pi", "codex", "claude", "codebuddy", "cursor", "antigravity")
|
|
28
|
+
INSTALLED_SKILL_MARKERS = {
|
|
29
|
+
"pi": ".pi/skills/prizmkit/SKILL.md",
|
|
30
|
+
"codex": ".agents/skills/prizmkit/SKILL.md",
|
|
31
|
+
"claude": ".claude/commands/prizmkit.md",
|
|
32
|
+
"codebuddy": ".codebuddy/skills/prizmkit/SKILL.md",
|
|
33
|
+
"cursor": ".cursor/skills/prizmkit/SKILL.md",
|
|
34
|
+
"antigravity": ".agents/plugins/prizmkit/skills/prizmkit/SKILL.md",
|
|
35
|
+
}
|
|
36
|
+
INSTALLED_MARKER_DIRS = (
|
|
37
|
+
".codebuddy",
|
|
38
|
+
".claude",
|
|
39
|
+
".agents/skills",
|
|
40
|
+
".pi",
|
|
41
|
+
".cursor",
|
|
42
|
+
".agents/plugins/prizmkit",
|
|
43
|
+
)
|
|
24
44
|
|
|
25
45
|
|
|
26
46
|
@dataclass(frozen=True)
|
|
@@ -58,6 +78,7 @@ _PLATFORM_MARKERS = {
|
|
|
58
78
|
"codebuddy": (".codebuddy/skills",),
|
|
59
79
|
"pi": (".pi/skills",),
|
|
60
80
|
"cursor": (".cursor/skills", ".cursor/rules"),
|
|
81
|
+
"antigravity": (".agents/plugins/prizmkit/skills", ".agents/plugins/prizmkit/rules"),
|
|
61
82
|
}
|
|
62
83
|
|
|
63
84
|
|
|
@@ -87,6 +108,11 @@ _PLATFORM_SKILL_PATTERNS = {
|
|
|
87
108
|
("project-agent-skill", ".agents/skills/{skill}"),
|
|
88
109
|
("home-skill", "~/.cursor/skills/{skill}"),
|
|
89
110
|
),
|
|
111
|
+
"antigravity": (
|
|
112
|
+
("project-plugin-skill", ".agents/plugins/prizmkit/skills/{skill}"),
|
|
113
|
+
("project-agent-skill", ".agents/skills/{skill}"),
|
|
114
|
+
("home-skill", "~/.gemini/config/skills/{skill}"),
|
|
115
|
+
),
|
|
90
116
|
}
|
|
91
117
|
|
|
92
118
|
|
|
@@ -100,32 +126,37 @@ def read_json_object(path: str | Path) -> dict:
|
|
|
100
126
|
return data if isinstance(data, dict) else {}
|
|
101
127
|
|
|
102
128
|
|
|
103
|
-
def platform_from_command(command: object) -> str:
|
|
129
|
+
def platform_from_command(command: object, *, allow_substring: bool = True) -> str:
|
|
104
130
|
"""Map an AI CLI command/config value to a PrizmKit platform name."""
|
|
105
|
-
|
|
106
|
-
if not
|
|
131
|
+
raw = str(command or "").strip()
|
|
132
|
+
if not raw:
|
|
107
133
|
return ""
|
|
108
|
-
unquoted =
|
|
109
|
-
|
|
110
|
-
unquoted
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
134
|
+
unquoted = raw[1:-1] if len(raw) >= 2 and raw[0] == raw[-1] and raw[0] in "'\"" else raw
|
|
135
|
+
if len(unquoted) >= 3 and unquoted[1:3] in {":\\", ":/"} and unquoted.lower().endswith((".exe", ".cmd", ".bat")):
|
|
136
|
+
token = unquoted
|
|
137
|
+
else:
|
|
138
|
+
try:
|
|
139
|
+
tokens = shlex.split(raw)
|
|
140
|
+
token = tokens[0] if tokens else raw
|
|
141
|
+
except ValueError:
|
|
142
|
+
token = raw.split()[0].strip("'\"")
|
|
143
|
+
base = os.path.basename(token).replace("\\", "/").rsplit("/", 1)[-1].lower()
|
|
115
144
|
for suffix in (".exe", ".cmd", ".bat"):
|
|
116
145
|
if base.endswith(suffix):
|
|
117
146
|
base = base[: -len(suffix)]
|
|
118
147
|
break
|
|
119
|
-
if base in ("claude", "claude-code") or "claude" in base:
|
|
148
|
+
if base in ("claude", "claude-code") or (allow_substring and "claude" in base):
|
|
120
149
|
return "claude"
|
|
121
|
-
if base in ("codex", "openai-codex") or "codex" in base:
|
|
150
|
+
if base in ("codex", "openai-codex") or (allow_substring and "codex" in base):
|
|
122
151
|
return "codex"
|
|
123
|
-
if base in ("cbc", "codebuddy") or "codebuddy" in base:
|
|
152
|
+
if base in ("cbc", "codebuddy") or (allow_substring and "codebuddy" in base):
|
|
124
153
|
return "codebuddy"
|
|
125
154
|
if base == "pi":
|
|
126
155
|
return "pi"
|
|
127
156
|
if base == "agent":
|
|
128
157
|
return "cursor"
|
|
158
|
+
if base in ("agy", "antigravity"):
|
|
159
|
+
return "antigravity"
|
|
129
160
|
return ""
|
|
130
161
|
|
|
131
162
|
|
|
@@ -230,7 +261,7 @@ def resolve_platform(project_root: str | Path, env: Mapping[str, str] | None = N
|
|
|
230
261
|
"unresolved",
|
|
231
262
|
(
|
|
232
263
|
"No supported platform marker found. Set PRIZMKIT_PLATFORM, configure .prizmkit/config.json, "
|
|
233
|
-
"or install Claude/Codex/CodeBuddy/Pi/Cursor platform files.",
|
|
264
|
+
"or install Claude/Codex/CodeBuddy/Pi/Cursor/Antigravity platform files.",
|
|
234
265
|
),
|
|
235
266
|
)
|
|
236
267
|
|