@faces-sh/cli 0.0.0-stage → 1.0.1

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.
Files changed (290) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -2
  3. package/bin/dev.js +5 -0
  4. package/bin/run.js +5 -0
  5. package/dist/base.d.ts +26 -0
  6. package/dist/base.js +181 -0
  7. package/dist/benchmark.d.ts +21 -0
  8. package/dist/benchmark.js +95 -0
  9. package/dist/billing.d.ts +17 -0
  10. package/dist/billing.js +101 -0
  11. package/dist/catalog.d.ts +35 -0
  12. package/dist/catalog.js +242 -0
  13. package/dist/client.d.ts +98 -0
  14. package/dist/client.js +590 -0
  15. package/dist/commands/account/preferences.d.ts +20 -0
  16. package/dist/commands/account/preferences.js +190 -0
  17. package/dist/commands/account/state.d.ts +11 -0
  18. package/dist/commands/account/state.js +24 -0
  19. package/dist/commands/auth/connect.d.ts +17 -0
  20. package/dist/commands/auth/connect.js +190 -0
  21. package/dist/commands/auth/connections.d.ts +12 -0
  22. package/dist/commands/auth/connections.js +40 -0
  23. package/dist/commands/auth/disconnect.d.ts +15 -0
  24. package/dist/commands/auth/disconnect.js +49 -0
  25. package/dist/commands/auth/login.d.ts +13 -0
  26. package/dist/commands/auth/login.js +42 -0
  27. package/dist/commands/auth/logout.d.ts +11 -0
  28. package/dist/commands/auth/logout.js +14 -0
  29. package/dist/commands/auth/refresh.d.ts +11 -0
  30. package/dist/commands/auth/refresh.js +30 -0
  31. package/dist/commands/auth/register.d.ts +15 -0
  32. package/dist/commands/auth/register.js +98 -0
  33. package/dist/commands/auth/whoami.d.ts +11 -0
  34. package/dist/commands/auth/whoami.js +108 -0
  35. package/dist/commands/benchmark/get.d.ts +16 -0
  36. package/dist/commands/benchmark/get.js +42 -0
  37. package/dist/commands/benchmark/list.d.ts +13 -0
  38. package/dist/commands/benchmark/list.js +47 -0
  39. package/dist/commands/benchmark/start.d.ts +22 -0
  40. package/dist/commands/benchmark/start.js +80 -0
  41. package/dist/commands/billing/balance.d.ts +11 -0
  42. package/dist/commands/billing/balance.js +27 -0
  43. package/dist/commands/billing/card/default.d.ts +15 -0
  44. package/dist/commands/billing/card/default.js +33 -0
  45. package/dist/commands/billing/card/remove.d.ts +16 -0
  46. package/dist/commands/billing/card/remove.js +41 -0
  47. package/dist/commands/billing/card-setup.d.ts +13 -0
  48. package/dist/commands/billing/card-setup.js +41 -0
  49. package/dist/commands/billing/cards.d.ts +11 -0
  50. package/dist/commands/billing/cards.js +34 -0
  51. package/dist/commands/billing/llm-costs.d.ts +14 -0
  52. package/dist/commands/billing/llm-costs.js +95 -0
  53. package/dist/commands/billing/subscription/activate.d.ts +14 -0
  54. package/dist/commands/billing/subscription/activate.js +91 -0
  55. package/dist/commands/billing/subscription/cancel.d.ts +12 -0
  56. package/dist/commands/billing/subscription/cancel.js +54 -0
  57. package/dist/commands/billing/subscription/index.d.ts +11 -0
  58. package/dist/commands/billing/subscription/index.js +46 -0
  59. package/dist/commands/billing/subscription/plan.d.ts +16 -0
  60. package/dist/commands/billing/subscription/plan.js +86 -0
  61. package/dist/commands/billing/topup.d.ts +16 -0
  62. package/dist/commands/billing/topup.js +60 -0
  63. package/dist/commands/billing/usage.d.ts +15 -0
  64. package/dist/commands/billing/usage.js +68 -0
  65. package/dist/commands/catalog/backup.d.ts +11 -0
  66. package/dist/commands/catalog/backup.js +169 -0
  67. package/dist/commands/catalog/doctor.d.ts +14 -0
  68. package/dist/commands/catalog/doctor.js +303 -0
  69. package/dist/commands/catalog/list.d.ts +11 -0
  70. package/dist/commands/catalog/list.js +39 -0
  71. package/dist/commands/catalog/restore.d.ts +17 -0
  72. package/dist/commands/catalog/restore.js +259 -0
  73. package/dist/commands/causes.d.ts +27 -0
  74. package/dist/commands/causes.js +135 -0
  75. package/dist/commands/chat/chat.d.ts +42 -0
  76. package/dist/commands/chat/chat.js +363 -0
  77. package/dist/commands/chat/messages.d.ts +26 -0
  78. package/dist/commands/chat/messages.js +139 -0
  79. package/dist/commands/chat/responses.d.ts +27 -0
  80. package/dist/commands/chat/responses.js +150 -0
  81. package/dist/commands/chat/thread.d.ts +43 -0
  82. package/dist/commands/chat/thread.js +458 -0
  83. package/dist/commands/compile/all.d.ts +14 -0
  84. package/dist/commands/compile/all.js +186 -0
  85. package/dist/commands/compile/doc/create.d.ts +19 -0
  86. package/dist/commands/compile/doc/create.js +58 -0
  87. package/dist/commands/compile/doc/delete.d.ts +15 -0
  88. package/dist/commands/compile/doc/delete.js +33 -0
  89. package/dist/commands/compile/doc/edit.d.ts +19 -0
  90. package/dist/commands/compile/doc/edit.js +59 -0
  91. package/dist/commands/compile/doc/get.d.ts +15 -0
  92. package/dist/commands/compile/doc/get.js +43 -0
  93. package/dist/commands/compile/doc/index.d.ts +24 -0
  94. package/dist/commands/compile/doc/index.js +211 -0
  95. package/dist/commands/compile/doc/list.d.ts +15 -0
  96. package/dist/commands/compile/doc/list.js +46 -0
  97. package/dist/commands/compile/doc/make.d.ts +17 -0
  98. package/dist/commands/compile/doc/make.js +95 -0
  99. package/dist/commands/compile/doc/pause.d.ts +17 -0
  100. package/dist/commands/compile/doc/pause.js +74 -0
  101. package/dist/commands/compile/doc/reset.d.ts +15 -0
  102. package/dist/commands/compile/doc/reset.js +33 -0
  103. package/dist/commands/compile/import.d.ts +20 -0
  104. package/dist/commands/compile/import.js +138 -0
  105. package/dist/commands/compile/stats.d.ts +11 -0
  106. package/dist/commands/compile/stats.js +75 -0
  107. package/dist/commands/compile/status.d.ts +17 -0
  108. package/dist/commands/compile/status.js +110 -0
  109. package/dist/commands/compile/thread/create.d.ts +16 -0
  110. package/dist/commands/compile/thread/create.js +42 -0
  111. package/dist/commands/compile/thread/delete.d.ts +15 -0
  112. package/dist/commands/compile/thread/delete.js +33 -0
  113. package/dist/commands/compile/thread/edit.d.ts +19 -0
  114. package/dist/commands/compile/thread/edit.js +120 -0
  115. package/dist/commands/compile/thread/get.d.ts +15 -0
  116. package/dist/commands/compile/thread/get.js +48 -0
  117. package/dist/commands/compile/thread/list.d.ts +14 -0
  118. package/dist/commands/compile/thread/list.js +38 -0
  119. package/dist/commands/compile/thread/make.d.ts +17 -0
  120. package/dist/commands/compile/thread/make.js +87 -0
  121. package/dist/commands/compile/thread/message.d.ts +16 -0
  122. package/dist/commands/compile/thread/message.js +43 -0
  123. package/dist/commands/compile/thread/pause.d.ts +17 -0
  124. package/dist/commands/compile/thread/pause.js +75 -0
  125. package/dist/commands/compile/thread/replace.d.ts +27 -0
  126. package/dist/commands/compile/thread/replace.js +114 -0
  127. package/dist/commands/compile/thread/reset.d.ts +15 -0
  128. package/dist/commands/compile/thread/reset.js +33 -0
  129. package/dist/commands/compile/upload.d.ts +21 -0
  130. package/dist/commands/compile/upload.js +162 -0
  131. package/dist/commands/config/clear.d.ts +12 -0
  132. package/dist/commands/config/clear.js +17 -0
  133. package/dist/commands/config/set.d.ts +15 -0
  134. package/dist/commands/config/set.js +43 -0
  135. package/dist/commands/config/show.d.ts +11 -0
  136. package/dist/commands/config/show.js +19 -0
  137. package/dist/commands/decide.d.ts +35 -0
  138. package/dist/commands/decide.js +242 -0
  139. package/dist/commands/face/attributes.d.ts +11 -0
  140. package/dist/commands/face/attributes.js +44 -0
  141. package/dist/commands/face/avatar/delete.d.ts +15 -0
  142. package/dist/commands/face/avatar/delete.js +38 -0
  143. package/dist/commands/face/avatar/get.d.ts +20 -0
  144. package/dist/commands/face/avatar/get.js +100 -0
  145. package/dist/commands/face/avatar/list.d.ts +14 -0
  146. package/dist/commands/face/avatar/list.js +56 -0
  147. package/dist/commands/face/avatar/make.d.ts +16 -0
  148. package/dist/commands/face/avatar/make.js +64 -0
  149. package/dist/commands/face/avatar/upload.d.ts +15 -0
  150. package/dist/commands/face/avatar/upload.js +67 -0
  151. package/dist/commands/face/create.d.ts +23 -0
  152. package/dist/commands/face/create.js +122 -0
  153. package/dist/commands/face/delete.d.ts +15 -0
  154. package/dist/commands/face/delete.js +39 -0
  155. package/dist/commands/face/diff.d.ts +12 -0
  156. package/dist/commands/face/diff.js +50 -0
  157. package/dist/commands/face/edit.d.ts +25 -0
  158. package/dist/commands/face/edit.js +155 -0
  159. package/dist/commands/face/get.d.ts +16 -0
  160. package/dist/commands/face/get.js +145 -0
  161. package/dist/commands/face/groups.d.ts +15 -0
  162. package/dist/commands/face/groups.js +34 -0
  163. package/dist/commands/face/list.d.ts +23 -0
  164. package/dist/commands/face/list.js +168 -0
  165. package/dist/commands/face/lock.d.ts +15 -0
  166. package/dist/commands/face/lock.js +35 -0
  167. package/dist/commands/face/neighbors.d.ts +16 -0
  168. package/dist/commands/face/neighbors.js +63 -0
  169. package/dist/commands/face/publish.d.ts +16 -0
  170. package/dist/commands/face/publish.js +43 -0
  171. package/dist/commands/face/share.d.ts +22 -0
  172. package/dist/commands/face/share.js +104 -0
  173. package/dist/commands/face/sources.d.ts +21 -0
  174. package/dist/commands/face/sources.js +169 -0
  175. package/dist/commands/face/stats.d.ts +12 -0
  176. package/dist/commands/face/stats.js +46 -0
  177. package/dist/commands/face/tag/add.d.ts +15 -0
  178. package/dist/commands/face/tag/add.js +40 -0
  179. package/dist/commands/face/tag/all.d.ts +11 -0
  180. package/dist/commands/face/tag/all.js +31 -0
  181. package/dist/commands/face/tag/list.d.ts +14 -0
  182. package/dist/commands/face/tag/list.js +36 -0
  183. package/dist/commands/face/tag/remove.d.ts +16 -0
  184. package/dist/commands/face/tag/remove.js +44 -0
  185. package/dist/commands/face/tag/set.d.ts +15 -0
  186. package/dist/commands/face/tag/set.js +40 -0
  187. package/dist/commands/face/unlock.d.ts +15 -0
  188. package/dist/commands/face/unlock.js +35 -0
  189. package/dist/commands/face/unpublish.d.ts +14 -0
  190. package/dist/commands/face/unpublish.js +32 -0
  191. package/dist/commands/face/unshare.d.ts +18 -0
  192. package/dist/commands/face/unshare.js +66 -0
  193. package/dist/commands/fidelity/get.d.ts +15 -0
  194. package/dist/commands/fidelity/get.js +42 -0
  195. package/dist/commands/fidelity/pick.d.ts +19 -0
  196. package/dist/commands/fidelity/pick.js +70 -0
  197. package/dist/commands/fidelity/run.d.ts +20 -0
  198. package/dist/commands/fidelity/run.js +99 -0
  199. package/dist/commands/fidelity/save-thread.d.ts +15 -0
  200. package/dist/commands/fidelity/save-thread.js +35 -0
  201. package/dist/commands/fidelity/start.d.ts +17 -0
  202. package/dist/commands/fidelity/start.js +56 -0
  203. package/dist/commands/fidelity/turn.d.ts +17 -0
  204. package/dist/commands/fidelity/turn.js +48 -0
  205. package/dist/commands/group/add.d.ts +16 -0
  206. package/dist/commands/group/add.js +83 -0
  207. package/dist/commands/group/create.d.ts +16 -0
  208. package/dist/commands/group/create.js +68 -0
  209. package/dist/commands/group/delete.d.ts +15 -0
  210. package/dist/commands/group/delete.js +39 -0
  211. package/dist/commands/group/edit.d.ts +18 -0
  212. package/dist/commands/group/edit.js +75 -0
  213. package/dist/commands/group/get.d.ts +14 -0
  214. package/dist/commands/group/get.js +29 -0
  215. package/dist/commands/group/list.d.ts +11 -0
  216. package/dist/commands/group/list.js +39 -0
  217. package/dist/commands/group/members.d.ts +15 -0
  218. package/dist/commands/group/members.js +68 -0
  219. package/dist/commands/group/remove.d.ts +15 -0
  220. package/dist/commands/group/remove.js +55 -0
  221. package/dist/commands/group/tag/add.d.ts +15 -0
  222. package/dist/commands/group/tag/add.js +30 -0
  223. package/dist/commands/group/tag/list.d.ts +14 -0
  224. package/dist/commands/group/tag/list.js +36 -0
  225. package/dist/commands/group/tag/remove.d.ts +15 -0
  226. package/dist/commands/group/tag/remove.js +30 -0
  227. package/dist/commands/group/tag/set.d.ts +15 -0
  228. package/dist/commands/group/tag/set.js +30 -0
  229. package/dist/commands/keys/create.d.ts +17 -0
  230. package/dist/commands/keys/create.js +72 -0
  231. package/dist/commands/keys/list.d.ts +11 -0
  232. package/dist/commands/keys/list.js +24 -0
  233. package/dist/commands/keys/revoke.d.ts +15 -0
  234. package/dist/commands/keys/revoke.js +49 -0
  235. package/dist/commands/keys/update.d.ts +17 -0
  236. package/dist/commands/keys/update.js +41 -0
  237. package/dist/commands/models/list.d.ts +15 -0
  238. package/dist/commands/models/list.js +98 -0
  239. package/dist/commands/session/close.d.ts +16 -0
  240. package/dist/commands/session/close.js +36 -0
  241. package/dist/commands/session/compact.d.ts +15 -0
  242. package/dist/commands/session/compact.js +58 -0
  243. package/dist/commands/session/create.d.ts +15 -0
  244. package/dist/commands/session/create.js +45 -0
  245. package/dist/commands/session/get.d.ts +15 -0
  246. package/dist/commands/session/get.js +34 -0
  247. package/dist/commands/style/delete.d.ts +19 -0
  248. package/dist/commands/style/delete.js +94 -0
  249. package/dist/commands/style/make.d.ts +28 -0
  250. package/dist/commands/style/make.js +298 -0
  251. package/dist/commands/style/revert.d.ts +17 -0
  252. package/dist/commands/style/revert.js +66 -0
  253. package/dist/commands/style/status.d.ts +20 -0
  254. package/dist/commands/style/status.js +109 -0
  255. package/dist/commands/style/upload.d.ts +19 -0
  256. package/dist/commands/style/upload.js +100 -0
  257. package/dist/commands/style/versions.d.ts +15 -0
  258. package/dist/commands/style/versions.js +104 -0
  259. package/dist/commands/user/follow.d.ts +14 -0
  260. package/dist/commands/user/follow.js +38 -0
  261. package/dist/commands/user/followers.d.ts +14 -0
  262. package/dist/commands/user/followers.js +50 -0
  263. package/dist/commands/user/following.d.ts +14 -0
  264. package/dist/commands/user/following.js +50 -0
  265. package/dist/commands/user/get.d.ts +14 -0
  266. package/dist/commands/user/get.js +49 -0
  267. package/dist/commands/user/unfollow.d.ts +14 -0
  268. package/dist/commands/user/unfollow.js +38 -0
  269. package/dist/config.d.ts +32 -0
  270. package/dist/config.js +139 -0
  271. package/dist/decisions.d.ts +42 -0
  272. package/dist/decisions.js +262 -0
  273. package/dist/fidelity.d.ts +50 -0
  274. package/dist/fidelity.js +92 -0
  275. package/dist/group-catalog.d.ts +22 -0
  276. package/dist/group-catalog.js +133 -0
  277. package/dist/paths.d.ts +1 -0
  278. package/dist/paths.js +8 -0
  279. package/dist/poll.d.ts +26 -0
  280. package/dist/poll.js +75 -0
  281. package/dist/routing.d.ts +15 -0
  282. package/dist/routing.js +135 -0
  283. package/dist/session.d.ts +14 -0
  284. package/dist/session.js +18 -0
  285. package/dist/style.d.ts +46 -0
  286. package/dist/style.js +285 -0
  287. package/dist/utils.d.ts +149 -0
  288. package/dist/utils.js +865 -0
  289. package/oclif.manifest.json +11070 -0
  290. package/package.json +127 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Headwaters Lab Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,159 @@
1
- # Temporary Holding Version
1
+ # Faces CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Command-line interface for [Faces](https://faces.sh). Faces are causal models: compile one from an
4
+ author's source texts, and when prompted it returns a **cause**, the principal *why* behind that
5
+ author's response in context. Get the cause alone, or let it steer any supported model through the
6
+ chat and decision wrappers.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install -g @faces-sh/cli
12
+ ```
13
+
14
+ Requires Node.js >= 18. Formerly published as `faces-cli`.
15
+
16
+ ## Quick start
17
+
18
+ ```bash
19
+ # Register or log in: you will be asked for your password
20
+ faces auth:register --email you@example.com --username you
21
+ faces auth:login --email you@example.com
22
+
23
+ # Create a face
24
+ faces face:create --name "Alice" --alias alice --default-model gpt-5.4-mini \
25
+ --attr gender=woman --attr age=29 --attr occupation="Works as a product designer."
26
+
27
+ # Add source texts and compile: her own writing as a document, an interview as a thread
28
+ faces compile:doc alice --file essay.txt --medium essay
29
+ faces compile:upload alice --file interview.txt --kind thread --face-speaker Alice
30
+
31
+ # The cause alone
32
+ faces causes alice -m "Should I take the offer?"
33
+
34
+ # Chat: the face's cause steers the model's answer
35
+ faces chat:chat alice -m "What matters most to you?"
36
+ faces chat:chat alice -m "Tell me more" --llm claude-sonnet-4-6 --show-cause
37
+
38
+ # Decide: typed answers, with a cause per question
39
+ faces decide alice --state "A colleague asks you to sign a proposal you have not read." \
40
+ --question "Does the speaker sign?"
41
+
42
+ # Compare and compose
43
+ faces face:diff --face alice --face bob
44
+ faces face:create --name "Alice-Bob" --alias alice-bob --formula "alice | bob"
45
+ ```
46
+
47
+ ## Commands
48
+
49
+ ```
50
+ faces auth:login / logout / register / whoami / refresh
51
+ faces auth:connect / disconnect / connections
52
+
53
+ faces face:create / list / get / edit / delete / stats / attributes / sources
54
+ faces face:diff / neighbors / lock / unlock / publish / unpublish / share / unshare / groups
55
+ faces face:avatar:list / get / make / upload / delete
56
+ faces face:tag:add / list / remove / set / all
57
+
58
+ faces causes # a face's cause alone
59
+ faces chat:chat / messages / responses / thread
60
+ faces decide # what a face would decide: yes/no, a choice, or a score
61
+ faces session:create / get / compact / close
62
+
63
+ faces compile:doc / compile:doc:create / list / get / edit / make / pause / reset / delete
64
+ faces compile:thread:create / list / get / edit / message / replace / make / pause / reset / delete
65
+ faces compile:upload / import / all / status / stats
66
+
67
+ faces style:upload / make / status / versions / revert / delete
68
+
69
+ faces models:list # the models you can name; --kind takes a list, or all
70
+ faces benchmark:start / get / list
71
+ faces fidelity:start / turn / pick / get / run / save-thread
72
+
73
+ faces group:create / list / get / edit / delete / members / add / remove
74
+ faces group:tag:add / list / remove / set
75
+ faces user:get / follow / unfollow / followers / following
76
+
77
+ faces catalog:list / doctor / backup / restore
78
+
79
+ faces keys:create / list / revoke / update
80
+
81
+ faces billing:balance / usage / llm-costs / topup / cards / card-setup / card:default / card:remove
82
+ faces billing:subscription / subscription:activate / subscription:plan / subscription:cancel
83
+
84
+ faces account:state / preferences
85
+
86
+ faces config:set / show / clear
87
+ ```
88
+
89
+ Run `faces <command> --help` for details on any command. Every command takes `--json`, and
90
+ `--toon` for a more compact encoding of the same data.
91
+
92
+ ## Documents and threads
93
+
94
+ A **document** is the face's own writing: an essay, a letter, a paper, a book, a poem. Every word
95
+ in it is read as the face's. Writing about the face by someone else can also be a document, with
96
+ `--perspective third-person`.
97
+
98
+ An interview, transcript, dialogue or any other exchange between speakers is a **thread**. Upload
99
+ it with `--kind thread` and `--face-speaker` naming the face, so only the face's turns are used:
100
+
101
+ ```bash
102
+ faces compile:upload alice --file interview.txt --kind thread --face-speaker Alice
103
+ faces compile:upload alice --file podcast.mp3 --kind thread --face-speaker A
104
+ ```
105
+
106
+ A labelled dialogue uploaded as a document is read as entirely the face's own words, other
107
+ speakers included. The document commands warn when a text file reads as a transcript.
108
+
109
+ ## Styles
110
+
111
+ A style is built from a face's own writing in one medium, and applied on chat with `--style`:
112
+
113
+ ```bash
114
+ faces style:make alice --all
115
+ faces chat:chat alice -m "Reply to the note below." --style email
116
+ ```
117
+
118
+ `--medium` says what the reply is without applying a built style. A style adds roughly 2,000 to
119
+ 3,500 input tokens per request.
120
+
121
+ A build runs at no charge on Connect or Pro with a linked ChatGPT account. Anywhere else it is
122
+ charged to credits at the build model's listed price, so `style:make` needs `--allow-paid`.
123
+
124
+ ## Sessions
125
+
126
+ A session groups the turns of one conversation with one face. Compacting it returns a summary
127
+ under a compaction id, which a later request reads in place of the history you no longer send.
128
+
129
+ ```bash
130
+ faces session:create alice
131
+ faces chat:chat alice -m "Should I take the offer?" --session fs_SESSION_ID
132
+ faces session:compact fs_SESSION_ID
133
+ faces chat:chat alice -m "So what do I tell them tomorrow?" --compaction fcmp_COMPACTION_ID
134
+ ```
135
+
136
+ ## Authentication
137
+
138
+ Login stores a JWT at `~/.faces/config.json`. You can also authenticate with environment variables:
139
+
140
+ ```bash
141
+ export FACES_API_KEY=sk-faces-...
142
+ export FACES_TOKEN=your_jwt
143
+ export FACES_BASE_URL=https://api.faces.sh # optional override
144
+ ```
145
+
146
+ ## Plans
147
+
148
+ - **Free**: a $5 activation, added as credits. Everything is paid as it goes, from credits.
149
+ - **Connect** ($17/month) and **Pro** ($49/month): monthly compile and cause allowances. Link a
150
+ ChatGPT account with `faces auth:connect openai`, and Codex-eligible models
151
+ (`faces models:list --chatgpt`) run on the ChatGPT plan at `/v1/responses`. The cause is still billed, from the
152
+ allowance and then credits.
153
+
154
+ Answering models are charged at the model's listed price plus 5%. Current prices: `faces models:list`
155
+ and `faces billing:llm-costs`.
156
+
157
+ ## License
158
+
159
+ MIT. Copyright (c) 2026 Headwaters Lab Inc.
package/bin/dev.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({development: true, dir: import.meta.url})
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({development: false, dir: import.meta.url})
package/dist/base.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { Command } from '@oclif/core';
2
+ import { FacesClient } from './client.js';
3
+ export declare abstract class BaseCommand extends Command {
4
+ static enableJsonFlag: boolean;
5
+ static baseFlags: {
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ protected toonEnabled(): boolean;
12
+ jsonEnabled(): boolean;
13
+ logJson(json: unknown): void;
14
+ protected makeClient(flags: {
15
+ 'base-url'?: string;
16
+ token?: string;
17
+ 'api-key'?: string;
18
+ }, _requireJwt?: boolean): FacesClient;
19
+ private apiClient?;
20
+ catch(err: Error & {
21
+ exitCode?: number;
22
+ }): Promise<unknown>;
23
+ protected confirmOrRefuse(message: string, yes: boolean): Promise<void>;
24
+ protected secretOrPrompt(value: string | undefined, flag: string, label: string): Promise<string>;
25
+ protected printHuman(data: unknown, indent?: number): void;
26
+ }
package/dist/base.js ADDED
@@ -0,0 +1,181 @@
1
+ import { createInterface } from 'node:readline';
2
+ import { Command, Flags, ux } from '@oclif/core';
3
+ import { encode as encodeToon } from '@toon-format/toon';
4
+ import { FacesAPIError, FacesClient } from './client.js';
5
+ import { resolveBaseUrl, resolveCredentials } from './config.js';
6
+ import { compileFieldLine } from './utils.js';
7
+ export class BaseCommand extends Command {
8
+ static enableJsonFlag = true;
9
+ static baseFlags = {
10
+ 'base-url': Flags.string({
11
+ description: 'API base URL',
12
+ env: 'FACES_BASE_URL',
13
+ }),
14
+ token: Flags.string({
15
+ description: 'JWT bearer token',
16
+ env: 'FACES_TOKEN',
17
+ }),
18
+ 'api-key': Flags.string({
19
+ description: 'API key',
20
+ env: 'FACES_API_KEY',
21
+ }),
22
+ toon: Flags.boolean({
23
+ description: 'Format output as TOON instead of JSON: the same data and field names in a more compact ' +
24
+ 'encoding, for agents that pay for their input. Measured across this CLI it is about 40% fewer ' +
25
+ 'tokens than --json.',
26
+ default: false,
27
+ exclusive: ['json'],
28
+ }),
29
+ };
30
+ toonEnabled() {
31
+ const passThrough = this.argv.indexOf('--');
32
+ const i = this.argv.indexOf('--toon');
33
+ if (i === -1)
34
+ return false;
35
+ if (this.argv.includes('--json'))
36
+ return false;
37
+ return passThrough === -1 || i < passThrough;
38
+ }
39
+ jsonEnabled() {
40
+ return this.toonEnabled() || super.jsonEnabled();
41
+ }
42
+ logJson(json) {
43
+ if (this.toonEnabled()) {
44
+ ux.stdout(encodeToon(json));
45
+ return;
46
+ }
47
+ super.logJson(json);
48
+ }
49
+ makeClient(flags, _requireJwt = false) {
50
+ const baseUrl = resolveBaseUrl(flags['base-url']);
51
+ const { token, apiKey, withheld, keySaved } = resolveCredentials(flags, baseUrl);
52
+ this.apiClient = new FacesClient(baseUrl, token, apiKey, withheld, keySaved);
53
+ return this.apiClient;
54
+ }
55
+ apiClient;
56
+ async catch(err) {
57
+ if (this.jsonEnabled()) {
58
+ const code = err.oclif?.exit ?? err.exitCode ?? 1;
59
+ const error = { message: err.message, code };
60
+ const api = err instanceof FacesAPIError ? err : this.apiClient?.lastError;
61
+ if (api) {
62
+ error.status = api.statusCode;
63
+ if (api.errorCode)
64
+ error.error_code = api.errorCode;
65
+ if (api.fallbackAvailable !== undefined)
66
+ error.fallback_available = api.fallbackAvailable;
67
+ if (api.retryAfter !== undefined)
68
+ error.retry_after = api.retryAfter;
69
+ if (typeof api.details?.rush_premium_usd === 'number')
70
+ error.rush_premium_usd = api.details.rush_premium_usd;
71
+ if (typeof api.details?.estimated_usd === 'number')
72
+ error.estimated_usd = api.details.estimated_usd;
73
+ if (typeof api.details?.balance_usd === 'number')
74
+ error.balance_usd = api.details.balance_usd;
75
+ }
76
+ const payload = { error };
77
+ process.stdout.write((this.toonEnabled() ? encodeToon(payload) : JSON.stringify(payload)) + '\n');
78
+ process.exit(code);
79
+ }
80
+ throw err;
81
+ }
82
+ async confirmOrRefuse(message, yes) {
83
+ if (yes)
84
+ return;
85
+ if (this.jsonEnabled() || !process.stdin.isTTY) {
86
+ this.error(`${message}\nRe-run with --yes to confirm. Nothing was changed.`);
87
+ }
88
+ const answer = await new Promise((resolve) => {
89
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
90
+ rl.question(`${message} [y/N] `, (a) => {
91
+ rl.close();
92
+ resolve(a);
93
+ });
94
+ });
95
+ if (answer.trim().toLowerCase() !== 'y')
96
+ this.error('Aborted. Nothing was changed.');
97
+ }
98
+ async secretOrPrompt(value, flag, label) {
99
+ if (value !== undefined)
100
+ return value;
101
+ if (!process.stdin.isTTY || typeof process.stdin.setRawMode !== 'function') {
102
+ this.error(`--${flag} is required when not running in a terminal.`);
103
+ }
104
+ const typed = await new Promise((resolve) => {
105
+ const stdin = process.stdin;
106
+ let buf = '';
107
+ process.stderr.write(`${label}: `);
108
+ stdin.setRawMode(true);
109
+ stdin.resume();
110
+ stdin.setEncoding('utf8');
111
+ const done = (result) => {
112
+ stdin.setRawMode(false);
113
+ stdin.pause();
114
+ stdin.removeListener('data', onData);
115
+ process.stderr.write('\n');
116
+ resolve(result);
117
+ };
118
+ const onData = (chunk) => {
119
+ for (const ch of chunk) {
120
+ if (ch === '\r' || ch === '\n' || ch === '\u0004')
121
+ return done(buf);
122
+ if (ch === '\u0003')
123
+ return done(null);
124
+ if (ch === '\u007f' || ch === '\b')
125
+ buf = buf.slice(0, -1);
126
+ else if (ch >= ' ')
127
+ buf += ch;
128
+ }
129
+ };
130
+ stdin.on('data', onData);
131
+ });
132
+ if (typed === null)
133
+ this.error('Aborted.');
134
+ if (typed === '')
135
+ this.error(`No ${label.toLowerCase()} entered.`);
136
+ return typed;
137
+ }
138
+ printHuman(data, indent = 0) {
139
+ const prefix = ' '.repeat(indent);
140
+ if (Array.isArray(data)) {
141
+ if (data.length === 0) {
142
+ this.log(`${prefix}(empty)`);
143
+ return;
144
+ }
145
+ if (data.every((v) => v === null || typeof v !== 'object')) {
146
+ this.log(`${prefix}[${data.map((v) => String(v)).join(', ')}]`);
147
+ return;
148
+ }
149
+ for (const [i, item] of data.entries()) {
150
+ this.log(`${prefix}[${i}]`);
151
+ this.printHuman(item, indent + 1);
152
+ }
153
+ }
154
+ else if (data !== null && typeof data === 'object') {
155
+ for (const [k, v] of Object.entries(data)) {
156
+ if (k === 'read_only') {
157
+ if (v)
158
+ this.log(`${prefix}read only`);
159
+ continue;
160
+ }
161
+ const line = compileFieldLine(k, v);
162
+ if (line === null)
163
+ continue;
164
+ if (line !== undefined) {
165
+ this.log(`${prefix}${line}`);
166
+ continue;
167
+ }
168
+ if (v !== null && typeof v === 'object') {
169
+ this.log(`${prefix}${k}:`);
170
+ this.printHuman(v, indent + 1);
171
+ }
172
+ else {
173
+ this.log(`${prefix}${k}: ${v}`);
174
+ }
175
+ }
176
+ }
177
+ else {
178
+ this.log(`${prefix}${data}`);
179
+ }
180
+ }
181
+ }
@@ -0,0 +1,21 @@
1
+ import { FacesAPIError, FacesClient } from './client.js';
2
+ export declare const BENCHMARK_RUNS = "/v1/benchmark/runs";
3
+ export interface BenchmarkRun {
4
+ run_id: string;
5
+ self_face?: string;
6
+ status?: string;
7
+ model?: string;
8
+ reference_model?: string;
9
+ progress?: {
10
+ rounds_done?: number;
11
+ rounds_total?: number;
12
+ } | null;
13
+ result?: Record<string, unknown> | null;
14
+ error?: string | null;
15
+ created_at?: string | null;
16
+ }
17
+ export declare function resultLines(r: Record<string, unknown>): string[];
18
+ export declare function runLines(run: BenchmarkRun): string[];
19
+ export declare function benchmarkHint(err: FacesAPIError, face?: string): string | undefined;
20
+ export declare function benchmarkError(err: FacesAPIError, face?: string): string;
21
+ export declare function followRun(client: FacesClient, id: string, onProgress: (line: string) => unknown): Promise<BenchmarkRun>;
@@ -0,0 +1,95 @@
1
+ import { seg, usd } from './utils.js';
2
+ export const BENCHMARK_RUNS = '/v1/benchmark/runs';
3
+ const num = (v, places = 2) => (typeof v === 'number' && Number.isFinite(v) ? v.toFixed(places) : '-');
4
+ const signed = (v) => (typeof v === 'number' && Number.isFinite(v) ? `${v >= 0 ? '+' : ''}${v.toFixed(2)}` : '-');
5
+ function interval(ci) {
6
+ const c = ci;
7
+ if (!c)
8
+ return '';
9
+ return ` (95% interval ${signed(c.lo)} to ${signed(c.hi)}${c.resolved ? '' : ', too close to call'})`;
10
+ }
11
+ function winnerOf(w) {
12
+ return w === 'face' ? 'the face' : w === 'reference' ? 'the reference model' : 'neither, too close to call';
13
+ }
14
+ function sliceLine(name, s) {
15
+ const parts = [`face ${num(s.face)}`, `reference ${num(s.reference)}`];
16
+ if (s.gap !== undefined)
17
+ parts.push(`gap ${signed(s.gap)}`);
18
+ if (s.winner)
19
+ parts.push(`won by ${s.winner}`);
20
+ return ` ${name}: ${parts.join(', ')} (${s.rounds ?? 0} rounds)`;
21
+ }
22
+ export function resultLines(r) {
23
+ const lines = [
24
+ `winner: ${winnerOf(r.winner)}`,
25
+ `gap: ${signed(r.gap)}${interval(r.ci95)}`,
26
+ `scores: face ${num(r.face)}, reference ${num(r.reference)}`,
27
+ `rounds: ${r.rounds_fought ?? '-'} of ${r.rounds_requested ?? '-'}${r.stopped_early ? ', stopped early at the spend cap' : ''}`,
28
+ ];
29
+ const usage = (r.usage ?? {});
30
+ if (usage.spend_usd !== undefined) {
31
+ lines.push(`spent: ${usd(usage.spend_usd)}${usage.budget_usd ? ` of a ${usd(usage.budget_usd)} cap` : ''}`);
32
+ }
33
+ if (r.seed !== undefined && r.seed !== null)
34
+ lines.push(`seed: ${r.seed} (pass --seed ${r.seed} to draw the same rounds again)`);
35
+ for (const [label, key] of [['by length', 'by_length'], ['by medium', 'by_medium']]) {
36
+ const slices = Object.entries((r[key] ?? {}));
37
+ if (slices.length === 0)
38
+ continue;
39
+ lines.push(`${label}:`);
40
+ for (const [name, s] of slices)
41
+ lines.push(sliceLine(name, s));
42
+ }
43
+ for (const w of r.warnings ?? [])
44
+ lines.push(`warning: ${w}`);
45
+ return lines;
46
+ }
47
+ export function runLines(run) {
48
+ const lines = [
49
+ `run: ${run.run_id}`,
50
+ `face: ${run.self_face ?? '-'} on ${run.model ?? '-'}`,
51
+ `reference: ${run.reference_model ?? '-'}`,
52
+ `status: ${run.status ?? '-'}`,
53
+ ];
54
+ const p = run.progress;
55
+ if (p?.rounds_total)
56
+ lines.push(`progress: ${p.rounds_done ?? 0} of ${p.rounds_total} rounds`);
57
+ if (run.error)
58
+ lines.push(`error: ${run.error}`);
59
+ if (run.result)
60
+ lines.push('', ...resultLines(run.result));
61
+ return lines;
62
+ }
63
+ export function benchmarkHint(err, face) {
64
+ const alias = face ?? '<alias>';
65
+ if (err.errorCode === 'benchmark_no_compiled_corpus')
66
+ return `Add a source with: faces compile:upload ${alias} --file <file>`;
67
+ if (err.errorCode === 'benchmark_no_style')
68
+ return `Build its style with: faces style:make ${alias} --all`;
69
+ if (err.errorCode === 'benchmark_insufficient_credit')
70
+ return 'Lower --rounds or --max-spend, or add credit: faces billing:topup --amount <usd>';
71
+ if (err.statusCode === 400 && /model/i.test(err.message))
72
+ return 'List the models with: faces models:list';
73
+ return undefined;
74
+ }
75
+ export function benchmarkError(err, face) {
76
+ const hint = benchmarkHint(err, face);
77
+ return `HTTP ${err.statusCode}: ${err.message}${hint ? `\n${hint}` : ''}`;
78
+ }
79
+ export async function followRun(client, id, onProgress) {
80
+ let last = '';
81
+ for (;;) {
82
+ const run = (await client.get(`${BENCHMARK_RUNS}/${seg(id)}`));
83
+ if (run.status === 'done' || run.status === 'failed') {
84
+ if (run.status === 'failed')
85
+ process.exitCode = 1;
86
+ return run;
87
+ }
88
+ const p = run.progress;
89
+ const now = p?.rounds_total ? `${p.rounds_done ?? 0}/${p.rounds_total} rounds` : String(run.status);
90
+ if (now !== last)
91
+ onProgress(now);
92
+ last = now;
93
+ await new Promise((r) => setTimeout(r, 10_000));
94
+ }
95
+ }
@@ -0,0 +1,17 @@
1
+ export declare const PAID_PLANS: readonly ["connect", "pro"];
2
+ export type PaidPlan = (typeof PAID_PLANS)[number];
3
+ export declare const PLAN_PRICE: Record<PaidPlan, string>;
4
+ export declare function planName(plan: unknown): string;
5
+ export declare function tokens(n: unknown): string;
6
+ export declare function percentUsed(used: number, limit: number): string;
7
+ export declare function allowanceLines(sub: Record<string, unknown>): string[];
8
+ export interface Card {
9
+ id: string;
10
+ brand?: string;
11
+ last4?: string;
12
+ exp_month?: number;
13
+ exp_year?: number;
14
+ is_default?: boolean;
15
+ }
16
+ export declare function cardLine(c: Card): string;
17
+ export declare function llmCostLab(row: Record<string, unknown>): string;
@@ -0,0 +1,101 @@
1
+ export const PAID_PLANS = ['connect', 'pro'];
2
+ export const PLAN_PRICE = {
3
+ connect: '$17/month',
4
+ pro: '$49/month',
5
+ };
6
+ export function planName(plan) {
7
+ const p = String(plan ?? '');
8
+ return p ? p[0].toUpperCase() + p.slice(1) : 'unknown';
9
+ }
10
+ const ALLOWANCES = [
11
+ ['cause_5h', 'causes, rolling 5 hours'],
12
+ ['cause_week', 'causes, this week'],
13
+ ['cause_month', 'causes, this month'],
14
+ ['compile_month', 'compile, this month'],
15
+ ];
16
+ export function tokens(n) {
17
+ if (typeof n !== 'number' || !Number.isFinite(n))
18
+ return '-';
19
+ const millions = () => `${Math.floor(n / 10_000) / 100}M`;
20
+ const abs = Math.abs(n);
21
+ if (abs >= 1_000_000)
22
+ return millions();
23
+ if (abs >= 10_000)
24
+ return `${Math.floor(n / 100) / 10}k`;
25
+ return String(n);
26
+ }
27
+ export function percentUsed(used, limit) {
28
+ const pct = Math.floor((used / limit) * 100);
29
+ return pct === 0 && used > 0 ? '<1%' : `${pct}%`;
30
+ }
31
+ function when(ts) {
32
+ if (typeof ts !== 'string' || !ts)
33
+ return undefined;
34
+ const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(ts);
35
+ return m ? `${m[1]} ${m[2]} UTC` : ts;
36
+ }
37
+ export function allowanceLines(sub) {
38
+ const all = sub.allowances;
39
+ if (!all || typeof all !== 'object')
40
+ return [];
41
+ const rows = ALLOWANCES.filter(([key]) => all[key]).map(([key, label]) => {
42
+ const a = all[key];
43
+ const unlimited = typeof a.limit === 'number' && a.limit < 0;
44
+ const none = a.limit === 0;
45
+ let amount;
46
+ if (unlimited) {
47
+ amount = `${tokens(a.used)} used, unlimited`;
48
+ }
49
+ else if (none) {
50
+ amount = 'none, paid per token';
51
+ }
52
+ else {
53
+ const pct = typeof a.used === 'number' && typeof a.limit === 'number' && a.limit > 0
54
+ ? ` (${percentUsed(a.used, a.limit)})`
55
+ : '';
56
+ amount = `${tokens(a.used)} of ${tokens(a.limit)}${pct}`;
57
+ }
58
+ const reset = when(a.resets_at);
59
+ return { label, amount, tail: unlimited || none ? '' : (reset ? `resets ${reset}` : 'rolls') };
60
+ });
61
+ for (const [key, a] of Object.entries(all)) {
62
+ if (ALLOWANCES.some(([k]) => k === key) || !a || typeof a !== 'object')
63
+ continue;
64
+ const amount = typeof a.limit === 'number' && a.limit < 0
65
+ ? `${tokens(a.used)} used, unlimited`
66
+ : a.limit === 0 ? 'none, paid per token' : `${tokens(a.used)} of ${tokens(a.limit)}`;
67
+ rows.push({ label: key, amount, tail: a.limit !== 0 && when(a.resets_at) ? `resets ${when(a.resets_at)}` : '' });
68
+ }
69
+ if (rows.length === 0)
70
+ return [];
71
+ const lw = Math.max(...rows.map((r) => r.label.length));
72
+ const aw = Math.max(...rows.map((r) => r.amount.length));
73
+ const lines = [`${planName(sub.plan)} allowances (tokens):`];
74
+ for (const r of rows)
75
+ lines.push(` ${r.label.padEnd(lw)} ${r.amount.padEnd(aw)} ${r.tail}`.trimEnd());
76
+ const unlimited = rows.every((r) => r.amount.endsWith('unlimited'));
77
+ if (!unlimited) {
78
+ const rates = sub.rates;
79
+ let past = 'Past an allowance, api_fallback on pays from your credits; off refuses with a 429 until it resets.';
80
+ if (rates && typeof rates.cause_usd_per_million_input_tokens === 'number' && typeof rates.compile_usd_per_million_source_tokens === 'number') {
81
+ const added = typeof rates.cause_added_tokens === 'number' && rates.cause_added_tokens > 0
82
+ ? `, each cause counting its input tokens plus ${rates.cause_added_tokens.toLocaleString('en-US')},`
83
+ : '';
84
+ const rush = typeof rates.compile_rush_usd_per_million_source_tokens === 'number'
85
+ ? ` ($${rates.compile_rush_usd_per_million_source_tokens} for a rush)`
86
+ : '';
87
+ past +=
88
+ ` Credits pay $${rates.cause_usd_per_million_input_tokens} per million cause tokens${added} and ` +
89
+ `$${rates.compile_usd_per_million_source_tokens} per million compile tokens${rush}.`;
90
+ }
91
+ lines.push(` ${past}`);
92
+ }
93
+ return lines;
94
+ }
95
+ export function cardLine(c) {
96
+ const exp = c.exp_month && c.exp_year ? `, expires ${String(c.exp_month).padStart(2, '0')}/${c.exp_year}` : '';
97
+ return `${c.brand ?? 'card'} ending ${c.last4 ?? '????'}${exp} ${c.id}${c.is_default ? ' (default)' : ''}`;
98
+ }
99
+ export function llmCostLab(row) {
100
+ return typeof row.lab === 'string' ? row.lab : '';
101
+ }
@@ -0,0 +1,35 @@
1
+ export declare const CATALOG_DIR: string;
2
+ export declare const CATALOG_INDEX: string;
3
+ export interface FaceFrontmatter {
4
+ name: string;
5
+ description?: string;
6
+ alias: string;
7
+ attributes?: Record<string, string>;
8
+ tags?: string[];
9
+ default_model?: string;
10
+ formula?: string | null;
11
+ component_counts?: number[];
12
+ compiled_tokens?: number;
13
+ [key: string]: unknown;
14
+ }
15
+ export interface FaceDataInput {
16
+ name: string;
17
+ alias: string;
18
+ uid?: string;
19
+ description?: string | null;
20
+ basic_facts?: Record<string, string | {
21
+ value: string;
22
+ }> | null;
23
+ tags?: string[] | null;
24
+ default_model?: string | null;
25
+ formula?: string | null;
26
+ component_counts?: number[] | null;
27
+ compile_tokens_synced?: number | null;
28
+ }
29
+ export declare class CatalogService {
30
+ isEnabled(): boolean;
31
+ writeFace(faceData: FaceDataInput, description?: string): void;
32
+ deleteFace(alias: string): void;
33
+ updateTags(alias: string, tags: string[]): void;
34
+ rebuildIndex(): void;
35
+ }