@faces-sh/cli 0.0.0-stage → 1.0.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.
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 +42 -0
  171. package/dist/commands/face/share.d.ts +22 -0
  172. package/dist/commands/face/share.js +103 -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 +31 -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 +92 -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
@@ -0,0 +1,162 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { BaseCommand } from '../../base.js';
5
+ import { MEDIUM_MISSING_MESSAGE, MEDIUM_REQUIRED_DESCRIPTION, readTextFile, documentWarningLines, withoutWarnings, uploadWarningLines, seg } from '../../utils.js';
6
+ import { FacesAPIError } from '../../client.js';
7
+ function sleep(ms) {
8
+ return new Promise((resolve) => setTimeout(resolve, ms));
9
+ }
10
+ export default class CompileUpload extends BaseCommand {
11
+ static description = 'Upload a file (text/PDF/Word .docx/audio/video) to compile into a face. A document (the default) ' +
12
+ 'is the face\'s own writing, and every word in it is read as theirs. An interview, transcript or ' +
13
+ 'dialogue is a thread: upload it with --kind thread --face-speaker NAME, so only the face\'s turns ' +
14
+ 'are used.';
15
+ static examples = [
16
+ '<%= config.bin %> <%= command.id %> alice --file essay.txt --medium essay --perspective first-person',
17
+ '<%= config.bin %> <%= command.id %> alice --file interview.txt --kind thread --face-speaker Alice',
18
+ ];
19
+ static flags = {
20
+ ...BaseCommand.baseFlags,
21
+ file: Flags.string({ description: 'File to upload', required: true }),
22
+ kind: Flags.string({
23
+ description: 'document: the face\'s own writing (or, with --perspective third-person, writing about them). ' +
24
+ 'thread: an exchange between speakers (an interview, transcript or dialogue), with --face-speaker ' +
25
+ 'naming the face. A transcript uploaded as a document is read as entirely the face\'s words.',
26
+ options: ['document', 'thread'],
27
+ default: 'document',
28
+ }),
29
+ perspective: Flags.string({
30
+ description: 'Who wrote it (document only). Defaults to third-person, meaning the file is ABOUT the subject, ' +
31
+ 'because an uploaded file is as often somebody else\'s writing. Pass first-person for the ' +
32
+ "subject's own writing, which is the only kind a style can be built from. Note compile:doc " +
33
+ 'defaults the other way, since text pasted in is usually theirs.',
34
+ options: ['first-person', 'third-person'],
35
+ default: 'third-person',
36
+ }),
37
+ medium: Flags.string({
38
+ description: MEDIUM_REQUIRED_DESCRIPTION +
39
+ ' Required with --kind document, and only valid with it.',
40
+ }),
41
+ 'face-speaker': Flags.string({
42
+ description: 'The speaker who is the face (thread only), as labelled in the file ("Alice" for "Alice: ..." ' +
43
+ 'lines, or "A" for a recording). Only that speaker\'s turns are used. If omitted, the speaker ' +
44
+ 'matching the face\'s name is used, or else the first speaker, so set it to be sure.',
45
+ }),
46
+ 'no-wait': Flags.boolean({
47
+ description: 'Return immediately after upload (do not poll for transcription). Prints the ID for manual polling.',
48
+ default: false,
49
+ }),
50
+ };
51
+ static args = {
52
+ alias: Args.string({ description: 'Face alias', required: true }),
53
+ };
54
+ async run() {
55
+ const { args, flags } = await this.parse(CompileUpload);
56
+ const client = this.makeClient(flags);
57
+ const json = this.jsonEnabled();
58
+ if (!fs.existsSync(flags.file))
59
+ this.error(`File not found: ${flags.file}`);
60
+ if (flags.medium && flags.kind !== 'document') {
61
+ this.error(`--medium applies to --kind document only (got --kind ${flags.kind}); a thread carries a kind per message.`);
62
+ }
63
+ if (!flags.medium && flags.kind === 'document')
64
+ this.error(MEDIUM_MISSING_MESSAGE);
65
+ let text;
66
+ if (flags.kind === 'document') {
67
+ try {
68
+ text = readTextFile(flags.file);
69
+ }
70
+ catch {
71
+ }
72
+ }
73
+ const filename = path.basename(flags.file);
74
+ const fileBlob = new Blob([fs.readFileSync(flags.file)], { type: 'application/octet-stream' });
75
+ const form = new FormData();
76
+ form.append('file', fileBlob, filename);
77
+ const params = new URLSearchParams();
78
+ params.set('type', flags.kind);
79
+ if (flags.medium)
80
+ params.set('medium', flags.medium);
81
+ params.set('perspective', flags.perspective);
82
+ if (flags['face-speaker'])
83
+ params.set('face_speaker', flags['face-speaker']);
84
+ let data;
85
+ try {
86
+ data = await client.postForm(`/v1/faces/${seg(args.alias)}/upload?${params}`, form);
87
+ }
88
+ catch (err) {
89
+ if (err instanceof FacesAPIError)
90
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
91
+ throw err;
92
+ }
93
+ if (flags.kind === 'document') {
94
+ for (const line of documentWarningLines(data, text, args.alias, flags.file))
95
+ process.stderr.write(`${line}\n`);
96
+ }
97
+ if (data.status === 'transcribing' && flags['no-wait']) {
98
+ const id = (data.thread_id ?? data.document_id);
99
+ if (!json) {
100
+ process.stderr.write(`Transcription started in background.\n`);
101
+ process.stderr.write(`Poll with: faces compile:${flags.kind === 'thread' ? 'thread' : 'doc'}:get ${id} --json\n`);
102
+ }
103
+ return data;
104
+ }
105
+ if (data.status === 'transcribing') {
106
+ const id = (data.thread_id ?? data.document_id);
107
+ const endpoint = flags.kind === 'thread'
108
+ ? `/v1/compile/threads/${seg(id)}`
109
+ : `/v1/compile/documents/${seg(id)}`;
110
+ if (!json)
111
+ process.stderr.write('Transcribing...\n');
112
+ const timeout = 3600_000;
113
+ const start = Date.now();
114
+ while (Date.now() - start < timeout) {
115
+ await sleep(5000);
116
+ try {
117
+ const poll = await client.get(endpoint);
118
+ const status = poll.status;
119
+ if (status !== 'transcribing') {
120
+ data = poll;
121
+ if (!json) {
122
+ if (status === 'failed') {
123
+ process.stderr.write('Transcription failed.\n');
124
+ }
125
+ else {
126
+ const msgCount = poll.message_count ?? 0;
127
+ process.stderr.write(`Transcription complete: ${msgCount} messages\n`);
128
+ }
129
+ }
130
+ break;
131
+ }
132
+ if (!json)
133
+ process.stderr.write('Transcribing...\n');
134
+ }
135
+ catch {
136
+ }
137
+ }
138
+ }
139
+ if (!json) {
140
+ this.printHuman(flags.kind === 'document' ? withoutWarnings(data) : data);
141
+ const warnings = flags.kind === 'thread' ? uploadWarningLines(data) : [];
142
+ if (warnings.length > 0) {
143
+ this.log('');
144
+ for (const line of warnings)
145
+ this.log(line);
146
+ }
147
+ if (flags.kind === 'thread' && data.thread_id) {
148
+ this.log(`\nReview the transcript:`);
149
+ this.log(` faces compile:thread:get ${data.thread_id}`);
150
+ this.log(`\nWhen ready to compile:`);
151
+ this.log(` faces compile:thread:make ${data.thread_id}`);
152
+ }
153
+ else if (flags.kind === 'document' && data.document_id) {
154
+ this.log(`\nReview the document:`);
155
+ this.log(` faces compile:doc:get ${data.document_id}`);
156
+ this.log(`\nWhen ready to compile:`);
157
+ this.log(` faces compile:doc:make ${data.document_id}`);
158
+ }
159
+ }
160
+ return data;
161
+ }
162
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class ConfigClear extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
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
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,17 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { clearConfig } from '../../config.js';
4
+ export default class ConfigClear extends BaseCommand {
5
+ static description = 'Delete all saved credentials and config';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
9
+ };
10
+ async run() {
11
+ const { flags } = await this.parse(ConfigClear);
12
+ await this.confirmOrRefuse('Delete all saved credentials?', flags.yes);
13
+ clearConfig();
14
+ this.log('Config cleared.');
15
+ return { status: 'cleared' };
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class ConfigSet extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static args: {
11
+ key: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ value: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
14
+ run(): Promise<unknown>;
15
+ }
@@ -0,0 +1,43 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { resolveBaseUrl, saveCredentials, setConfigKey } from '../../config.js';
4
+ const KNOWN_KEYS = ['base_url', 'api_key', 'token', 'user_id', 'catalog', 'catalog_model', 'credentials_base_url'];
5
+ export default class ConfigSet extends BaseCommand {
6
+ static description = 'Set a config value (e.g. base_url, api_key, token)';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ };
10
+ static args = {
11
+ key: Args.string({ description: 'Config key', required: true }),
12
+ value: Args.string({ description: 'Config value', required: true }),
13
+ };
14
+ async run() {
15
+ const { args } = await this.parse(ConfigSet);
16
+ if (!KNOWN_KEYS.includes(args.key)) {
17
+ const close = KNOWN_KEYS.find((k) => k.replace(/_/g, '') === args.key.toLowerCase().replace(/[-_]/g, ''));
18
+ this.error(`Unknown config key "${args.key}".${close ? ` Did you mean ${close}?` : ''} Keys: ${KNOWN_KEYS.join(', ')}`);
19
+ }
20
+ if (args.key === 'base_url') {
21
+ let url;
22
+ try {
23
+ url = new URL(args.value);
24
+ }
25
+ catch {
26
+ }
27
+ if (!url || !['http:', 'https:'].includes(url.protocol)) {
28
+ this.error(`base_url must be an http(s) URL, such as https://api.faces.sh (got "${args.value}").`);
29
+ }
30
+ }
31
+ if (args.key === 'api_key' && args.value && !args.value.startsWith('sk-faces-')) {
32
+ this.error('Faces API keys start with sk-faces-. This does not look like a Faces API key.');
33
+ }
34
+ if (args.key === 'api_key' || args.key === 'token') {
35
+ saveCredentials({ [args.key]: args.value }, resolveBaseUrl());
36
+ }
37
+ else {
38
+ setConfigKey(args.key, args.value);
39
+ }
40
+ this.log(`Set ${args.key}.`);
41
+ return { key: args.key, status: 'set' };
42
+ }
43
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class ConfigShow extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<unknown>;
11
+ }
@@ -0,0 +1,19 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ import { maskedConfig } from '../../config.js';
3
+ export default class ConfigShow extends BaseCommand {
4
+ static description = 'Print current config (credentials are masked)';
5
+ static flags = {
6
+ ...BaseCommand.baseFlags,
7
+ };
8
+ async run() {
9
+ await this.parse(ConfigShow);
10
+ const data = maskedConfig();
11
+ if (Object.keys(data).length === 0) {
12
+ this.log('No config found at ~/.faces/config.json');
13
+ return {};
14
+ }
15
+ if (!this.jsonEnabled())
16
+ this.log(JSON.stringify(data, null, 2));
17
+ return data;
18
+ }
19
+ }
@@ -0,0 +1,35 @@
1
+ import { BaseCommand } from '../base.js';
2
+ export default class Decide extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ state: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'state-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ question: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ option: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ level: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'questions-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ model: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ baseline: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ 'show-cause': import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ session: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ compaction: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ retry: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ };
26
+ static args: {
27
+ face: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
28
+ };
29
+ run(): Promise<unknown>;
30
+ private ask;
31
+ private readState;
32
+ private readQuestions;
33
+ private models?;
34
+ private explain;
35
+ }
@@ -0,0 +1,242 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../base.js';
3
+ import { FacesAPIError, missingFieldsNote } from '../client.js';
4
+ import { DECISION_MODELS, decisionModels, DECISION_FORMATS, fromOpenAIAnswers, toOpenAIDecision, questionsProblem, MAX_WARM_UP_WAIT_S, QUESTION_TYPES, causeLines, decisionLines, heldDecisionError, readStateFlags, readQuestionFlags, warmUpWait, } from '../decisions.js';
5
+ import { compileHint, reasoningHeading, sayWarmUp, SESSION_FLAG_DESCRIPTION, COMPACTION_FLAG_DESCRIPTION } from '../utils.js';
6
+ const OPENAI_FORMAT_ONLY = ['gpt-6-luna'];
7
+ export default class Decide extends BaseCommand {
8
+ static description = 'Ask what a face would decide. Describe a situation, ask typed questions about it, and get back numbers, ' +
9
+ 'as this face: a yes-or-no (noul), a pick between options (choice), or a place on a graded scale (score). ' +
10
+ 'Chat gives you what a face would say; this gives you what it would decide, for routing, simulations or ' +
11
+ 'panels. The face\'s cause for each question guides the decision model\'s (--model) answer. A face\'s ' +
12
+ 'answer takes about 10 to 20 seconds; one that runs long is held open by the server and can take a ' +
13
+ 'minute or more. --baseline asks the decision model alone (no-face baseline), in about a second: the ' +
14
+ 'number to compare a face\'s answer against. Name a face and ask no questions for its cause alone. On ' +
15
+ 'Connect and Pro the cause counts against the plan\'s allowance and the decision model is paid from ' +
16
+ 'credits; on Free both bill per token. A face needs something compiled.';
17
+ static examples = [
18
+ '<%= config.bin %> <%= command.id %> alice --state "A colleague asks you to sign a grant proposal you have not read, due in an hour." ' +
19
+ '--question "Does the speaker sign?" --option yes="signs it as asked" --option no="declines to sign" ' +
20
+ '--option later="asks for time to read it first"',
21
+ '<%= config.bin %> <%= command.id %> alice --state-file situation.txt --question "Is the speaker irritated?"',
22
+ '<%= config.bin %> <%= command.id %> alice --state-file situation.txt --question "How firm is the reply?" ' +
23
+ '--level yields --level hedges --level firm --show-cause',
24
+ '<%= config.bin %> <%= command.id %> --baseline --model clef-flash --state-file situation.txt --questions-file questions.json',
25
+ '<%= config.bin %> <%= command.id %> alice --state-file situation.txt',
26
+ '<%= config.bin %> <%= command.id %> alice --state-file situation.json --questions-file questions.json --model clef --json',
27
+ ];
28
+ static flags = {
29
+ ...BaseCommand.baseFlags,
30
+ state: Flags.string({
31
+ description: 'The situation the face is responding to, as plain text, up to 60,000 characters. Write it the way ' +
32
+ 'the face would hear it: it is read as the turn the face is answering.',
33
+ exclusive: ['state-file'],
34
+ }),
35
+ 'state-file': Flags.string({
36
+ description: 'Read the situation from this file instead of --state. A .json file is sent as the JSON it holds, ' +
37
+ 'so the situation can be an object or an array.',
38
+ exclusive: ['state'],
39
+ }),
40
+ question: Flags.string({
41
+ description: 'One question to ask. Its type follows from what comes with it: --option makes it a choice, --level a ' +
42
+ 'score, and neither a yes-or-no (noul). For several questions, use --questions-file.',
43
+ exclusive: ['questions-file'],
44
+ }),
45
+ type: Flags.string({
46
+ description: 'The type of --question, when you would rather say it than leave it to --option and --level.',
47
+ options: [...QUESTION_TYPES],
48
+ dependsOn: ['question'],
49
+ }),
50
+ option: Flags.string({
51
+ description: 'An option for a choice, as name="description", or a bare name (repeatable, at least two). The name is ' +
52
+ 'what comes back; the description is what the answer is judged against, so make it specific: ' +
53
+ '"declines to sign", not "no". Keep the options mutually exclusive, because the probability is split ' +
54
+ 'between them.',
55
+ multiple: true,
56
+ dependsOn: ['question'],
57
+ exclusive: ['level'],
58
+ }),
59
+ level: Flags.string({
60
+ description: 'A level of a score, described (repeatable, 2 to 10, lowest first). The answer is the expected level, ' +
61
+ 'from 0 for the first to one less than the number of levels.',
62
+ multiple: true,
63
+ dependsOn: ['question'],
64
+ exclusive: ['option'],
65
+ }),
66
+ id: Flags.string({
67
+ description: 'Key for the --question in the result (default: answer)',
68
+ dependsOn: ['question'],
69
+ }),
70
+ 'questions-file': Flags.string({
71
+ description: 'A JSON file of 1 to 32 questions, in the API\'s own shape: {"<id>": {"type": "noul" | "choice" | ' +
72
+ '"score", "instructions": "...", "criteria": ...}}. A choice\'s criteria are {"<option>": ' +
73
+ '"<description>" or null}; a score\'s are a list of 2 to 10 levels, lowest first; a noul\'s are optional, ' +
74
+ '{"true": "...", "false": "..."}.',
75
+ exclusive: ['question'],
76
+ }),
77
+ model: Flags.string({
78
+ description: 'The decision model: the model that turns the situation into probabilities, as opposed to a ' +
79
+ 'generative model that writes text. Checked against the decision models the API lists: ' +
80
+ 'jev-latest, clef, clef-flash and gpt-6-luna today. gpt-6-luna answers in OpenAI\'s format only, ' +
81
+ 'so it uses --format openai.',
82
+ default: 'jev-latest',
83
+ }),
84
+ baseline: Flags.boolean({
85
+ description: 'Ask the decision model alone, with no face: the no-face baseline. Costs only the decision model.',
86
+ default: false,
87
+ }),
88
+ 'show-cause': Flags.boolean({
89
+ description: 'Also show the face\'s cause, one per question when there are several. Printed to stderr ahead of ' +
90
+ 'the answers. It is always in --json, as cause and causes.',
91
+ default: false,
92
+ }),
93
+ session: Flags.string({ description: SESSION_FLAG_DESCRIPTION, exclusive: ['baseline'] }),
94
+ compaction: Flags.string({ description: COMPACTION_FLAG_DESCRIPTION, exclusive: ['baseline'] }),
95
+ format: Flags.string({
96
+ description: 'The request shape: systemone (default, TypeSafe Jev\'s System One) or openai (OpenAI\'s Decisions ' +
97
+ 'format). The answers are the same; --json returns the chosen format\'s own shape.',
98
+ options: [...DECISION_FORMATS],
99
+ default: 'systemone',
100
+ }),
101
+ retry: Flags.boolean({
102
+ description: 'If the server answers 503 with the seconds to wait, wait exactly that and ask again, for up to ' +
103
+ `${MAX_WARM_UP_WAIT_S / 60} minutes in all. On by default; --no-retry returns the 503 straight away.`,
104
+ default: true,
105
+ allowNo: true,
106
+ }),
107
+ };
108
+ static args = {
109
+ face: Args.string({ description: 'Face alias to answer as, a saved composite, or a formula such as "(a | b)". Leave it out with --baseline.' }),
110
+ };
111
+ async run() {
112
+ const { args, flags } = await this.parse(Decide);
113
+ const client = this.makeClient(flags);
114
+ const json = this.jsonEnabled();
115
+ if (flags.baseline && args.face)
116
+ this.error('--baseline asks with no face, so leave the face out.');
117
+ if (!flags.baseline && !args.face)
118
+ this.error('Name a face to ask, or pass --baseline to ask with none.');
119
+ const state = this.readState(flags);
120
+ const questions = this.readQuestions(flags);
121
+ if (!questions && flags.baseline)
122
+ this.error('--baseline answers questions, so ask one with --question or --questions-file.');
123
+ if (questions) {
124
+ const problem = questionsProblem(questions, !flags.baseline, OPENAI_FORMAT_ONLY.includes(flags.model.toLowerCase()));
125
+ if (problem)
126
+ this.error(problem);
127
+ this.models = await decisionModels(client);
128
+ const match = this.models.find((m) => m.toLowerCase() === flags.model.toLowerCase());
129
+ if (!match)
130
+ this.error(`'${flags.model}' is not a decision model. The decision models are: ${this.models.join(', ')}.`);
131
+ flags.model = match;
132
+ if (OPENAI_FORMAT_ONLY.includes(match)) {
133
+ if (this.argv.some((a) => a === '--format=systemone' || a === 'systemone')) {
134
+ this.error(`${match} answers in OpenAI's format only. Use --format openai, or leave --format out.`);
135
+ }
136
+ flags.format = 'openai';
137
+ }
138
+ }
139
+ const face = args.face;
140
+ const model = questions ? (face ? `${face}@${flags.model}` : flags.model) : face;
141
+ let body = questions ? { model, state, questions } : { model, state };
142
+ if (flags.format === 'openai') {
143
+ try {
144
+ body = toOpenAIDecision(model, state, questions);
145
+ }
146
+ catch (err) {
147
+ this.error(err instanceof Error ? err.message : String(err));
148
+ }
149
+ }
150
+ if (flags.session)
151
+ body.session = flags.session;
152
+ if (flags.compaction)
153
+ body.compaction = flags.compaction;
154
+ if (!json) {
155
+ process.stderr.write(!questions
156
+ ? `Asking ${face} for its cause alone, with no questions.\n`
157
+ : face
158
+ ? `Asking ${face}. Decision model: ${flags.model}. This usually takes 10 to 20 seconds, sometimes a minute or more.\n`
159
+ : `Asking the decision model alone (no-face baseline). Decision model: ${flags.model}.\n`);
160
+ }
161
+ let data;
162
+ try {
163
+ data = (await this.ask(client, body, flags.retry, json, flags.format === 'openai' ? '/v1/decisions' : '/v1/systemone'));
164
+ }
165
+ catch (err) {
166
+ if (err instanceof FacesAPIError)
167
+ this.error(this.explain(err, face, flags.model));
168
+ throw err;
169
+ }
170
+ const expected = [...(questions ? ['answers'] : []), ...(face ? ['cause'] : [])];
171
+ const missing = missingFieldsNote(data, expected);
172
+ if (missing && !json && !questions)
173
+ this.error(missing);
174
+ if (missing)
175
+ process.stderr.write(`${missing}\n`);
176
+ if (json)
177
+ return data;
178
+ if (!questions) {
179
+ this.log(data.cause ?? '');
180
+ return data;
181
+ }
182
+ const cause = causeLines(data, Object.keys(questions));
183
+ if (flags['show-cause'] && cause.length > 0 && face)
184
+ process.stderr.write(`${reasoningHeading(face)}\n${cause.join('\n')}\n\n`);
185
+ const answers = flags.format === 'openai' ? fromOpenAIAnswers(data.answers, questions) : (data.answers ?? {});
186
+ for (const line of decisionLines(answers))
187
+ this.log(line);
188
+ return data;
189
+ }
190
+ async ask(client, body, retry, json, endpoint) {
191
+ let waited = 0;
192
+ for (;;) {
193
+ try {
194
+ const data = await client.post(endpoint, { body });
195
+ const held = heldDecisionError(data);
196
+ if (held)
197
+ throw held;
198
+ return data;
199
+ }
200
+ catch (err) {
201
+ if (!(err instanceof FacesAPIError) || !retry || err.retryable === false)
202
+ throw err;
203
+ const wait = warmUpWait(err.statusCode, err.retryAfter, waited);
204
+ if (wait === undefined)
205
+ throw err;
206
+ if (!json)
207
+ sayWarmUp(wait);
208
+ await new Promise((r) => setTimeout(r, wait * 1000));
209
+ waited += wait;
210
+ }
211
+ }
212
+ }
213
+ readState(flags) {
214
+ return readStateFlags(flags, (m) => this.error(m));
215
+ }
216
+ readQuestions(flags) {
217
+ return readQuestionFlags(flags, (m) => this.error(m));
218
+ }
219
+ models;
220
+ explain(err, face, model) {
221
+ const head = `HTTP ${err.statusCode}: ${err.message}`;
222
+ switch (err.statusCode) {
223
+ case 409: {
224
+ if (!face)
225
+ return head;
226
+ return `${head}\n${compileHint(face, !/nothing compiled/i.test(err.message), 'decide')}`;
227
+ }
228
+ case 503: {
229
+ if (err.retryAfter !== undefined)
230
+ return `${head}\nTry again in ${err.retryAfter}s.`;
231
+ const others = (this.models ?? [...DECISION_MODELS]).filter((m) => m !== model).join(', ');
232
+ return `${head}\nTry again. If the message names the decision model, another --model may answer (${others}).`;
233
+ }
234
+ case 504: {
235
+ return `${head}\n${face ? 'The face' : 'The decision'} did not finish within 300 seconds. Ask again.`;
236
+ }
237
+ default: {
238
+ return head;
239
+ }
240
+ }
241
+ }
242
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class FaceAttributes extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<unknown>;
11
+ }
@@ -0,0 +1,44 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ import { FacesAPIError } from '../../client.js';
3
+ export default class FaceAttributes extends BaseCommand {
4
+ static description = 'List the attribute keys a face can have (its basic_facts): fields that take a bare value, and keys ' +
5
+ 'that each take a short sentence. Any other key is refused.';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ async run() {
10
+ const { flags } = await this.parse(FaceAttributes);
11
+ const client = this.makeClient(flags);
12
+ let data;
13
+ try {
14
+ data = await client.get('/v1/faces/attributes');
15
+ }
16
+ catch (err) {
17
+ if (err instanceof FacesAPIError)
18
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
19
+ throw err;
20
+ }
21
+ if (!this.jsonEnabled()) {
22
+ const rows = (data.data ?? []);
23
+ const width = Math.max(0, ...rows.map((r) => r.key.length));
24
+ const groups = [
25
+ ['value', 'Fields, each a bare value:'],
26
+ ['sentence', 'Keys of short sentences:'],
27
+ ];
28
+ for (const [format, heading] of groups) {
29
+ const these = rows.filter((r) => (r.format ?? 'sentence') === format);
30
+ if (these.length === 0)
31
+ continue;
32
+ this.log(`\n${heading}`);
33
+ for (const r of these)
34
+ this.log(` ${r.key.padEnd(width)} ${r.holds ?? ''}`.trimEnd());
35
+ }
36
+ const known = new Set(groups.map(([f]) => f));
37
+ const other = rows.filter((r) => r.format && !known.has(r.format));
38
+ for (const r of other)
39
+ this.log(` ${r.key.padEnd(width)} ${r.holds ?? ''} (${r.format})`);
40
+ this.log('\nSet them with: faces face:edit <alias> --attr KEY=VALUE\n');
41
+ }
42
+ return data;
43
+ }
44
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class FaceAvatarDelete extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
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
+ static args: {
12
+ face_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
14
+ run(): Promise<unknown>;
15
+ }