feat: offline file list + SELECT picker for the SIM/USIM RFM builders (v3.4.0)

The SELECT rows (compact RFM chains and the Expanded Script C-APDU picker,
which shares the row editor) now have a file picker instead of typing FIDs,
paths or chains by hand.

Data:
- `pysim_simple_server/uicc_files.py` builds the standard file list cardless
  from pySim's profiles and application classes (CardProfileUICC + CardProfileSIM
  for the MF tree, every concrete CardApplication subclass for the ADFs) and
  writes `frontend/uicc_files.json` (490 entries: canonical FID path, symbolic
  name, fid, kind, root, ADF AID).  `tests/test_uicc_files.py` regenerates it
  and fails when pySim adds or renames files.  The asset is precached by the
  service worker, so the builders keep working offline.

Picker:
- Sources merged per canonical path: the loaded file-manager tree (card names
  and probed presence; probed-absent files hidden), custom files, and the
  shipped standard list (specs-default until "Probe all files" has run).
- Default list shows what the current method can express; "all files" reveals
  the rest, and picking one auto-switches the method - preferring path (one
  SELECT) over chain - with a note line explaining the switch.  A "starts in"
  selector sets the implicit current DF (UICC shared-FS RFM app starts in MF,
  an ADF RFM app in its ADF, TS 102 226 7.2/7.3 - the TAR decides; default per
  builder, overridable per row).
- Fill rules: by FID only for direct children of the current DF; path = FID
  sequence from MF without the MF identifier (ISO 7816-4) or the relative tail
  (USIM P1=09); chain stays relative and follows the TS 102 221 11.1.1.2 FID
  search order (children, parent, siblings), so no hop to the common ancestor.
  ADF roots are not pickable (selection is by AID; TS 102 226 7.1 forbids
  P1=04 for RFM) - the By AID method stays manual.

Tests/docs: frontend/tests/uicc_files.test.js (asset shape, merge/priority/
exclusion, fill matrix, relative chains, session-context tracking, option
grouping); help 2.1/2.2 EN+RU, READMEs, AGENTS.  sw cache -> simple-v242.
This commit is contained in:
2026-09-23 08:20:10 +03:00
parent 7aee1818b8
commit b8734189cf
12 changed files with 4762 additions and 5 deletions
+9
View File
@@ -94,6 +94,15 @@
<p class="text-sm mb-3">Для record-команд режим P2: <strong>Absolute (04)</strong>, <strong>Next (02)</strong> или <strong>Previous (03)</strong>. Если за Case&nbsp;4 командой сразу следует строка GET RESPONSE, сборщик цепочки автоматически убирает её байт Le (ETSI TS 102 226 &sect;5.1.1). В правой колонке — панель конвертации (IMSI, MSISDN, ICCID, SPN, PLMN, nibble swap). См. <a href="#conversion" class="text-blue-600 dark:text-blue-400 hover:underline">&sect;2.5</a>.</p>
<p class="text-sm mb-3"><strong>&rarr; Расширенный скрипт</strong> отправляет собранную цепочку в конструктор Expanded Script строками C-APDU (строки GET RESPONSE отбрасываются — расширенный формат их не использует, TS 102 226 &sect;5.2.1.1). Приложение UICC Shared File System RFM (TAR <code class="font-mono text-sm">B00000</code>) доступно и в компактном, и в расширенном формате — если TAR не настроен на автоопределение формата, используются разные значения TAR (TS 102 226 &sect;7.0/&sect;5.3).</p>
<h4 id="rfm-file-picker" class="font-medium mb-1">Выбор файла для SELECT</h4>
<p class="text-sm mb-2">У каждой строки SELECT под полями метода есть выбор файла: поле фильтра, переключатель <strong>all files</strong>, корень начала сессии с текущим DF и список файлов, сгруппированный по корню (<code class="font-mono text-sm">MF</code>, <code class="font-mono text-sm">ADF.USIM</code>, &hellip;). Выбор файла заполняет поля текущего метода; если метод не может выразить выбор, помощник переключается на подходящий &mdash; предпочитая <strong>path</strong> (один SELECT), затем <strong>chain</strong> &mdash; и пишет об этом в строке примечания, например файл из другого DF становится <code class="font-mono text-sm">7F106F40</code> (путь от MF) или <code class="font-mono text-sm">7F20,6F46</code> (относительная цепочка FID).</p>
<ul class="list-disc list-inside text-sm space-y-1 mb-3">
<li><strong>Источник списка</strong>: при подключённой карте приоритет у загруженного дерева файлового менеджера (имена карты и проверенное наличие; отсутствующие файлы скрываются). Без карты и для незагруженных ветвей используется поставляемый стандартный список &mdash; <code class="font-mono text-sm">uicc_files.json</code>, собранный из профилей/классов приложений pySim скриптом <code class="font-mono text-sm">pysim_simple_server/uicc_files.py</code> и проверяемый тестом. До запуска <strong>&laquo;Проверить все файлы&raquo;</strong> в файловом менеджере список соответствует спецификациям. Пользовательские файлы добавляются всегда.</li>
<li><strong>Начало сессии</strong>: неявный текущий DF зависит от <em>TAR</em>, на который отправляется защищённый пакет &mdash; приложение UICC Shared File System RFM начинает с MF (TS 102 226 &sect;7.2), приложение ADF RFM &mdash; со своего ADF (&sect;7.3). По умолчанию помощник берёт MF для этого конструктора и ADF.USIM для USIM RFM (в соответствии с TAR пресетов); можно изменить для каждой строки.</li>
<li><strong>Path</strong> &mdash; последовательность FID от MF <em>без</em> идентификатора MF (ISO 7816-4: &laquo;select from the MF &mdash; path without the MF identifier&raquo;); вариант USIM <strong>from current DF</strong> использует относительный хвост. <strong>Chain</strong> остаётся относительным к текущему DF и следует порядку поиска FID из TS 102 221 &sect;11.1.1.2 (дети &rarr; родитель &rarr; соседи), поэтому переход к общему предку не нужен.</li>
<li>Корни ADF не выбираются: приложение выбирается по AID, и метод <strong>By AID</strong> остаётся ручным (TS 102 226 &sect;7.1 запрещает P1=<code class="font-mono text-sm">04</code> для RFM).</li>
</ul>
<h3 id="usim-rfm" class="text-lg font-medium mb-2">2.2 USIM RFM</h3>
<p class="mb-2">CLA = <code class="font-mono text-sm">00</code> (ETSI TS 102 221). Тот же сборщик цепочки и набор команд, что и SIM, плюс административные команды UICC и формы SEARCH RECORD / INCREASE из TS 102 221:</p>
<ul class="list-disc list-inside text-sm space-y-1 mb-3">