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
|
@@ -26,10 +26,11 @@ from .stage_ledger import build_stage_ledger
|
|
|
26
26
|
from .scope_provenance import brief_end_state_id_sequence
|
|
27
27
|
|
|
28
28
|
from .final_report_schema import follow_up_task_rules, task_block_rules, verdict_token_rule
|
|
29
|
-
from .report_contract import TASK_TYPE_DATA_PROPERTY
|
|
29
|
+
from .report_contract import TASK_TYPE_DATA_PROPERTY, report_authoring_suffix
|
|
30
30
|
from .report_markdown import humanise
|
|
31
31
|
from .report_narrative import NarrativeContractError, allowed_top_level_fields
|
|
32
|
-
from .report_narrative import NARRATIVE_GRAMMAR_INSTRUCTIONS
|
|
32
|
+
from .report_narrative import JSON_NARRATIVE_INSTRUCTIONS, NARRATIVE_GRAMMAR_INSTRUCTIONS
|
|
33
|
+
from .report_inputs import report_authoring_format
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
@dataclass(frozen=True)
|
|
@@ -96,6 +97,7 @@ class ReportSynthesisPacket:
|
|
|
96
97
|
# 적던 동안 리드가 어느 task type 에도 없는 절을 지시했고, 작성자는 조립이
|
|
97
98
|
# 거절할 때까지 그 지시를 거를 근거가 없었다(2026-09-03 실측).
|
|
98
99
|
allowed_top_level: tuple[str, ...] = ()
|
|
100
|
+
authoring_format: str = "markdown-v1"
|
|
99
101
|
|
|
100
102
|
def _carry_instructions(self) -> list[str]:
|
|
101
103
|
"""이번 run 의 이월 지시. 증분이 아니면 빈 목록.
|
|
@@ -191,16 +193,21 @@ class ReportSynthesisPacket:
|
|
|
191
193
|
f"Required top-level fields for this task type: {labels}. "
|
|
192
194
|
"Report assembly refuses a narrative that omits any of them."
|
|
193
195
|
)
|
|
196
|
+
verdict_path = (
|
|
197
|
+
"`finalVerdict.verdictToken`"
|
|
198
|
+
if self.authoring_format == "json-v1"
|
|
199
|
+
else "`Final Verdict` -> `Verdict Token`"
|
|
200
|
+
)
|
|
194
201
|
if len(self.verdict_tokens) == 1:
|
|
195
202
|
lines.append(
|
|
196
|
-
f"
|
|
203
|
+
f"{verdict_path}: write exactly "
|
|
197
204
|
f"`{self.verdict_tokens[0]}`; the schema pins it for task type "
|
|
198
205
|
f"`{self.task_type}` and refuses every other value."
|
|
199
206
|
)
|
|
200
207
|
elif self.verdict_tokens:
|
|
201
208
|
allowed = ", ".join(f"`{token}`" for token in self.verdict_tokens)
|
|
202
209
|
lines.append(
|
|
203
|
-
f"
|
|
210
|
+
f"{verdict_path}: one of {allowed} for task type "
|
|
204
211
|
f"`{self.task_type}`."
|
|
205
212
|
)
|
|
206
213
|
if self.allowed_top_level:
|
|
@@ -212,13 +219,21 @@ class ReportSynthesisPacket:
|
|
|
212
219
|
)
|
|
213
220
|
lines.extend(self.follow_up_rules)
|
|
214
221
|
if self.block_rules:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
if self.authoring_format == "json-v1":
|
|
223
|
+
lines.append(
|
|
224
|
+
f"Shape of the `{self.block_key}` block, one rule per object, "
|
|
225
|
+
"from the frozen writer-owned schema. Use exact JSON keys; "
|
|
226
|
+
"`[]` marks each array item. Report assembly refuses an input "
|
|
227
|
+
"that breaks any rule."
|
|
228
|
+
)
|
|
229
|
+
else:
|
|
230
|
+
lines.append(
|
|
231
|
+
f"Shape of the `{self.block_key}` block, one line per object, from "
|
|
232
|
+
"the frozen schema. Paths are schema keys: write each key as its "
|
|
233
|
+
"Title Case label (`rankedOptions` -> `Ranked Options`), and `[]` "
|
|
234
|
+
"marks the items of an `- Item N` list. Report assembly refuses a "
|
|
235
|
+
"narrative that breaks any line."
|
|
236
|
+
)
|
|
222
237
|
lines.extend(self.block_rules)
|
|
223
238
|
return lines
|
|
224
239
|
|
|
@@ -230,6 +245,15 @@ class ReportSynthesisPacket:
|
|
|
230
245
|
return []
|
|
231
246
|
|
|
232
247
|
def _task_instructions(self) -> list[str]:
|
|
248
|
+
if self.task_type == "implementation":
|
|
249
|
+
design_note = (
|
|
250
|
+
"Report assembly derives verifierResults[].designReview and overall verifier verdicts "
|
|
251
|
+
"from current sealed verifier returns when the run uses design-review input 4.0. "
|
|
252
|
+
"Do not author that field, omit findings to obtain acceptance or treat incomplete "
|
|
253
|
+
"coverage as clean. Preserve reported nits, parked findings and accepted-risk bases."
|
|
254
|
+
)
|
|
255
|
+
else:
|
|
256
|
+
design_note = ""
|
|
233
257
|
if self.task_type == "technical-verification":
|
|
234
258
|
return [
|
|
235
259
|
"Copy sourceReport, sourceDataSha256, scope and every fact identity "
|
|
@@ -257,7 +281,7 @@ class ReportSynthesisPacket:
|
|
|
257
281
|
source.label.startswith(f"{CONVERGENCE_STATE_LABEL} (correction-r")
|
|
258
282
|
for source in self.sources
|
|
259
283
|
):
|
|
260
|
-
return [
|
|
284
|
+
return [design_note,
|
|
261
285
|
"Each `Convergence state (correction-r<N>)` source is correction round N's "
|
|
262
286
|
"re-convergence of the verifiers' re-verification; the plain `Convergence "
|
|
263
287
|
"state` is the initial round's. Describe the stage's open findings from the "
|
|
@@ -273,7 +297,7 @@ class ReportSynthesisPacket:
|
|
|
273
297
|
"verdict as an unresolved divergence.",
|
|
274
298
|
]
|
|
275
299
|
if self.task_type != "implementation-option-selection":
|
|
276
|
-
return []
|
|
300
|
+
return [design_note] if design_note else []
|
|
277
301
|
return selection_requirement_instructions(
|
|
278
302
|
self.original_requirement_ids, self.participating_analysers,
|
|
279
303
|
)
|
|
@@ -317,10 +341,10 @@ class ReportSynthesisPacket:
|
|
|
317
341
|
"taskType": self.task_type,
|
|
318
342
|
"authoringContract": {
|
|
319
343
|
"resultPath": self.result_path,
|
|
320
|
-
"format":
|
|
344
|
+
"format": self._output_format(),
|
|
321
345
|
"sourcePolicy": "read-only-synthesis-packet",
|
|
322
346
|
"instructions": [
|
|
323
|
-
*
|
|
347
|
+
*self._format_instructions(),
|
|
324
348
|
"Write the complete human-readable report narrative.",
|
|
325
349
|
"Preserve settled source values, identities, dissent, and user responses.",
|
|
326
350
|
"Do not invent a value when a source is missing or contradictory.",
|
|
@@ -355,8 +379,8 @@ class ReportSynthesisPacket:
|
|
|
355
379
|
"",
|
|
356
380
|
f"- Task type: `{self.task_type}`",
|
|
357
381
|
f"- Result path: `{self.result_path}`",
|
|
358
|
-
"- Output format: `
|
|
359
|
-
*(f"- {text}" for text in
|
|
382
|
+
f"- Output format: `{self._output_format()}`",
|
|
383
|
+
*(f"- {text}" for text in self._format_instructions()),
|
|
360
384
|
"- Input policy: read this synthesis packet as the dispatched source set",
|
|
361
385
|
"- Responsibility: write the complete human-readable narrative while preserving settled values",
|
|
362
386
|
"- Runtime-owned values: session identifiers, token usage, estimated cost, "
|
|
@@ -374,12 +398,22 @@ class ReportSynthesisPacket:
|
|
|
374
398
|
sections = [("Authoring Contract", "\n".join(lines[1:]).rstrip() + "\n")]
|
|
375
399
|
sections.extend(
|
|
376
400
|
(source.label, "\n".join(_source_markdown(
|
|
377
|
-
source, self.task_type, self.sources,
|
|
401
|
+
source, self.task_type, self.sources, self.authoring_format,
|
|
378
402
|
)).rstrip() + "\n")
|
|
379
403
|
for source in self.sources
|
|
380
404
|
)
|
|
381
405
|
return _indexed_markdown(lines[0], sections)
|
|
382
406
|
|
|
407
|
+
def _output_format(self) -> str:
|
|
408
|
+
return "json-v1" if self.authoring_format == "json-v1" else "report-narrative-v3.0"
|
|
409
|
+
|
|
410
|
+
def _format_instructions(self) -> tuple[str, ...]:
|
|
411
|
+
return (
|
|
412
|
+
JSON_NARRATIVE_INSTRUCTIONS
|
|
413
|
+
if self.authoring_format == "json-v1"
|
|
414
|
+
else NARRATIVE_GRAMMAR_INSTRUCTIONS
|
|
415
|
+
)
|
|
416
|
+
|
|
383
417
|
|
|
384
418
|
_SOURCE_FIELDS = (
|
|
385
419
|
("Analysis packet", "orchestrator", "instructionSet", "analysisPacketPath", True),
|
|
@@ -505,7 +539,9 @@ def _convergence_view(content: str) -> str:
|
|
|
505
539
|
return json.dumps(view, ensure_ascii=False, indent=1)
|
|
506
540
|
|
|
507
541
|
|
|
508
|
-
def _writer_schema_view(
|
|
542
|
+
def _writer_schema_view(
|
|
543
|
+
content: str, task_type: str, authoring_format: str = "markdown-v1",
|
|
544
|
+
) -> tuple[str, list[str]]:
|
|
509
545
|
try:
|
|
510
546
|
schema = json.loads(content)
|
|
511
547
|
except json.JSONDecodeError:
|
|
@@ -513,8 +549,10 @@ def _writer_schema_view(content: str, task_type: str) -> tuple[str, list[str]]:
|
|
|
513
549
|
if not isinstance(schema, dict) or not schema.get("properties"):
|
|
514
550
|
return content, []
|
|
515
551
|
owned = writer_owned_schema(schema)
|
|
516
|
-
#
|
|
517
|
-
|
|
552
|
+
# 기존 줄 문법의 읽기 계약은 유지한다. JSON은 작성자 몫만 전달하고
|
|
553
|
+
# 태스크 조건은 저작 계약의 별도 규칙으로 안내한다.
|
|
554
|
+
if authoring_format == "markdown-v1":
|
|
555
|
+
owned["allOf"] = schema.get("allOf", [])
|
|
518
556
|
owned["required"] = [
|
|
519
557
|
key for key in schema.get("required", []) if key in owned["properties"]
|
|
520
558
|
]
|
|
@@ -527,6 +565,7 @@ def _writer_schema_view(content: str, task_type: str) -> tuple[str, list[str]]:
|
|
|
527
565
|
def _source_markdown(
|
|
528
566
|
source: ReportSynthesisSource, task_type: str,
|
|
529
567
|
sources: tuple[ReportSynthesisSource, ...],
|
|
568
|
+
authoring_format: str = "markdown-v1",
|
|
530
569
|
) -> list[str]:
|
|
531
570
|
content = source.content.rstrip("\n")
|
|
532
571
|
view = []
|
|
@@ -559,7 +598,7 @@ def _source_markdown(
|
|
|
559
598
|
"the original line index is omitted.",
|
|
560
599
|
]
|
|
561
600
|
if source.label == "Final report schema":
|
|
562
|
-
content, view = _writer_schema_view(content, task_type)
|
|
601
|
+
content, view = _writer_schema_view(content, task_type, authoring_format)
|
|
563
602
|
longest = max((len(run) for run in re.findall(r"`+", content)), default=0)
|
|
564
603
|
fence = "`" * max(3, longest + 1)
|
|
565
604
|
return [
|
|
@@ -722,8 +761,10 @@ class CarriedStages:
|
|
|
722
761
|
prior_plan: dict[str, Any] | None = None
|
|
723
762
|
|
|
724
763
|
|
|
725
|
-
def carried_stages_path(
|
|
726
|
-
|
|
764
|
+
def carried_stages_path(
|
|
765
|
+
narrative_path: Path, authoring_format: str = "markdown-v1",
|
|
766
|
+
) -> Path:
|
|
767
|
+
_, markdown_path = report_synthesis_packet_paths(narrative_path, authoring_format)
|
|
727
768
|
return markdown_path.with_name(
|
|
728
769
|
markdown_path.name.replace(
|
|
729
770
|
"report-writer-synthesis-packet", "report-writer-carried-stages"
|
|
@@ -751,6 +792,7 @@ def materialize_carried_stages(
|
|
|
751
792
|
return _materialize_stage_rows(
|
|
752
793
|
project_root=project_root,
|
|
753
794
|
narrative_path=narrative_path,
|
|
795
|
+
authoring_format=report_authoring_format(manifest),
|
|
754
796
|
source_plan=_string(decision.get("prevDataPath")),
|
|
755
797
|
stages=[
|
|
756
798
|
stage for stage in decision["carryStages"] if isinstance(stage, int)
|
|
@@ -768,6 +810,7 @@ def materialize_carried_stages(
|
|
|
768
810
|
return _materialize_stage_rows(
|
|
769
811
|
project_root=project_root,
|
|
770
812
|
narrative_path=narrative_path,
|
|
813
|
+
authoring_format=report_authoring_format(manifest),
|
|
771
814
|
source_plan=_string(prior_plan.get("sourcePlanPath")),
|
|
772
815
|
stages=list(prior_plan["doneStages"]),
|
|
773
816
|
carried=CarriedStages("", prior_plan=prior_plan),
|
|
@@ -778,6 +821,7 @@ def _materialize_stage_rows(
|
|
|
778
821
|
*,
|
|
779
822
|
project_root: Path,
|
|
780
823
|
narrative_path: Path,
|
|
824
|
+
authoring_format: str,
|
|
781
825
|
source_plan: str,
|
|
782
826
|
stages: list[int],
|
|
783
827
|
carried: CarriedStages,
|
|
@@ -792,7 +836,7 @@ def _materialize_stage_rows(
|
|
|
792
836
|
rows = carried_stage_rows(prior_data, stages)
|
|
793
837
|
if not rows:
|
|
794
838
|
return None
|
|
795
|
-
path = carried_stages_path(narrative_path)
|
|
839
|
+
path = carried_stages_path(narrative_path, authoring_format)
|
|
796
840
|
write_owned_object_atomic(
|
|
797
841
|
path,
|
|
798
842
|
{
|
|
@@ -1019,6 +1063,8 @@ def build_report_synthesis_packet(
|
|
|
1019
1063
|
team_state: Mapping[str, Any],
|
|
1020
1064
|
narrative_path: Path,
|
|
1021
1065
|
) -> ReportSynthesisPacket:
|
|
1066
|
+
authoring_format = report_authoring_format(manifest)
|
|
1067
|
+
report_synthesis_packet_paths(narrative_path, authoring_format)
|
|
1022
1068
|
carried = materialize_carried_stages(
|
|
1023
1069
|
project_root=project_root, manifest=manifest, narrative_path=narrative_path,
|
|
1024
1070
|
)
|
|
@@ -1054,7 +1100,7 @@ def build_report_synthesis_packet(
|
|
|
1054
1100
|
if _string(worker) and _string(worker) != "report-writer"
|
|
1055
1101
|
)
|
|
1056
1102
|
required_top_level, verdict_tokens, block_rules, follow_up_rules = (
|
|
1057
|
-
_schema_authoring_rules(sources, task_type)
|
|
1103
|
+
_schema_authoring_rules(sources, task_type, authoring_format)
|
|
1058
1104
|
)
|
|
1059
1105
|
return ReportSynthesisPacket(
|
|
1060
1106
|
task_key=_string(manifest.get("taskKey")),
|
|
@@ -1065,7 +1111,8 @@ def build_report_synthesis_packet(
|
|
|
1065
1111
|
follow_up_rules=follow_up_rules,
|
|
1066
1112
|
block_key=TASK_TYPE_DATA_PROPERTY.get(task_type, "") if block_rules else "",
|
|
1067
1113
|
block_rules=block_rules,
|
|
1068
|
-
allowed_top_level=_allowed_top_level_labels(),
|
|
1114
|
+
allowed_top_level=_allowed_top_level_labels(authoring_format),
|
|
1115
|
+
authoring_format=authoring_format,
|
|
1069
1116
|
sources=sources,
|
|
1070
1117
|
accounting_snapshot=_accounting_snapshot(team_state),
|
|
1071
1118
|
original_requirement_ids=original_requirement_ids,
|
|
@@ -1077,11 +1124,12 @@ def build_report_synthesis_packet(
|
|
|
1077
1124
|
|
|
1078
1125
|
def _schema_authoring_rules(
|
|
1079
1126
|
sources: tuple[ReportSynthesisSource, ...], task_type: str,
|
|
1127
|
+
authoring_format: str = "markdown-v1",
|
|
1080
1128
|
) -> tuple[tuple[str, ...], tuple[str, ...], tuple[str, ...], tuple[str, ...]]:
|
|
1081
1129
|
"""넘겨받은(동결된) 완성 리포트 스키마에서 작성자 몫의 규칙 네 가지를 뽑는다.
|
|
1082
1130
|
|
|
1083
1131
|
최상위 `required` 가운데 작성자 소유 이름(서사 스키마의 properties)만
|
|
1084
|
-
|
|
1132
|
+
선언 형식의 키 또는 라벨로, 이 task type 의 판정 토큰 허용값, 이 task type 의
|
|
1085
1133
|
데이터 블록 안쪽 모양(`task_block_rules`), 그리고 `followUpTasks` 행 규칙
|
|
1086
1134
|
(`follow_up_task_rules`). 스키마 소스가 없거나
|
|
1087
1135
|
JSON 이 아니면 빈 값이다 — 이 함수는 조립 검증을 대신하지 않고 도달하지
|
|
@@ -1103,36 +1151,45 @@ def _schema_authoring_rules(
|
|
|
1103
1151
|
allowed = frozenset()
|
|
1104
1152
|
required = schema.get("required")
|
|
1105
1153
|
required_top_level = tuple(
|
|
1106
|
-
humanise(key)
|
|
1154
|
+
key if authoring_format == "json-v1" else humanise(key)
|
|
1107
1155
|
for key in (required if isinstance(required, list) else [])
|
|
1108
1156
|
if isinstance(key, str) and key in allowed
|
|
1109
1157
|
)
|
|
1110
1158
|
block_key = TASK_TYPE_DATA_PROPERTY.get(task_type, "")
|
|
1111
|
-
block_rules = task_block_rules(
|
|
1159
|
+
block_rules = task_block_rules(
|
|
1160
|
+
writer_owned_schema(schema), block_key, authoring_format=authoring_format,
|
|
1161
|
+
) if block_key else ()
|
|
1162
|
+
follow_up_rules = follow_up_task_rules(schema, task_type, authoring_format=authoring_format)
|
|
1112
1163
|
return (
|
|
1113
1164
|
required_top_level,
|
|
1114
1165
|
verdict_token_rule(schema, task_type),
|
|
1115
1166
|
block_rules,
|
|
1116
|
-
|
|
1167
|
+
follow_up_rules,
|
|
1117
1168
|
)
|
|
1118
1169
|
|
|
1119
1170
|
|
|
1120
|
-
def _allowed_top_level_labels() -> tuple[str, ...]:
|
|
1171
|
+
def _allowed_top_level_labels(authoring_format: str = "markdown-v1") -> tuple[str, ...]:
|
|
1121
1172
|
"""작성자 소유 최상위 필드 전체 — 서사 스키마 부재는 빈 값(조립이 판정한다)."""
|
|
1122
1173
|
try:
|
|
1123
1174
|
allowed = allowed_top_level_fields()
|
|
1124
1175
|
except (NarrativeContractError, JsonBoundaryError):
|
|
1125
1176
|
return ()
|
|
1126
|
-
return tuple(
|
|
1177
|
+
return tuple(
|
|
1178
|
+
key if authoring_format == "json-v1" else humanise(key)
|
|
1179
|
+
for key in sorted(allowed)
|
|
1180
|
+
)
|
|
1127
1181
|
|
|
1128
1182
|
|
|
1129
|
-
def report_synthesis_packet_paths(
|
|
1183
|
+
def report_synthesis_packet_paths(
|
|
1184
|
+
narrative_path: Path, authoring_format: str = "markdown-v1",
|
|
1185
|
+
) -> tuple[Path, Path]:
|
|
1130
1186
|
name = narrative_path.name
|
|
1131
1187
|
prefix = "report-writer-narrative-"
|
|
1132
|
-
|
|
1188
|
+
suffix = report_authoring_suffix(authoring_format)
|
|
1189
|
+
if name == "report-writer-narrative" + suffix:
|
|
1133
1190
|
packet_name = "report-writer-synthesis-packet.md"
|
|
1134
|
-
elif name.startswith(prefix) and name.endswith(
|
|
1135
|
-
packet_name = "report-writer-synthesis-packet-" +
|
|
1191
|
+
elif name.startswith(prefix) and name.endswith(suffix):
|
|
1192
|
+
packet_name = "report-writer-synthesis-packet-" + narrative_path.stem[len(prefix):] + ".md"
|
|
1136
1193
|
else:
|
|
1137
1194
|
raise ValueError(f"report narrative path has an unsupported name: {narrative_path}")
|
|
1138
1195
|
markdown_path = narrative_path.with_name(packet_name)
|
|
@@ -1155,7 +1212,9 @@ def materialize_report_synthesis_packet(
|
|
|
1155
1212
|
team_state=team_state,
|
|
1156
1213
|
narrative_path=narrative_path,
|
|
1157
1214
|
)
|
|
1158
|
-
data_path, markdown_path = report_synthesis_packet_paths(
|
|
1215
|
+
data_path, markdown_path = report_synthesis_packet_paths(
|
|
1216
|
+
narrative_path, packet.authoring_format,
|
|
1217
|
+
)
|
|
1159
1218
|
write_owned_object_atomic(
|
|
1160
1219
|
data_path,
|
|
1161
1220
|
packet.to_dict(),
|