okstra 0.231.1 → 0.233.0
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 +19 -271
- package/dist/cli-registry.mjs +14 -1
- package/dist/cli-registry.mjs.map +1 -1
- package/dist/commands/execute/render-bundle.d.mts +6 -1
- package/dist/commands/execute/render-bundle.mjs +139 -32
- package/dist/commands/execute/render-bundle.mjs.map +1 -1
- package/dist/commands/lifecycle/config.mjs +6 -74
- package/dist/commands/lifecycle/config.mjs.map +1 -1
- package/dist/commands/memory/memory.mjs +9 -55
- package/dist/commands/memory/memory.mjs.map +1 -1
- package/dist/commands/trace/capacity.d.mts +12 -0
- package/dist/commands/trace/capacity.mjs +21 -0
- package/dist/commands/trace/capacity.mjs.map +1 -0
- package/dist/commands/trace/model.d.mts +89 -0
- package/dist/commands/trace/model.mjs +251 -0
- package/dist/commands/trace/model.mjs.map +1 -0
- package/dist/commands/trace/progression.d.mts +11 -0
- package/dist/commands/trace/progression.mjs +194 -0
- package/dist/commands/trace/progression.mjs.map +1 -0
- package/dist/commands/trace/review.d.mts +7 -0
- package/dist/commands/trace/review.mjs +51 -0
- package/dist/commands/trace/review.mjs.map +1 -0
- package/dist/commands/trace/task-link.d.mts +18 -0
- package/dist/commands/trace/task-link.mjs +72 -0
- package/dist/commands/trace/task-link.mjs.map +1 -0
- package/dist/commands/trace/trace.d.mts +1 -0
- package/dist/commands/trace/trace.mjs +293 -0
- package/dist/commands/trace/trace.mjs.map +1 -0
- package/dist/lib/bounded-file.d.mts +1 -0
- package/dist/lib/bounded-file.mjs +36 -0
- package/dist/lib/bounded-file.mjs.map +1 -0
- package/dist/lib/config-store.d.mts +34 -0
- package/dist/lib/config-store.mjs +70 -0
- package/dist/lib/config-store.mjs.map +1 -0
- package/dist/lib/file-lock.mjs +4 -5
- package/dist/lib/file-lock.mjs.map +1 -1
- package/dist/lib/input-limit.d.mts +4 -0
- package/dist/lib/input-limit.mjs +8 -0
- package/dist/lib/input-limit.mjs.map +1 -0
- package/dist/lib/memory-auto-register.d.mts +1 -0
- package/dist/lib/memory-auto-register.mjs +98 -0
- package/dist/lib/memory-auto-register.mjs.map +1 -0
- package/dist/lib/memory-entry-contract.d.mts +12 -0
- package/dist/lib/memory-entry-contract.mjs +46 -0
- package/dist/lib/memory-entry-contract.mjs.map +1 -0
- package/dist/lib/python-helper.d.mts +1 -1
- package/dist/lib/python-helper.mjs +3 -2
- package/dist/lib/python-helper.mjs.map +1 -1
- package/dist/lib/record-secrets.d.mts +1 -0
- package/dist/lib/record-secrets.mjs +28 -0
- package/dist/lib/record-secrets.mjs.map +1 -0
- package/dist/lib/report-language-tag.d.mts +1 -0
- package/dist/lib/report-language-tag.mjs +4 -0
- package/dist/lib/report-language-tag.mjs.map +1 -0
- package/dist/lib/report-language.d.mts +1 -0
- package/dist/lib/report-language.mjs +50 -0
- package/dist/lib/report-language.mjs.map +1 -0
- package/dist/lib/skill-catalog.mjs +3 -0
- package/dist/lib/skill-catalog.mjs.map +1 -1
- package/dist/lib/types.d.mts +2 -1
- package/docs/architecture/storage-model.md +163 -5
- package/docs/architecture.md +17 -4
- package/docs/cli.md +511 -0
- package/docs/contributor-change-matrix.md +1 -2
- package/docs/project-structure-overview.md +33 -42
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/common.json +8 -8
- package/runtime/agents/operations/trace-interface-review.json +6 -0
- package/runtime/agents/operations/trace-scope-review.json +6 -0
- package/runtime/agents/roles/verifier.json +2 -4
- package/runtime/bin/okstra-provider-exec.py +10 -4
- package/runtime/prompts/coding-preflight/architectures/hexagonal.md +23 -30
- package/runtime/prompts/coding-preflight/authoring-checks.md +17 -0
- package/runtime/prompts/coding-preflight/clean-code.md +88 -286
- package/runtime/prompts/coding-preflight/frameworks/node-server.md +2 -3
- package/runtime/prompts/coding-preflight/languages/java.md +3 -5
- package/runtime/prompts/coding-preflight/languages/javascript-typescript.md +5 -12
- package/runtime/prompts/coding-preflight/languages/kotlin.md +2 -4
- package/runtime/prompts/coding-preflight/languages/python.md +2 -7
- package/runtime/prompts/coding-preflight/languages/rust.md +2 -8
- package/runtime/prompts/coding-preflight/languages/sql.md +2 -4
- package/runtime/prompts/coding-preflight/overview.md +25 -38
- package/runtime/prompts/coding-preflight/review-rules.json +30 -0
- package/runtime/prompts/duties/code-reviewer.json +15 -18
- package/runtime/prompts/duties/implementation-verifier.json +1 -0
- package/runtime/prompts/duties/interface-reviewer.json +32 -0
- package/runtime/prompts/host-orchestration/README.md +18 -9
- package/runtime/prompts/launch.template.md +3 -2
- package/runtime/prompts/lead/context-loader.md +2 -0
- package/runtime/prompts/lead/okstra-lead-contract.md +7 -7
- package/runtime/prompts/lead/report-writer.md +6 -6
- package/runtime/prompts/profiles/_coding-conventions-preflight.md +41 -6
- package/runtime/prompts/profiles/_common-contract.md +1 -1
- package/runtime/python/okstra_ctl/agent/invocation.py +122 -36
- package/runtime/python/okstra_ctl/agent/prompt_cli/cli.py +72 -26
- package/runtime/python/okstra_ctl/agent/prompt_cli/corrections.py +23 -8
- package/runtime/python/okstra_ctl/agent/prompt_cli/materialize.py +58 -14
- package/runtime/python/okstra_ctl/agent/prompt_cli/results.py +8 -11
- package/runtime/python/okstra_ctl/agent/standalone.py +15 -0
- package/runtime/python/okstra_ctl/analysis_packet.py +24 -30
- package/runtime/python/okstra_ctl/attempt_evidence.py +10 -0
- package/runtime/python/okstra_ctl/code_review_census.py +162 -7
- package/runtime/python/okstra_ctl/code_review_coverage.py +4 -274
- package/runtime/python/okstra_ctl/code_review_integrity.py +154 -0
- package/runtime/python/okstra_ctl/code_review_invocation.py +212 -0
- package/runtime/python/okstra_ctl/code_review_prepare.py +381 -0
- package/runtime/python/okstra_ctl/code_review_run.py +384 -0
- package/runtime/python/okstra_ctl/code_review_scope.py +49 -9
- package/runtime/python/okstra_ctl/code_review_supervisor.py +41 -0
- package/runtime/python/okstra_ctl/code_review_target.py +212 -13
- package/runtime/python/okstra_ctl/consumers.py +12 -9
- package/runtime/python/okstra_ctl/coverage_census.py +11 -2
- package/runtime/python/okstra_ctl/design_review.py +207 -0
- package/runtime/python/okstra_ctl/design_review_evidence.py +297 -0
- package/runtime/python/okstra_ctl/design_snapshot.py +16 -9
- package/runtime/python/okstra_ctl/direct_work.py +45 -3
- package/runtime/python/okstra_ctl/dispatch_core.py +31 -15
- package/runtime/python/okstra_ctl/dispatch_state.py +9 -2
- package/runtime/python/okstra_ctl/doctor.py +8 -25
- package/runtime/python/okstra_ctl/domain/role.py +1 -0
- package/runtime/python/okstra_ctl/doyouknow/__init__.py +9 -0
- package/runtime/python/okstra_ctl/doyouknow/cli.py +91 -0
- package/runtime/python/okstra_ctl/doyouknow/config.py +58 -0
- package/runtime/python/okstra_ctl/doyouknow/contracts.py +184 -0
- package/runtime/python/okstra_ctl/doyouknow/identity.py +22 -0
- package/runtime/python/okstra_ctl/doyouknow/paths.py +22 -0
- package/runtime/python/okstra_ctl/doyouknow/pending.py +72 -0
- package/runtime/python/okstra_ctl/doyouknow/registration.py +260 -0
- package/runtime/python/okstra_ctl/doyouknow/source_contracts.py +128 -0
- package/runtime/python/okstra_ctl/doyouknow/source_store.py +172 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/io.py +36 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/manager.py +300 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/memory.py +179 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/task.py +95 -0
- package/runtime/python/okstra_ctl/doyouknow/store.py +260 -0
- package/runtime/python/okstra_ctl/doyouknow/sync.py +58 -0
- package/runtime/python/okstra_ctl/execution_mutation_audit.py +18 -2
- package/runtime/python/okstra_ctl/file_size_cap.py +3 -4
- package/runtime/python/okstra_ctl/final_report_schema.py +37 -34
- package/runtime/python/okstra_ctl/incremental_carry.py +6 -7
- package/runtime/python/okstra_ctl/initial_prompt_materialization.py +9 -2
- package/runtime/python/okstra_ctl/json_boundary.py +51 -5
- package/runtime/python/okstra_ctl/jsonl.py +21 -0
- package/runtime/python/okstra_ctl/manager_cli.py +148 -1
- package/runtime/python/okstra_ctl/manager_journal.py +126 -0
- package/runtime/python/okstra_ctl/manager_launch.py +3 -3
- package/runtime/python/okstra_ctl/manager_log.py +221 -0
- package/runtime/python/okstra_ctl/manager_paths.py +8 -0
- package/runtime/python/okstra_ctl/manager_registration.py +29 -0
- package/runtime/python/okstra_ctl/manager_resume.py +59 -0
- package/runtime/python/okstra_ctl/manager_split.py +2 -2
- package/runtime/python/okstra_ctl/manager_store.py +116 -17
- package/runtime/python/okstra_ctl/manager_sync.py +45 -25
- package/runtime/python/okstra_ctl/manager_view.py +35 -2
- package/runtime/python/okstra_ctl/material.py +2 -0
- package/runtime/python/okstra_ctl/model_cli.py +64 -14
- package/runtime/python/okstra_ctl/model_defaults.py +22 -0
- package/runtime/python/okstra_ctl/model_io/renderers.py +16 -2
- package/runtime/python/okstra_ctl/model_io_cli.py +7 -1
- package/runtime/python/okstra_ctl/operation_invocation.py +207 -28
- package/runtime/python/okstra_ctl/path_hints.py +14 -3
- package/runtime/python/okstra_ctl/paths.py +6 -1
- package/runtime/python/okstra_ctl/phases/catalog.py +24 -7
- package/runtime/python/okstra_ctl/phases/final_verification/validation.py +20 -0
- package/runtime/python/okstra_ctl/phases/implementation/host-rules.md +3 -3
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-deliverable.md +10 -0
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-diff-review.md +23 -8
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-self-check.md +6 -4
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-verifier.md +38 -10
- package/runtime/python/okstra_ctl/phases/implementation/report_assets/implementation.template.html +13 -0
- package/runtime/python/okstra_ctl/phases/implementation/spec.md +25 -0
- package/runtime/python/okstra_ctl/phases/implementation/validation.py +6 -0
- package/runtime/python/okstra_ctl/phases/implementation_option_selection/profile.md +1 -1
- package/runtime/python/okstra_ctl/phases/implementation_option_selection/votes.py +11 -11
- package/runtime/python/okstra_ctl/phases/implementation_planning/authoring.py +16 -9
- package/runtime/python/okstra_ctl/phases/implementation_planning/host-rules.md +3 -6
- package/runtime/python/okstra_ctl/phases/implementation_planning/instructions/plan-body-verification.md +12 -10
- package/runtime/python/okstra_ctl/phases/implementation_planning/profile.md +6 -6
- package/runtime/python/okstra_ctl/phases/improvement_discovery/lenses.py +12 -0
- package/runtime/python/okstra_ctl/phases/improvement_discovery/profile.md +7 -6
- package/runtime/python/okstra_ctl/phases/improvement_discovery/resolved_census.py +159 -0
- package/runtime/python/okstra_ctl/phases/improvement_discovery/spec.md +5 -2
- package/runtime/python/okstra_ctl/phases/improvement_discovery/validation.py +21 -7
- package/runtime/python/okstra_ctl/phases/release_handoff/boundary.json +1 -1
- package/runtime/python/okstra_ctl/phases/release_handoff/profile.md +4 -1
- package/runtime/python/okstra_ctl/plan_verify_cli.py +6 -4
- package/runtime/python/okstra_ctl/render.py +28 -2
- package/runtime/python/okstra_ctl/report_assembly.py +53 -11
- package/runtime/python/okstra_ctl/report_contract.py +26 -0
- package/runtime/python/okstra_ctl/report_corrections.py +36 -20
- package/runtime/python/okstra_ctl/report_inputs.py +1 -0
- package/runtime/python/okstra_ctl/report_language.py +4 -1
- package/runtime/python/okstra_ctl/report_narrative.py +182 -7
- package/runtime/python/okstra_ctl/report_projections.py +64 -18
- package/runtime/python/okstra_ctl/report_synthesis_packet.py +97 -38
- package/runtime/python/okstra_ctl/review_policy.py +359 -0
- package/runtime/python/okstra_ctl/review_verdicts.py +291 -0
- package/runtime/python/okstra_ctl/run.py +67 -36
- package/runtime/python/okstra_ctl/run_context.py +10 -1
- package/runtime/python/okstra_ctl/set_work_status.py +4 -15
- package/runtime/python/okstra_ctl/stage_done.py +11 -0
- package/runtime/python/okstra_ctl/standalone_review_audit.py +28 -0
- package/runtime/python/okstra_ctl/task_list_cli.py +34 -8
- package/runtime/python/okstra_ctl/task_query.py +239 -0
- package/runtime/python/okstra_ctl/trace_review.py +264 -0
- package/runtime/python/okstra_ctl/trace_tasks.py +197 -0
- package/runtime/python/okstra_ctl/user_authorization.py +14 -0
- package/runtime/python/okstra_ctl/verification_generation.py +23 -1
- package/runtime/python/okstra_ctl/verification_input_types.py +15 -1
- package/runtime/python/okstra_ctl/verification_inputs.py +28 -6
- package/runtime/python/okstra_ctl/verification_invocation.py +7 -1
- package/runtime/python/okstra_ctl/verification_target.py +2 -0
- package/runtime/python/okstra_ctl/wizard/confirmation.py +7 -3
- package/runtime/python/okstra_ctl/wizard/launch.py +52 -0
- package/runtime/python/okstra_ctl/wizard/launch_cli.py +39 -0
- package/runtime/python/okstra_ctl/wizard/outcome.py +17 -16
- package/runtime/python/okstra_ctl/wizard/registry.py +1 -1
- package/runtime/python/okstra_ctl/wizard/render.py +8 -0
- package/runtime/python/okstra_ctl/wizard/state.py +2 -1
- package/runtime/python/okstra_ctl/worker_prompt_headers.py +24 -9
- package/runtime/python/okstra_ctl/worker_runner.py +66 -10
- package/runtime/python/okstra_ctl/write_policy.py +34 -1
- package/runtime/python/okstra_project/__init__.py +2 -0
- package/runtime/python/okstra_project/dirs.py +18 -0
- package/runtime/python/okstra_project/state.py +45 -20
- package/runtime/python/okstra_token_usage/blocks.py +74 -0
- package/runtime/python/okstra_token_usage/cli.py +23 -10
- package/runtime/python/okstra_token_usage/collect.py +25 -22
- package/runtime/python/okstra_token_usage/policy.py +193 -0
- package/runtime/schemas/doyouknow-config-v1.schema.json +20 -0
- package/runtime/schemas/doyouknow-v1.schema.json +65 -0
- package/runtime/schemas/final-report-v2.0.schema.json +157 -0
- package/runtime/schemas/final-report-v3.0.schema.json +157 -0
- package/runtime/schemas/memory-entry-contract-v1.json +11 -0
- package/runtime/schemas/record-secret-patterns.json +41 -0
- package/runtime/schemas/report-synthesis-packet-v1.0.schema.json +1 -1
- package/runtime/skills/_fragments/wizard-confirm-step.md +1 -1
- package/runtime/skills/_fragments/wizard-preflight.md +1 -1
- package/runtime/skills/_fragments/wizard-prompt-loop.md +3 -5
- package/runtime/skills/_fragments/wizard-relay-protocol.md +1 -1
- package/runtime/skills/_fragments/wizard-render-bundle.md +15 -29
- package/runtime/skills/okstra-brief-gen/SKILL.md +7 -7
- package/runtime/skills/okstra-brief-gen/references/tracker-recursion.md +1 -1
- package/runtime/skills/okstra-code-review/SKILL.md +92 -136
- package/runtime/skills/okstra-code-review/references/census-rules.md +29 -105
- package/runtime/skills/okstra-code-review/references/review-calibration.md +37 -61
- package/runtime/skills/okstra-discussion/SKILL.md +22 -38
- package/runtime/skills/okstra-explain-flow/SKILL.md +6 -2
- package/runtime/skills/okstra-manager/SKILL.md +31 -0
- package/runtime/skills/okstra-memory/SKILL.md +8 -1
- package/runtime/skills/okstra-pr-gen/SKILL.md +1 -1
- package/runtime/skills/okstra-run/SKILL.md +55 -183
- package/runtime/skills/okstra-schedule-gen/SKILL.md +9 -13
- package/runtime/skills/okstra-setup/SKILL.md +3 -2
- package/runtime/skills/okstra-setup/references/project-config.md +2 -4
- package/runtime/skills/okstra-tdd/SKILL.md +187 -0
- package/runtime/skills/okstra-user-response/SKILL.md +4 -2
- package/runtime/templates/implementation-worker-preamble.md +4 -9
- package/runtime/templates/manager/view.template.html +4 -0
- package/runtime/templates/report-writer-prompt-preamble.md +15 -3
- package/runtime/templates/trace/trace.template.md +42 -0
- package/runtime/templates/worker-prompt-preamble.md +4 -12
- package/runtime/validators/checks/fixtures-02.py +25 -33
- package/runtime/validators/validate-run.py +107 -38
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
"""Read project-local okstra state into manager-owned snapshots."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
import sys
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
|
|
7
|
-
from okstra_project import
|
|
8
|
+
from okstra_project import StateError, read_task_manifest, resolve_task_root_read_only
|
|
8
9
|
from okstra_project.dirs import TASK_MANIFEST_FILENAME
|
|
9
10
|
|
|
10
11
|
from . import next_phase
|
|
11
12
|
from .next_phase import STATUS_BLOCKED, STATUS_TERMINAL
|
|
12
13
|
from .phases.discussion.overview import discussion_overview
|
|
13
14
|
from .phases.discussion.store import DiscussionStore
|
|
14
|
-
from .manager_paths import
|
|
15
|
-
|
|
15
|
+
from .manager_paths import (
|
|
16
|
+
children_json_path,
|
|
17
|
+
events_jsonl_path,
|
|
18
|
+
projects_json_path,
|
|
19
|
+
snapshots_json_path,
|
|
20
|
+
task_manifest_path,
|
|
21
|
+
)
|
|
22
|
+
from .manager_store import ManagerError, _now_iso, _read_json, _read_json_default, _write_json, record_event
|
|
16
23
|
|
|
17
24
|
|
|
18
25
|
def _project_map(home: Path, manager_id: str) -> dict[str, dict]:
|
|
@@ -39,25 +46,6 @@ def _list_field(payload: dict, field: str) -> list:
|
|
|
39
46
|
return list(value) if isinstance(value, list) else []
|
|
40
47
|
|
|
41
48
|
|
|
42
|
-
def _resolve_task_root_read_only(project_root: Path, task_key: str) -> Path | None:
|
|
43
|
-
_, task_group, task_id = parse_task_key(task_key)
|
|
44
|
-
requested_key = task_key.lower()
|
|
45
|
-
for entry in read_task_catalog(project_root):
|
|
46
|
-
entry_key = entry.get("taskKey") or ""
|
|
47
|
-
if not isinstance(entry_key, str) or entry_key.lower() != requested_key:
|
|
48
|
-
continue
|
|
49
|
-
relative_path = entry.get("taskRootPath") or entry.get("taskRoot") or ""
|
|
50
|
-
if not isinstance(relative_path, str) or not relative_path:
|
|
51
|
-
continue
|
|
52
|
-
candidate = project_root / relative_path if not Path(relative_path).is_absolute() else Path(relative_path)
|
|
53
|
-
if candidate.is_dir():
|
|
54
|
-
return candidate
|
|
55
|
-
slug_path = project_root / TASKS_RELATIVE / slugify(task_group) / slugify(task_id)
|
|
56
|
-
if slug_path.is_dir():
|
|
57
|
-
return slug_path
|
|
58
|
-
return None
|
|
59
|
-
|
|
60
|
-
|
|
61
49
|
DISCUSSION_TASK_TYPE = "discussion"
|
|
62
50
|
|
|
63
51
|
|
|
@@ -77,7 +65,7 @@ def _snapshot_child(project_root: Path, child: dict) -> dict:
|
|
|
77
65
|
base = _base_child_snapshot(child)
|
|
78
66
|
task_key = base["taskKey"]
|
|
79
67
|
try:
|
|
80
|
-
task_dir =
|
|
68
|
+
task_dir = resolve_task_root_read_only(project_root, task_key)
|
|
81
69
|
if task_dir is None:
|
|
82
70
|
return base
|
|
83
71
|
manifest = read_task_manifest(task_dir) or {}
|
|
@@ -111,8 +99,34 @@ def _snapshot_child(project_root: Path, child: dict) -> dict:
|
|
|
111
99
|
}
|
|
112
100
|
|
|
113
101
|
|
|
102
|
+
def _previous_buckets(path: Path) -> dict[str, str]:
|
|
103
|
+
try:
|
|
104
|
+
previous = _read_json_default(path, {})
|
|
105
|
+
except ManagerError:
|
|
106
|
+
print(f"okstra manager: previous snapshot is damaged; this sync replaces it and reports its "
|
|
107
|
+
f"children with from=null: {path}", file=sys.stderr)
|
|
108
|
+
previous = {}
|
|
109
|
+
return {
|
|
110
|
+
str(row.get("taskKey") or ""): summary_bucket(row)
|
|
111
|
+
for row in _list_field(previous, "children")
|
|
112
|
+
if isinstance(row, dict)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _bucket_transitions(before: dict[str, str], rows: list[dict]) -> list[dict]:
|
|
117
|
+
transitions = []
|
|
118
|
+
for row in rows:
|
|
119
|
+
task_key = str(row.get("taskKey") or "")
|
|
120
|
+
bucket = summary_bucket(row)
|
|
121
|
+
if before.get(task_key) != bucket:
|
|
122
|
+
transitions.append({"taskKey": task_key, "from": before.get(task_key), "to": bucket})
|
|
123
|
+
return transitions
|
|
124
|
+
|
|
125
|
+
|
|
114
126
|
def sync_task(home: Path, manager_id: str, task_group: str, task_id: str, *, now: str | None = None) -> dict:
|
|
115
127
|
_read_json(task_manifest_path(home, manager_id, task_group, task_id))
|
|
128
|
+
snapshot_path = snapshots_json_path(home, manager_id, task_group, task_id)
|
|
129
|
+
before = _previous_buckets(snapshot_path)
|
|
116
130
|
children = _read_json_default(children_json_path(home, manager_id, task_group, task_id), {"children": []})
|
|
117
131
|
projects = _project_map(home, manager_id)
|
|
118
132
|
rows = []
|
|
@@ -135,7 +149,13 @@ def sync_task(home: Path, manager_id: str, task_group: str, task_id: str, *, now
|
|
|
135
149
|
"syncedAt": now or _now_iso(),
|
|
136
150
|
"children": rows,
|
|
137
151
|
}
|
|
138
|
-
_write_json(
|
|
152
|
+
_write_json(snapshot_path, payload)
|
|
153
|
+
transitions = _bucket_transitions(before, rows)
|
|
154
|
+
if transitions:
|
|
155
|
+
record_event(
|
|
156
|
+
events_jsonl_path(home, manager_id, task_group, task_id),
|
|
157
|
+
{"event": "task-synced", "createdAt": payload["syncedAt"], "transitions": transitions},
|
|
158
|
+
)
|
|
139
159
|
return payload
|
|
140
160
|
|
|
141
161
|
|
|
@@ -183,7 +203,7 @@ def _manifest_changed_since(project: dict | None, task_key: str, synced: int | N
|
|
|
183
203
|
root = Path(str(project.get("projectRoot") or ""))
|
|
184
204
|
if not root.is_dir():
|
|
185
205
|
return False
|
|
186
|
-
task_dir =
|
|
206
|
+
task_dir = resolve_task_root_read_only(root, task_key)
|
|
187
207
|
manifest_path = task_dir / TASK_MANIFEST_FILENAME if task_dir is not None else None
|
|
188
208
|
if manifest_path is None or not manifest_path.is_file():
|
|
189
209
|
return False
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""manager 상태를 한 장짜리 HTML 로 그린다.
|
|
2
2
|
|
|
3
3
|
manager 가 이미 저장한 파일(projects / task manifest / children / snapshots /
|
|
4
|
-
directives / events)만 읽는다. 하위 프로젝트는 읽지 않는다 — 최신 상태가 필요하면
|
|
4
|
+
directives / events / journal)만 읽는다. 하위 프로젝트는 읽지 않는다 — 최신 상태가 필요하면
|
|
5
5
|
먼저 `okstra manager task sync` 를 돌리고, 페이지는 각 task 의 마지막 sync 시각을
|
|
6
6
|
보여 준다.
|
|
7
7
|
"""
|
|
@@ -15,6 +15,7 @@ from pathlib import Path
|
|
|
15
15
|
|
|
16
16
|
from okstra_ctl.jsonl import read_jsonl
|
|
17
17
|
|
|
18
|
+
from .manager_log import MANAGER_EVENT, merge_activity
|
|
18
19
|
from .manager_paths import directives_jsonl_path, events_jsonl_path, view_html_path
|
|
19
20
|
from .manager_store import ManagerError, list_projects, list_tasks, load_manager
|
|
20
21
|
from .manager_sync import status_task
|
|
@@ -192,17 +193,48 @@ def _directive_list(directives: list[dict]) -> str:
|
|
|
192
193
|
return f'<ul class="plain">{items}</ul>'
|
|
193
194
|
|
|
194
195
|
|
|
196
|
+
def _event_detail(row: dict) -> str:
|
|
197
|
+
if row.get("event") == "task-synced":
|
|
198
|
+
return f" · child tasks changed: {len(row.get('transitions') or [])}"
|
|
199
|
+
if row.get("event") == "task-assigned":
|
|
200
|
+
return " · changed: " + _e(", ".join(sorted(row.get("changes") or {})))
|
|
201
|
+
return ""
|
|
202
|
+
|
|
203
|
+
|
|
195
204
|
def _event_list(events: list[dict]) -> str:
|
|
196
205
|
if not events:
|
|
197
206
|
return '<p class="empty">No events.</p>'
|
|
198
207
|
items = "".join(
|
|
199
208
|
f"<li><code>{_e(row.get('createdAt'))}</code> {_e(row.get('event'))}"
|
|
200
|
-
f"{' · ' + _e(row.get('taskKey')) if row.get('taskKey') else ''}</li>"
|
|
209
|
+
f"{' · ' + _e(row.get('taskKey')) if row.get('taskKey') else ''}{_event_detail(row)}</li>"
|
|
201
210
|
for row in events
|
|
202
211
|
)
|
|
203
212
|
return f'<ul class="plain">{items}</ul>'
|
|
204
213
|
|
|
205
214
|
|
|
215
|
+
def _followup_list(entries: list[dict]) -> str:
|
|
216
|
+
if not entries:
|
|
217
|
+
return '<p class="empty">No open follow-ups.</p>'
|
|
218
|
+
items = "".join(
|
|
219
|
+
f"<li><code>{_e(entry['createdAt'])}</code> {_e(entry['row'].get('body'))}"
|
|
220
|
+
f"{' · ' + _e(entry['taskGroup'] + ' / ' + entry['taskId']) if entry['taskId'] else ''}"
|
|
221
|
+
f" <span class=\"meta\">{_e(entry['row'].get('id'))}</span></li>"
|
|
222
|
+
for entry in entries
|
|
223
|
+
)
|
|
224
|
+
return f'<ul class="plain">{items}</ul>'
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def _activity_section(home: Path, manager_id: str) -> str:
|
|
228
|
+
"""Open follow-ups oldest first, then manager-level events newest first."""
|
|
229
|
+
activity = merge_activity(home, manager_id)
|
|
230
|
+
followups = activity.open_followups_oldest_first()
|
|
231
|
+
events = [entry["row"] for entry in activity.entries if entry["origin"] == MANAGER_EVENT]
|
|
232
|
+
return (
|
|
233
|
+
f"<h3>Open follow-ups ({len(followups)})</h3>{_followup_list(followups)}"
|
|
234
|
+
f"<details><summary>Manager events ({len(events)})</summary>{_event_list(events)}</details>"
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
206
238
|
def _task_panel(home: Path, manager_id: str, task: dict, status: dict, roots: dict[str, str]) -> str:
|
|
207
239
|
group, task_id = task["taskGroup"], task["taskId"]
|
|
208
240
|
synced_at = status["lastSnapshot"].get("syncedAt") or ""
|
|
@@ -265,6 +297,7 @@ def render_view(home: Path, manager_id: str, *, now: str | None = None) -> str:
|
|
|
265
297
|
"TITLE": _e(f"Okstra manager · {manager.get('managerId') or manager_id}"),
|
|
266
298
|
"META": meta,
|
|
267
299
|
"SUMMARY": _summary_tiles(totals),
|
|
300
|
+
"ACTIVITY": _activity_section(home, manager_id),
|
|
268
301
|
"PROJECTS": _projects_table(projects),
|
|
269
302
|
"TASKS": "".join(panels) or '<p class="empty">No manager tasks.</p>',
|
|
270
303
|
}
|
|
@@ -90,6 +90,8 @@ def direct_work_context(project_root: Path, task_key: str, related: list[str]) -
|
|
|
90
90
|
f"- Summary: {' '.join(record['summary'].split())[:400]}",
|
|
91
91
|
f"- Record: `{record_path}`", "",
|
|
92
92
|
])
|
|
93
|
+
if record.get("implementationTracePath"):
|
|
94
|
+
blocks.extend([f"- Implementation trace: `{record['implementationTracePath']}`", ""])
|
|
93
95
|
if not blocks:
|
|
94
96
|
return ""
|
|
95
97
|
return "\n".join(["## Direct Work Context", "", *blocks])
|
|
@@ -66,26 +66,56 @@ def set_model_default(
|
|
|
66
66
|
f"model {ref!r} cannot default role {canonical}: "
|
|
67
67
|
f"{availability.reason}"
|
|
68
68
|
)
|
|
69
|
-
|
|
70
|
-
payload = _read_json(path)
|
|
71
|
-
defaults = dict(payload.get("modelDefaults") or {})
|
|
72
|
-
defaults[canonical] = list(refs)
|
|
73
|
-
payload["modelDefaults"] = defaults
|
|
74
|
-
_write_json_atomic(path, payload)
|
|
69
|
+
_update_config_section(scope, cwd, "modelDefaults", canonical, refs)
|
|
75
70
|
return 0
|
|
76
71
|
|
|
77
72
|
|
|
78
73
|
def unset_model_default(*, role: str, scope: str, cwd: Path) -> int:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
_update_config_section(scope, cwd, "modelDefaults", normalize_role(role), None)
|
|
75
|
+
return 0
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def set_operation_models(*, operation: str, refs: tuple[str, ...], scope: str, cwd: Path) -> int:
|
|
79
|
+
from .operation_invocation import operation_contract_root, resolve_operation_models
|
|
80
|
+
|
|
81
|
+
pool, _adapter = _pool_and_host("claude-code")
|
|
82
|
+
resolve_operation_models(operation, refs, contract_root=operation_contract_root(), pool=pool)
|
|
83
|
+
_update_config_section(scope, cwd, "operationModels", operation, refs)
|
|
84
|
+
return 0
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def unset_operation_models(*, operation: str, scope: str, cwd: Path) -> int:
|
|
88
|
+
_update_config_section(scope, cwd, "operationModels", operation, None)
|
|
86
89
|
return 0
|
|
87
90
|
|
|
88
91
|
|
|
92
|
+
def _update_config_section(
|
|
93
|
+
scope: str, cwd: Path, key: str, name: str, refs: tuple[str, ...] | None,
|
|
94
|
+
) -> None:
|
|
95
|
+
"""Set (`refs`) or remove (`None`) one entry of a model-list section.
|
|
96
|
+
|
|
97
|
+
The whole read-modify-write holds the config file's registry lock, so two
|
|
98
|
+
commands changing different entries cannot drop each other's change.
|
|
99
|
+
"""
|
|
100
|
+
from okstra_project.dirs import json_lock_path, registry_lock
|
|
101
|
+
|
|
102
|
+
from .model_defaults import ModelDefaultError, parse_model_lists
|
|
103
|
+
|
|
104
|
+
path = _config_path(scope, cwd)
|
|
105
|
+
with registry_lock(json_lock_path(path)):
|
|
106
|
+
payload = _read_json(path)
|
|
107
|
+
try:
|
|
108
|
+
section = {entry: list(values) for entry, values in parse_model_lists(payload, key, path).items()}
|
|
109
|
+
except ModelDefaultError as exc:
|
|
110
|
+
raise ModelCliError(str(exc)) from exc
|
|
111
|
+
if refs is None:
|
|
112
|
+
section.pop(name, None)
|
|
113
|
+
else:
|
|
114
|
+
section[name] = list(refs)
|
|
115
|
+
payload[key] = section
|
|
116
|
+
_write_json_atomic(path, payload)
|
|
117
|
+
|
|
118
|
+
|
|
89
119
|
def model_diagnostics(
|
|
90
120
|
*,
|
|
91
121
|
host_runtime: str = "claude-code",
|
|
@@ -238,10 +268,12 @@ _CLI_EPILOG = r"""Usage:
|
|
|
238
268
|
okstra model list [--role <role>] [--host <host>] [--json]
|
|
239
269
|
okstra model default set <role> <modelRef[,modelRef...]> --scope project|global [--cwd <dir>]
|
|
240
270
|
okstra model default unset <role> --scope project|global [--cwd <dir>]
|
|
271
|
+
okstra model operation set <operation> <modelRef[,modelRef...]> --scope project|global [--cwd <dir>]
|
|
272
|
+
okstra model operation unset <operation> --scope project|global [--cwd <dir>]
|
|
241
273
|
|
|
242
274
|
Listing and default writes never send an inference call.
|
|
243
275
|
"""
|
|
244
|
-
_CLI_DESCRIPTION = "List catalog models and manage role defaults."
|
|
276
|
+
_CLI_DESCRIPTION = "List catalog models and manage role and operation model defaults."
|
|
245
277
|
|
|
246
278
|
|
|
247
279
|
def main(argv: list[str] | None = None) -> int:
|
|
@@ -266,12 +298,30 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
266
298
|
unsetter.add_argument("role")
|
|
267
299
|
unsetter.add_argument("--scope", choices=("project", "global"), required=True)
|
|
268
300
|
unsetter.add_argument("--cwd", default=".")
|
|
301
|
+
operation = sub.add_parser("operation")
|
|
302
|
+
operation_sub = operation.add_subparsers(dest="operation_command", required=True)
|
|
303
|
+
operation_set = operation_sub.add_parser("set")
|
|
304
|
+
operation_set.add_argument("operation")
|
|
305
|
+
operation_set.add_argument("refs")
|
|
306
|
+
operation_set.add_argument("--scope", choices=("project", "global"), required=True)
|
|
307
|
+
operation_set.add_argument("--cwd", default=".")
|
|
308
|
+
operation_unset = operation_sub.add_parser("unset")
|
|
309
|
+
operation_unset.add_argument("operation")
|
|
310
|
+
operation_unset.add_argument("--scope", choices=("project", "global"), required=True)
|
|
311
|
+
operation_unset.add_argument("--cwd", default=".")
|
|
269
312
|
args = parser.parse_args(argv)
|
|
270
313
|
try:
|
|
271
314
|
if args.command == "list":
|
|
272
315
|
return list_models(
|
|
273
316
|
role=args.role, host_runtime=args.host, as_json=args.json
|
|
274
317
|
)
|
|
318
|
+
if args.command == "operation":
|
|
319
|
+
if args.operation_command == "set":
|
|
320
|
+
refs = tuple(part for part in args.refs.split(",") if part)
|
|
321
|
+
return set_operation_models(
|
|
322
|
+
operation=args.operation, refs=refs, scope=args.scope, cwd=Path(args.cwd)
|
|
323
|
+
)
|
|
324
|
+
return unset_operation_models(operation=args.operation, scope=args.scope, cwd=Path(args.cwd))
|
|
275
325
|
if args.default_command == "set":
|
|
276
326
|
refs = tuple(part for part in args.refs.split(",") if part)
|
|
277
327
|
return set_model_default(
|
|
@@ -44,3 +44,25 @@ def default_scope(role: str, scopes: ModelDefaultScopes) -> str | None:
|
|
|
44
44
|
if role in values:
|
|
45
45
|
return scope_name
|
|
46
46
|
return None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def parse_model_lists(payload: object, key: str, source: object) -> dict[str, tuple[str, ...]]:
|
|
50
|
+
"""Read a config section mapping names to non-empty model-ref lists.
|
|
51
|
+
|
|
52
|
+
`modelDefaults` (role → refs) and `operationModels` (operation → refs)
|
|
53
|
+
share this shape; `source` names the file in error messages.
|
|
54
|
+
"""
|
|
55
|
+
raw = payload.get(key, {}) if isinstance(payload, Mapping) else {}
|
|
56
|
+
if not isinstance(raw, Mapping):
|
|
57
|
+
raise ModelDefaultError(f"{key} must be an object: {source}")
|
|
58
|
+
lists: dict[str, tuple[str, ...]] = {}
|
|
59
|
+
for name, refs in raw.items():
|
|
60
|
+
if (
|
|
61
|
+
not isinstance(name, str)
|
|
62
|
+
or not isinstance(refs, list)
|
|
63
|
+
or not refs
|
|
64
|
+
or not all(isinstance(ref, str) and ref for ref in refs)
|
|
65
|
+
):
|
|
66
|
+
raise ModelDefaultError(f"{key} entries must be non-empty string arrays: {source}")
|
|
67
|
+
lists[name] = tuple(refs)
|
|
68
|
+
return lists
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from typing import Any, Mapping
|
|
9
|
+
from typing import Any, Mapping, Sequence
|
|
10
10
|
|
|
11
11
|
from okstra_project import StateError, parse_task_key, slugify
|
|
12
12
|
|
|
@@ -20,8 +20,10 @@ from ..fixed_text import line as _line, scalar as _value, quoted_value_lines
|
|
|
20
20
|
from ..json_boundary import JsonBoundaryError, load_owned_object
|
|
21
21
|
from ..paths import find_asset_root, okstra_home
|
|
22
22
|
from ..ports.verification_inputs import VerificationInputStore
|
|
23
|
+
from ..review_policy import render_review_policy, review_policy_context
|
|
23
24
|
from ..phases.catalog import PhaseAssetError, profile_markdown
|
|
24
25
|
from ..recap import assemble_group_recap, assemble_recap
|
|
26
|
+
from ..report_contract import report_authoring_format
|
|
25
27
|
from ..role_requirements import RoleProfileError, load_role_profile
|
|
26
28
|
from ..timeline_runs import current_run_facts
|
|
27
29
|
from .lines import (
|
|
@@ -148,7 +150,8 @@ def render_project_context(project_root: Path, task_ref: str = "") -> str:
|
|
|
148
150
|
|
|
149
151
|
|
|
150
152
|
def render_verification_input(
|
|
151
|
-
run_manifest: Path, store: VerificationInputStore,
|
|
153
|
+
run_manifest: Path, store: VerificationInputStore, *, source_paths: Sequence[str] = (),
|
|
154
|
+
resources: Sequence[str] = (),
|
|
152
155
|
) -> str:
|
|
153
156
|
reference, inputs = _load_verification_input(run_manifest, store)
|
|
154
157
|
rows = [
|
|
@@ -162,6 +165,15 @@ def render_verification_input(
|
|
|
162
165
|
"\n## QA Commands\n\n",
|
|
163
166
|
*quoted_value_lines("QA commands", inputs["qaCommands"]),
|
|
164
167
|
]
|
|
168
|
+
if "reviewPolicy" in inputs:
|
|
169
|
+
project_paths, manifests = (review_policy_context(
|
|
170
|
+
Path(inputs["sourceRoot"]), "HEAD", source_paths,
|
|
171
|
+
) if source_paths else ((), {}))
|
|
172
|
+
rows.append(render_review_policy(
|
|
173
|
+
inputs["reviewPolicy"], source_paths, project_paths=project_paths,
|
|
174
|
+
manifest_contents=manifests,
|
|
175
|
+
resources=resources,
|
|
176
|
+
))
|
|
165
177
|
rows.append("\n## QA Source Observations\n\n")
|
|
166
178
|
if "qaSourceObservations" in inputs:
|
|
167
179
|
rows.extend(quoted_value_lines(
|
|
@@ -203,6 +215,7 @@ def render_run_input(run_manifest: Path) -> str:
|
|
|
203
215
|
+ _line("Task type", run.get("taskType"))
|
|
204
216
|
+ _line("Run ID", run.get("runDateTimeSegment"))
|
|
205
217
|
+ _line("Work category", run.get("workCategory"))
|
|
218
|
+
+ _line("Report authoring format", report_authoring_format(run))
|
|
206
219
|
+ _line("Lead runtime", run.get("leadRuntime"))
|
|
207
220
|
+ _line("Lead adapter name", adapter.get("name"))
|
|
208
221
|
+ _line("Lead dispatch mode", adapter.get("dispatchMode"))
|
|
@@ -218,6 +231,7 @@ def render_run_input(run_manifest: Path) -> str:
|
|
|
218
231
|
+ _worker_prompt_lines(run)
|
|
219
232
|
+ _line("Worker results directory", run.get("workerResultsDirectoryPath"))
|
|
220
233
|
+ _line("Expected report", run.get("expectedReportRecordPath"))
|
|
234
|
+
+ _line("Report writer input", run.get("reportNarrativePath"))
|
|
221
235
|
+ _line("Expected status", run.get("expectedStatusPath"))
|
|
222
236
|
+ _line("Validator", run.get("validatorScriptPath"))
|
|
223
237
|
+ _line("Resume command", run.get("resumeCommandPath"))
|
|
@@ -32,7 +32,7 @@ from .model_io.renderers import (
|
|
|
32
32
|
_CLI_EPILOG = r"""Usage:
|
|
33
33
|
okstra model-io project-context --project-root <dir> [--task-ref <task-id|task-key|task-manifest-path>]
|
|
34
34
|
okstra model-io run-input --run-manifest <path>
|
|
35
|
-
okstra model-io verification-input --run-manifest <path>
|
|
35
|
+
okstra model-io verification-input --run-manifest <path> [--source-path <relative-file> ...] [--resource <pack-relative-resource> ...]
|
|
36
36
|
okstra model-io active-context-input --project-root <dir> --run-manifest <path>
|
|
37
37
|
okstra model-io schedule-input --project-root <dir> --task-group <id>
|
|
38
38
|
okstra model-io code-review-input --project-root <dir> --base <ref> --head <ref>
|
|
@@ -57,6 +57,10 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
57
57
|
run.add_argument("--run-manifest", required=True)
|
|
58
58
|
verification = commands.add_parser("verification-input")
|
|
59
59
|
verification.add_argument("--run-manifest", required=True)
|
|
60
|
+
verification.add_argument("--source-path", action="append", default=[],
|
|
61
|
+
help="load frozen rules applicable to this repository-relative source")
|
|
62
|
+
verification.add_argument("--resource", action="append", default=[],
|
|
63
|
+
help="load an additional captured pack-relative rule resource")
|
|
60
64
|
active = commands.add_parser("active-context-input")
|
|
61
65
|
active.add_argument("--project-root", required=True)
|
|
62
66
|
active.add_argument("--run-manifest", required=True)
|
|
@@ -101,6 +105,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
101
105
|
elif args.command == "verification-input":
|
|
102
106
|
text = render_verification_input(
|
|
103
107
|
Path(args.run_manifest), default_verification_input_store(),
|
|
108
|
+
source_paths=args.source_path,
|
|
109
|
+
resources=args.resource,
|
|
104
110
|
)
|
|
105
111
|
elif args.command == "active-context-input":
|
|
106
112
|
text = render_active_context_input(
|