okstra 0.195.3 → 0.195.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okstra",
3
- "version": "0.195.3",
3
+ "version": "0.195.4",
4
4
  "description": "Host-aware multi-provider cross-verification orchestrator runtime and agent skills.",
5
5
  "license": "MIT",
6
6
  "author": "devonshin",
@@ -1,5 +1,5 @@
1
1
  {
2
- "package": "0.195.3",
3
- "builtAt": "2026-09-09T16:13:30.574Z",
2
+ "package": "0.195.4",
3
+ "builtAt": "2026-09-09T19:01:57.276Z",
4
4
  "repoRoot": "/home/runner/work/okstra/okstra"
5
5
  }
@@ -151,6 +151,11 @@ class CapabilityInteractionPort:
151
151
  """
152
152
  return self._limits.max_options
153
153
 
154
+ @property
155
+ def native_question_limit(self) -> int:
156
+ """이 호스트의 네이티브 질문 묶음이 한 화면에 받는 질문 수."""
157
+ return self._limits.max_questions
158
+
154
159
  def _native_options_fit(self, prompt: WizardPrompt) -> bool:
155
160
  labels = tuple(option.label for option in prompt.options)
156
161
  return (
@@ -33,7 +33,13 @@ from .ids import (
33
33
  )
34
34
  from .state import Prompt, WizardError, WizardState, _is_role_selection_step
35
35
  from .prompts import _domain_prompt
36
- from .picker_navigation import present_picker, accept_picker_answer
36
+ from .picker_navigation import (
37
+ accept_picker_answer,
38
+ is_split_checkbox,
39
+ merge_split_checkbox_answer,
40
+ present_picker,
41
+ split_checkbox,
42
+ )
37
43
  from .roles import _submit_role_prompt, next_role_prompt
38
44
  from .steps_identity import _submit_task_pick
39
45
  from .steps_analysis import _advance_design_prep_item
@@ -135,12 +141,14 @@ def _native_picker_screen(state: WizardState, prompt: Prompt) -> Prompt:
135
141
  """호스트 네이티브 선택기 한도에 맞춘 화면.
136
142
 
137
143
  단일 선택이 한도를 넘으면 쪽으로 나눈다(`present_picker`). 체크박스(`multi`)는
138
- 나누지 않는다 — 네이티브 체크박스에 실으면 `CapabilityInteractionPort.plan`
139
- `numbered-multi` 내려 전체 목록을 번에 보인다. 종전엔 체크박스도
140
- 줄씩 토글하는 쪽으로 내렸는데, claude-code 한도 4 에서 후보 12개는 쪽당
141
- 2개가 됐고, 사본이 추천 표시를 단일 선택이 돼 `Prompt` 의 추천
142
- 불변식(단일 선택은 추천 정확히 하나) 걸려 화면이 열리지 않았다(실측
143
- 2026-09-09, verifier 전체 후보 화면).
144
+ 쪽으로 나누지 않는다 — 종전엔 줄씩 토글하는 쪽으로 내렸는데, claude-code
145
+ 한도 4 에서 후보 12개는 쪽당 2개가 됐고, 사본이 추천 표시를 단 채 단일
146
+ 선택이 `Prompt` 추천 불변식(단일 선택은 추천 정확히 하나)에 걸려
147
+ 화면이 열리지 않았다(실측 2026-09-09, verifier 전체 후보 화면). 대신
148
+ 네이티브 질문 묶음에 실리는 크기(claude-code 4×4=16) 같은 화면의 체크박스
149
+ 질문 여러 개로 자른다(`split_checkbox`) — 묶음이 네이티브에 실릴 때만이고,
150
+ 아니면 `CapabilityInteractionPort.plan` 이 `numbered-multi` 로 내려 전체
151
+ 목록을 한 번에 보인다.
144
152
  """
145
153
  if "native_single_select" not in state.available_functions:
146
154
  return prompt
@@ -148,10 +156,17 @@ def _native_picker_screen(state: WizardState, prompt: Prompt) -> Prompt:
148
156
  if _interaction_plan(state, prompt).kind == "native-group":
149
157
  return prompt
150
158
  prompt = prompt.questions[0]
159
+ port = default_host_registry().resolve(state.host_runtime).interaction()
151
160
  if prompt.multi:
161
+ split = split_checkbox(
162
+ prompt,
163
+ max_options=port.native_option_limit,
164
+ max_questions=port.native_question_limit,
165
+ )
166
+ if split is not prompt and _interaction_plan(state, split).kind == "native-group":
167
+ return split
152
168
  return prompt
153
- limit = default_host_registry().resolve(state.host_runtime).interaction().native_option_limit
154
- return present_picker(state, prompt, limit=limit)
169
+ return present_picker(state, prompt, limit=port.native_option_limit)
155
170
 
156
171
 
157
172
  def _next_prompt_screen(state: WizardState) -> Prompt:
@@ -204,6 +219,9 @@ def _sim_answer(prompt: Prompt) -> str:
204
219
  def _sim_advance(state: WizardState, prompt: Prompt) -> None:
205
220
  """기본답으로 한 화면 전진한다. progress 를 재계산하는 submit()/
206
221
  _submit_group() 은 호출하지 않고 step.submit 만 직접 호출해 재귀를 막는다."""
222
+ if is_split_checkbox(prompt):
223
+ # 조각 질문의 step 은 등록된 step 이 아니다 — 잘리지 않은 원본으로 낸다.
224
+ prompt = _next_prompt_screen(state)
207
225
  try:
208
226
  if _is_role_selection_step(prompt.step):
209
227
  # 화면은 호스트 한도에 맞춰 쪽으로 잘린 사본일 수 있다 — 기본답은
@@ -384,7 +402,12 @@ def submit(state: WizardState, value: str) -> dict[str, Any]:
384
402
  value = accept_picker_answer(state, original, value)
385
403
  if value is None:
386
404
  return {"echo": "", "next": prompt_payload(state, next_prompt(state))}
387
- if prompt.kind == "pick_group":
405
+ if is_split_checkbox(prompt):
406
+ # 질문 묶음으로 잘린 체크박스 — 탭별 CSV 를 한 줄로 합쳐 원본 step 의
407
+ # 제출 경로로 보낸다. 원본의 선택지로 검증한다.
408
+ value = merge_split_checkbox_answer(prompt, value)
409
+ prompt = _next_prompt_screen(state)
410
+ elif prompt.kind == "pick_group":
388
411
  return _submit_group(state, prompt, value)
389
412
  if _is_role_selection_step(prompt.step):
390
413
  # 고정 단일 역할의 화면은 호스트 한도에 맞춰 쪽으로 잘린 사본일 수
@@ -1,16 +1,93 @@
1
- """호스트 선택기 한도 안에서 단일 선택의 원래 선택지를 보존하는 나누기.
1
+ """호스트 선택기 한도 안에서 원래 선택지를 보존하는 가지 강등.
2
2
 
3
- 체크박스(`multi`)는 여기 오지 않는다 — 네이티브 체크박스에 못 실으면
4
- `numbered-multi` 전체 목록을 번에 보인다(`engine._native_picker_screen`).
5
- 사본이 추천 표시를 단일 선택으로 바뀌면 `Prompt` 의 추천 불변식에
6
- 걸리므로, 줄씩 토글하던 체크박스 나누기는 2026-09-09 뺐다.
3
+ 단일 선택은 쪽으로 나눈다(`present_picker`). 체크박스(`multi`)는 쪽으로 나누지
4
+ 않는다 사본이 추천 표시를 단 채 단일 선택으로 바뀌면 `Prompt` 의 추천
5
+ 불변식에 걸리므로, 줄씩 토글하던 체크박스 나누기는 2026-09-09 뺐다.
6
+ 대신 네이티브 질문 묶음(claude-code `AskUserQuestion` 질문 4개 × 옵션 4개)
7
+ 실리는 크기면 같은 화면 안의 체크박스 질문 여러 개로 자른다(`split_checkbox`):
8
+ 사용자는 탭마다 체크하고, 답은 하나의 CSV 로 합쳐져(`merge_split_checkbox_answer`)
9
+ 원래 step 의 제출 경로로 간다. 그 크기도 넘으면 `numbered-multi` 로 전체 목록을
10
+ 한 번에 보인다(`engine._native_picker_screen`).
7
11
  """
12
+ import json
13
+ import math
8
14
  from dataclasses import replace
9
15
 
10
16
  from .ids import PICK_TYPE_CUSTOM
11
17
  from .state import Option, Prompt, WizardError, WizardState
12
18
 
13
19
  _PAGE_PREFIX = "__okstra_picker_page__:"
20
+ _SPLIT_SEPARATOR = "#"
21
+
22
+
23
+ def split_checkbox(
24
+ prompt: Prompt, *, max_options: int, max_questions: int,
25
+ ) -> Prompt:
26
+ """옵션이 `max_options` 를 넘는 체크박스를 같은 화면의 질문 묶음으로 자른다.
27
+
28
+ 질문 수는 옵션이 들어가는 최소 개수이고 옵션은 질문에 고르게 나눈다 —
29
+ 마지막 질문이 한 줄짜리가 되면 호스트 최소 옵션 수(2)에 걸려 묶음 전체가
30
+ 네이티브에 못 실린다. 추천은 원래 목록의 앞머리 run 이라 어느 조각에서도
31
+ 앞머리 run 이 된다(`Prompt._check_recommendations`). `max_questions` 도
32
+ 넘으면 자르지 않고 그대로 돌려준다.
33
+ """
34
+ if prompt.kind != "pick" or not prompt.multi or len(prompt.options) <= max_options:
35
+ return prompt
36
+ count = len(prompt.options)
37
+ questions = math.ceil(count / max_options)
38
+ if questions > max_questions:
39
+ return prompt
40
+ base, extra = divmod(count, questions)
41
+ chunks: list[Prompt] = []
42
+ offset = 0
43
+ for index in range(questions):
44
+ size = base + (1 if index < extra else 0)
45
+ shown = prompt.options[offset:offset + size]
46
+ chunks.append(replace(
47
+ prompt,
48
+ step=f"{prompt.step}{_SPLIT_SEPARATOR}{index + 1}",
49
+ label=f"{prompt.label} ({offset + 1}–{offset + size}/{count})",
50
+ options=shown,
51
+ ))
52
+ offset += size
53
+ return Prompt(
54
+ step=prompt.step,
55
+ kind="pick_group",
56
+ label=prompt.label,
57
+ help=prompt.help,
58
+ echo_template=prompt.echo_template,
59
+ questions=chunks,
60
+ )
61
+
62
+
63
+ def is_split_checkbox(prompt: Prompt) -> bool:
64
+ return prompt.kind == "pick_group" and bool(prompt.questions) and all(
65
+ question.multi
66
+ and question.step.startswith(f"{prompt.step}{_SPLIT_SEPARATOR}")
67
+ for question in prompt.questions
68
+ )
69
+
70
+
71
+ def merge_split_checkbox_answer(prompt: Prompt, value: str) -> str:
72
+ """질문 묶음 답(JSON, 조각 step → CSV)을 원래 체크박스의 CSV 한 줄로 합친다."""
73
+ try:
74
+ answers = json.loads(value or "{}")
75
+ except json.JSONDecodeError as exc:
76
+ raise WizardError(f"pick_group answer must be a JSON object: {exc}") from exc
77
+ if not isinstance(answers, dict):
78
+ raise WizardError("pick_group answer must be a JSON object")
79
+ known = {question.step for question in prompt.questions}
80
+ unknown = sorted(set(answers) - known)
81
+ if unknown:
82
+ raise WizardError(
83
+ f"wizard step {prompt.step!r}: answer names unknown questions {unknown}; "
84
+ f"expected {sorted(known)}"
85
+ )
86
+ chosen: list[str] = []
87
+ for question in prompt.questions:
88
+ raw = str(answers.get(question.step, "") or "")
89
+ chosen.extend(item.strip() for item in raw.split(",") if item.strip())
90
+ return ",".join(chosen)
14
91
 
15
92
 
16
93
  def present_picker(state: WizardState, prompt: Prompt, *, limit: int) -> Prompt:
@@ -10,10 +10,12 @@ verifier: `max > 1`)은 체크박스 한 장이고, 고른 모델 수가 곧 인
10
10
  체크박스 화면(`role-models:<role>`)은 실행 가능한 전체 후보를 한 번에 싣는다.
11
11
  기본 후보(프로젝트 `modelDefaults`, 없으면 카탈로그 기본값)가 앞이고 권장
12
12
  수만큼의 앞줄이 추천이다. 호스트 네이티브 선택기의 옵션 한도(claude-code 4,
13
- codex 3, grok 15)를 넘으면 `CapabilityInteractionPort.plan` `numbered-multi`
14
- 내려 번호 목록이 된다 기본 후보만 실은 짧은 화면과 "직접 선택" 이 여는
15
- 번째 화면으로 나누던 설계는 2026-09-09 사용자 요청으로 뺐다(후보 12개 중
16
- 3개만 보이고, 번째 화면은 나누기가 추천 불변식을 열리지도 않았다).
13
+ codex 3, grok 15)를 넘으면 네이티브 질문 묶음에 실리는 크기(claude-code 4×4)
14
+ 까지는 같은 화면의 체크박스 질문 여러 개로 자르고(`picker_navigation.split_checkbox`),
15
+ 그것도 넘으면 `CapabilityInteractionPort.plan` `numbered-multi` 내려 번호
16
+ 목록이 된다 기본 후보만 실은 짧은 화면과 "직접 선택" 여는 두 번째 화면으로
17
+ 나누던 설계는 2026-09-09 사용자 요청으로 뺐다(후보 12개 중 3개만 보이고, 두
18
+ 번째 화면은 쪽 나누기가 추천 불변식을 깨 열리지도 않았다).
17
19
  """
18
20
  from __future__ import annotations
19
21
 
@@ -198,7 +198,7 @@ That is the entire interactive flow. The wizard handles:
198
198
  - base-ref pick + git rev-parse validation (skipped when reusing an active worktree),
199
199
  - `implementation`-only sub-flow: approved-plan path (frontmatter `approved: true` check) + stage pick (`auto` = the earliest incomplete stage whose dependencies are satisfied, or a specific stage number). Implementer slots use role-count / role-model like every other role (`executor` is only a compatibility alias for `implementer`). When an approved plan is selected and a `## PLAN DECISION` sidecar carrying `Status: approved`, exported from the report — matching the plan on source-report·seq — is detected in that run's sibling `user-responses/`, the approve-confirm step expands to 3 options (`yes_apply` recommended: approve + apply the option as exported / `yes` approve only / `no` abort) — `yes_apply` validates the option against the plan's `optionCandidates` before applying it via the existing approval·option path,
200
200
  - `release-handoff`-only sub-flow: after the approved plan auto-resolves, a `handoff_stage_pick` multi-select — choose an eligible stage bundle (stage-group) or the whole task (when an accepted whole-task verification report exists); the result goes out as render-args' `stages` key (csv, empty when whole-task),
201
- - launch selection after identity/worktree steps: one screen per static role, in profile order. A role that can run several instances (`max > 1`) is a checkbox step `role-models:<role>` (`multi: true`) — the number of models checked is the number of instances, there is no separate count question; the label states the profile range and recommended count, every executable candidate is listed on that one screen (defaults first, the recommended set flagged), and when the list exceeds the host's native checkbox limit the interaction plan is `numbered-multi` — render the whole list, never a shortlist or pages. An optional role (`min = 0`, e.g. critic) carries a `추가 안 함` row. A fixed single role (`min = max = 1`, e.g. report-writer) is a single pick `role-model:<role>:1`. current-session lead is this session and is listed on the confirmation summary, not as a wizard step. The wizard does not fork on defaults-vs-customize, does not show a provider roster multi-pick, and does not offer a separate implementer-provider pick. Dynamic verifiers are not chosen at launch. `--workers` is compatibility-only, not a launch picker. Repeated `--role-count` / `--role-model` tokens on `renderArgv` are intentional,
201
+ - launch selection after identity/worktree steps: one screen per static role, in profile order. A role that can run several instances (`max > 1`) is a checkbox step `role-models:<role>` (`multi: true`) — the number of models checked is the number of instances, there is no separate count question; the label states the profile range and recommended count, every executable candidate is listed on that one screen (defaults first, the recommended set flagged), and when the list exceeds the host's native checkbox limit the runtime either splits it into several checkbox questions on one `pick_group` screen (interaction plan `native-group`; the question steps are `role-models:<role>#1`, `#2`, … and the answer is one JSON object keyed by them, each value a CSV) when the host's native question group holds every option, or returns the interaction plan `numbered-multi` — render the whole list, never a shortlist or pages. An optional role (`min = 0`, e.g. critic) carries a `추가 안 함` row. A fixed single role (`min = max = 1`, e.g. report-writer) is a single pick `role-model:<role>:1`. current-session lead is this session and is listed on the confirmation summary, not as a wizard step. The wizard does not fork on defaults-vs-customize, does not show a provider roster multi-pick, and does not offer a separate implementer-provider pick. Dynamic verifiers are not chosen at launch. `--workers` is compatibility-only, not a launch picker. Repeated `--role-count` / `--role-model` tokens on `renderArgv` are intentional,
202
202
  - **resume-clarification (in-session equivalent)** — there is no separate mode or flag matching the shell's `okstra.sh --resume-clarification`; two steps of the standard flow carry out its substance. (1) `reuse_previous` (yes/no to reuse the previous run's settings — in `requirements-discovery` / `error-analysis` / `implementation-planning`, only when prior run-inputs exist): YES prefills role-count·role-model·directive·related-tasks at once. (2) `clarification_pick`: if the **task-type's own** previous `final-report` exists it is auto-recommended as the carry-in input (falling back to the newest by mtime across all phases when absent), and the same run's `user-responses/` sidecar (answers the user filled in) is attached alongside. The chosen path is passed to prepare as `--clarification-response` — the user makes the sidecar via the report's `Export user response`, places it in `runs/<task-type>/user-responses/`, and re-runs the same phase,
203
203
  - **re-verification scope (`reverify_scope_pick`, `implementation-planning` clarification re-runs only)** — asked right before `confirm` when the re-run is narrowable **or** an answered `C-NNN` traces to no stage. When every answered id traces to a stage: 3 options — `auto` (recommended — leave it to the lead's `okstra incremental-scope` decision) / `full` (re-verify every stage) / Enter directly (a stage-number CSV, validated against the prior report's Stage Map). When an id is unlinked, `auto` is omitted and the user names stages or picks `full`; that unlinked id does not freeze the run at full. The answer goes out as `--reverify-scope` and reaches the lead prompt as the `REVERIFY_SCOPE_MODE` / `REVERIFY_SCOPE_STAGES` tokens; it shapes that CLI's inputs rather than replacing the decision. The confirmation block's `reverify-scope` line names unlinked ids as needing stage numbers, not as a forced full re-run,
204
204
  - `release-handoff` PR template override + persist scope,