@faces-sh/cli 1.0.0 → 1.0.2

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 (49) hide show
  1. package/README.md +32 -7
  2. package/dist/commands/auth/connections.js +1 -1
  3. package/dist/commands/billing/card/default.js +1 -1
  4. package/dist/commands/billing/card/remove.js +1 -1
  5. package/dist/commands/billing/card-setup.js +1 -1
  6. package/dist/commands/billing/subscription/activate.js +2 -2
  7. package/dist/commands/billing/subscription/cancel.js +1 -1
  8. package/dist/commands/billing/subscription/plan.js +1 -1
  9. package/dist/commands/billing/topup.js +2 -2
  10. package/dist/commands/causes.d.ts +6 -2
  11. package/dist/commands/causes.js +11 -0
  12. package/dist/commands/chat/chat.d.ts +12 -7
  13. package/dist/commands/chat/chat.js +19 -6
  14. package/dist/commands/chat/messages.d.ts +10 -6
  15. package/dist/commands/chat/messages.js +10 -1
  16. package/dist/commands/chat/responses.d.ts +10 -6
  17. package/dist/commands/chat/responses.js +10 -1
  18. package/dist/commands/chat/thread.d.ts +17 -10
  19. package/dist/commands/chat/thread.js +20 -6
  20. package/dist/commands/conversation/add.d.ts +18 -0
  21. package/dist/commands/conversation/add.js +66 -0
  22. package/dist/commands/conversation/close.d.ts +16 -0
  23. package/dist/commands/conversation/close.js +36 -0
  24. package/dist/commands/conversation/compact.d.ts +16 -0
  25. package/dist/commands/conversation/compact.js +69 -0
  26. package/dist/commands/conversation/create.d.ts +19 -0
  27. package/dist/commands/conversation/create.js +76 -0
  28. package/dist/commands/conversation/get.d.ts +15 -0
  29. package/dist/commands/conversation/get.js +35 -0
  30. package/dist/commands/conversation/items.d.ts +15 -0
  31. package/dist/commands/conversation/items.js +45 -0
  32. package/dist/commands/decide.d.ts +8 -4
  33. package/dist/commands/decide.js +10 -0
  34. package/dist/commands/face/delete.js +1 -1
  35. package/dist/commands/face/publish.js +1 -0
  36. package/dist/commands/face/share.js +1 -0
  37. package/dist/commands/face/unpublish.js +1 -0
  38. package/dist/commands/face/unshare.js +1 -1
  39. package/dist/commands/session/close.js +1 -1
  40. package/dist/commands/session/compact.js +1 -1
  41. package/dist/commands/session/create.js +1 -1
  42. package/dist/commands/session/get.js +1 -1
  43. package/dist/commands/style/delete.js +16 -14
  44. package/dist/conversation.d.ts +63 -0
  45. package/dist/conversation.js +237 -0
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/utils.js +4 -3
  48. package/oclif.manifest.json +3007 -2319
  49. package/package.json +4 -1
@@ -50,7 +50,7 @@ export default class FaceUnshare extends BaseCommand {
50
50
  }
51
51
  let data;
52
52
  try {
53
- data = await client.patch(`/v1/faces/${seg(args.alias)}/share`, { body: { shared_with: next } });
53
+ data = await client.patch(`/v1/faces/${seg(args.alias)}/share`, { requireJwt: true, body: { shared_with: next } });
54
54
  }
55
55
  catch (err) {
56
56
  if (err instanceof FacesAPIError)
@@ -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.';
8
+ 'compactions stay usable until they expire. Free. Sessions are now called conversations: see faces conversation:close.';
9
9
  static examples = ['<%= config.bin %> <%= command.id %> fs_SESSION_ID --yes'];
10
10
  static flags = {
11
11
  ...BaseCommand.baseFlags,
@@ -9,7 +9,7 @@ export default class SessionCompact extends BaseCommand {
9
9
  'stored under a compaction id. Pass that id with --compaction on a later request with the same face, ' +
10
10
  'and send only the messages you still want read. Billed at the cause rate on the tokens it reads and ' +
11
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.';
12
+ 'A compaction expires 30 days after it is written. Sessions are now called conversations: see faces conversation:compact.';
13
13
  static examples = [
14
14
  '<%= config.bin %> <%= command.id %> fs_SESSION_ID',
15
15
  '<%= config.bin %> <%= command.id %> fs_SESSION_ID --json',
@@ -5,7 +5,7 @@ import { SESSIONS_PATH, sessionLines } from '../../session.js';
5
5
  export default class SessionCreate extends BaseCommand {
6
6
  static description = 'Start a session with a face. A session groups the turns of one conversation with one face: pass its id ' +
7
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.';
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.';
9
9
  static examples = [
10
10
  '<%= config.bin %> <%= command.id %> alice',
11
11
  '<%= config.bin %> <%= command.id %> "(alice | bob)" --json',
@@ -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.';
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.';
8
8
  static examples = ['<%= config.bin %> <%= command.id %> fs_SESSION_ID'];
9
9
  static flags = {
10
10
  ...BaseCommand.baseFlags,
@@ -4,11 +4,12 @@ import { FacesAPIError } from '../../client.js';
4
4
  import { STYLE_FACES_PATH } from '../../style.js';
5
5
  import { faceStyles, seg } from '../../utils.js';
6
6
  export default class StyleDelete extends BaseCommand {
7
- static description = "Delete a face's built style. A face holds one per medium, so name which with --medium, or pass " +
8
- '--all to remove every one. On a face with several, an unscoped delete is refused rather than taking ' +
9
- 'them all. The material a style was built from is always kept, so it can be built again without ' +
10
- 're-uploading; to remove source text use compile:doc:delete, or compile:doc:reset to withdraw it from ' +
11
- 'the face while keeping it.';
7
+ static description = "Delete a face's style build. A face holds one per medium, so name which with --medium, or pass " +
8
+ '--all to delete every one. On a face with several, an unscoped delete is refused rather than taking ' +
9
+ 'them all. Only the build goes: the uploaded material is kept, so it can be built again without ' +
10
+ 're-uploading, and what the face learned about how it writes from its documents and threads stays ' +
11
+ 'until they are deleted. To remove a style completely, delete that medium\'s documents and threads ' +
12
+ '(compile:doc:delete, compile:thread:delete), then the build.';
12
13
  static examples = [
13
14
  '<%= config.bin %> <%= command.id %> alice --medium email',
14
15
  '<%= config.bin %> <%= command.id %> alice --all --yes',
@@ -16,11 +17,11 @@ export default class StyleDelete extends BaseCommand {
16
17
  static flags = {
17
18
  ...BaseCommand.baseFlags,
18
19
  medium: Flags.string({
19
- description: 'Delete only this medium\'s style, leaving the rest. See faces style:versions <alias>.',
20
+ description: 'Delete only this medium\'s style build, leaving the rest. See faces style:versions <alias>.',
20
21
  exclusive: ['all'],
21
22
  }),
22
23
  all: Flags.boolean({
23
- description: 'Delete every style the face has. Required when it holds more than one.',
24
+ description: 'Delete every style build the face has. Required when it holds more than one.',
24
25
  default: false,
25
26
  exclusive: ['medium'],
26
27
  }),
@@ -35,13 +36,14 @@ export default class StyleDelete extends BaseCommand {
35
36
  if (!flags.yes) {
36
37
  const media = await this.mediaOf(client, args.alias);
37
38
  const scope = flags.medium
38
- ? `its ${flags.medium} style`
39
+ ? `the ${flags.medium} style build`
39
40
  : media.length > 1
40
- ? `all ${media.length} of its styles (${media.join(', ')})`
41
+ ? `all ${media.length} style builds (${media.join(', ')})`
41
42
  : media.length === 1
42
- ? `its ${media[0]} style`
43
- : 'its style';
44
- const what = `'${args.alias}' will forget ${scope}. Its documents, threads and uploaded material are kept.`;
43
+ ? `the ${media[0]} style build`
44
+ : 'the style build';
45
+ const what = `This deletes ${scope} of '${args.alias}'. Its documents, threads and uploaded material are kept, ` +
46
+ 'and so is what it learned from them.';
45
47
  await this.confirmOrRefuse(`${what}\nDelete?`, false);
46
48
  }
47
49
  const params = new URLSearchParams();
@@ -76,8 +78,8 @@ export default class StyleDelete extends BaseCommand {
76
78
  const scoped = data.scoped === true || typeof data.medium === 'string';
77
79
  const medium = data.medium;
78
80
  this.log(scoped && medium
79
- ? `'${args.alias}' has forgotten its ${medium} style. Its other styles and all its source material are untouched.`
80
- : `'${args.alias}' has forgotten its styles. Its source material is untouched.`);
81
+ ? `Deleted the ${medium} style build of '${args.alias}'. Its other styles, its sources and what it learned from them are untouched.`
82
+ : `Deleted the style builds of '${args.alias}'. Its sources and what it learned from them are untouched.`);
81
83
  this.log(`Build it again with: faces style:make ${args.alias} --all`);
82
84
  return data;
83
85
  }
@@ -0,0 +1,63 @@
1
+ import { FacesAPIError } from './client.js';
2
+ export declare const CONVERSATIONS_PATH = "/v1/conversations";
3
+ export declare const MAX_CONVERSATION_ITEMS = 20;
4
+ export interface Conversation {
5
+ object?: string;
6
+ id?: string;
7
+ model?: string | null;
8
+ turns?: number;
9
+ items?: number;
10
+ causes_visible?: boolean;
11
+ status?: string;
12
+ created_at?: string;
13
+ last_used_at?: string;
14
+ expires_at?: string;
15
+ }
16
+ export interface Premise {
17
+ key: string;
18
+ value: unknown;
19
+ description?: string;
20
+ }
21
+ export interface PremiseState {
22
+ value?: unknown;
23
+ description?: string | null;
24
+ }
25
+ export declare const CONVERSATION_FLAG_DESCRIPTION: string;
26
+ export declare const PREMISE_FLAG_DESCRIPTION: string;
27
+ export declare const PREMISE_DESCRIPTION_FLAG_DESCRIPTION: string;
28
+ export declare const CAUSES_VISIBLE_TURN_FLAG_DESCRIPTION: string;
29
+ export declare function conversationTurnFlags(opts?: {
30
+ suffix?: string;
31
+ exclusive?: string[];
32
+ }): {
33
+ conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ premise: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ 'premise-description': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ 'causes-visible': import("@oclif/core/interfaces").BooleanFlag<boolean>;
37
+ };
38
+ export declare function conversationLines(c: Conversation): string[];
39
+ export declare function conversationHint(err: FacesAPIError): string | undefined;
40
+ export declare function premiseValue(raw: string): unknown;
41
+ export declare function parsePremises(premises?: string[], descriptions?: string[]): Premise[];
42
+ export declare function conversationFields(flags: {
43
+ conversation?: string;
44
+ session?: string;
45
+ premise?: string[];
46
+ 'premise-description'?: string[];
47
+ 'causes-visible'?: boolean;
48
+ }): Record<string, unknown>;
49
+ export declare function clientItems(messages?: string[], premises?: Premise[]): Array<Record<string, unknown>>;
50
+ export declare function shownValue(v: unknown): string;
51
+ export declare function premiseLines(premises: Record<string, PremiseState> | undefined): string[];
52
+ export declare function itemLines(items: Array<Record<string, unknown>>): string[];
53
+ export interface StaleDecision {
54
+ call_id?: string;
55
+ question?: Record<string, unknown>;
56
+ choice?: unknown;
57
+ face?: string;
58
+ changed?: Record<string, {
59
+ was?: unknown;
60
+ now?: unknown;
61
+ }>;
62
+ }
63
+ export declare function staleDecisionLines(stale: StaleDecision[] | undefined): string[];
@@ -0,0 +1,237 @@
1
+ import { Flags } from '@oclif/core';
2
+ export const CONVERSATIONS_PATH = '/v1/conversations';
3
+ export const MAX_CONVERSATION_ITEMS = 20;
4
+ const PREMISE_KEY = /^[A-Za-z0-9_-]{1,64}$/;
5
+ export const CONVERSATION_FLAG_DESCRIPTION = 'Add this turn to a conversation, by id (from faces conversation:create). Send only the new message: ' +
6
+ 'the conversation so far is read before it. A conversation opened with one face takes only that face.';
7
+ export const PREMISE_FLAG_DESCRIPTION = 'A premise, as key=value (repeatable): a named fact the face\'s answers depend on, kept on the ' +
8
+ 'conversation. The key is 1 to 64 letters, digits, _ or -. The value is read as JSON when it is JSON ' +
9
+ '(50000, true, null, ["a","b"], {"max":3}) and as text otherwise, so plan=annual is the text "annual". ' +
10
+ 'Quote it to keep a number as text: --premise \'code="007"\'. A newer value of a key replaces it from ' +
11
+ 'then on. A key used for the first time needs --premise-description.';
12
+ export const PREMISE_DESCRIPTION_FLAG_DESCRIPTION = 'What a --premise means, in plain words, as key="text" (repeatable, one per key), e.g. ' +
13
+ '--premise-description budget_usd="the most we can spend this year". Required the first time a key is ' +
14
+ 'used in a conversation, and kept after that.';
15
+ export const CAUSES_VISIBLE_TURN_FLAG_DESCRIPTION = 'Whether the face reads the other faces\' causes on this turn, in a conversation with several faces. ' +
16
+ 'Leave it out to follow the conversation (see faces conversation:create --no-causes-visible).';
17
+ export function conversationTurnFlags(opts = {}) {
18
+ const d = (text) => (opts.suffix ? `${text} ${opts.suffix}` : text);
19
+ const exclusive = opts.exclusive;
20
+ return {
21
+ conversation: Flags.string({ description: d(CONVERSATION_FLAG_DESCRIPTION), exclusive }),
22
+ premise: Flags.string({ description: d(`${PREMISE_FLAG_DESCRIPTION} Needs --conversation.`), multiple: true, exclusive }),
23
+ 'premise-description': Flags.string({ description: d(PREMISE_DESCRIPTION_FLAG_DESCRIPTION), multiple: true, dependsOn: ['premise'], exclusive }),
24
+ 'causes-visible': Flags.boolean({ description: d(`${CAUSES_VISIBLE_TURN_FLAG_DESCRIPTION} Needs --conversation.`), allowNo: true, exclusive }),
25
+ };
26
+ }
27
+ export function conversationLines(c) {
28
+ const pairs = [
29
+ ['conversation', c.id],
30
+ ['face', c.model ?? (c.object === 'conversation' ? 'any of your faces' : undefined)],
31
+ ['status', c.status],
32
+ ['turns', c.turns],
33
+ ['items', c.items],
34
+ ['causes', c.causes_visible === undefined ? undefined : c.causes_visible ? 'each face reads the other faces\' causes' : 'each face reads its own only'],
35
+ ['created', c.created_at],
36
+ ['last used', c.last_used_at],
37
+ ['expires', c.expires_at],
38
+ ];
39
+ return pairs.filter(([, v]) => v !== undefined && v !== null).map(([k, v]) => `${`${k}:`.padEnd(14)}${v}`);
40
+ }
41
+ export function conversationHint(err) {
42
+ if (err.statusCode === 404) {
43
+ return 'A conversation expires 30 days after it was last used, and a closed one cannot be used. ' +
44
+ 'Start another with: faces conversation:create';
45
+ }
46
+ const fresh = err.statusCode === 422 ? /premise '([A-Za-z0-9_-]{1,64})' is new/.exec(err.message) : null;
47
+ if (fresh)
48
+ return `Say what it means: --premise-description ${fresh[1]}="what it means, in plain words"`;
49
+ return undefined;
50
+ }
51
+ export function premiseValue(raw) {
52
+ if (raw.trim() === '')
53
+ return raw;
54
+ try {
55
+ const v = JSON.parse(raw);
56
+ if (typeof v === 'number' && !Number.isFinite(v))
57
+ return raw;
58
+ return v;
59
+ }
60
+ catch {
61
+ return raw;
62
+ }
63
+ }
64
+ function splitPair(raw, flag, shape) {
65
+ const i = raw.indexOf('=');
66
+ if (i <= 0)
67
+ throw new Error(`${flag} takes ${shape} (got '${raw}').`);
68
+ return [raw.slice(0, i).trim(), raw.slice(i + 1)];
69
+ }
70
+ function checkKey(key, flag) {
71
+ if (!PREMISE_KEY.test(key))
72
+ throw new Error(`${flag}: a premise key is 1 to 64 letters, digits, _ or - (got '${key}').`);
73
+ }
74
+ export function parsePremises(premises = [], descriptions = []) {
75
+ const out = [];
76
+ const seen = new Map();
77
+ for (const raw of premises) {
78
+ const [key, value] = splitPair(raw, '--premise', 'key=value');
79
+ checkKey(key, '--premise');
80
+ if (seen.has(key))
81
+ throw new Error(`--premise sets '${key}' twice. Give each key once per request.`);
82
+ const p = { key, value: premiseValue(value) };
83
+ seen.set(key, p);
84
+ out.push(p);
85
+ }
86
+ const described = new Set();
87
+ for (const raw of descriptions) {
88
+ const [key, text] = splitPair(raw, '--premise-description', 'key="what it means"');
89
+ checkKey(key, '--premise-description');
90
+ const p = seen.get(key);
91
+ if (!p)
92
+ throw new Error(`--premise-description names '${key}', which no --premise sets. Add --premise ${key}=<value>.`);
93
+ if (described.has(key))
94
+ throw new Error(`--premise-description describes '${key}' twice. Give one description per key.`);
95
+ if (text.trim() === '')
96
+ throw new Error(`--premise-description for '${key}' is empty. Say what it means, in plain words.`);
97
+ described.add(key);
98
+ p.description = text.trim();
99
+ }
100
+ return out;
101
+ }
102
+ export function conversationFields(flags) {
103
+ const out = {};
104
+ if (flags.conversation && flags.session && flags.conversation !== flags.session) {
105
+ throw new Error('--session is the old name for --conversation: pass one of them, not two different ids.');
106
+ }
107
+ const premises = parsePremises(flags.premise, flags['premise-description']);
108
+ const inConversation = Boolean(flags.conversation || flags.session);
109
+ if (!inConversation && (premises.length > 0 || flags['causes-visible'] !== undefined)) {
110
+ throw new Error('Premises and --causes-visible belong to a conversation: add --conversation <id> (from faces conversation:create).');
111
+ }
112
+ if (flags.conversation)
113
+ out.conversation = flags.conversation;
114
+ if (premises.length > 0)
115
+ out.premises = premises;
116
+ if (flags['causes-visible'] !== undefined)
117
+ out.causes_visible = flags['causes-visible'];
118
+ return out;
119
+ }
120
+ export function clientItems(messages = [], premises = []) {
121
+ return [...premises.map((p) => ({ ...p })), ...messages.map((content) => ({ type: 'message', role: 'user', content }))];
122
+ }
123
+ export function shownValue(v) {
124
+ return v === undefined ? '-' : JSON.stringify(v);
125
+ }
126
+ export function premiseLines(premises) {
127
+ const entries = Object.entries(premises ?? {});
128
+ if (entries.length === 0)
129
+ return ['premises: none'];
130
+ const lines = ['premises:'];
131
+ for (const [key, p] of entries) {
132
+ lines.push(` ${key} = ${shownValue(p?.value)}${p?.description ? ` (${p.description})` : ''}`);
133
+ }
134
+ return lines;
135
+ }
136
+ function textOf(content) {
137
+ if (typeof content === 'string')
138
+ return content;
139
+ if (Array.isArray(content)) {
140
+ return content
141
+ .map((part) => (part && typeof part === 'object' ? String(part.text ?? '') : String(part ?? '')))
142
+ .join('');
143
+ }
144
+ return content === undefined || content === null ? '' : JSON.stringify(content);
145
+ }
146
+ function parsed(raw) {
147
+ if (raw && typeof raw === 'object')
148
+ return raw;
149
+ if (typeof raw !== 'string')
150
+ return {};
151
+ try {
152
+ const v = JSON.parse(raw);
153
+ return v && typeof v === 'object' ? v : {};
154
+ }
155
+ catch {
156
+ return {};
157
+ }
158
+ }
159
+ function questionText(q) {
160
+ return String(q.instructions ?? q.question ?? q.id ?? '?');
161
+ }
162
+ function choiceOf(out) {
163
+ if (out.choice !== undefined && out.choice !== null)
164
+ return String(out.choice);
165
+ const answer = out.answer;
166
+ if (answer && typeof answer === 'object') {
167
+ const a = answer;
168
+ for (const k of ['choice', 'value', 'score', 'answer'])
169
+ if (a[k] !== undefined && a[k] !== null)
170
+ return String(a[k]);
171
+ }
172
+ return answer === undefined || answer === null ? '-' : String(answer);
173
+ }
174
+ export function itemLines(items) {
175
+ const calls = new Map();
176
+ const lines = [];
177
+ for (const it of items) {
178
+ const id = String(it.id ?? '');
179
+ const head = id ? `${id.padEnd(7)}` : '';
180
+ const pad = ' '.repeat(head.length);
181
+ if (it.type === 'function_call') {
182
+ calls.set(String(it.call_id ?? ''), it);
183
+ continue;
184
+ }
185
+ if (it.type === 'function_call_output') {
186
+ const call = calls.get(String(it.call_id ?? ''));
187
+ const out = parsed(it.output);
188
+ if (call?.name === 'premise') {
189
+ const key = String(parsed(call.arguments).key ?? '?');
190
+ const desc = typeof out.description === 'string' && out.description ? ` (${out.description})` : '';
191
+ lines.push(`${head}premise ${key} = ${shownValue(out.value)}${desc}`);
192
+ }
193
+ else if (call?.name === 'decision') {
194
+ const who = String(it.face ?? call.face ?? 'face');
195
+ const model = it.model ?? call.model;
196
+ lines.push(`${head}${who}${model ? ` (${model})` : ''} decided: ${questionText(parsed(call.arguments))} -> ${choiceOf(out)}`);
197
+ if (typeof out.cause === 'string' && out.cause)
198
+ lines.push(`${pad}cause: ${out.cause}`);
199
+ }
200
+ else {
201
+ lines.push(`${head}${String(call?.name ?? 'output')}: ${typeof it.output === 'string' ? it.output : JSON.stringify(it.output)}`);
202
+ }
203
+ continue;
204
+ }
205
+ if (it.type === 'message' || it.role !== undefined) {
206
+ const who = it.role === 'user' ? 'you' : `${String(it.name ?? it.role ?? '?')}${it.model ? ` (${it.model})` : ''}`;
207
+ const text = textOf(it.content);
208
+ const cause = typeof it.cause === 'string' && it.cause ? it.cause : '';
209
+ if (!text && cause) {
210
+ lines.push(`${head}${who}'s cause: ${cause}`);
211
+ continue;
212
+ }
213
+ lines.push(`${head}${who}: ${text}`);
214
+ if (cause)
215
+ lines.push(`${pad}cause: ${cause}`);
216
+ continue;
217
+ }
218
+ lines.push(`${head}${String(it.type ?? 'item')}`);
219
+ }
220
+ return lines;
221
+ }
222
+ export function staleDecisionLines(stale) {
223
+ if (!stale || stale.length === 0)
224
+ return [];
225
+ const lines = [
226
+ `${stale.length === 1 ? '1 earlier decision was' : `${stale.length} earlier decisions were`} made under a value you just changed. Nothing was decided again:`,
227
+ ];
228
+ for (const d of stale) {
229
+ const q = d.question ? questionText(d.question) : '?';
230
+ const choice = d.choice === undefined || d.choice === null ? '-' : String(d.choice);
231
+ lines.push(` ${d.face ?? 'face'}: ${q} -> ${choice}${d.call_id ? ` [${d.call_id}]` : ''}`);
232
+ for (const [key, c] of Object.entries(d.changed ?? {})) {
233
+ lines.push(` ${key}: was ${shownValue(c?.was)}, now ${shownValue(c?.now)}`);
234
+ }
235
+ }
236
+ return lines;
237
+ }
package/dist/utils.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare function isMaxTokensRenameError(message: string): boolean;
55
55
  export declare const DOCUMENT_VS_THREAD: string;
56
56
  export declare const STYLE_FLAG_DESCRIPTION: string;
57
57
  export declare const MEDIUM_FLAG_DESCRIPTION: string;
58
- export declare const SESSION_FLAG_DESCRIPTION = "Add this turn to a session, by id (from faces session:create). The session must be with this face.";
58
+ export declare const SESSION_FLAG_DESCRIPTION: string;
59
59
  export declare const COMPACTION_FLAG_DESCRIPTION: string;
60
60
  export declare function chatExtras(flags: {
61
61
  style?: string;
package/dist/utils.js CHANGED
@@ -426,9 +426,10 @@ export const STYLE_FLAG_DESCRIPTION = 'Apply the style the face has built for th
426
426
  export const MEDIUM_FLAG_DESCRIPTION = 'What the reply is, so it is shaped for it: email, text message, social post, essay, academic paper, ' +
427
427
  'blog post, legal document, thread reply, conversation, lecture, other. Needs no built style. Leave it ' +
428
428
  'out and the medium is inferred from your message. With --style, leave it out or give the same medium.';
429
- export const SESSION_FLAG_DESCRIPTION = 'Add this turn to a session, by id (from faces session:create). The session must be with this face.';
430
- export const COMPACTION_FLAG_DESCRIPTION = 'Read a compaction, by id (from faces session:compact), alongside the messages sent. It must be of a ' +
431
- 'session with this face.';
429
+ export const SESSION_FLAG_DESCRIPTION = 'The old name for --conversation, still accepted: add this turn to a session (a conversation), by id ' +
430
+ '(from faces session:create or conversation:create). The session must be with this face.';
431
+ export const COMPACTION_FLAG_DESCRIPTION = 'Read a compaction, by id (from faces conversation:compact or session:compact), alongside the messages ' +
432
+ 'sent. It must be of this face.';
432
433
  export function chatExtras(flags) {
433
434
  const out = {};
434
435
  if (flags.style)