Skip to content
pi-c Changes To checkin/88759093c7e4988a7bbfb32ad60e2eb000da032f691c7707eb0c055908716a13
Login

Changes To checkin/88759093c7e4988a7bbfb32ad60e2eb000da032f691c7707eb0c055908716a13

Initial version of "checkin/88759093c7e4988a7bbfb32ad60e2eb000da032f691c7707eb0c055908716a13"







































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# /auth step 6 (#75): profiles, and the /auth list on the phone

## Profiles

A profile is the setting `profile:NAME` = `{"model", "key"?, "thinking"?}`, kept in userdb.c
(`pic_profile_get`, `pic_profile_set`, `pic_profiles_each`).

- `pic profiles [list] | set NAME --model M [--key L] [--thinking T] | remove NAME`, each with
  `[--json]`. A name is 1-32 of a-z, 0-9, `-` and `_`, and may not be a provider's name. A key
  the model's provider lacks is refused.
- `--model NAME` with no `/` uses the profile: its model, plus its key and thinking level unless
  `--key` or `--thinking` is given. The level is clamped to what the model takes.
- TUI `/model NAME` (asks `get_profiles`), RPC `set_model {profile}`, and `get_profiles` in the
  registry.

## On the phone (pic remote)

- Answered through the registry: `get_credentials`, `check_credentials` and `get_profiles`.
  These return names, kinds, states, what is left, expiry and rules, never a key.
  `check_credentials` runs on the computer, inside pic remote's loop, for up to the 8-second check
  deadline.
- `set_credential` is held per conversation (`rmt_choice.key`), as `set_model` is, and passed to
  that conversation's next run as `--key`. With `persist: true` it becomes the provider's saved key.
- `set_model {profile}` sets the model, key and level together.
- `get_state` gains `credential` (provider:label): the phone's choice, else the conversation's own.
- Not carried (answered `not_available`): add_credential, command keys, removing a key, rules,
  expiry and unlock.
- docs/design/remote-protocol.md: a new subsection "Keys and profiles" and two command-table rows.
  It is byte-identical to pic-relay's docs/remote-protocol.md (pic-relay branch auth-6).

## Tests

- authcmd.sh: profiles over the shell and RPC.
- remote.sh: phone get_credentials, set_credential (held, and a missing label refused), get_state
  credential, get_profiles, set_model profile, and no key reaching the phone.

Tier: core (userdb.c, rpc.c), bundled (remote.c), root (main.c), client (tui); no new file. Clock:
pi. Record: settings `profile:NAME`. Default: no profiles.