@faces-sh/cli 1.0.3 → 1.1.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.
- package/README.md +71 -51
- package/dist/choices.d.ts +23 -0
- package/dist/choices.js +48 -0
- package/dist/commands/auth/connect.js +2 -2
- package/dist/commands/catalog/doctor.js +9 -68
- package/dist/commands/causes.d.ts +2 -0
- package/dist/commands/causes.js +2 -2
- package/dist/commands/{fidelity/run.d.ts → choices.d.ts} +9 -8
- package/dist/commands/choices.js +86 -0
- package/dist/commands/conversation/add.d.ts +2 -0
- package/dist/commands/conversation/add.js +21 -10
- package/dist/commands/conversation/close.js +5 -5
- package/dist/commands/conversation/compact.js +9 -9
- package/dist/commands/conversation/create.d.ts +2 -0
- package/dist/commands/conversation/create.js +14 -12
- package/dist/commands/conversation/get.js +4 -4
- package/dist/commands/conversation/items.js +5 -5
- package/dist/commands/decide.d.ts +3 -0
- package/dist/commands/decide.js +20 -3
- package/dist/commands/face/get.js +1 -1
- package/dist/commands/fidelity/pick.js +2 -2
- package/dist/commands/models/list.js +7 -3
- package/dist/commands/session/close.js +1 -1
- package/dist/commands/session/compact.js +2 -2
- package/dist/commands/session/create.js +2 -2
- package/dist/commands/session/get.js +1 -1
- package/dist/commands/state/add.d.ts +3 -0
- package/dist/commands/state/add.js +3 -0
- package/dist/commands/state/close.d.ts +3 -0
- package/dist/commands/state/close.js +3 -0
- package/dist/commands/state/compact.d.ts +3 -0
- package/dist/commands/state/compact.js +3 -0
- package/dist/commands/state/create.d.ts +3 -0
- package/dist/commands/state/create.js +3 -0
- package/dist/commands/state/get.d.ts +3 -0
- package/dist/commands/state/get.js +3 -0
- package/dist/commands/state/items.d.ts +3 -0
- package/dist/commands/state/items.js +3 -0
- package/dist/commands/style/make.js +2 -6
- package/dist/conversation.d.ts +27 -2
- package/dist/conversation.js +91 -16
- package/dist/fidelity.js +3 -3
- package/oclif.manifest.json +1794 -2187
- package/package.json +9 -9
- package/dist/commands/chat/chat.d.ts +0 -47
- package/dist/commands/chat/chat.js +0 -376
- package/dist/commands/chat/messages.d.ts +0 -30
- package/dist/commands/chat/messages.js +0 -148
- package/dist/commands/chat/responses.d.ts +0 -31
- package/dist/commands/chat/responses.js +0 -159
- package/dist/commands/chat/thread.d.ts +0 -50
- package/dist/commands/chat/thread.js +0 -472
- package/dist/commands/fidelity/run.js +0 -99
- package/dist/commands/fidelity/start.d.ts +0 -17
- package/dist/commands/fidelity/start.js +0 -56
- package/dist/commands/fidelity/turn.d.ts +0 -17
- package/dist/commands/fidelity/turn.js +0 -48
|
@@ -4,20 +4,20 @@ import { FacesAPIError } from '../../client.js';
|
|
|
4
4
|
import { CONVERSATIONS_PATH, conversationHint } from '../../conversation.js';
|
|
5
5
|
import { seg } from '../../utils.js';
|
|
6
6
|
export default class ConversationClose extends BaseCommand {
|
|
7
|
-
static description = 'Close a
|
|
7
|
+
static description = 'Close a state. A closed state takes no more turns and cannot be read or compacted. Its ' +
|
|
8
8
|
'compactions stay usable until they expire. Free.';
|
|
9
|
-
static examples = ['<%= config.bin %> <%= command.id %>
|
|
9
|
+
static examples = ['<%= config.bin %> <%= command.id %> fs_STATE_ID --yes'];
|
|
10
10
|
static flags = {
|
|
11
11
|
...BaseCommand.baseFlags,
|
|
12
12
|
yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
|
|
13
13
|
};
|
|
14
14
|
static args = {
|
|
15
|
-
conversation_id: Args.string({ description: '
|
|
15
|
+
conversation_id: Args.string({ description: 'State id (from state:create)', required: true }),
|
|
16
16
|
};
|
|
17
17
|
async run() {
|
|
18
18
|
const { args, flags } = await this.parse(ConversationClose);
|
|
19
19
|
const client = this.makeClient(flags);
|
|
20
|
-
await this.confirmOrRefuse(`Close
|
|
20
|
+
await this.confirmOrRefuse(`Close state ${args.conversation_id}? It cannot be reopened.`, flags.yes);
|
|
21
21
|
let data;
|
|
22
22
|
try {
|
|
23
23
|
data = await client.delete(`${CONVERSATIONS_PATH}/${seg(args.conversation_id)}`);
|
|
@@ -30,7 +30,7 @@ export default class ConversationClose extends BaseCommand {
|
|
|
30
30
|
throw err;
|
|
31
31
|
}
|
|
32
32
|
if (!this.jsonEnabled())
|
|
33
|
-
this.log(`Closed
|
|
33
|
+
this.log(`Closed state ${args.conversation_id}.`);
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -5,23 +5,23 @@ import { heldDecisionError } from '../../decisions.js';
|
|
|
5
5
|
import { CONVERSATIONS_PATH, conversationHint } from '../../conversation.js';
|
|
6
6
|
import { retryOnceOnWarmUp, sayWarmUp, seg } from '../../utils.js';
|
|
7
7
|
export default class ConversationCompact extends BaseCommand {
|
|
8
|
-
static description = 'Compact a
|
|
8
|
+
static description = 'Compact a state: a summary of one face\'s position over the state, in the face\'s own ' +
|
|
9
9
|
'terms, stored under a compaction id. Pass that id with --compaction on a later request with the same ' +
|
|
10
|
-
'face. A
|
|
10
|
+
'face. A state that takes any face needs the face named. Billed at the cause rate on the tokens ' +
|
|
11
11
|
'it reads and writes; on Connect and Pro it counts against the cause allowance. A failed compaction is ' +
|
|
12
12
|
'not charged. A compaction expires 30 days after it is written.';
|
|
13
13
|
static examples = [
|
|
14
|
-
'<%= config.bin %> <%= command.id %>
|
|
15
|
-
'<%= config.bin %> <%= command.id %>
|
|
14
|
+
'<%= config.bin %> <%= command.id %> fs_STATE_ID',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> fs_STATE_ID alice --json',
|
|
16
16
|
];
|
|
17
17
|
static flags = {
|
|
18
18
|
...BaseCommand.baseFlags,
|
|
19
19
|
};
|
|
20
20
|
static args = {
|
|
21
|
-
conversation_id: Args.string({ description: '
|
|
21
|
+
conversation_id: Args.string({ description: 'State id (from state:create)', required: true }),
|
|
22
22
|
face: Args.string({
|
|
23
|
-
description: 'The face to compact, alone (no @model). Needed when the
|
|
24
|
-
'
|
|
23
|
+
description: 'The face to compact, alone (no @model). Needed when the state takes any face; a ' +
|
|
24
|
+
'state opened with one face compacts that face.',
|
|
25
25
|
required: false,
|
|
26
26
|
}),
|
|
27
27
|
};
|
|
@@ -45,7 +45,7 @@ export default class ConversationCompact extends BaseCommand {
|
|
|
45
45
|
catch (err) {
|
|
46
46
|
if (err instanceof FacesAPIError) {
|
|
47
47
|
if (err.statusCode === 422 && !face && /takes any face/.test(err.message)) {
|
|
48
|
-
this.error(`HTTP ${err.statusCode}: ${err.message}\nName the face: faces
|
|
48
|
+
this.error(`HTTP ${err.statusCode}: ${err.message}\nName the face: faces state:compact ${args.conversation_id} <face>`);
|
|
49
49
|
}
|
|
50
50
|
const hint = conversationHint(err);
|
|
51
51
|
this.error(`HTTP ${err.statusCode}: ${err.message}${hint ? `\n${hint}` : ''}`);
|
|
@@ -62,7 +62,7 @@ export default class ConversationCompact extends BaseCommand {
|
|
|
62
62
|
if (data.expires_at)
|
|
63
63
|
this.log(`expires: ${data.expires_at}`);
|
|
64
64
|
if (data.compaction_id)
|
|
65
|
-
this.log(`\nUse it with: faces
|
|
65
|
+
this.log(`\nUse it with: faces causes ${face ?? '<face>'} --compaction ${data.compaction_id} -m "..."`);
|
|
66
66
|
}
|
|
67
67
|
return data;
|
|
68
68
|
}
|
|
@@ -7,6 +7,8 @@ export default class ConversationCreate extends BaseCommand {
|
|
|
7
7
|
message: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
premise: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
'premise-description': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'premise-status': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'premise-depends-on': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
14
|
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { BaseCommand } from '../../base.js';
|
|
3
3
|
import { FacesAPIError } from '../../client.js';
|
|
4
|
-
import { CONVERSATIONS_PATH, MAX_CONVERSATION_ITEMS, PREMISE_DESCRIPTION_FLAG_DESCRIPTION, PREMISE_FLAG_DESCRIPTION, clientItems, conversationHint, conversationLines, parsePremises, } from '../../conversation.js';
|
|
4
|
+
import { CONVERSATIONS_PATH, MAX_CONVERSATION_ITEMS, PREMISE_DESCRIPTION_FLAG_DESCRIPTION, PREMISE_DEPENDS_ON_FLAG_DESCRIPTION, PREMISE_FLAG_DESCRIPTION, PREMISE_STATUS_FLAG_DESCRIPTION, clientItems, conversationHint, conversationLines, parsePremises, } from '../../conversation.js';
|
|
5
5
|
export default class ConversationCreate extends BaseCommand {
|
|
6
|
-
static description = 'Start a conversation. The server keeps the
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
6
|
+
static description = 'Start a state (formerly a conversation). The server keeps the situation your agent builds: premises ' +
|
|
7
|
+
'(named facts, each with a status and what it depends on), the decisions faces made, and your messages. ' +
|
|
8
|
+
'Ask a face about it with faces choices --state-id, or pass its id with --conversation on decide or causes ' +
|
|
9
|
+
'and send only what is new. Name a face and the state takes that face only; leave it out and it takes any ' +
|
|
10
|
+
'of your faces. Opening one is free. A state expires 30 days after it was last used.';
|
|
11
11
|
static examples = [
|
|
12
12
|
'<%= config.bin %> <%= command.id %> alice',
|
|
13
13
|
'<%= config.bin %> <%= command.id %>',
|
|
@@ -18,18 +18,20 @@ export default class ConversationCreate extends BaseCommand {
|
|
|
18
18
|
...BaseCommand.baseFlags,
|
|
19
19
|
'causes-visible': Flags.boolean({
|
|
20
20
|
description: 'Whether each face reads the other faces\' causes. On by default; --no-causes-visible keeps each ' +
|
|
21
|
-
'face to its own. Matters only in a
|
|
21
|
+
'face to its own. Matters only in a state with several faces.',
|
|
22
22
|
default: true,
|
|
23
23
|
allowNo: true,
|
|
24
24
|
}),
|
|
25
25
|
message: Flags.string({ char: 'm', description: 'A first message of yours (repeatable, kept in order).', multiple: true }),
|
|
26
26
|
premise: Flags.string({ description: PREMISE_FLAG_DESCRIPTION, multiple: true }),
|
|
27
27
|
'premise-description': Flags.string({ description: PREMISE_DESCRIPTION_FLAG_DESCRIPTION, multiple: true }),
|
|
28
|
+
'premise-status': Flags.string({ description: PREMISE_STATUS_FLAG_DESCRIPTION, multiple: true }),
|
|
29
|
+
'premise-depends-on': Flags.string({ description: PREMISE_DEPENDS_ON_FLAG_DESCRIPTION, multiple: true }),
|
|
28
30
|
};
|
|
29
31
|
static args = {
|
|
30
32
|
face: Args.string({
|
|
31
33
|
description: 'The face alone: an alias, owner:alias, or a composite such as "(a | b)". No @model. Leave it out ' +
|
|
32
|
-
'for a
|
|
34
|
+
'for a state that takes any of your faces.',
|
|
33
35
|
required: false,
|
|
34
36
|
}),
|
|
35
37
|
};
|
|
@@ -38,16 +40,16 @@ export default class ConversationCreate extends BaseCommand {
|
|
|
38
40
|
const client = this.makeClient(flags);
|
|
39
41
|
const face = args.face?.trim();
|
|
40
42
|
if (face?.includes('@'))
|
|
41
|
-
this.error(`A
|
|
43
|
+
this.error(`A state is with a face alone: ${face.slice(0, face.lastIndexOf('@'))}`);
|
|
42
44
|
let items;
|
|
43
45
|
try {
|
|
44
|
-
items = clientItems(flags.message, parsePremises(flags.premise, flags['premise-description']));
|
|
46
|
+
items = clientItems(flags.message, parsePremises(flags.premise, flags['premise-description'], flags['premise-status'], flags['premise-depends-on']));
|
|
45
47
|
}
|
|
46
48
|
catch (err) {
|
|
47
49
|
this.error(err instanceof Error ? err.message : String(err));
|
|
48
50
|
}
|
|
49
51
|
if (items.length > MAX_CONVERSATION_ITEMS) {
|
|
50
|
-
this.error(`At most ${MAX_CONVERSATION_ITEMS} messages and premises at a time (got ${items.length}). Add the rest with faces
|
|
52
|
+
this.error(`At most ${MAX_CONVERSATION_ITEMS} messages and premises at a time (got ${items.length}). Add the rest with faces state:add.`);
|
|
51
53
|
}
|
|
52
54
|
const body = { causes_visible: flags['causes-visible'] };
|
|
53
55
|
if (face)
|
|
@@ -69,7 +71,7 @@ export default class ConversationCreate extends BaseCommand {
|
|
|
69
71
|
for (const line of conversationLines(data))
|
|
70
72
|
this.log(line);
|
|
71
73
|
if (data.id)
|
|
72
|
-
this.log(`\
|
|
74
|
+
this.log(`\nAsk a face about it with: faces choices ${face ?? '<face>'} --state-id ${data.id} --question "..."`);
|
|
73
75
|
}
|
|
74
76
|
return data;
|
|
75
77
|
}
|
|
@@ -4,14 +4,14 @@ import { FacesAPIError } from '../../client.js';
|
|
|
4
4
|
import { CONVERSATIONS_PATH, conversationHint, conversationLines } from '../../conversation.js';
|
|
5
5
|
import { seg } from '../../utils.js';
|
|
6
6
|
export default class ConversationGet extends BaseCommand {
|
|
7
|
-
static description = 'Read a
|
|
8
|
-
'read each other\'s causes, and when it expires. Free. See its items with faces
|
|
9
|
-
static examples = ['<%= config.bin %> <%= command.id %>
|
|
7
|
+
static description = 'Read a state: its face (or any), status, how many turns and items it holds, whether faces ' +
|
|
8
|
+
'read each other\'s causes, and when it expires. Free. See its items with faces state:items.';
|
|
9
|
+
static examples = ['<%= config.bin %> <%= command.id %> fs_STATE_ID'];
|
|
10
10
|
static flags = {
|
|
11
11
|
...BaseCommand.baseFlags,
|
|
12
12
|
};
|
|
13
13
|
static args = {
|
|
14
|
-
conversation_id: Args.string({ description: '
|
|
14
|
+
conversation_id: Args.string({ description: 'State id (from state:create)', required: true }),
|
|
15
15
|
};
|
|
16
16
|
async run() {
|
|
17
17
|
const { args, flags } = await this.parse(ConversationGet);
|
|
@@ -4,17 +4,17 @@ import { FacesAPIError } from '../../client.js';
|
|
|
4
4
|
import { CONVERSATIONS_PATH, conversationHint, itemLines, premiseLines } from '../../conversation.js';
|
|
5
5
|
import { seg } from '../../utils.js';
|
|
6
6
|
export default class ConversationItems extends BaseCommand {
|
|
7
|
-
static description = 'List a
|
|
8
|
-
'
|
|
7
|
+
static description = 'List a state\'s items in order: premises, decisions with their choice, cause and status, your messages ' +
|
|
8
|
+
'and each face\'s reply. Ends with the premises in force now, each with its status. Free.';
|
|
9
9
|
static examples = [
|
|
10
|
-
'<%= config.bin %> <%= command.id %>
|
|
11
|
-
'<%= config.bin %> <%= command.id %>
|
|
10
|
+
'<%= config.bin %> <%= command.id %> fs_STATE_ID',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> fs_STATE_ID --json',
|
|
12
12
|
];
|
|
13
13
|
static flags = {
|
|
14
14
|
...BaseCommand.baseFlags,
|
|
15
15
|
};
|
|
16
16
|
static args = {
|
|
17
|
-
conversation_id: Args.string({ description: '
|
|
17
|
+
conversation_id: Args.string({ description: 'State id (from state:create)', required: true }),
|
|
18
18
|
};
|
|
19
19
|
async run() {
|
|
20
20
|
const { args, flags } = await this.parse(ConversationItems);
|
|
@@ -3,6 +3,7 @@ export default class Decide extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
'depends-on': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
session: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
compaction: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -10,6 +11,8 @@ export default class Decide extends BaseCommand {
|
|
|
10
11
|
conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
premise: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
'premise-description': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'premise-status': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'premise-depends-on': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
16
|
'causes-visible': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
17
|
state: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
18
|
'state-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
package/dist/commands/decide.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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';
|
|
4
|
+
import { conversationFields, conversationTurnFlags, MAX_DEPENDS_ON, parseDependsOn } from '../conversation.js';
|
|
5
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
6
|
import { compileHint, reasoningHeading, sayWarmUp, SESSION_FLAG_DESCRIPTION, COMPACTION_FLAG_DESCRIPTION } from '../utils.js';
|
|
7
7
|
const OPENAI_FORMAT_ONLY = ['gpt-6-luna'];
|
|
8
8
|
export default class Decide extends BaseCommand {
|
|
9
9
|
static description = 'Ask what a face would decide. Describe a situation, ask typed questions about it, and get back numbers, ' +
|
|
10
10
|
'as this face: a yes-or-no (noul), a pick between options (choice), or a place on a graded scale (score). ' +
|
|
11
|
-
'
|
|
12
|
-
'panels. The face\'s cause for each question guides the decision model\'s (--model) answer. A face\'s ' +
|
|
11
|
+
'faces choices gives you the options a face would weigh; this gives you what it would decide, for routing, ' +
|
|
12
|
+
'simulations or panels. The face\'s cause for each question guides the decision model\'s (--model) answer. A face\'s ' +
|
|
13
13
|
'answer takes about 10 to 20 seconds; one that runs long is held open by the server and can take a ' +
|
|
14
14
|
'minute or more. --baseline asks the decision model alone (no-face baseline), in about a second: the ' +
|
|
15
15
|
'number to compare a face\'s answer against. Name a face and ask no questions for its cause alone. On ' +
|
|
@@ -92,6 +92,12 @@ export default class Decide extends BaseCommand {
|
|
|
92
92
|
default: false,
|
|
93
93
|
}),
|
|
94
94
|
...conversationTurnFlags({ exclusive: ['baseline'] }),
|
|
95
|
+
'depends-on': Flags.string({
|
|
96
|
+
description: 'In a state (--conversation), what this decision rests on, comma separated: premise keys and decision ids ' +
|
|
97
|
+
`already in the state or set with --premise, at most ${MAX_DEPENDS_ON}. The decision is shown those, and is ` +
|
|
98
|
+
'invalidated when one of them is. Left out, it rests on every premise in force.',
|
|
99
|
+
exclusive: ['baseline'],
|
|
100
|
+
}),
|
|
95
101
|
session: Flags.string({ description: SESSION_FLAG_DESCRIPTION, exclusive: ['baseline'] }),
|
|
96
102
|
compaction: Flags.string({ description: COMPACTION_FLAG_DESCRIPTION, exclusive: ['baseline'] }),
|
|
97
103
|
format: Flags.string({
|
|
@@ -121,6 +127,11 @@ export default class Decide extends BaseCommand {
|
|
|
121
127
|
let turn = {};
|
|
122
128
|
try {
|
|
123
129
|
turn = conversationFields(flags);
|
|
130
|
+
if (flags['depends-on'] !== undefined) {
|
|
131
|
+
if (!flags.conversation && !flags.session)
|
|
132
|
+
throw new Error('--depends-on belongs to a state: add --conversation <id> (from faces state:create).');
|
|
133
|
+
turn.depends_on = parseDependsOn(flags['depends-on']);
|
|
134
|
+
}
|
|
124
135
|
}
|
|
125
136
|
catch (err) {
|
|
126
137
|
this.error(err instanceof Error ? err.message : String(err));
|
|
@@ -195,6 +206,12 @@ export default class Decide extends BaseCommand {
|
|
|
195
206
|
const answers = flags.format === 'openai' ? fromOpenAIAnswers(data.answers, questions) : (data.answers ?? {});
|
|
196
207
|
for (const line of decisionLines(answers))
|
|
197
208
|
this.log(line);
|
|
209
|
+
const ids = Object.entries(data.decision_ids ?? {});
|
|
210
|
+
if (ids.length > 0) {
|
|
211
|
+
this.log('');
|
|
212
|
+
for (const [q, id] of ids)
|
|
213
|
+
this.log(`decision id (${q}): ${id}`);
|
|
214
|
+
}
|
|
198
215
|
return data;
|
|
199
216
|
}
|
|
200
217
|
async ask(client, body, retry, json, endpoint) {
|
|
@@ -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
|
|
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);
|
|
@@ -40,7 +40,7 @@ export default class FidelityPick extends BaseCommand {
|
|
|
40
40
|
if (!run.next)
|
|
41
41
|
this.error(`This run is finished. Read it with: faces fidelity:get ${args.run_id}`);
|
|
42
42
|
if (run.next.awaiting !== 'choice') {
|
|
43
|
-
this.error(`Turn ${run.next.turn} has no answers to pick from
|
|
43
|
+
this.error(`Turn ${run.next.turn} has no answers to pick from, and new turns are retired with chat.`);
|
|
44
44
|
}
|
|
45
45
|
turn = run.next.turn;
|
|
46
46
|
}
|
|
@@ -63,7 +63,7 @@ export default class FidelityPick extends BaseCommand {
|
|
|
63
63
|
this.log(`Keep the conversation as a thread, to compile: faces fidelity:save-thread ${args.run_id}`);
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
this.log(
|
|
66
|
+
this.log('New turns are retired with chat, so the run cannot go further.');
|
|
67
67
|
}
|
|
68
68
|
return data;
|
|
69
69
|
}
|
|
@@ -2,13 +2,15 @@ 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 = ['
|
|
5
|
+
const KINDS = ['choices', 'decision', 'cause', 'compile', 'chat', '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
|
|
9
|
-
'
|
|
8
|
+
'Without --kind only chat models are listed; --kind choices lists the models faces choices runs on. ' +
|
|
9
|
+
'CHATGPT marks the Codex-eligible models, which can run on a linked ChatGPT plan (style builds, interviews). ' +
|
|
10
|
+
'Prices are per million tokens. No login needed.';
|
|
10
11
|
static examples = [
|
|
11
12
|
'<%= config.bin %> <%= command.id %>',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --kind choices',
|
|
12
14
|
'<%= config.bin %> <%= command.id %> --kind decision',
|
|
13
15
|
'<%= config.bin %> <%= command.id %> --kind cause,compile',
|
|
14
16
|
'<%= config.bin %> <%= command.id %> --kind all --json',
|
|
@@ -81,6 +83,8 @@ export default class ModelsList extends BaseCommand {
|
|
|
81
83
|
}
|
|
82
84
|
if (m.token_basis === 'source')
|
|
83
85
|
notes.push(`${m.id}: priced per million source tokens compiled.`);
|
|
86
|
+
if (m.token_basis === 'processed')
|
|
87
|
+
notes.push(`${m.id}: priced on the tokens each call processes, as its usage reports them.`);
|
|
84
88
|
const inc = m.included_tokens_per_month;
|
|
85
89
|
if (inc && typeof inc === 'object') {
|
|
86
90
|
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
|
|
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,
|
|
@@ -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. Sessions are now called
|
|
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',
|
|
@@ -51,7 +51,7 @@ export default class SessionCompact extends BaseCommand {
|
|
|
51
51
|
if (data.expires_at)
|
|
52
52
|
this.log(`expires: ${data.expires_at}`);
|
|
53
53
|
if (data.compaction_id)
|
|
54
|
-
this.log(`\nUse it with: faces
|
|
54
|
+
this.log(`\nUse it with: faces causes <face> --compaction ${data.compaction_id} -m "..."`);
|
|
55
55
|
}
|
|
56
56
|
return data;
|
|
57
57
|
}
|
|
@@ -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. Sessions are now called
|
|
8
|
+
'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
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> <%= command.id %> alice',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> "(alice | bob)" --json',
|
|
@@ -38,7 +38,7 @@ export default class SessionCreate extends BaseCommand {
|
|
|
38
38
|
for (const line of sessionLines(data))
|
|
39
39
|
this.log(line);
|
|
40
40
|
if (data.id)
|
|
41
|
-
this.log(`\nAdd turns with: faces
|
|
41
|
+
this.log(`\nAdd turns with: faces decide ${face}@<decision model> --session ${data.id} --state "..." --question "..."`);
|
|
42
42
|
}
|
|
43
43
|
return data;
|
|
44
44
|
}
|
|
@@ -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
|
|
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,
|
|
@@ -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,
|
|
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
|
-
|
|
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. It is kept on the face; no route applies a style since chat was retired.`);
|
|
115
111
|
this.log(`Go back to the previous style: faces style:revert ${args.alias} --yes`);
|
|
116
112
|
return final;
|
|
117
113
|
}
|
package/dist/conversation.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FacesAPIError } from './client.js';
|
|
2
|
-
export declare const CONVERSATIONS_PATH = "/v1/
|
|
2
|
+
export declare const CONVERSATIONS_PATH = "/v1/states";
|
|
3
3
|
export declare const MAX_CONVERSATION_ITEMS = 20;
|
|
4
|
+
export declare const PREMISE_STATUSES: readonly ["stated", "verified", "assumed", "unresolved", "invalidated"];
|
|
5
|
+
export declare const MAX_DEPENDS_ON = 200;
|
|
4
6
|
export interface Conversation {
|
|
5
7
|
object?: string;
|
|
6
8
|
id?: string;
|
|
@@ -17,14 +19,30 @@ export interface Premise {
|
|
|
17
19
|
key: string;
|
|
18
20
|
value: unknown;
|
|
19
21
|
description?: string;
|
|
22
|
+
status?: string;
|
|
23
|
+
depends_on?: string[];
|
|
20
24
|
}
|
|
21
25
|
export interface PremiseState {
|
|
22
26
|
value?: unknown;
|
|
23
27
|
description?: string | null;
|
|
28
|
+
status?: string;
|
|
29
|
+
asserted_status?: string;
|
|
30
|
+
because?: string | null;
|
|
31
|
+
depends_on?: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface StatusChange {
|
|
34
|
+
kind?: string;
|
|
35
|
+
key?: string;
|
|
36
|
+
id?: string;
|
|
37
|
+
from?: string;
|
|
38
|
+
to?: string;
|
|
39
|
+
because?: string | null;
|
|
24
40
|
}
|
|
25
41
|
export declare const CONVERSATION_FLAG_DESCRIPTION: string;
|
|
26
42
|
export declare const PREMISE_FLAG_DESCRIPTION: string;
|
|
27
43
|
export declare const PREMISE_DESCRIPTION_FLAG_DESCRIPTION: string;
|
|
44
|
+
export declare const PREMISE_STATUS_FLAG_DESCRIPTION: string;
|
|
45
|
+
export declare const PREMISE_DEPENDS_ON_FLAG_DESCRIPTION: string;
|
|
28
46
|
export declare const CAUSES_VISIBLE_TURN_FLAG_DESCRIPTION: string;
|
|
29
47
|
export declare function conversationTurnFlags(opts?: {
|
|
30
48
|
suffix?: string;
|
|
@@ -33,21 +51,27 @@ export declare function conversationTurnFlags(opts?: {
|
|
|
33
51
|
conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
52
|
premise: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
53
|
'premise-description': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
54
|
+
'premise-status': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
55
|
+
'premise-depends-on': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
56
|
'causes-visible': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
37
57
|
};
|
|
38
58
|
export declare function conversationLines(c: Conversation): string[];
|
|
39
59
|
export declare function conversationHint(err: FacesAPIError): string | undefined;
|
|
40
60
|
export declare function premiseValue(raw: string): unknown;
|
|
41
|
-
export declare function parsePremises(premises?: string[], descriptions?: string[]): Premise[];
|
|
61
|
+
export declare function parsePremises(premises?: string[], descriptions?: string[], statuses?: string[], dependsOn?: string[]): Premise[];
|
|
62
|
+
export declare function parseDependsOn(raw: string, flag?: string): string[];
|
|
42
63
|
export declare function conversationFields(flags: {
|
|
43
64
|
conversation?: string;
|
|
44
65
|
session?: string;
|
|
45
66
|
premise?: string[];
|
|
46
67
|
'premise-description'?: string[];
|
|
68
|
+
'premise-status'?: string[];
|
|
69
|
+
'premise-depends-on'?: string[];
|
|
47
70
|
'causes-visible'?: boolean;
|
|
48
71
|
}): Record<string, unknown>;
|
|
49
72
|
export declare function clientItems(messages?: string[], premises?: Premise[]): Array<Record<string, unknown>>;
|
|
50
73
|
export declare function shownValue(v: unknown): string;
|
|
74
|
+
export declare function statusChangeLines(changes: StatusChange[] | undefined): string[];
|
|
51
75
|
export declare function premiseLines(premises: Record<string, PremiseState> | undefined): string[];
|
|
52
76
|
export declare function itemLines(items: Array<Record<string, unknown>>): string[];
|
|
53
77
|
export interface StaleDecision {
|
|
@@ -59,5 +83,6 @@ export interface StaleDecision {
|
|
|
59
83
|
was?: unknown;
|
|
60
84
|
now?: unknown;
|
|
61
85
|
}>;
|
|
86
|
+
via?: string | null;
|
|
62
87
|
}
|
|
63
88
|
export declare function staleDecisionLines(stale: StaleDecision[] | undefined): string[];
|