@faces-sh/cli 1.0.3 → 1.2.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 (70) hide show
  1. package/README.md +107 -53
  2. package/dist/billing.js +11 -8
  3. package/dist/{commands/causes.d.ts → chat-command.d.ts} +13 -13
  4. package/dist/chat-command.js +110 -0
  5. package/dist/chat.d.ts +47 -0
  6. package/dist/chat.js +157 -0
  7. package/dist/choices.d.ts +20 -0
  8. package/dist/choices.js +49 -0
  9. package/dist/commands/auth/connect.js +2 -2
  10. package/dist/commands/billing/llm-costs.js +9 -5
  11. package/dist/commands/billing/subscription/index.js +1 -1
  12. package/dist/commands/catalog/doctor.js +9 -68
  13. package/dist/commands/chat/chat.d.ts +10 -26
  14. package/dist/commands/chat/chat.js +21 -366
  15. package/dist/commands/chat/messages.d.ts +13 -13
  16. package/dist/commands/chat/messages.js +15 -142
  17. package/dist/commands/chat/responses.d.ts +13 -14
  18. package/dist/commands/chat/responses.js +16 -153
  19. package/dist/commands/chat/thread.d.ts +3 -15
  20. package/dist/commands/chat/thread.js +128 -362
  21. package/dist/commands/choices.d.ts +20 -0
  22. package/dist/commands/choices.js +91 -0
  23. package/dist/commands/conversation/add.d.ts +2 -0
  24. package/dist/commands/conversation/add.js +21 -10
  25. package/dist/commands/conversation/close.js +5 -5
  26. package/dist/commands/conversation/compact.js +15 -18
  27. package/dist/commands/conversation/create.d.ts +2 -0
  28. package/dist/commands/conversation/create.js +20 -17
  29. package/dist/commands/conversation/get.js +4 -4
  30. package/dist/commands/conversation/items.js +5 -5
  31. package/dist/commands/decide.d.ts +4 -4
  32. package/dist/commands/decide.js +70 -81
  33. package/dist/commands/face/get.js +2 -2
  34. package/dist/commands/group/add.js +1 -1
  35. package/dist/commands/media/list.d.ts +12 -0
  36. package/dist/commands/media/list.js +35 -0
  37. package/dist/commands/models/list.js +16 -5
  38. package/dist/commands/session/close.js +1 -1
  39. package/dist/commands/session/compact.js +6 -9
  40. package/dist/commands/session/create.js +10 -9
  41. package/dist/commands/session/get.js +1 -1
  42. package/dist/commands/state/add.d.ts +3 -0
  43. package/dist/commands/state/add.js +3 -0
  44. package/dist/commands/state/close.d.ts +3 -0
  45. package/dist/commands/state/close.js +3 -0
  46. package/dist/commands/state/compact.d.ts +3 -0
  47. package/dist/commands/state/compact.js +3 -0
  48. package/dist/commands/state/create.d.ts +3 -0
  49. package/dist/commands/state/create.js +3 -0
  50. package/dist/commands/state/get.d.ts +3 -0
  51. package/dist/commands/state/get.js +3 -0
  52. package/dist/commands/state/items.d.ts +3 -0
  53. package/dist/commands/state/items.js +3 -0
  54. package/dist/commands/style/make.js +2 -6
  55. package/dist/commands/style/upload.js +1 -1
  56. package/dist/conversation.d.ts +27 -2
  57. package/dist/conversation.js +91 -16
  58. package/dist/decisions.d.ts +0 -5
  59. package/dist/decisions.js +0 -18
  60. package/dist/media.d.ts +8 -0
  61. package/dist/media.js +12 -0
  62. package/dist/model.d.ts +11 -0
  63. package/dist/model.js +53 -0
  64. package/dist/routing.d.ts +1 -4
  65. package/dist/routing.js +4 -40
  66. package/dist/utils.d.ts +1 -25
  67. package/dist/utils.js +10 -108
  68. package/oclif.manifest.json +2054 -1649
  69. package/package.json +10 -7
  70. package/dist/commands/causes.js +0 -146
@@ -1,30 +1,29 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
2
  import { BaseCommand } from '../base.js';
3
3
  import { FacesAPIError, missingFieldsNote } from '../client.js';
4
- import { conversationFields, conversationTurnFlags } from '../conversation.js';
5
- 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';
6
- import { compileHint, reasoningHeading, sayWarmUp, SESSION_FLAG_DESCRIPTION, COMPACTION_FLAG_DESCRIPTION } from '../utils.js';
4
+ import { conversationFields, conversationTurnFlags, MAX_DEPENDS_ON, parseDependsOn } from '../conversation.js';
5
+ import { DECISION_MODELS, decisionModels, DECISION_FORMATS, fromOpenAIAnswers, toOpenAIDecision, questionsProblem, MAX_WARM_UP_WAIT_S, QUESTION_TYPES, decisionLines, heldDecisionError, readStateFlags, readQuestionFlags, warmUpWait, } from '../decisions.js';
6
+ import { compileHint, sayWarmUp, SESSION_FLAG_DESCRIPTION, COMPACTION_FLAG_DESCRIPTION } from '../utils.js';
7
+ import { modelProblem, parseModel } from '../model.js';
7
8
  const OPENAI_FORMAT_ONLY = ['gpt-6-luna'];
8
9
  export default class Decide extends BaseCommand {
9
10
  static description = 'Ask what a face would decide. Describe a situation, ask typed questions about it, and get back numbers, ' +
10
11
  'as this face: a yes-or-no (noul), a pick between options (choice), or a place on a graded scale (score). ' +
11
- 'Chat gives you what a face would say; this gives you what it would decide, for routing, simulations or ' +
12
- 'panels. The face\'s cause for each question guides the decision model\'s (--model) answer. A face\'s ' +
13
- 'answer takes about 10 to 20 seconds; one that runs long is held open by the server and can take a ' +
14
- 'minute or more. --baseline asks the decision model alone (no-face baseline), in about a second: the ' +
15
- 'number to compare a face\'s answer against. Name a face and ask no questions for its cause alone. On ' +
16
- 'Connect and Pro the cause counts against the plan\'s allowance and the decision model is paid from ' +
17
- 'credits; on Free both bill per token. A face needs something compiled.';
12
+ 'faces choices gives you the options a face would weigh; this gives you what it would decide, for routing, ' +
13
+ 'simulations or panels. Name the model as the upstream model over the decision model: ' +
14
+ '@alice:maestro-1/jev-latest. The face steers the decision model\'s answer. An answer takes about 10 to 20 ' +
15
+ 'seconds; one that runs long is held open by the server and can take a minute or more. ' +
16
+ 'The steering is billed per input token plus a small fee per call (see faces models:list --kind upstream), ' +
17
+ 'and the decision model at its listed price. A face needs something compiled.';
18
18
  static examples = [
19
- '<%= config.bin %> <%= command.id %> alice --state "A colleague asks you to sign a grant proposal you have not read, due in an hour." ' +
19
+ '<%= config.bin %> <%= command.id %> @alice:maestro-1/jev-latest --state "A colleague asks you to sign a grant proposal you have not read, due in an hour." ' +
20
20
  '--question "Does the speaker sign?" --option yes="signs it as asked" --option no="declines to sign" ' +
21
21
  '--option later="asks for time to read it first"',
22
- '<%= config.bin %> <%= command.id %> alice --state-file situation.txt --question "Is the speaker irritated?"',
23
- '<%= config.bin %> <%= command.id %> alice --state-file situation.txt --question "How firm is the reply?" ' +
24
- '--level yields --level hedges --level firm --show-cause',
25
- '<%= config.bin %> <%= command.id %> --baseline --model clef-flash --state-file situation.txt --questions-file questions.json',
26
- '<%= config.bin %> <%= command.id %> alice --state-file situation.txt',
27
- '<%= config.bin %> <%= command.id %> alice --state-file situation.json --questions-file questions.json --model clef --json',
22
+ '<%= config.bin %> <%= command.id %> @alice:maestro-1/jev-latest --state-file situation.txt --question "Is the speaker irritated?"',
23
+ '<%= config.bin %> <%= command.id %> @alice:maestro-1-flash/clef --state-file situation.txt --question "How firm is the reply?" ' +
24
+ '--level yields --level hedges --level firm',
25
+ '<%= config.bin %> <%= command.id %> "(@alice | @bob):maestro-1/jev-latest" --state-file situation.json --questions-file questions.json --json',
26
+ '<%= config.bin %> <%= command.id %> @alice:maestro-1/gpt-6-luna --state-file situation.txt --questions-file questions.json',
28
27
  ];
29
28
  static flags = {
30
29
  ...BaseCommand.baseFlags,
@@ -75,25 +74,14 @@ export default class Decide extends BaseCommand {
75
74
  '{"true": "...", "false": "..."}.',
76
75
  exclusive: ['question'],
77
76
  }),
78
- model: Flags.string({
79
- description: 'The decision model: the model that turns the situation into probabilities, as opposed to a ' +
80
- 'generative model that writes text. Checked against the decision models the API lists: ' +
81
- 'jev-latest, clef, clef-flash and gpt-6-luna today. gpt-6-luna answers in OpenAI\'s format only, ' +
82
- 'so it uses --format openai.',
83
- default: 'jev-latest',
77
+ ...conversationTurnFlags(),
78
+ 'depends-on': Flags.string({
79
+ description: 'In a state (--conversation), what this decision rests on, comma separated: premise keys and decision ids ' +
80
+ `already in the state or set with --premise, at most ${MAX_DEPENDS_ON}. The decision is shown those, and is ` +
81
+ 'invalidated when one of them is. Left out, it rests on every premise in force.',
84
82
  }),
85
- baseline: Flags.boolean({
86
- description: 'Ask the decision model alone, with no face: the no-face baseline. Costs only the decision model.',
87
- default: false,
88
- }),
89
- 'show-cause': Flags.boolean({
90
- description: 'Also show the face\'s cause, one per question when there are several. Printed to stderr ahead of ' +
91
- 'the answers. It is always in --json, as cause and causes.',
92
- default: false,
93
- }),
94
- ...conversationTurnFlags({ exclusive: ['baseline'] }),
95
- session: Flags.string({ description: SESSION_FLAG_DESCRIPTION, exclusive: ['baseline'] }),
96
- compaction: Flags.string({ description: COMPACTION_FLAG_DESCRIPTION, exclusive: ['baseline'] }),
83
+ session: Flags.string({ description: SESSION_FLAG_DESCRIPTION }),
84
+ compaction: Flags.string({ description: COMPACTION_FLAG_DESCRIPTION }),
97
85
  format: Flags.string({
98
86
  description: 'The request shape: systemone (default, TypeSafe Jev\'s System One) or openai (OpenAI\'s Decisions ' +
99
87
  'format). The answers are the same; --json returns the chosen format\'s own shape.',
@@ -108,46 +96,57 @@ export default class Decide extends BaseCommand {
108
96
  }),
109
97
  };
110
98
  static args = {
111
- face: Args.string({ description: 'Face alias to answer as, a saved composite, or a formula such as "(a | b)". Leave it out with --baseline.' }),
99
+ model: Args.string({
100
+ description: 'The upstream model over the decision model: @<face>:<maestro>/<decision model>, e.g. ' +
101
+ '@alice:maestro-1/jev-latest. Another account\'s face is @owner~face; a composite is ' +
102
+ '"(@a | @b):maestro-1/jev-latest". The decision models are jev-latest, clef, clef-flash and gpt-6-luna ' +
103
+ 'today (faces models:list --kind decision); gpt-6-luna answers in OpenAI\'s format only, so it uses --format openai.',
104
+ required: true,
105
+ }),
112
106
  };
113
107
  async run() {
114
108
  const { args, flags } = await this.parse(Decide);
115
109
  const client = this.makeClient(flags);
116
110
  const json = this.jsonEnabled();
117
- if (flags.baseline && args.face)
118
- this.error('--baseline asks with no face, so leave the face out.');
119
- if (!flags.baseline && !args.face)
120
- this.error('Name a face to ask, or pass --baseline to ask with none.');
111
+ const problem = modelProblem(args.model, 'both', 'jev-latest');
112
+ if (problem)
113
+ this.error(problem);
114
+ const name = parseModel(args.model);
115
+ const face = name.faces;
116
+ let downstream = name.downstream;
121
117
  let turn = {};
122
118
  try {
123
119
  turn = conversationFields(flags);
120
+ if (flags['depends-on'] !== undefined) {
121
+ if (!flags.conversation && !flags.session)
122
+ throw new Error('--depends-on belongs to a state: add --conversation <id> (from faces state:create).');
123
+ turn.depends_on = parseDependsOn(flags['depends-on']);
124
+ }
124
125
  }
125
126
  catch (err) {
126
127
  this.error(err instanceof Error ? err.message : String(err));
127
128
  }
128
129
  const state = this.readState(flags);
129
130
  const questions = this.readQuestions(flags);
130
- if (!questions && flags.baseline)
131
- this.error('--baseline answers questions, so ask one with --question or --questions-file.');
132
- if (questions) {
133
- const problem = questionsProblem(questions, !flags.baseline, OPENAI_FORMAT_ONLY.includes(flags.model.toLowerCase()));
134
- if (problem)
135
- this.error(problem);
136
- this.models = await decisionModels(client);
137
- const match = this.models.find((m) => m.toLowerCase() === flags.model.toLowerCase());
138
- if (!match)
139
- this.error(`'${flags.model}' is not a decision model. The decision models are: ${this.models.join(', ')}.`);
140
- flags.model = match;
141
- if (OPENAI_FORMAT_ONLY.includes(match)) {
142
- if (this.argv.some((a) => a === '--format=systemone' || a === 'systemone')) {
143
- this.error(`${match} answers in OpenAI's format only. Use --format openai, or leave --format out.`);
144
- }
145
- flags.format = 'openai';
131
+ if (!questions)
132
+ this.error('Ask at least one question, with --question or --questions-file.');
133
+ const openaiOnly = OPENAI_FORMAT_ONLY.includes(downstream.toLowerCase());
134
+ const problemQ = questionsProblem(questions, true, openaiOnly);
135
+ if (problemQ)
136
+ this.error(problemQ);
137
+ this.models = await decisionModels(client);
138
+ const match = this.models.find((m) => m.toLowerCase() === downstream.toLowerCase());
139
+ if (!match)
140
+ this.error(`'${downstream}' is not a decision model. The decision models are: ${this.models.join(', ')}.`);
141
+ downstream = match;
142
+ if (OPENAI_FORMAT_ONLY.includes(match)) {
143
+ if (this.argv.some((a) => a === '--format=systemone' || a === 'systemone')) {
144
+ this.error(`${match} answers in OpenAI's format only. Use --format openai, or leave --format out.`);
146
145
  }
146
+ flags.format = 'openai';
147
147
  }
148
- const face = args.face;
149
- const model = questions ? (face ? `${face}@${flags.model}` : flags.model) : face;
150
- let body = questions ? { model, state, questions } : { model, state };
148
+ const model = `${name.upstream}/${downstream}`;
149
+ let body = { model, state, questions };
151
150
  if (flags.format === 'openai') {
152
151
  try {
153
152
  body = toOpenAIDecision(model, state, questions);
@@ -162,11 +161,7 @@ export default class Decide extends BaseCommand {
162
161
  body.compaction = flags.compaction;
163
162
  Object.assign(body, turn);
164
163
  if (!json) {
165
- process.stderr.write(!questions
166
- ? `Asking ${face} for its cause alone, with no questions.\n`
167
- : face
168
- ? `Asking ${face}. Decision model: ${flags.model}. This usually takes 10 to 20 seconds, sometimes a minute or more.\n`
169
- : `Asking the decision model alone (no-face baseline). Decision model: ${flags.model}.\n`);
164
+ process.stderr.write(`Asking ${face}. Decision model: ${downstream}. This usually takes 10 to 20 seconds, sometimes a minute or more.\n`);
170
165
  }
171
166
  let data;
172
167
  try {
@@ -174,27 +169,23 @@ export default class Decide extends BaseCommand {
174
169
  }
175
170
  catch (err) {
176
171
  if (err instanceof FacesAPIError)
177
- this.error(this.explain(err, face, flags.model));
172
+ this.error(this.explain(err, face, downstream));
178
173
  throw err;
179
174
  }
180
- const expected = [...(questions ? ['answers'] : []), ...(face ? ['cause'] : [])];
181
- const missing = missingFieldsNote(data, expected);
182
- if (missing && !json && !questions)
183
- this.error(missing);
175
+ const missing = missingFieldsNote(data, ['answers']);
184
176
  if (missing)
185
177
  process.stderr.write(`${missing}\n`);
186
178
  if (json)
187
179
  return data;
188
- if (!questions) {
189
- this.log(data.cause ?? '');
190
- return data;
191
- }
192
- const cause = causeLines(data, Object.keys(questions));
193
- if (flags['show-cause'] && cause.length > 0 && face)
194
- process.stderr.write(`${reasoningHeading(face)}\n${cause.join('\n')}\n\n`);
195
180
  const answers = flags.format === 'openai' ? fromOpenAIAnswers(data.answers, questions) : (data.answers ?? {});
196
181
  for (const line of decisionLines(answers))
197
182
  this.log(line);
183
+ const ids = Object.entries(data.decision_ids ?? {});
184
+ if (ids.length > 0) {
185
+ this.log('');
186
+ for (const [q, id] of ids)
187
+ this.log(`decision id (${q}): ${id}`);
188
+ }
198
189
  return data;
199
190
  }
200
191
  async ask(client, body, retry, json, endpoint) {
@@ -231,18 +222,16 @@ export default class Decide extends BaseCommand {
231
222
  const head = `HTTP ${err.statusCode}: ${err.message}`;
232
223
  switch (err.statusCode) {
233
224
  case 409: {
234
- if (!face)
235
- return head;
236
- return `${head}\n${compileHint(face, !/nothing compiled/i.test(err.message), 'decide')}`;
225
+ return `${head}\n${compileHint(face.replace(/^@/, '').replace('~', ':'), !/nothing compiled/i.test(err.message), 'decide')}`;
237
226
  }
238
227
  case 503: {
239
228
  if (err.retryAfter !== undefined)
240
229
  return `${head}\nTry again in ${err.retryAfter}s.`;
241
230
  const others = (this.models ?? [...DECISION_MODELS]).filter((m) => m !== model).join(', ');
242
- return `${head}\nTry again. If the message names the decision model, another --model may answer (${others}).`;
231
+ return `${head}\nTry again. If the message names the decision model, another decision model may answer (${others}).`;
243
232
  }
244
233
  case 504: {
245
- return `${head}\n${face ? 'The face' : 'The decision'} did not finish within 300 seconds. Ask again.`;
234
+ return `${head}\nThe face did not finish within 300 seconds. Ask again.`;
246
235
  }
247
236
  default: {
248
237
  return head;
@@ -6,7 +6,7 @@ import { score10 } from '../../fidelity.js';
6
6
  import { faceStyles, renameFaceFields, resolveFace, isMeAlias, ME_MISSING, seg } from '../../utils.js';
7
7
  export default class FaceGet extends BaseCommand {
8
8
  static description = 'Get details for a face, by alias or owner:alias. A published or shared face is reachable under the ' +
9
- 'same owner:alias address chat uses; it is shown with a note that you do not own it.';
9
+ 'owner:alias address (in a model it is written @owner~alias); it is shown with a note that you do not own it.';
10
10
  static flags = {
11
11
  ...BaseCommand.baseFlags,
12
12
  include: Flags.string({
@@ -43,7 +43,7 @@ export default class FaceGet extends BaseCommand {
43
43
  if (args.face_id.includes(':')) {
44
44
  this.error(`Could not find '${args.face_id}' in the face listing.\n` +
45
45
  'A published face can be reachable before it appears there, so this may not mean it does ' +
46
- `not exist. If you know the handle, try it directly: faces chat:chat ${args.face_id}@<model>`);
46
+ `not exist. If you know the handle, try it directly: faces choices ${args.face_id} --state "..."`);
47
47
  }
48
48
  if (isMeAlias(args.face_id))
49
49
  this.error(ME_MISSING);
@@ -5,7 +5,7 @@ import { GroupCatalogService } from '../../group-catalog.js';
5
5
  import { resolveFace, seg } from '../../utils.js';
6
6
  export default class GroupAdd extends BaseCommand {
7
7
  static description = 'Add face(s) to a group. Any face this account can reach may join: your own, a published one, or one ' +
8
- 'shared with you. Name someone else\'s as owner:alias, the same address chat uses.';
8
+ 'shared with you. Name someone else\'s as owner:alias.';
9
9
  static flags = {
10
10
  ...BaseCommand.baseFlags,
11
11
  face: Flags.string({ description: 'Face alias to add (repeatable)', multiple: true, required: true }),
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class MediaList extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
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,35 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ import { FacesAPIError } from '../../client.js';
3
+ import { MEDIA_PATH, mediaLines, mediaOf } from '../../media.js';
4
+ export default class MediaList extends BaseCommand {
5
+ static description = 'List the media (GET /v1/media): the kinds of writing a source can be, each with its description and ' +
6
+ 'the subcategories it covers. A document declares one when it is compiled (--medium), styles are built ' +
7
+ 'one per medium, and chat chooses one for each request. Send the name exactly: a subcategory such as ' +
8
+ 'keynote is not a medium (it is a speech). No login needed.';
9
+ static examples = [
10
+ '<%= config.bin %> <%= command.id %>',
11
+ '<%= config.bin %> <%= command.id %> --json',
12
+ ];
13
+ static flags = {
14
+ ...BaseCommand.baseFlags,
15
+ };
16
+ async run() {
17
+ const { flags } = await this.parse(MediaList);
18
+ const client = this.makeClient(flags);
19
+ let raw;
20
+ try {
21
+ raw = await client.get(MEDIA_PATH, { optionalAuth: true });
22
+ }
23
+ catch (err) {
24
+ if (err instanceof FacesAPIError)
25
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
26
+ throw err;
27
+ }
28
+ const data = mediaOf(raw);
29
+ if (this.jsonEnabled())
30
+ return { object: 'list', data };
31
+ for (const line of mediaLines(data))
32
+ this.log(line);
33
+ return { object: 'list', data };
34
+ }
35
+ }
@@ -2,22 +2,26 @@ import { Flags } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base.js';
3
3
  import { FacesAPIError } from '../../client.js';
4
4
  import { table } from '../../utils.js';
5
- const KINDS = ['chat', 'image', 'transcription', 'decision', 'cause', 'compile'];
5
+ const KINDS = ['upstream', 'chat', 'decision', 'compile', 'image', 'transcription'];
6
6
  export default class ModelsList extends BaseCommand {
7
7
  static description = 'List the models you can name, once each, with their kind, endpoint and price (GET /v1/models). ' +
8
- 'Without --kind only chat models are listed. CHATGPT marks the Codex-eligible models, which run on a linked ' +
9
- 'ChatGPT plan, at /v1/responses on Connect and Pro. Prices are per million tokens. No login needed.';
8
+ 'Upstream models are ours, the maestros, written after a face: @alice:maestro-1. Downstream models write ' +
9
+ 'the answer, after the /: @alice:maestro-1/gpt-5.4. Each is priced on its own. Without --kind the maestros ' +
10
+ 'and the chat models are listed; --kind decision lists the models faces decide answers on. ' +
11
+ 'CHATGPT marks the Codex-eligible models, which can run on a linked ChatGPT plan (style builds, interviews). ' +
12
+ 'Prices are per million tokens. No login needed.';
10
13
  static examples = [
11
14
  '<%= config.bin %> <%= command.id %>',
15
+ '<%= config.bin %> <%= command.id %> --kind upstream',
12
16
  '<%= config.bin %> <%= command.id %> --kind decision',
13
- '<%= config.bin %> <%= command.id %> --kind cause,compile',
17
+ '<%= config.bin %> <%= command.id %> --kind upstream,compile',
14
18
  '<%= config.bin %> <%= command.id %> --kind all --json',
15
19
  '<%= config.bin %> <%= command.id %> --provider anthropic',
16
20
  ];
17
21
  static flags = {
18
22
  ...BaseCommand.baseFlags,
19
23
  kind: Flags.string({
20
- description: `One kind or a comma-separated list: ${KINDS.join(', ')}; or all. Default: chat.`,
24
+ description: `One kind or a comma-separated list: ${KINDS.join(', ')}; or all. Default: upstream and chat.`,
21
25
  }),
22
26
  provider: Flags.string({ description: 'Only models from this lab (e.g. openai, anthropic, qwen)' }),
23
27
  chatgpt: Flags.boolean({
@@ -81,6 +85,13 @@ export default class ModelsList extends BaseCommand {
81
85
  }
82
86
  if (m.token_basis === 'source')
83
87
  notes.push(`${m.id}: priced per million source tokens compiled.`);
88
+ if (m.token_basis === 'processed')
89
+ notes.push(`${m.id}: on /v1/choices, priced on the tokens each call processes, as its usage reports them.`);
90
+ const st = m.steering;
91
+ if (st && typeof st === 'object' && typeof st.input_cost_per_million_tokens === 'number') {
92
+ notes.push(`${m.id}: steering a face over a downstream model (chat, decide) costs $${st.input_cost_per_million_tokens} per million ` +
93
+ `input tokens plus $${st.cost_per_call_usd} a call, with no output charge; the downstream model is billed at its listed price plus the markup.`);
94
+ }
84
95
  const inc = m.included_tokens_per_month;
85
96
  if (inc && typeof inc === 'object') {
86
97
  const plans = Object.entries(inc).filter(([, n]) => typeof n === 'number' && n > 0).map(([p, n]) => `${p[0].toUpperCase()}${p.slice(1)} ${n.toLocaleString('en-US')}`);
@@ -5,7 +5,7 @@ import { SESSIONS_PATH, sessionHint } from '../../session.js';
5
5
  import { seg } from '../../utils.js';
6
6
  export default class SessionClose extends BaseCommand {
7
7
  static description = 'Close a session. A closed session takes no more turns and cannot be compacted or read. Its ' +
8
- 'compactions stay usable until they expire. Free. Sessions are now called conversations: see faces conversation:close.';
8
+ 'compactions stay usable until they expire. Free. Sessions are now called states: see faces state:close.';
9
9
  static examples = ['<%= config.bin %> <%= command.id %> fs_SESSION_ID --yes'];
10
10
  static flags = {
11
11
  ...BaseCommand.baseFlags,
@@ -5,11 +5,11 @@ import { heldDecisionError } from '../../decisions.js';
5
5
  import { SESSIONS_PATH, sessionHint } from '../../session.js';
6
6
  import { retryOnceOnWarmUp, sayWarmUp, seg } from '../../utils.js';
7
7
  export default class SessionCompact extends BaseCommand {
8
- static description = 'Compact a session: a summary of the face\'s position over the session, in the face\'s own terms, ' +
9
- 'stored under a compaction id. Pass that id with --compaction on a later request with the same face, ' +
10
- 'and send only the messages you still want read. Billed at the cause rate on the tokens it reads and ' +
11
- 'writes; on Connect and Pro it counts against the cause allowance. A failed compaction is not charged. ' +
12
- 'A compaction expires 30 days after it is written. Sessions are now called conversations: see faces conversation:compact.';
8
+ static description = 'Compact a session: the face\'s position over the session, kept on the server under a compaction id. ' +
9
+ 'Pass that id with --compaction on a later request with the same face, and send only the messages you ' +
10
+ 'still want read. Billed on the tokens it reads and writes; on Connect and Pro it counts against the ' +
11
+ 'plan\'s allowance. A failed compaction is not charged. ' +
12
+ 'A compaction expires 30 days after it is written. Sessions are now called states: see faces state:compact.';
13
13
  static examples = [
14
14
  '<%= config.bin %> <%= command.id %> fs_SESSION_ID',
15
15
  '<%= config.bin %> <%= command.id %> fs_SESSION_ID --json',
@@ -42,16 +42,13 @@ export default class SessionCompact extends BaseCommand {
42
42
  throw err;
43
43
  }
44
44
  if (!json) {
45
- if (typeof data.cause === 'string')
46
- this.log(data.cause);
47
- this.log('');
48
45
  this.log(`compaction: ${data.compaction_id ?? '-'}`);
49
46
  if (data.turns !== undefined)
50
47
  this.log(`turns: ${data.turns}`);
51
48
  if (data.expires_at)
52
49
  this.log(`expires: ${data.expires_at}`);
53
50
  if (data.compaction_id)
54
- this.log(`\nUse it with: faces chat:chat <face>@<model> --compaction ${data.compaction_id} -m "..."`);
51
+ this.log(`\nUse it with: faces chat:chat @<face>:maestro-1/<model> --compaction ${data.compaction_id} -m "..."`);
55
52
  }
56
53
  return data;
57
54
  }
@@ -2,29 +2,30 @@ import { Args } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base.js';
3
3
  import { FacesAPIError } from '../../client.js';
4
4
  import { SESSIONS_PATH, sessionLines } from '../../session.js';
5
+ import { asFace as faceAlone } from '../../model.js';
5
6
  export default class SessionCreate extends BaseCommand {
6
7
  static description = 'Start a session with a face. A session groups the turns of one conversation with one face: pass its id ' +
7
- 'with --session on chat, causes or decide, then compact it with session:compact. Opening one is free; ' +
8
- 'each turn costs what it costs without one. A session expires 30 days after its last turn. Sessions are now called conversations: see faces conversation:create.';
8
+ 'with --session on chat or decide, then compact it with session:compact. Opening one is free; ' +
9
+ 'each turn costs what it costs without one. A session expires 30 days after its last turn. Sessions are now called states: see faces state:create.';
9
10
  static examples = [
10
- '<%= config.bin %> <%= command.id %> alice',
11
- '<%= config.bin %> <%= command.id %> "(alice | bob)" --json',
11
+ '<%= config.bin %> <%= command.id %> @alice',
12
+ '<%= config.bin %> <%= command.id %> "(@alice | @bob)" --json',
12
13
  ];
13
14
  static flags = {
14
15
  ...BaseCommand.baseFlags,
15
16
  };
16
17
  static args = {
17
18
  face: Args.string({
18
- description: 'The face alone: an alias, owner:alias, or a composite such as "(a | b)". No @model.',
19
+ description: 'The face alone: @alice, @owner~alice, or a composite such as "(@a | @b)". No maestro or model.',
19
20
  required: true,
20
21
  }),
21
22
  };
22
23
  async run() {
23
24
  const { args, flags } = await this.parse(SessionCreate);
24
25
  const client = this.makeClient(flags);
25
- const face = args.face.trim();
26
- if (face.includes('@'))
27
- this.error(`A session is with a face alone: ${face.slice(0, face.lastIndexOf('@'))}`);
26
+ const face = faceAlone(args.face);
27
+ if (/[:/]/.test(face))
28
+ this.error(`A session is with a face alone, with no maestro or model: ${face.split(/[:/]/)[0]}`);
28
29
  let data;
29
30
  try {
30
31
  data = (await client.post(SESSIONS_PATH, { body: { model: face } }));
@@ -38,7 +39,7 @@ export default class SessionCreate extends BaseCommand {
38
39
  for (const line of sessionLines(data))
39
40
  this.log(line);
40
41
  if (data.id)
41
- this.log(`\nAdd turns with: faces chat:chat ${face}@<model> --session ${data.id} -m "..."`);
42
+ this.log(`\nAdd turns with: faces decide ${face}:maestro-1/jev-latest --session ${data.id} --state "..." --question "..."`);
42
43
  }
43
44
  return data;
44
45
  }
@@ -4,7 +4,7 @@ import { FacesAPIError } from '../../client.js';
4
4
  import { SESSIONS_PATH, sessionHint, sessionLines } from '../../session.js';
5
5
  import { seg } from '../../utils.js';
6
6
  export default class SessionGet extends BaseCommand {
7
- static description = 'Read a session: its face, status, how many turns it holds, and when it expires. Free. Sessions are now called conversations: see faces conversation:get.';
7
+ static description = 'Read a session: its face, status, how many turns it holds, and when it expires. Free. Sessions are now called states: see faces state:get.';
8
8
  static examples = ['<%= config.bin %> <%= command.id %> fs_SESSION_ID'];
9
9
  static flags = {
10
10
  ...BaseCommand.baseFlags,
@@ -0,0 +1,3 @@
1
+ import ConversationAdd from '../conversation/add.js';
2
+ export default class StateAdd extends ConversationAdd {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationAdd from '../conversation/add.js';
2
+ export default class StateAdd extends ConversationAdd {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationClose from '../conversation/close.js';
2
+ export default class StateClose extends ConversationClose {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationClose from '../conversation/close.js';
2
+ export default class StateClose extends ConversationClose {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationCompact from '../conversation/compact.js';
2
+ export default class StateCompact extends ConversationCompact {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationCompact from '../conversation/compact.js';
2
+ export default class StateCompact extends ConversationCompact {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationCreate from '../conversation/create.js';
2
+ export default class StateCreate extends ConversationCreate {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationCreate from '../conversation/create.js';
2
+ export default class StateCreate extends ConversationCreate {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationGet from '../conversation/get.js';
2
+ export default class StateGet extends ConversationGet {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationGet from '../conversation/get.js';
2
+ export default class StateGet extends ConversationGet {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationItems from '../conversation/items.js';
2
+ export default class StateItems extends ConversationItems {
3
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationItems from '../conversation/items.js';
2
+ export default class StateItems extends ConversationItems {
3
+ }
@@ -2,7 +2,7 @@ import { Args, Flags } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base.js';
3
3
  import { FacesAPIError } from '../../client.js';
4
4
  import { codexEligible } from '../../routing.js';
5
- import { BUILDS_PATH, LIVE_THREAD_MEDIUM, formatBuildReport, jobFailureMessage, jobMedium, listSelectable, parseSourceArg, pollStyleJob, publicJob, chatgptLinked, styleCreditRefusal, } from '../../style.js';
5
+ import { BUILDS_PATH, LIVE_THREAD_MEDIUM, formatBuildReport, jobFailureMessage, listSelectable, parseSourceArg, pollStyleJob, publicJob, chatgptLinked, styleCreditRefusal, } from '../../style.js';
6
6
  export default class StyleMake extends BaseCommand {
7
7
  static description = 'Build a style for a face from its own writing, one per medium, and install it. Building does not ' +
8
8
  'apply it: chat with --style <medium> to use it. Name the sources with --source, or take everything ' +
@@ -107,11 +107,7 @@ export default class StyleMake extends BaseCommand {
107
107
  for (const line of formatBuildReport(final))
108
108
  this.log(line);
109
109
  this.log('');
110
- const medium = jobMedium(final)?.split(', ')[0];
111
- const style = !medium ? '<medium>' : medium.includes(' ') ? `"${medium}"` : medium;
112
- this.log(`'${args.alias}' has built a style. Use it with --style and the medium:`);
113
- this.log(` faces chat:chat ${args.alias} --style ${style} -m "..."`);
114
- this.log(`Without --style, no built style is applied.`);
110
+ this.log(`'${args.alias}' has built a style. Chat with the face uses it when a request is in that medium.`);
115
111
  this.log(`Go back to the previous style: faces style:revert ${args.alias} --yes`);
116
112
  return final;
117
113
  }
@@ -12,7 +12,7 @@ export default class StyleUpload extends BaseCommand {
12
12
  'for plaintextBody. The server lists every problem with a refused line, and the fields it accepts. ' +
13
13
  'Upload ONE medium per file: a file mixing, say, email and ' +
14
14
  'text messages produces threads with no medium at all, which no style can be built from. A message that declares ' +
15
- 'its own `kind` must spell one of the eleven media exactly; an unknown one is refused, naming the ' +
15
+ 'its own `kind` must spell one of the media in faces media:list exactly; an unknown one is refused, naming the ' +
16
16
  'message that carried it. The file is passed through as written, so this is the server answering.';
17
17
  static examples = [
18
18
  '<%= config.bin %> <%= command.id %> alice ./mail.jsonl',