prizmkit 1.1.162 → 1.1.165

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.
Files changed (75) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/cursor/assets/prizmkit-hook.cjs +65 -0
  4. package/bundled/adapters/cursor/hooks-adapter.js +139 -0
  5. package/bundled/adapters/cursor/paths.js +11 -0
  6. package/bundled/adapters/cursor/rules-adapter.js +49 -0
  7. package/bundled/adapters/cursor/skill-adapter.js +27 -0
  8. package/bundled/dev-pipeline/README.md +18 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +3 -25
  10. package/bundled/dev-pipeline/prizmkit_runtime/config.py +71 -14
  11. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +28 -4
  12. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +5 -2
  13. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +21 -3
  14. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +19 -5
  15. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +123 -28
  16. package/bundled/dev-pipeline/prizmkit_runtime/status.py +2 -0
  17. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +1 -42
  18. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +43 -6
  19. package/bundled/dev-pipeline/scripts/init-pipeline.py +46 -8
  20. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +41 -6
  21. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +143 -27
  22. package/bundled/dev-pipeline/scripts/update-feature-status.py +2 -2
  23. package/bundled/dev-pipeline/scripts/utils.py +3 -12
  24. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +4 -2
  25. package/bundled/dev-pipeline/templates/feature-list-schema.json +4 -2
  26. package/bundled/dev-pipeline/templates/refactor-list-schema.json +4 -2
  27. package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +2 -1
  28. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +5 -23
  29. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +2 -2
  30. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +231 -0
  31. package/bundled/dev-pipeline/tests/test_unified_cli.py +406 -30
  32. package/bundled/dev-pipeline/tests/test_utils.py +23 -0
  33. package/bundled/rules/USAGE.md +3 -0
  34. package/bundled/skills/_metadata.json +1 -1
  35. package/bundled/skills/app-planner/SKILL.md +18 -9
  36. package/bundled/skills/app-planner/references/app-design-guide.md +7 -5
  37. package/bundled/skills/app-planner/references/brainstorm-guide.md +13 -21
  38. package/bundled/skills/app-planner/references/generated-plan-review.md +6 -2
  39. package/bundled/skills/bug-planner/SKILL.md +13 -5
  40. package/bundled/skills/bug-planner/assets/bug-confirmation-template.md +11 -7
  41. package/bundled/skills/bug-planner/references/generated-plan-review.md +7 -3
  42. package/bundled/skills/bug-planner/references/verification.md +0 -2
  43. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +37 -7
  44. package/bundled/skills/feature-planner/SKILL.md +17 -11
  45. package/bundled/skills/feature-planner/assets/planning-guide.md +13 -13
  46. package/bundled/skills/feature-planner/references/completeness-review.md +8 -4
  47. package/bundled/skills/feature-planner/references/generated-plan-review.md +6 -2
  48. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +43 -19
  49. package/bundled/skills/prizmkit-init/SKILL.md +1 -1
  50. package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
  51. package/bundled/skills/prizmkit-plan/SKILL.md +15 -4
  52. package/bundled/skills/prizmkit-plan/assets/plan-template.md +18 -3
  53. package/bundled/skills/prizmkit-plan/assets/spec-template.md +17 -5
  54. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +26 -24
  55. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +7 -5
  56. package/bundled/skills/prizmkit-plan/references/verification-checklist.md +15 -6
  57. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
  58. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
  59. package/bundled/skills/refactor-planner/SKILL.md +18 -11
  60. package/bundled/skills/refactor-planner/references/generated-plan-review.md +6 -2
  61. package/bundled/skills/refactor-planner/references/planning-phases.md +14 -9
  62. package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +8 -2
  63. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +38 -9
  64. package/package.json +4 -2
  65. package/src/ai-cli-launch.js +9 -2
  66. package/src/clean.js +42 -6
  67. package/src/config.js +51 -10
  68. package/src/detect-platform.js +30 -8
  69. package/src/external-skills.js +33 -99
  70. package/src/index.js +5 -0
  71. package/src/manifest.js +30 -4
  72. package/src/platforms.js +11 -4
  73. package/src/prompts.js +12 -4
  74. package/src/scaffold.js +75 -4
  75. package/src/upgrade.js +15 -14
@@ -42,6 +42,8 @@ HIDDEN_TOOL_WORKTREE_EXCLUDES = (
42
42
  ":(top,exclude,glob).agents/**",
43
43
  ":(top,exclude).pi",
44
44
  ":(top,exclude,glob).pi/**",
45
+ ":(top,exclude).cursor",
46
+ ":(top,exclude,glob).cursor/**",
45
47
  )
46
48
 
47
49
  UNTRACKED_TRANSIENT_EXCLUDES = (
@@ -54,7 +56,7 @@ UNTRACKED_TRANSIENT_EXCLUDES = (
54
56
  PIPELINE_FALLBACK_GIT_NAME = "PrizmKit Pipeline"
55
57
  PIPELINE_FALLBACK_GIT_EMAIL = "prizmkit-pipeline@example.invalid"
56
58
 
57
- WORKTREE_PLATFORM_SUPPORT_DIRS = (".claude", ".codebuddy", ".codex", ".agents", ".pi")
59
+ WORKTREE_PLATFORM_SUPPORT_DIRS = (".claude", ".codebuddy", ".codex", ".agents", ".pi", ".cursor")
58
60
  WORKTREE_ROOT_SUPPORT_FILES = ("skills-lock.json", "AGENTS.md")
59
61
  WORKTREE_PRIZMKIT_SUPPORT_ENTRIES = ("prizm-docs", "config.json", "manifest.json")
60
62
  WORKTREE_SUPPORT_IGNORE_NAMES = {"__pycache__", ".DS_Store", "settings.local.json"}
@@ -777,9 +779,17 @@ def current_branch(project_root: Path) -> str:
777
779
 
778
780
 
779
781
  def git_status_safe(project_root: Path) -> str:
780
- """Return task-visible status while excluding runner-owned support paths."""
782
+ """Return task-visible status while excluding copied support payloads."""
781
783
  result = run_git_command(project_root, ("status", "--porcelain", "--", ".", *HIDDEN_TOOL_WORKTREE_EXCLUDES))
782
- return result.stdout if result.return_code == 0 else ""
784
+ if result.return_code != 0:
785
+ return ""
786
+ tracked_cursor = run_git_command(
787
+ project_root,
788
+ ("status", "--porcelain", "--untracked-files=no", "--", ".cursor"),
789
+ )
790
+ if tracked_cursor.return_code != 0:
791
+ return ""
792
+ return result.stdout + tracked_cursor.stdout
783
793
 
784
794
 
785
795
  def _status_record_paths(stdout: str) -> tuple[str, ...]:
@@ -805,7 +815,21 @@ def visible_task_paths(project_root: Path) -> tuple[tuple[str, ...], GitCommandR
805
815
  project_root,
806
816
  ("status", "--porcelain=v1", "-z", "--untracked-files=all", "--", ".", *HIDDEN_TOOL_WORKTREE_EXCLUDES),
807
817
  )
808
- return (_status_record_paths(result.stdout) if result.return_code == 0 else ()), result
818
+ if result.return_code != 0:
819
+ return (), result
820
+
821
+ # Platform payloads copied into a task worktree stay hidden, but existing
822
+ # tracked Cursor project configuration remains part of complete-workspace
823
+ # commit semantics. `--untracked-files=no` admits only Git-owned Cursor
824
+ # changes and cannot sweep materialized support files into a task commit.
825
+ cursor_result = run_git_command(
826
+ project_root,
827
+ ("status", "--porcelain=v1", "-z", "--untracked-files=no", "--", ".cursor"),
828
+ )
829
+ if cursor_result.return_code != 0:
830
+ return (), cursor_result
831
+ paths = (*_status_record_paths(result.stdout), *_status_record_paths(cursor_result.stdout))
832
+ return tuple(dict.fromkeys(paths)), result
809
833
 
810
834
 
811
835
  def addable_task_paths(project_root: Path, paths: Sequence[str]) -> tuple[tuple[str, ...], GitCommandResult]:
@@ -69,13 +69,16 @@ def _progress_signature(path: Path | None) -> tuple[str, str, bool]:
69
69
  current_tool = data.get("current_tool")
70
70
  tool_active = isinstance(current_tool, str) and bool(current_tool.strip())
71
71
  child_signature = str(data.get("child_activity_signature") or "")
72
+ subagent_statistics = data.get("subagent_statistics")
73
+ if not isinstance(subagent_statistics, dict):
74
+ subagent_statistics = {}
72
75
  signature = json.dumps(
73
76
  [
74
77
  current_tool or "",
75
78
  int(data.get("message_count") or 0),
76
79
  int(data.get("total_tool_calls") or 0),
77
- int(data.get("active_subagent_count") or 0),
78
- int(data.get("subagent_spawn_count") or 0),
80
+ int(subagent_statistics.get("active") or 0),
81
+ int(subagent_statistics.get("spawned") or 0),
79
82
  child_signature,
80
83
  int(data.get("child_total_bytes") or 0),
81
84
  data.get("fatal_error_code") or "",
@@ -8,7 +8,7 @@ from collections.abc import Mapping
8
8
  from dataclasses import dataclass
9
9
  from pathlib import Path
10
10
 
11
- SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi")
11
+ SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi", "cursor")
12
12
 
13
13
 
14
14
  @dataclass(frozen=True)
@@ -45,6 +45,7 @@ _PLATFORM_MARKERS = {
45
45
  "codex": (".agents/skills",),
46
46
  "codebuddy": (".codebuddy/skills",),
47
47
  "pi": (".pi/skills",),
48
+ "cursor": (".cursor/skills", ".cursor/rules"),
48
49
  }
49
50
 
50
51
 
@@ -69,6 +70,11 @@ _PLATFORM_SKILL_PATTERNS = {
69
70
  ("project-agent-skill", ".agents/skills/{skill}"),
70
71
  ("home-skill", "~/.pi/agent/skills/{skill}"),
71
72
  ),
73
+ "cursor": (
74
+ ("project-skill", ".cursor/skills/{skill}"),
75
+ ("project-agent-skill", ".agents/skills/{skill}"),
76
+ ("home-skill", "~/.cursor/skills/{skill}"),
77
+ ),
72
78
  }
73
79
 
74
80
 
@@ -87,7 +93,17 @@ def platform_from_command(command: object) -> str:
87
93
  cmd = str(command or "").strip().lower()
88
94
  if not cmd:
89
95
  return ""
90
- base = os.path.basename(cmd.split()[0])
96
+ unquoted = cmd[1:-1] if len(cmd) >= 2 and cmd[0] == cmd[-1] and cmd[0] in "'\"" else cmd
97
+ token = (
98
+ unquoted
99
+ if len(unquoted) >= 3 and unquoted[1:3] in {":\\", ":/"} and unquoted.endswith((".exe", ".cmd", ".bat"))
100
+ else cmd.split()[0]
101
+ )
102
+ base = os.path.basename(token).replace("\\", "/").rsplit("/", 1)[-1]
103
+ for suffix in (".exe", ".cmd", ".bat"):
104
+ if base.endswith(suffix):
105
+ base = base[: -len(suffix)]
106
+ break
91
107
  if base in ("claude", "claude-code") or "claude" in base:
92
108
  return "claude"
93
109
  if base in ("codex", "openai-codex") or "codex" in base:
@@ -96,6 +112,8 @@ def platform_from_command(command: object) -> str:
96
112
  return "codebuddy"
97
113
  if base == "pi":
98
114
  return "pi"
115
+ if base == "agent":
116
+ return "cursor"
99
117
  return ""
100
118
 
101
119
 
@@ -152,7 +170,7 @@ def resolve_platform(project_root: str | Path, env: Mapping[str, str] | None = N
152
170
  "unresolved",
153
171
  (
154
172
  "No supported platform marker found. Set PRIZMKIT_PLATFORM, configure .prizmkit/config.json, "
155
- "or install Claude/Codex/CodeBuddy/Pi platform files.",
173
+ "or install Claude/Codex/CodeBuddy/Pi/Cursor platform files.",
156
174
  ),
157
175
  )
158
176
 
@@ -416,7 +416,10 @@ def _progress_data(path: Path) -> dict[str, object]:
416
416
 
417
417
 
418
418
  def _subagent_state_summary(progress: Mapping[str, object]) -> str:
419
- states = progress.get("subagent_states")
419
+ statistics = progress.get("subagent_statistics")
420
+ if not isinstance(statistics, Mapping):
421
+ return ""
422
+ states = statistics.get("states")
420
423
  if not isinstance(states, list):
421
424
  return ""
422
425
  parts = []
@@ -458,9 +461,9 @@ def _emit_session_summary(session_result, session_paths: SessionPaths, classific
458
461
  providers = subagent_stats.get("providers")
459
462
  provider_text = ",".join(str(provider) for provider in providers) if isinstance(providers, list) else ""
460
463
  else:
461
- spawned = int(progress.get("subagent_spawn_count") or 0)
462
- active = int(progress.get("active_subagent_count") or 0)
463
- provider_text = str(progress.get("subagent_provider") or "")
464
+ spawned = 0
465
+ active = 0
466
+ provider_text = ""
464
467
  state_summary = _subagent_state_summary(progress)
465
468
  if spawned or active or state_summary:
466
469
  suffix = f" ({provider_text}; source=session.log)" if provider_text else " (source=session.log)"
@@ -509,6 +512,8 @@ def _preview_item(
509
512
  config = load_runtime_config(paths)
510
513
  if not config.ai_client.command:
511
514
  raise RuntimeError("No supported AI CLI command was found")
515
+ if config.ai_client.platform == "cursor" and not config.effort_validation.valid:
516
+ raise RuntimeError(config.effort_validation.message)
512
517
  metadata = _with_recovery_metadata(family, item_id, initial_metadata)
513
518
  retry_count = int(metadata.get("retry_count") or 0)
514
519
  session_id = f"{item_id}-dry-run"
@@ -548,6 +553,8 @@ def _process_item_locked(
548
553
  config = load_runtime_config(paths)
549
554
  if not config.ai_client.command:
550
555
  raise RuntimeError("No supported AI CLI command was found")
556
+ if config.ai_client.platform == "cursor" and not config.effort_validation.valid:
557
+ raise RuntimeError(config.effort_validation.message)
551
558
 
552
559
  active_branch = current_branch(paths.project_root)
553
560
  checkout = load_task_checkout(family.state_dir, family.task_type, item_id)
@@ -727,7 +734,14 @@ def _process_item_locked(
727
734
  _emit_prompt_summary(prompt, session_id)
728
735
  stream_json = False
729
736
  if getattr(config.ai_client, "launch_profile", None) is None:
730
- stream_json = detect_stream_json_support(config.ai_client.command, config.ai_client.platform).enabled
737
+ stream_support = detect_stream_json_support(config.ai_client.command, config.ai_client.platform)
738
+ stream_json = stream_support.enabled
739
+ if config.ai_client.platform == "cursor" and not stream_json:
740
+ details = "; ".join(stream_support.notes) or "required stream-json flags were not found"
741
+ raise RuntimeError(
742
+ "Cursor Agent CLI is incompatible with PrizmKit headless execution: "
743
+ f"{details}. Install or update Cursor Agent and verify `agent --help`."
744
+ )
731
745
  base_head = run_git_command(execution_root, ("rev-parse", "HEAD")).stdout.strip()
732
746
  session_result = AISessionLauncher(
733
747
  AISessionConfig(
@@ -121,7 +121,7 @@ HelpRunner = Callable[[Sequence[str]], str]
121
121
 
122
122
  def _normalize_platform(platform: str | None) -> str:
123
123
  normalized = (platform or "").strip().lower()
124
- return normalized if normalized in {"claude", "codex", "codebuddy", "pi", "custom"} else "codebuddy"
124
+ return normalized if normalized in {"claude", "codex", "codebuddy", "pi", "cursor", "custom"} else "codebuddy"
125
125
 
126
126
 
127
127
  def _prompt_text(path: Path) -> str:
@@ -129,13 +129,35 @@ def _prompt_text(path: Path) -> str:
129
129
 
130
130
 
131
131
  def _default_help_runner(command: Sequence[str]) -> str:
132
- completed = subprocess.run(
133
- list(command),
134
- stdout=subprocess.PIPE,
135
- stderr=subprocess.STDOUT,
136
- text=True,
137
- check=False,
138
- )
132
+ try:
133
+ completed = subprocess.run(
134
+ list(command),
135
+ stdout=subprocess.PIPE,
136
+ stderr=subprocess.STDOUT,
137
+ text=True,
138
+ check=False,
139
+ timeout=10,
140
+ )
141
+ except (OSError, subprocess.SubprocessError):
142
+ return ""
143
+ return completed.stdout or ""
144
+
145
+
146
+ def _default_cursor_probe_runner(command: Sequence[str]) -> str:
147
+ """Run a Cursor identity/capability probe and require a successful exit."""
148
+ try:
149
+ completed = subprocess.run(
150
+ list(command),
151
+ stdout=subprocess.PIPE,
152
+ stderr=subprocess.STDOUT,
153
+ text=True,
154
+ check=False,
155
+ timeout=10,
156
+ )
157
+ except (OSError, subprocess.SubprocessError):
158
+ return ""
159
+ if completed.returncode != 0:
160
+ return ""
139
161
  return completed.stdout or ""
140
162
 
141
163
 
@@ -146,10 +168,37 @@ def detect_stream_json_support(
146
168
  ) -> StreamJsonSupport:
147
169
  """Detect stream-json support using shell-compatible provider rules."""
148
170
  normalized = _normalize_platform(platform)
149
- command_name = Path(str(cli_command).split()[0].strip("'\"")).name.lower()
171
+ raw_command = str(cli_command).strip()
172
+ unquoted = (
173
+ raw_command[1:-1]
174
+ if len(raw_command) >= 2 and raw_command[0] == raw_command[-1] and raw_command[0] in "'\""
175
+ else raw_command
176
+ )
177
+ command_token = (
178
+ unquoted
179
+ if len(unquoted) >= 3 and unquoted[1:3] in {":\\", ":/"} and unquoted.lower().endswith((".exe", ".cmd", ".bat"))
180
+ else raw_command.split()[0].strip("'\"")
181
+ )
182
+ command_name = command_token.replace("\\", "/").rsplit("/", 1)[-1].lower()
183
+ for suffix in (".exe", ".cmd", ".bat"):
184
+ if command_name.endswith(suffix):
185
+ command_name = command_name[: -len(suffix)]
186
+ break
150
187
  runner = help_runner or _default_help_runner
151
188
  if normalized == "codebuddy" or command_name == "cbc":
152
189
  return StreamJsonSupport(True, "stream-json", "codebuddy-default")
190
+ if normalized == "cursor" or command_name == "agent":
191
+ cursor_runner = runner if help_runner is not None else _default_cursor_probe_runner
192
+ version_output = cursor_runner((cli_command, "--version"))
193
+ help_output = cursor_runner((cli_command, "--help"))
194
+ required = ("--print", "--force", "--trust", "--output-format")
195
+ missing = tuple(flag for flag in required if flag not in help_output)
196
+ if "cursor" not in f"{version_output}\n{help_output}".lower():
197
+ missing = (*missing, "Cursor identity not found")
198
+ if not missing:
199
+ return StreamJsonSupport(True, "cursor-stream-json", "cursor-version-help")
200
+ notes = tuple(f"{flag} not found" if flag.startswith("--") else flag for flag in missing)
201
+ return StreamJsonSupport(False, "", "cursor-version-help", notes)
153
202
  if normalized == "pi" or command_name == "pi":
154
203
  help_output = runner((cli_command, "--help"))
155
204
  required = ("--mode", "--approve", "--no-session", "--tools", "--model", "--thinking")
@@ -200,6 +249,20 @@ def build_ai_session_command(config: AISessionConfig) -> AISessionCommand:
200
249
  argv.extend(config.extra_args)
201
250
  return AISessionCommand(tuple(argv), prompt, "pi", "stdin", prompt)
202
251
 
252
+ if platform == "cursor":
253
+ argv = [
254
+ config.cli_command,
255
+ "--print",
256
+ "--force",
257
+ "--trust",
258
+ ]
259
+ if config.use_stream_json:
260
+ argv.extend(["--output-format", "stream-json"])
261
+ if config.model:
262
+ argv.extend(["--model", config.model])
263
+ argv.extend(config.extra_args)
264
+ return AISessionCommand(tuple(argv), prompt, "cursor", "stdin", prompt)
265
+
203
266
  if platform == "claude":
204
267
  argv = [
205
268
  config.cli_command,
@@ -331,12 +394,17 @@ def _permission_denial_text(event: object) -> str:
331
394
  return text[:500] if any(marker in lower for marker in markers) else ""
332
395
 
333
396
 
334
- def parse_stream_progress_lines(lines: Sequence[str]) -> ProgressSummary:
397
+ def parse_stream_progress_lines(
398
+ lines: Sequence[str],
399
+ provider_hint: str | None = None,
400
+ ) -> ProgressSummary:
335
401
  """Parse raw JSONL lines into additive provider-neutral progress metadata."""
336
402
  event_type_counts: Counter[str] = Counter()
337
403
  permission_denials: list[str] = []
338
404
  claude_session_id = ""
339
405
  cb_session_id = ""
406
+ cursor_session_id = ""
407
+ cursor_stream = _normalize_platform(provider_hint) == "cursor"
340
408
  result_subtype = ""
341
409
  stop_reason = ""
342
410
  has_usage = False
@@ -362,10 +430,20 @@ def parse_stream_progress_lines(lines: Sequence[str]) -> ProgressSummary:
362
430
  event_type_counts[event_type] += 1
363
431
  if isinstance(event.get("sessionId"), str) and not cb_session_id:
364
432
  cb_session_id = event["sessionId"].strip()
433
+ if event_type == "tool_call":
434
+ cursor_stream = True
435
+ if not cursor_session_id and claude_session_id:
436
+ cursor_session_id = claude_session_id
437
+ claude_session_id = ""
438
+ if cursor_stream and isinstance(event.get("session_id"), str) and not cursor_session_id:
439
+ cursor_session_id = event["session_id"].strip()
365
440
  if event_type == "system" and event.get("subtype") == "init":
366
441
  session_id = event.get("session_id")
367
442
  if isinstance(session_id, str):
368
- claude_session_id = session_id.strip()
443
+ if cursor_stream:
444
+ cursor_session_id = cursor_session_id or session_id.strip()
445
+ else:
446
+ claude_session_id = session_id.strip()
369
447
  if event_type == "result":
370
448
  result_subtype = str(event.get("subtype") or event.get("result_subtype") or "")
371
449
  stop_reason = str(event.get("stop_reason") or "")
@@ -396,6 +474,7 @@ def parse_stream_progress_lines(lines: Sequence[str]) -> ProgressSummary:
396
474
  event_type_counts=dict(event_type_counts),
397
475
  claude_session_id=claude_session_id,
398
476
  cb_session_id=cb_session_id,
477
+ cursor_session_id=cursor_session_id,
399
478
  result_subtype=result_subtype,
400
479
  stop_reason=stop_reason,
401
480
  has_usage=has_usage,
@@ -410,18 +489,20 @@ def parse_stream_progress_lines(lines: Sequence[str]) -> ProgressSummary:
410
489
  class _FallbackProgressTracker:
411
490
  """Bounded additive progress fallback when the shared parser cannot load."""
412
491
 
413
- def __init__(self):
492
+ def __init__(self, provider_hint: str | None = None):
414
493
  self._event_type_counts: Counter[str] = Counter()
415
494
  self._summary = ProgressSummary()
495
+ self._provider_hint = provider_hint
416
496
 
417
497
  def process_event(self, event: object) -> None:
418
498
  line = json.dumps(event, ensure_ascii=False, default=str) if isinstance(event, dict) else str(event)
419
- current = parse_stream_progress_lines((line,))
499
+ current = parse_stream_progress_lines((line,), self._provider_hint)
420
500
  self._event_type_counts.update(current.event_type_counts)
421
501
  self._summary = ProgressSummary(
422
502
  event_type_counts=dict(self._event_type_counts),
423
503
  claude_session_id=current.claude_session_id or self._summary.claude_session_id,
424
504
  cb_session_id=current.cb_session_id or self._summary.cb_session_id,
505
+ cursor_session_id=current.cursor_session_id or self._summary.cursor_session_id,
425
506
  result_subtype=current.result_subtype or self._summary.result_subtype,
426
507
  stop_reason=current.stop_reason or self._summary.stop_reason,
427
508
  has_usage=current.has_usage or self._summary.has_usage,
@@ -483,12 +564,7 @@ def _progress_refresh_key(data: Mapping[str, object]) -> tuple[object, ...]:
483
564
  str(data.get("current_tool") or ""),
484
565
  str(data.get("current_phase") or ""),
485
566
  int(data.get("total_tool_calls") or 0),
486
- int(data.get("active_subagent_count") or 0),
487
- int(data.get("subagent_spawn_count") or 0),
488
- str(data.get("subagent_stats_source") or ""),
489
- str(data.get("subagent_provider") or ""),
490
- json.dumps(data.get("subagent_states") or [], sort_keys=True, default=str),
491
- json.dumps(data.get("subagent_observed_ids") or [], sort_keys=True, default=str),
567
+ json.dumps(data.get("subagent_statistics") or {}, sort_keys=True, default=str),
492
568
  str(data.get("child_activity_signature") or ""),
493
569
  int(data.get("child_total_bytes") or 0),
494
570
  str(data.get("fatal_error_code") or ""),
@@ -582,7 +658,12 @@ def _emit_ai_interruption_received(
582
658
  tool = str(progress.get("current_tool") or "unavailable")
583
659
  messages = _diagnostic_int(progress.get("message_count"))
584
660
  tool_calls = _diagnostic_int(progress.get("total_tool_calls"))
585
- active_subagents = _diagnostic_int(progress.get("active_subagent_count"))
661
+ subagent_statistics = progress.get("subagent_statistics")
662
+ active_subagents = _diagnostic_int(
663
+ subagent_statistics.get("active")
664
+ if isinstance(subagent_statistics, Mapping)
665
+ else 0
666
+ )
586
667
  elapsed = _format_elapsed(time.time() - started_epoch)
587
668
  heartbeat_details = heartbeat_state.details if heartbeat_state is not None else "unavailable"
588
669
  heartbeat_stale = heartbeat_state.stale if heartbeat_state is not None else "unavailable"
@@ -730,13 +811,19 @@ def _compact_progress_line(
730
811
  child_bytes = int(data.get("child_total_bytes") or 0)
731
812
  child_files = data.get("child_session_files")
732
813
  child_file_count = len(child_files) if isinstance(child_files, list) else 0
733
- spawned = int(data.get("subagent_spawn_count") or 0)
734
- active = int(data.get("active_subagent_count") or 0)
735
- subagent_states = data.get("subagent_states")
736
- if spawned or active or subagent_states:
814
+ subagent_statistics = data.get("subagent_statistics")
815
+ if isinstance(subagent_statistics, Mapping):
816
+ spawned = int(subagent_statistics.get("spawned") or 0)
817
+ active = int(subagent_statistics.get("active") or 0)
818
+ state_counts = subagent_statistics.get("states")
819
+ else:
820
+ spawned = 0
821
+ active = 0
822
+ state_counts = []
823
+ if spawned or active or state_counts:
737
824
  state_bits = []
738
- if isinstance(subagent_states, list):
739
- for item in subagent_states:
825
+ if isinstance(state_counts, list):
826
+ for item in state_counts:
740
827
  if not isinstance(item, Mapping):
741
828
  continue
742
829
  status = str(item.get("status") or "unknown")
@@ -832,6 +919,7 @@ def _reader_thread(
832
919
  result_queue: "queue.Queue[dict[str, object]]",
833
920
  progress_path: Path | None = None,
834
921
  live_output: bool = False,
922
+ provider_hint: str | None = None,
835
923
  ) -> None:
836
924
  tracker_lock = threading.Lock()
837
925
  progress_refresh_stop = threading.Event()
@@ -839,9 +927,14 @@ def _reader_thread(
839
927
  refresh_progress: Callable[[bool], None] | None = None
840
928
  tracker_class, normalizer_class = _load_stream_parser_classes()
841
929
  try:
842
- tracker = tracker_class(session_log) if tracker_class is not None else _FallbackProgressTracker()
930
+ tracker = tracker_class(session_log) if tracker_class is not None else _FallbackProgressTracker(provider_hint)
931
+ if tracker_class is not None and provider_hint is not None:
932
+ try:
933
+ tracker.provider_hint = str(provider_hint).strip().lower()
934
+ except (AttributeError, TypeError):
935
+ pass
843
936
  except Exception:
844
- tracker = _FallbackProgressTracker()
937
+ tracker = _FallbackProgressTracker(provider_hint)
845
938
  try:
846
939
  normalizer = normalizer_class() if normalizer_class is not None else None
847
940
  except Exception:
@@ -960,6 +1053,7 @@ def _summary_from_progress_dict(data: Mapping[str, object], fallback: ProgressSu
960
1053
  event_type_counts=event_counts if isinstance(event_counts, Mapping) else fallback.event_type_counts,
961
1054
  claude_session_id=str(data.get("claude_session_id") or fallback.claude_session_id),
962
1055
  cb_session_id=str(data.get("cb_session_id") or fallback.cb_session_id),
1056
+ cursor_session_id=str(data.get("cursor_session_id") or fallback.cursor_session_id),
963
1057
  result_subtype=str(data.get("result_subtype") or fallback.result_subtype),
964
1058
  stop_reason=str(data.get("stop_reason") or fallback.stop_reason),
965
1059
  has_usage=bool(data.get("has_usage") or fallback.has_usage),
@@ -1011,6 +1105,7 @@ class AISessionLauncher:
1011
1105
  reader_result_queue,
1012
1106
  self.config.progress_path,
1013
1107
  self.config.live_output and self.config.verbose and not self.config.suppress_stream_output,
1108
+ self.config.platform,
1014
1109
  ),
1015
1110
  daemon=True,
1016
1111
  )
@@ -37,6 +37,7 @@ class ProgressSummary:
37
37
  event_type_counts: Mapping[str, int] = field(default_factory=dict)
38
38
  claude_session_id: str = ""
39
39
  cb_session_id: str = ""
40
+ cursor_session_id: str = ""
40
41
  result_subtype: str = ""
41
42
  stop_reason: str = ""
42
43
  has_usage: bool = False
@@ -52,6 +53,7 @@ class ProgressSummary:
52
53
  "event_type_counts": dict(self.event_type_counts),
53
54
  "claude_session_id": self.claude_session_id,
54
55
  "cb_session_id": self.cb_session_id,
56
+ "cursor_session_id": self.cursor_session_id,
55
57
  "result_subtype": self.result_subtype,
56
58
  "stop_reason": self.stop_reason,
57
59
  "has_usage": self.has_usage,
@@ -31,7 +31,6 @@ _INDEPENDENT_REVIEW_KEYS = {
31
31
  "downgrade_reason",
32
32
  "final_state_rechecked",
33
33
  }
34
- _LEGACY_RESULT_KEYS = _RESULT_KEYS | {"review_required", "review_scope"}
35
34
 
36
35
 
37
36
  def load_test_result(path: str | Path) -> dict[str, Any] | None:
@@ -43,27 +42,6 @@ def load_test_result(path: str | Path) -> dict[str, Any] | None:
43
42
  return _validate_test_result_value(value)
44
43
 
45
44
 
46
- def load_legacy_test_result(path: str | Path) -> dict[str, Any] | None:
47
- """Read a historical pass projection without permitting new legacy output."""
48
- try:
49
- value = json.loads(Path(path).read_text(encoding="utf-8"))
50
- except (OSError, ValueError, TypeError):
51
- return None
52
- if not isinstance(value, dict):
53
- return None
54
- if set(value) == _RESULT_KEYS:
55
- return _validate_test_result_value(value)
56
- if set(value) != _LEGACY_RESULT_KEYS:
57
- return None
58
- if value.get("review_required") is not False or value.get("review_scope") is not None:
59
- return None
60
- normalized = {
61
- key: item for key, item in value.items()
62
- if key not in {"review_required", "review_scope"}
63
- }
64
- return _validate_test_result_value(normalized)
65
-
66
-
67
45
  def _validate_test_result_value(value: object) -> dict[str, Any] | None:
68
46
  if not isinstance(value, dict):
69
47
  return None
@@ -136,22 +114,6 @@ def valid_test_artifact_pair(
136
114
  report_path,
137
115
  result_path,
138
116
  required_result=required_result,
139
- legacy=False,
140
- )
141
-
142
-
143
- def valid_legacy_test_artifact_pair(
144
- report_path: str | Path,
145
- result_path: str | Path,
146
- *,
147
- required_result: str | None = None,
148
- ) -> bool:
149
- """Validate a historical completed pair for read-only recovery."""
150
- return _valid_test_artifact_pair(
151
- report_path,
152
- result_path,
153
- required_result=required_result,
154
- legacy=True,
155
117
  )
156
118
 
157
119
 
@@ -160,7 +122,6 @@ def _valid_test_artifact_pair(
160
122
  result_path: str | Path,
161
123
  *,
162
124
  required_result: str | None,
163
- legacy: bool,
164
125
  ) -> bool:
165
126
  report = Path(report_path)
166
127
  result = Path(result_path)
@@ -168,9 +129,7 @@ def _valid_test_artifact_pair(
168
129
  return False
169
130
  if report.resolve().parent != result.resolve().parent:
170
131
  return False
171
- projection = (
172
- load_legacy_test_result(result) if legacy else load_test_result(result)
173
- )
132
+ projection = load_test_result(result)
174
133
  if projection is None:
175
134
  return False
176
135
  if required_result is not None and projection.get("result") != required_result:
@@ -20,6 +20,15 @@ from utils import stable_topological_order
20
20
 
21
21
  EXPECTED_SCHEMA = "dev-pipeline-bug-fix-list-v1"
22
22
  BUG_ID_PATTERN = re.compile(r"^B-\d{3}$")
23
+ ALLOWED_LIST_FIELDS = {
24
+ "$schema", "project_name", "project_description", "created_at",
25
+ "created_by", "bugs", "global_context",
26
+ }
27
+ ALLOWED_GLOBAL_CONTEXT_FIELDS = {
28
+ "tech_stack", "language", "runtime", "frontend_framework",
29
+ "frontend_styling", "backend_framework", "database", "orm",
30
+ "testing_strategy", "bundler", "project_type", "ci_pipeline",
31
+ }
23
32
 
24
33
  REQUIRED_BUG_FIELDS = [
25
34
  "id",
@@ -31,6 +40,15 @@ REQUIRED_BUG_FIELDS = [
31
40
  "acceptance_criteria",
32
41
  "status",
33
42
  ]
43
+ ALLOWED_BUG_FIELDS = set(REQUIRED_BUG_FIELDS) | {
44
+ "priority",
45
+ "environment",
46
+ "affected_modules",
47
+ "dependencies",
48
+ "user_context",
49
+ "browser_interaction",
50
+ "model",
51
+ }
34
52
 
35
53
  VALID_SEVERITIES = ["critical", "high", "medium", "low"]
36
54
  VALID_VERIFICATION_TYPES = ["automated", "manual", "hybrid"]
@@ -80,6 +98,12 @@ def validate_schema(data):
80
98
  """Validate the top-level schema and structure of the bug fix list."""
81
99
  errors = []
82
100
 
101
+ unknown_root = set(data) - ALLOWED_LIST_FIELDS
102
+ if unknown_root:
103
+ errors.append("Bug fix list has unknown fields: {}".format(
104
+ ", ".join(sorted(unknown_root))
105
+ ))
106
+
83
107
  # Check $schema
84
108
  schema = data.get("$schema")
85
109
  if schema != EXPECTED_SCHEMA:
@@ -93,6 +117,17 @@ def validate_schema(data):
93
117
  elif not isinstance(data["project_name"], str) or not data["project_name"].strip():
94
118
  errors.append("project_name must be a non-empty string")
95
119
 
120
+ global_context = data.get("global_context")
121
+ if global_context is not None:
122
+ if not isinstance(global_context, dict):
123
+ errors.append("global_context must be an object")
124
+ else:
125
+ unknown_context = set(global_context) - ALLOWED_GLOBAL_CONTEXT_FIELDS
126
+ if unknown_context:
127
+ errors.append("global_context has unknown fields: {}".format(
128
+ ", ".join(sorted(unknown_context))
129
+ ))
130
+
96
131
  # Check bugs array
97
132
  if "bugs" not in data:
98
133
  errors.append("Missing required field: bugs")
@@ -114,12 +149,6 @@ def validate_bugs(bugs):
114
149
  errors.append("Bug at index {} is not an object".format(i))
115
150
  continue
116
151
 
117
- for retired_field in ("critic", "critic_count"):
118
- if retired_field in bug:
119
- errors.append(
120
- "Bug at index {} uses retired field '{}'".format(i, retired_field)
121
- )
122
-
123
152
  # Check required fields
124
153
  for field in REQUIRED_BUG_FIELDS:
125
154
  if field not in bug:
@@ -127,6 +156,14 @@ def validate_bugs(bugs):
127
156
  "Bug at index {} missing required field: {}".format(i, field)
128
157
  )
129
158
 
159
+ unknown = set(bug) - ALLOWED_BUG_FIELDS
160
+ if unknown:
161
+ errors.append(
162
+ "Bug at index {} has unknown fields: {}".format(
163
+ i, ", ".join(sorted(unknown))
164
+ )
165
+ )
166
+
130
167
  # Validate bug ID format
131
168
  bid = bug.get("id")
132
169
  if bid is not None: