@seeed-studio/sensecraft-cli 0.1.1 → 0.1.3
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/INSTALL.md +442 -0
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/package.json +28 -5
- package/scripts/constants.js +18 -2
- package/scripts/download.js +64 -16
- package/scripts/download.test.js +110 -0
- package/scripts/paths.js +28 -4
- package/scripts/paths.test.js +92 -0
- package/scripts/platform.js +8 -2
- package/scripts/postinstall.js +28 -7
- package/scripts/test-install.js +121 -0
- package/skills/README.md +32 -0
- package/skills/confirmation.md +54 -0
- package/skills/sensecraft-ai/SKILL.md +129 -0
- package/skills/sensecraft-apps/SKILL.md +197 -0
- package/skills/sensecraft-apps/commands.md +195 -0
- package/skills/sensecraft-apps/reference-app-fields.md +95 -0
- package/skills/sensecraft-apps/reference-tool-blocks.md +132 -0
- package/skills/sensecraft-data/SKILL.md +180 -0
- package/skills/sensecraft-data/commands.md +858 -0
- package/skills/sensecraft-devices-cloud/SKILL.md +53 -0
- package/skills/sensecraft-devices-cloud/commands.md +58 -0
- package/skills/sensecraft-files/SKILL.md +73 -0
- package/skills/sensecraft-files/commands.md +61 -0
- package/skills/sensecraft-models/SKILL.md +196 -0
- package/skills/sensecraft-models/commands.md +177 -0
- package/skills/sensecraft-models/reference-model-fields.md +139 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Model library & upload field reference
|
|
2
|
+
|
|
3
|
+
Aligned with Console `views/model/add.vue`, `detail.vue`, and `constants/sensecraftModel.js`.
|
|
4
|
+
|
|
5
|
+
## Identity & copy
|
|
6
|
+
|
|
7
|
+
| Field | Type | Required (create UI) | Compliance |
|
|
8
|
+
|-------|------|----------------------|------------|
|
|
9
|
+
| `name` | text | yes | max **64** (`SENSECRAFT_MODEL_NAME_MAX_LENGTH`); trim before API |
|
|
10
|
+
| `description` | text | yes | max **300** |
|
|
11
|
+
| `content` | rich text | yes | model detail / documentation body |
|
|
12
|
+
| `pic_url` | image URL | yes | inference example image; upload via `file upload --type 1` (**≤2 MB**, Console `model/add.vue` max-size=2); JPG/PNG/GIF/WebP; must be http(s) URL |
|
|
13
|
+
| `scenario` | option | yes | id from `get_constant` **`scenarios_array`** (not app `app_scenarios_array`); CLI rejects unknown ids |
|
|
14
|
+
| `precision` | option | yes | id from **`model_precision_array`** (1=INT8, 2=FLOAT16, 3=FLOAT32 typical); CLI rejects unknown ids |
|
|
15
|
+
| `file_url` | URL | yes | model binary URL; http(s); extension must match `model_format` |
|
|
16
|
+
| `preparation` | string[] | often | prep steps (UI list) |
|
|
17
|
+
|
|
18
|
+
## Classification & devices
|
|
19
|
+
|
|
20
|
+
| Field | Type | Required | Compliance |
|
|
21
|
+
|-------|------|----------|------------|
|
|
22
|
+
| `task` | option (id) | yes | From **`get_constant` → `model_task_array`**. Product categories include vision detection, vision classification, audio, vibration-related tasks, etc. **Resolve names→ids from constants**; do not hardcode stale enums in Agent replies when constants are available. |
|
|
23
|
+
| `ai_framework` | option (id) | conditional | From `ai_framework_array`, filtered by device/task (e.g. reCamera Pro detection). Classification/audio may hide framework and map algorithm by task. |
|
|
24
|
+
| `adapteds` | multi device | yes | Supported device entries; drives `uniform_types` and accept filters |
|
|
25
|
+
| `model_format` | option | yes | From `model_format_array` (examples in code comments: alpkg=`7`, zip=`8`; rknn common for vision). Accept filter follows format + task (e.g. audio → `.rknn` / `.alpkg` / `.zip` rules in UI). |
|
|
26
|
+
|
|
27
|
+
## Classes / labels
|
|
28
|
+
|
|
29
|
+
| Field | Type | Required | Compliance |
|
|
30
|
+
|-------|------|----------|------------|
|
|
31
|
+
| `labels[]` | list | usually yes | Each item: `object_id` (**number or numeric string, not JSON `null`**), `object_name` (non-empty, pass `validateClassName`) |
|
|
32
|
+
| classes | derived | — | Often mirrored from label names for deploy |
|
|
33
|
+
|
|
34
|
+
Empty or invalid class names block save/deploy in Console.
|
|
35
|
+
|
|
36
|
+
CLI-enforced class-name rule matches Console `validateClassName`: ASCII letters, digits, and spaces only; at least one letter; the first character cannot be a digit.
|
|
37
|
+
|
|
38
|
+
## Device family and format matrix
|
|
39
|
+
|
|
40
|
+
`adapteds` contains device option ids, not uniform types. Create/update resolves every id through the current `get_constant.device_type_array` and enforces the same selection families as Console:
|
|
41
|
+
|
|
42
|
+
| Resolved `uniform_type` | Selection | Allowed `model_format` / file |
|
|
43
|
+
|-------------------------|-----------|-------------------------------|
|
|
44
|
+
| `32`, `52` | group may multi-select; cannot mix with other families | `2` / `.tflite` |
|
|
45
|
+
| `36`, `37`, `41` | group may multi-select; cannot mix with other families | `2` / `.tflite` |
|
|
46
|
+
| `26` | Jetson/reComputer entries may multi-select | `3` / `.engine` or `4` / `.pt` |
|
|
47
|
+
| `40` | single selection | `5` / `.cvimodel` |
|
|
48
|
+
| `53` | single selection | Pro matrix below |
|
|
49
|
+
| other | single selection | current format option except `2`; extension follows format |
|
|
50
|
+
|
|
51
|
+
Non-Pro payloads do not submit `ai_framework`, matching Console.
|
|
52
|
+
|
|
53
|
+
## reCamera Pro (`uniform_type=53`)
|
|
54
|
+
|
|
55
|
+
Create/update automatically recognizes Pro from `adapteds`. The resolver remains useful for planning:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
sensecraft-cli model recamera-pro resolve --task <task> [--ai-framework <id>]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Supported task/format matrix
|
|
62
|
+
|
|
63
|
+
| Task id | Meaning | `ai_framework` | Device algorithm | Format / file |
|
|
64
|
+
|---------|---------|----------------|------------------|---------------|
|
|
65
|
+
| `1` | Detection | required; see map below | mapped framework algorithm | `6` / `.rknn` |
|
|
66
|
+
| `2` | Classification | omit | `classify` | `6` / `.rknn` |
|
|
67
|
+
| `4` | Pose | only `2` (YOLOV8) | `yolov8_pose` | `6` / `.rknn` |
|
|
68
|
+
| `6` | Audio | omit | package-defined | `7` / `.alpkg` or `8` / `.zip` |
|
|
69
|
+
| `7` | Tracking | omit | `bytetrack` | `6` / `.rknn` |
|
|
70
|
+
| `3`, `5` | Segmentation, Generation | — | — | hidden/unsupported |
|
|
71
|
+
|
|
72
|
+
### Detection framework map
|
|
73
|
+
|
|
74
|
+
| `ai_framework` id | Device `algorithm` |
|
|
75
|
+
|-------------------|--------------------|
|
|
76
|
+
| `1` | `yolov5` |
|
|
77
|
+
| `2` | `yolov8` |
|
|
78
|
+
| `8` | `yolov5u` |
|
|
79
|
+
| `9` | `yolov10` |
|
|
80
|
+
| `10` | `yolo11` |
|
|
81
|
+
| `11` | `yolo12` |
|
|
82
|
+
| `12` | `yolo26` |
|
|
83
|
+
| `13` | `nanodet` |
|
|
84
|
+
| `14` | `yolox` |
|
|
85
|
+
| `15` | `detr` |
|
|
86
|
+
|
|
87
|
+
The IDs must still exist in the current `get_constant` response. Do not substitute display names for IDs in library payloads.
|
|
88
|
+
|
|
89
|
+
reCamera Pro deployment is local device IP/USB (Console workspace). It does not use cloud `update_stream`; the CLI resolver validates metadata but does not pretend to complete physical deployment.
|
|
90
|
+
|
|
91
|
+
## File & tech metadata
|
|
92
|
+
|
|
93
|
+
| Field | Type | Required | Compliance |
|
|
94
|
+
|-------|------|----------|------------|
|
|
95
|
+
| `file_url` | URL | yes | Via `acquire_file_url` upload (`upload-type` model); http(s); extension must match `model_format` |
|
|
96
|
+
| `checksum` | string | yes in UI | MD5/checksum from upload; keep in sync with `file_url` |
|
|
97
|
+
| `model_size` | number/string | from upload | bytes / display size |
|
|
98
|
+
| `version` | text | yes | exact `major.minor.patch`; major `1–99`, minor/patch `0–99`, no leading zeros; update cannot decrease; unchanged version auto-increments when labels/file changes |
|
|
99
|
+
| `precision` | option | yes | id from `model_precision_array`; CLI rejects unknown ids |
|
|
100
|
+
| `attr.conf` / `attr.iou` | number | Watcher-related | sliders when adapted devices include Watcher |
|
|
101
|
+
|
|
102
|
+
CLI create/update validates the **complete** merged payload (Console save rules) before calling the API: empty/overlong `name`/`description`, missing required fields, invalid option ids (`task`/`scenario`/`precision`/`model_format`), bad labels, device/format matrix, and http(s) `pic_url`/`file_url`. Invalid input → non-zero exit + field-level error (not opaque API text). Sparse update patches are merged with `view_model` first, then validated.
|
|
103
|
+
|
|
104
|
+
## Visibility lifecycle
|
|
105
|
+
|
|
106
|
+
| `be_public` | Meaning |
|
|
107
|
+
|-------------|---------|
|
|
108
|
+
| `0` | Private (My Models). Delete allowed. |
|
|
109
|
+
| `1` | Public library. **Owner** may edit (re-enters review; CLI `edit_model` sends `be_public=1`). Others: deploy-only, no clone/download/edit. |
|
|
110
|
+
| `2` | Under review. Owner may edit; delete hidden until unpublished. |
|
|
111
|
+
|
|
112
|
+
### Update API
|
|
113
|
+
|
|
114
|
+
`POST /model/edit_model` requires **`model_id` and `id`** (same value). CLI `model update` sets both.
|
|
115
|
+
|
|
116
|
+
### Publish API (not the same as apps)
|
|
117
|
+
|
|
118
|
+
`POST /model/publish_model`
|
|
119
|
+
|
|
120
|
+
| Intent | Body |
|
|
121
|
+
|--------|------|
|
|
122
|
+
| Publish to public library | `{ "model_id": <id>, "status": 1 }` |
|
|
123
|
+
| Privatize / unpublish | `{ "model_id": <id>, "status": 0 }` |
|
|
124
|
+
|
|
125
|
+
`model_id` must be a **JSON number** (e.g. `63758`, not `"63758"`). CLI converts a numeric `--id` before POST. String `model_id` returns aiserver **11202**.
|
|
126
|
+
|
|
127
|
+
**L2 user confirmation required.** Do not confuse with app `edit_privacy_app` (`privacy` 2/0).
|
|
128
|
+
|
|
129
|
+
## Download & invoke
|
|
130
|
+
|
|
131
|
+
| Path | Who | Behavior |
|
|
132
|
+
|------|-----|----------|
|
|
133
|
+
| Detail `file_url` | **Private owner** download in UI / CLI | Console: owner-only file box. CLI: `model download` only when `be_public=0`. Public list/view **omit** `file_url`. |
|
|
134
|
+
| `GET /model/apply_model` | Deploy pipelines (device pull) | Snapshot URL for device apply — **not** a user-facing download for public models. Jetson: `cloud deploy`. reCamera Pro: Console local L3. |
|
|
135
|
+
| CodeCraft | External | If detail or product config exposes workspace/compile invoke links, **return them to the user**. This skill does **not** run CodeCraft compilation. Bases (prod/test) live in Console `envApi` (`codecraftHomeUrl` / `codecraftWorkspaceUrl`). |
|
|
136
|
+
|
|
137
|
+
## Delete
|
|
138
|
+
|
|
139
|
+
`POST /model/delete_model` with `{ model_id }` — **L2 confirm**; owner **private** only (`be_public=0`). Published / under-review: `model unpublish` first.
|