palabre 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -68
- package/dist/adapters/cli-pty.js +1 -1
- package/dist/adapters/cli.js +33 -3
- package/dist/adapters/ollama.js +1 -1
- package/dist/agentRegistry.js +3 -3
- package/dist/args.js +21 -1
- package/dist/config.js +58 -24
- package/dist/configWizard.js +12 -2
- package/dist/context.js +5 -1
- package/dist/discovery.js +3 -3
- package/dist/doctor.js +4 -1
- package/dist/history.js +85 -0
- package/dist/index.js +742 -94
- package/dist/messages/agents.js +4 -2
- package/dist/messages/common.js +4 -0
- package/dist/messages/config.js +18 -8
- package/dist/messages/help.js +116 -10
- package/dist/messages/index.js +2 -0
- package/dist/messages/init.js +2 -2
- package/dist/messages/new.js +14 -0
- package/dist/messages/output.js +10 -0
- package/dist/messages/preview.js +4 -2
- package/dist/messages/prompt.js +46 -2
- package/dist/messages/renderers.js +2 -2
- package/dist/messages/tui.js +228 -0
- package/dist/messages/update.js +16 -2
- package/dist/new.js +158 -4
- package/dist/orchestrator.js +168 -9
- package/dist/output.js +31 -8
- package/dist/presets.js +39 -39
- package/dist/prompt.js +61 -10
- package/dist/renderers/console.js +39 -3
- package/dist/renderers/ndjson.js +30 -1
- package/dist/renderers/tui.js +1055 -0
- package/dist/tuiState.js +31 -0
- package/dist/update.js +2 -0
- package/package.json +2 -1
- package/palabre.config.example.json +0 -17
package/dist/renderers/ndjson.js
CHANGED
|
@@ -25,12 +25,13 @@ export class NdjsonRenderer {
|
|
|
25
25
|
start(options, agents = []) {
|
|
26
26
|
this.emit({
|
|
27
27
|
type: "start",
|
|
28
|
+
mode: options.mode,
|
|
28
29
|
topic: options.topic,
|
|
29
30
|
turns: options.turns,
|
|
30
31
|
agents: agents.map((a) => ({ name: a.name, role: a.role, type: a.type })),
|
|
31
32
|
summaryEnabled: options.summaryEnabled,
|
|
32
33
|
summaryAgent: options.summaryEnabled
|
|
33
|
-
? options
|
|
34
|
+
? resolveSummaryAgent(options)
|
|
34
35
|
: null,
|
|
35
36
|
earlyStop: options.earlyStopOnAgreement,
|
|
36
37
|
filesCount: options.files.length,
|
|
@@ -58,6 +59,13 @@ export class NdjsonRenderer {
|
|
|
58
59
|
this.currentRole = role;
|
|
59
60
|
this.emit({ type: "turn-start", turn, totalTurns, agent, role });
|
|
60
61
|
}
|
|
62
|
+
askResponseStart(response, totalResponses, agent, role) {
|
|
63
|
+
this.currentSection = "ask";
|
|
64
|
+
this.currentTurn = response;
|
|
65
|
+
this.currentAgent = agent;
|
|
66
|
+
this.currentRole = role;
|
|
67
|
+
this.emit({ type: "ask-response-start", response, totalResponses, agent, role });
|
|
68
|
+
}
|
|
61
69
|
/**
|
|
62
70
|
* Émet `thinking-start`. Les consommateurs UI peuvent l'utiliser pour un
|
|
63
71
|
* indicateur "agent en cours" ; les consommateurs purement data peuvent
|
|
@@ -84,6 +92,15 @@ export class NdjsonRenderer {
|
|
|
84
92
|
content,
|
|
85
93
|
});
|
|
86
94
|
}
|
|
95
|
+
else if (this.currentSection === "ask") {
|
|
96
|
+
this.emit({
|
|
97
|
+
type: "ask-response",
|
|
98
|
+
response: this.currentTurn,
|
|
99
|
+
agent: this.currentAgent,
|
|
100
|
+
role: this.currentRole,
|
|
101
|
+
content,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
87
104
|
else {
|
|
88
105
|
this.emit({
|
|
89
106
|
type: "message",
|
|
@@ -94,6 +111,9 @@ export class NdjsonRenderer {
|
|
|
94
111
|
});
|
|
95
112
|
}
|
|
96
113
|
}
|
|
114
|
+
askResponseMessage(content) {
|
|
115
|
+
this.message(content);
|
|
116
|
+
}
|
|
97
117
|
/** Émet `summary-start` et bascule la section courante en synthèse. */
|
|
98
118
|
summaryStart(agent, role) {
|
|
99
119
|
this.currentSection = "summary";
|
|
@@ -114,6 +134,15 @@ export class NdjsonRenderer {
|
|
|
114
134
|
process.stdout.write(JSON.stringify({ v: this.schemaVersion, ...event }) + "\n");
|
|
115
135
|
}
|
|
116
136
|
}
|
|
137
|
+
function resolveSummaryAgent(options) {
|
|
138
|
+
if (options.summaryAgent) {
|
|
139
|
+
return options.summaryAgent;
|
|
140
|
+
}
|
|
141
|
+
if (options.mode === "ask" && options.askAgents && options.askAgents.length > 0) {
|
|
142
|
+
return options.askAgents[options.askAgents.length - 1] ?? options.agentB;
|
|
143
|
+
}
|
|
144
|
+
return options.agentB;
|
|
145
|
+
}
|
|
117
146
|
/** Factory pratique pour conserver la symétrie avec `createConsoleRenderer`. */
|
|
118
147
|
export function createNdjsonRenderer() {
|
|
119
148
|
return new NdjsonRenderer();
|