tirtc-device-builder 0.2.0 → 0.4.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/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +657 -362
- package/bin/esp32-kit-metadata.js +8 -0
- package/bin/install-esp32-kit.js +208 -0
- package/bin/setup-esp32.js +796 -0
- package/bin/tirtc-device-builder.js +19 -2
- package/package.json +2 -1
- package/skills/tirtc-esp32-builder/SKILL.md +11 -8
- package/skills/tirtc-esp32-builder/USAGE.md +30 -22
- package/skills/tirtc-esp32-builder/assets/developer-intake-prompt.md +50 -0
- package/skills/tirtc-esp32-builder/assets/hardware-ir-v2.example.json +122 -0
- package/skills/tirtc-esp32-builder/assets/report-template.md +15 -0
- package/skills/tirtc-esp32-builder/references/capability-rules.md +41 -16
- package/skills/tirtc-esp32-builder/references/environment.md +25 -4
- package/skills/tirtc-esp32-builder/references/hardware-ir.md +44 -24
- package/skills/tirtc-esp32-builder/references/porting-risks.md +49 -0
- package/skills/tirtc-esp32-builder/references/reporting.md +5 -1
- package/skills/tirtc-esp32-builder/references/workflow.md +10 -9
- package/skills/tirtc-esp32-builder/scripts/doctor.py +4 -4
- package/skills/tirtc-esp32-builder/scripts/hardware_ir.py +670 -40
|
@@ -1,49 +1,69 @@
|
|
|
1
1
|
# Hardware IR
|
|
2
2
|
|
|
3
|
-
Hardware IR
|
|
3
|
+
Hardware IR describes one exact board revision and product contract. It is the deterministic handoff from board evidence to capability assessment, generation, build, and HIL reporting.
|
|
4
|
+
|
|
5
|
+
Create the current schema:
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
8
|
python3 <skill-dir>/scripts/hardware_ir.py init <output>/hardware-ir.json
|
|
7
9
|
```
|
|
8
10
|
|
|
11
|
+
The initializer creates schema v2. The validator still accepts schema v1 for existing H.264-only projects; update new or materially changed boards to v2.
|
|
12
|
+
|
|
9
13
|
## Evidence rules
|
|
10
14
|
|
|
11
15
|
- Give every source a stable `id`, `kind`, `location`, and revision when available.
|
|
12
|
-
- Reference
|
|
13
|
-
- Use `null` for unknown
|
|
14
|
-
- Hardware revision `unspecified` is
|
|
15
|
-
- Keep
|
|
16
|
-
-
|
|
16
|
+
- Reference source IDs from board facts, selected profiles, onboarding methods, resources, and runtime evidence.
|
|
17
|
+
- Use `null` for unknown facts. Retain contradictory values as explicit issues instead of choosing silently.
|
|
18
|
+
- Hardware revision `unspecified` is valid during intake but blocks reusable-board readiness.
|
|
19
|
+
- Keep requested product features under `features.requested`; desired behavior is not hardware evidence.
|
|
20
|
+
- Store concrete sensors, pins, clocks, codecs, slots, and task allocation in this board IR/adapter, never in generic Skill defaults.
|
|
17
21
|
|
|
18
22
|
Verification levels are ordered:
|
|
19
23
|
|
|
20
|
-
1. `extracted`:
|
|
21
|
-
2. `corroborated`:
|
|
22
|
-
3. `build_verified`:
|
|
23
|
-
4. `hardware_verified`: the peripheral works on the exact
|
|
24
|
-
5. `hil_verified`:
|
|
24
|
+
1. `extracted`: one source.
|
|
25
|
+
2. `corroborated`: another authoritative artifact confirms it.
|
|
26
|
+
3. `build_verified`: matching implementation builds with the locked toolchain.
|
|
27
|
+
4. `hardware_verified`: the local peripheral works on the exact board revision.
|
|
28
|
+
5. `hil_verified`: retained for legacy facts; schema v2 feature HIL additionally requires matching artifact evidence.
|
|
25
29
|
|
|
26
|
-
##
|
|
30
|
+
## Schema v2 contracts
|
|
27
31
|
|
|
28
32
|
The IR contains:
|
|
29
33
|
|
|
30
|
-
- exact board identity and
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
34
|
+
- exact board identity, module, Flash/PSRAM, ESP-IDF, TiRTC SDK and build contract;
|
|
35
|
+
- camera identity evidence plus `video_profiles[]` and `selected_video_profile`;
|
|
36
|
+
- audio input/output paths;
|
|
37
|
+
- `hardware_resources` for I2C, I2S/GPIO ownership, audio channel mapping, camera realtime policy, and memory budget;
|
|
38
|
+
- `onboarding.wifi_credentials` with selectable SoftAP/BLE/SmartConfig/factory/development/custom methods;
|
|
39
|
+
- selectable ThingConnect binding methods plus stored-binding states and reset control;
|
|
40
|
+
- requested features;
|
|
41
|
+
- optional `runtime_evidence[]`, each bound to a full firmware SHA-256.
|
|
42
|
+
|
|
43
|
+
The selected Wi-Fi method must be available and corroborated, credentials must remain outside tracked source, and reprovisioning must be defined. A board without SoftAP is valid when another selected method meets those conditions.
|
|
44
|
+
|
|
45
|
+
The selected video profile controls assessment. An unselected H.264 fallback cannot make an MJPEG target pass, and missing H.264 cannot block an evidenced MJPEG target.
|
|
46
|
+
|
|
47
|
+
## Artifact-bound HIL
|
|
48
|
+
|
|
49
|
+
Run:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python3 <skill-dir>/scripts/hardware_ir.py assess hardware-ir.json \
|
|
53
|
+
--artifact-sha256 <64-character-sha256> --strict
|
|
54
|
+
```
|
|
36
55
|
|
|
37
|
-
|
|
56
|
+
H5 features require matching L5 evidence; AI requires matching L6 evidence. Evidence from an older firmware remains provenance but does not verify the current artifact.
|
|
38
57
|
|
|
39
58
|
## Intake quality
|
|
40
59
|
|
|
41
|
-
Preferred
|
|
60
|
+
Preferred evidence order:
|
|
42
61
|
|
|
43
62
|
1. exact schematic/netlist and BOM for the physical revision;
|
|
44
63
|
2. official BSP pinned to a commit or release;
|
|
45
|
-
3. sensor, codec, amplifier
|
|
46
|
-
4.
|
|
47
|
-
5. product pages,
|
|
64
|
+
3. sensor, codec, amplifier and module datasheets;
|
|
65
|
+
4. minimal peripheral projects built for that board;
|
|
66
|
+
5. product pages, photographs and community material;
|
|
67
|
+
6. artifact-bound boot, media and browser observations.
|
|
48
68
|
|
|
49
|
-
A schematic establishes
|
|
69
|
+
A schematic establishes connectivity, not driver family compatibility, encoding throughput, acoustic behavior, provisioning usability, network performance, or end-to-end TiRTC operation. Preserve each as a separate fact and verification level.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Board-porting risk gates
|
|
2
|
+
|
|
3
|
+
Read this reference for every new board or failing media bring-up. It defines generic evidence gates; concrete values belong in the board's Hardware IR and adapter.
|
|
4
|
+
|
|
5
|
+
## Freeze the contract before code
|
|
6
|
+
|
|
7
|
+
Record the selected video profile, audio formats and stream IDs, duplex/AEC policy, onboarding method, platform-discovery transport, output path, and mutation authorization. Keep unknown values explicit. A server supporting several codecs does not select one for the device.
|
|
8
|
+
|
|
9
|
+
## Hardware identity and ownership
|
|
10
|
+
|
|
11
|
+
- Sensor and codec identity: reconcile schematic/BOM names with BSP probes or ID registers. Store every evidenced variant in an allowlist; retain contradictions as issues.
|
|
12
|
+
- I2C: select one ESP-IDF driver family for the final image. Audit the linked ELF when third-party components can introduce another family; a conflict bypass is not a resolution.
|
|
13
|
+
- I2S/audio: record controller, GPIO, master/slave mode, clocks, DMA, channel/TDM slot to physical-signal mapping, and shared-signal handoff. A codec name or I2C address does not prove the audio path.
|
|
14
|
+
- Realtime camera path: record DMA/event queues, task core/priority, and competing Wi-Fi work. Treat queue overflows as scheduling or throughput evidence, then change one variable per HIL comparison.
|
|
15
|
+
|
|
16
|
+
Turn every discovered invariant that can regress into a focused test or post-link gate. Generate board-specific values with the project; keep the Skill generic.
|
|
17
|
+
|
|
18
|
+
## Wi-Fi credentials and device binding
|
|
19
|
+
|
|
20
|
+
Wi-Fi provisioning and ThingConnect binding are separate state machines.
|
|
21
|
+
|
|
22
|
+
Select one evidenced Wi-Fi credential method from SoftAP, BLE, SmartConfig, secure factory/NVS provisioning, development configuration, or a documented custom path. SoftAP is not mandatory. A board without AP provisioning can reach `READY_TO_PORT` through another available method when credentials remain outside source control and a reprovisioning path is defined.
|
|
23
|
+
|
|
24
|
+
Development configuration may inject credentials through an untracked sdkconfig, environment, or provisioning artifact. Treat committed plaintext credentials as `BLOCKED`. Never copy SSIDs/passwords into Hardware IR, reports, examples, or source.
|
|
25
|
+
|
|
26
|
+
Select the binding method from the applicable platform/product contract: verification code, factory-bound identity, development credentials, or a documented custom flow. When verification-code binding is selected, distinguish at least:
|
|
27
|
+
|
|
28
|
+
- no Wi-Fi credentials;
|
|
29
|
+
- Wi-Fi present but no device binding, so the verification-code flow runs;
|
|
30
|
+
- stored binding present, so verification is skipped intentionally;
|
|
31
|
+
- binding-only reset and Wi-Fi reset.
|
|
32
|
+
|
|
33
|
+
For every method, keep device credentials outside source control, handle an already stored identity explicitly, and define binding reset/replacement behavior.
|
|
34
|
+
|
|
35
|
+
## Startup memory, TLS, and transport
|
|
36
|
+
|
|
37
|
+
Platform service discovery and the TiRTC SDK service endpoint are different settings. Record both. HTTPS requires valid time, DNS, certificate validation, TLS client/TLS 1.2, and enough contiguous internal memory.
|
|
38
|
+
|
|
39
|
+
Before sizing TiRTC buffers, measure internal free/largest blocks, PSRAM, frame size distribution, queue watermarks, and send/drop rates. A larger queue can prevent drops, exhaust startup memory, or add buffer latency. If an authorized HTTP baseline exists, stage transport changes separately from media changes and retain the HTTPS requirements as a pending acceptance item.
|
|
40
|
+
|
|
41
|
+
## Network and media evidence
|
|
42
|
+
|
|
43
|
+
Disable Wi-Fi power saving for the realtime baseline unless the product contract says otherwise. Record BSSID, channel, RSSI, reconnect/roaming events, media counters, queue watermarks, camera overflows, internal heap, and largest block. Establish a strong, stable AP baseline before controlled weak-network testing.
|
|
44
|
+
|
|
45
|
+
Confirm SDK send return semantics and callback payload lifetimes from the selected SDK version. Keep SDK callbacks bounded and copy payloads before returning.
|
|
46
|
+
|
|
47
|
+
## Artifact discipline
|
|
48
|
+
|
|
49
|
+
Record BIN/ELF SHA-256 for every build used in HIL. Runtime evidence applies only to the exact artifact. Diagnose one failing invariant, make the smallest correction, rerun that layer, and preserve the comparison in the report.
|
|
@@ -18,6 +18,10 @@ Use [the report template](../assets/report-template.md) and preserve separate `P
|
|
|
18
18
|
|
|
19
19
|
## Evidence
|
|
20
20
|
|
|
21
|
-
Record exact board revision, toolchain and SDK versions, source/adapter revisions, commands, return codes, firmware size and SHA-256, serial port/chip, sanitized log paths, browser or platform observations, and every unavailable dependency.
|
|
21
|
+
Record exact board revision, selected media, Wi-Fi, and binding profiles, toolchain and SDK versions, source/adapter revisions, commands, return codes, firmware size and SHA-256, serial port/chip, sanitized log paths, browser or platform observations, and every unavailable dependency.
|
|
22
|
+
|
|
23
|
+
Runtime evidence belongs to one artifact. Label superseded artifacts and keep their observations as history; do not promote them to the current BIN/ELF. For HIL assessment, add the full SHA-256 to `runtime_evidence` and run `hardware_ir.py assess --artifact-sha256 <sha> --strict`.
|
|
24
|
+
|
|
25
|
+
For L3-L7 media runs, capture the signals that distinguish software regressions from environment changes: onboarding/binding state, BSSID/channel/RSSI, reconnect or roaming events, audio/video send/receive/drop/error counters, queue watermarks, camera overflow count, internal heap/largest block, PSRAM, and measured latency when available. Never record credential values.
|
|
22
26
|
|
|
23
27
|
Reports describe observed current behavior. A `SKIP` caused by missing hardware, account, service, browser, or external network does not become a pass. If the user's requested completion level includes a skipped critical case, the final outcome remains incomplete.
|
|
@@ -19,11 +19,12 @@ The branch is complete when the new run has its own build and verification evide
|
|
|
19
19
|
Use this branch when the user supplies a board model, vendor URL, schematic, BOM, pin map, BSP, datasheets, photographs, or peripheral example projects without a verified adapter.
|
|
20
20
|
|
|
21
21
|
1. Resolve the full model, module, PCB marking, and hardware revision. Treat different revisions as different boards.
|
|
22
|
-
2.
|
|
23
|
-
3.
|
|
24
|
-
4.
|
|
25
|
-
5.
|
|
26
|
-
6.
|
|
22
|
+
2. Freeze the user-supplied product contract: selected video profile, audio/stream formats, duplex/AEC policy, supported Wi-Fi credential methods, selected onboarding method, transport staging, output path, and mutation boundary. Use `unknown` where the prompt lacks an answer.
|
|
23
|
+
3. Prefer official schematic/BOM and BSP facts. For a PDF schematic, inspect page labels and net names; prefer an exported netlist, pin CSV, or vendor board definition when available.
|
|
24
|
+
4. Cross-check critical pins, clocks, power enables, reset lines, sensor/codec variants, ESP-IDF version, resource ownership, and onboarding behavior across at least two independent artifacts when possible.
|
|
25
|
+
5. Create the Hardware IR v2. Use `null` for unknown facts and retain contradictory values as an explicit issue instead of selecting one silently. Store concrete board values in the IR/adapter rather than Skill files.
|
|
26
|
+
6. Validate and assess requested features. Ask only for unresolved facts that block the next safe step. SoftAP is optional when another evidenced Wi-Fi credential method is available, keeps credentials outside source, and defines reprovisioning.
|
|
27
|
+
7. When all requirements reach `READY_TO_PORT`, generate the starter and implement the board adapter. When requirements remain blocked, generate only the IR, capability report, and an optional compile-safe skeleton if requested.
|
|
27
28
|
|
|
28
29
|
The branch is complete when every supplied artifact maps to an IR fact, provenance entry, contradiction, or declared irrelevant item.
|
|
29
30
|
|
|
@@ -55,16 +56,16 @@ The runtime-facing `starter_media` interface stays stable. A reusable board inte
|
|
|
55
56
|
|
|
56
57
|
The adapter owns:
|
|
57
58
|
|
|
58
|
-
- camera capture and H.264
|
|
59
|
+
- camera capture and the selected MJPEG/H.264/H.265 media path;
|
|
59
60
|
- microphone capture and audio encoding;
|
|
60
61
|
- downlink audio decode, buffering, codec, amplifier, and I2S playback;
|
|
61
|
-
- DMA buffers, hardware clocks, power, reset, GPIO,
|
|
62
|
+
- DMA buffers, hardware clocks, power, reset, GPIO, refresh/key-frame requests, and realtime task allocation;
|
|
62
63
|
- bounded stop, resource release, and generation-aware flushing.
|
|
63
64
|
|
|
64
65
|
The stable modules own stream IDs, negotiated/contracted formats, TiRTC callback copying, connection handles, session generation, and H5/AI sequencing.
|
|
65
66
|
|
|
66
67
|
## Verification loop
|
|
67
68
|
|
|
68
|
-
Use a bounded loop per layer: diagnose one failing invariant, make the smallest correction, and rerun that layer before moving forward. Stop and report when the remaining failure requires unavailable hardware, credentials, a new SDK binary, a public protocol change, or a user choice.
|
|
69
|
+
Use a bounded loop per layer: diagnose one failing invariant, make the smallest correction, and rerun that layer before moving forward. Change one high-risk variable per HIL comparison. Turn reusable invariants into tests or post-link gates. Stop and report when the remaining failure requires unavailable hardware, credentials, a new SDK binary, a public protocol change, or a user choice.
|
|
69
70
|
|
|
70
|
-
Do not use successful compilation as evidence for camera frames, speaker output, Web rendering, AI audio, or long-run stability.
|
|
71
|
+
Do not use successful compilation as evidence for camera frames, speaker output, Web rendering, AI audio, or long-run stability. Bind every runtime conclusion to the tested firmware SHA-256.
|
|
@@ -204,7 +204,7 @@ def resolve_sdk_dir(
|
|
|
204
204
|
if bundled.is_dir():
|
|
205
205
|
return bundled, "generated project"
|
|
206
206
|
if thing_connect_root is not None:
|
|
207
|
-
return thing_connect_root / DEFAULT_SDK_RELATIVE_PATH, "
|
|
207
|
+
return thing_connect_root / DEFAULT_SDK_RELATIVE_PATH, "Device Kit or legacy workspace"
|
|
208
208
|
return None, "not found"
|
|
209
209
|
|
|
210
210
|
|
|
@@ -272,7 +272,7 @@ def diagnose(args: argparse.Namespace) -> dict[str, Any]:
|
|
|
272
272
|
)
|
|
273
273
|
checks.append(
|
|
274
274
|
check(
|
|
275
|
-
"
|
|
275
|
+
"ESP32 Device Kit",
|
|
276
276
|
workspace_status,
|
|
277
277
|
(
|
|
278
278
|
f"{thing_connect_root} ({thing_connect_source})"
|
|
@@ -286,7 +286,7 @@ def diagnose(args: argparse.Namespace) -> dict[str, Any]:
|
|
|
286
286
|
)
|
|
287
287
|
if args.require_workspace and thing_connect_root is None:
|
|
288
288
|
next_actions.append(
|
|
289
|
-
"
|
|
289
|
+
"Run setup esp32 --install or pass an existing Device Kit path with "
|
|
290
290
|
"--thing-connect-root."
|
|
291
291
|
)
|
|
292
292
|
|
|
@@ -414,7 +414,7 @@ def parse_args() -> argparse.Namespace:
|
|
|
414
414
|
parser.add_argument(
|
|
415
415
|
"--require-workspace",
|
|
416
416
|
action="store_true",
|
|
417
|
-
help="fail when a
|
|
417
|
+
help="fail when a Device Kit or legacy workspace with the ESP32 generator is unavailable",
|
|
418
418
|
)
|
|
419
419
|
parser.add_argument("--sdk-dir", type=Path)
|
|
420
420
|
parser.add_argument("--project", type=Path)
|