API Reference Matrix
更新日: 2026-07-05
主要 API の import path、引数、戻り値、副作用、関連テストを一覧化する。詳細な説明は各 module docs を参照する。
App CLI / Config
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.cli.main |
argv | None |
exit code |
delegates to subprocess command |
tests/test_app_config.py |
pca.cli.delegated_command |
argv |
command argv |
reads profile YAML |
tests/test_app_config.py |
pca.app_config.load_app_profile |
path |
AppProfile |
reads YAML |
tests/test_app_config.py |
pca.app_config.args_mapping_to_argv |
args mapping |
list[str] |
none |
tests/test_app_config.py |
Decision
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.decision.policy.deterministic_token_policy |
obs |
PolicyDecision |
none |
tests/test_encoder.py |
pca.decision.policy.neural_policy |
obs, model, torch, ... |
PolicyDecision |
optional runtime stats/cache update |
tests/test_encoder.py |
pca.decision.policy.neural_policy_batch |
observations, model, torch, ... |
list[PolicyDecision] |
optional runtime stats/cache update |
tests/test_encoder.py |
pca.decision.remote_policy.remote_policy |
url, timeout |
Callable[[Any], PolicyDecision] |
HTTP request per decision |
integration/smoke |
ISMCTS
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.search.ismcts.ismcts_policy |
obs, your_full_deck, opponent_prior_deck, policy_fn, search_api, config, ... |
PolicyDecision |
CABT search sessions, runtime stats |
tests/test_encoder.py |
pca.search.ismcts.ismcts_policy_with_hidden |
obs, hidden, policy_fn, search_api, config, ... |
PolicyDecision |
CABT search sessions, runtime stats |
tests/test_encoder.py |
pca.search.ismcts.candidate_action_indices |
obs, node, encoded, limit, ... |
list[int] |
optional runtime stats |
tests/test_encoder.py |
pca.search.ismcts.visit_distribution |
node, action_count, temperature |
list[float] |
none |
tests/test_encoder.py |
pca.search.ismcts.leaf_value_from_decision |
obs, decision, root_player_index, value_config, stats |
float |
optional stats update |
tests/test_encoder.py |
pca.search.ismcts.finish_search_session |
search_api |
None |
best-effort search_end() |
tests/test_module_boundaries.py |
Belief and Search Values
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.search.belief.sample_hidden_state |
obs, your_deck, opponent_deck, rng, ... |
HiddenStateSample |
rng advances |
tests/test_encoder.py |
pca.search.belief.PublicKnowledgeTracker.update |
obs |
constraints object |
tracker state update |
tests/test_encoder.py |
pca.search.mcts.search_value_config_for_profile |
name |
SearchValueConfig |
none |
tests/test_encoder.py |
pca.search.mcts.terminal_value_for_player |
result, player, result_reason, value_config |
float | None |
none |
tests/test_encoder.py |
Self-Play
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.training.selfplay.run_selfplay_battle |
api, deck0, deck1, ... |
(list[SelfPlayRecord], SelfPlaySummary) |
CABT battle API calls |
tests/test_encoder.py |
pca.training.selfplay.collect_selfplay_games_parallel |
CLI-derived args |
(records, summaries) |
worker processes, optional JSONL append |
tests/test_module_boundaries.py |
pca.training.selfplay.make_pending_record |
obs, decision, ... |
PendingRecord |
none |
tests/test_encoder.py |
pca.training.selfplay.finalize_records |
pending, result, ... |
list[SelfPlayRecord] |
none |
tests/test_selfplay_summary.py |
pca.training.selfplay.write_records_jsonl |
records, path |
None |
writes JSONL |
tests/test_encoder.py |
pca.training.selfplay.append_records_jsonl |
records, path |
None |
appends JSONL, writes lock file |
tests/test_selfplay_summary.py |
Training Data
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.training.dataset.load_records_jsonl |
path |
list[SelfPlayRecord] |
reads file |
tests/test_encoder.py, tests/test_training.py |
pca.training.dataset.iter_records_jsonl |
path |
iterator |
reads file lazily |
tests/test_training.py |
pca.training.dataset.collate_search_batch |
records, ... |
SearchBatch |
tensor allocation |
tests/test_training.py |
pca.training.dataset.collate_belief_batch |
records, ... |
BeliefBatch |
tensor allocation |
tests/test_training.py |
pca.training.dataset.record_policy_weight |
record, ... |
float |
none |
tests/test_training.py |
Policy/Value Training
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.training.train.train_policy_value |
input_path, output_path, config, best_output_path |
metrics dict |
writes checkpoints |
tests/test_training.py |
pca.training.train.policy_value_loss |
output, batch, ... |
(loss, metrics) |
none |
tests/test_training.py |
pca.training.train.resolve_model_config |
checkpoint/input/config args |
dict |
may inspect JSONL/card data |
tests/test_training.py |
pca.training.train.load_compatible_model_state |
model, state_dict, ... |
load report |
mutates model weights |
tests/test_training.py |
pca.training.train.load_unified_feature_tables_from_jsonl |
paths, ... |
feature tables |
optional cache write |
tests/test_training.py |
Belief Training
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.training.belief_train.train_belief |
input_path, output_path, config, best_output_path |
metrics dict |
writes checkpoints |
tests/test_module_boundaries.py, tests/test_training.py |
pca.training.belief_train.belief_loss |
output, batch, ... |
(loss, metrics) |
none |
tests/test_training.py |
pca.training.belief_train.belief_dataloader |
paths, config |
iterator |
reads JSONL lazily |
tests/test_module_boundaries.py |
Evaluation
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.evaluation.tournament.run_head_to_head |
deck/policy config |
match summaries |
CABT battle API calls |
tests/test_encoder.py |
pca.evaluation.tournament.run_against_deck_pool |
deck dirs/config |
evaluations |
CABT battle API calls |
tests/test_encoder.py |
pca.evaluation.tournament.summarize_matches |
match summaries |
aggregate summary |
none |
tests/test_module_boundaries.py |
pca.evaluation.tournament.write_csv_summary |
summary/path |
None |
writes CSV |
tests/test_module_boundaries.py |
Rule Agents
| API |
Arguments |
Returns |
Side Effects |
Tests |
pca.rule_agents.registry.load_rule_agent_registry |
path |
RuleAgentRegistry |
reads YAML |
tests/test_rule_agents.py |
pca.rule_agents.policy.rule_pool_policy_factory |
registry/deck config |
policy factory |
may instantiate agents |
tests/test_rule_agents.py |
pca.rule_agents.generic.GenericAdvancedHeuristicAgent |
observation methods |
rule decision |
none |
tests/test_rule_agents.py |
Compatibility Rule
公開 API を facade から出す場合は、tests/test_module_boundaries.py に以下を追加する。
- facade object と real module object の
assertIs
- real object の
__module__ 期待値
- 旧 import path を維持する必要がある場合の negative check