@actalk/inkos 1.3.6 → 1.3.7
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/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +28 -3
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +22 -17
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/interact.js +1 -1
- package/dist/commands/interact.js.map +1 -1
- package/dist/interaction/tools.d.ts.map +1 -0
- package/dist/{tui → interaction}/tools.js +1 -1
- package/dist/interaction/tools.js.map +1 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +8 -0
- package/dist/program.js.map +1 -1
- package/dist/project-bootstrap.d.ts +1 -0
- package/dist/project-bootstrap.d.ts.map +1 -1
- package/dist/project-bootstrap.js +22 -1
- package/dist/project-bootstrap.js.map +1 -1
- package/dist/tui/agent-input.d.ts +1 -1
- package/dist/tui/agent-input.d.ts.map +1 -1
- package/dist/tui/agent-input.js +153 -2
- package/dist/tui/agent-input.js.map +1 -1
- package/dist/tui/app.d.ts +1 -116
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/app.js +2 -47
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/dashboard.d.ts +1 -2
- package/dist/tui/dashboard.d.ts.map +1 -1
- package/dist/tui/dashboard.js +13 -53
- package/dist/tui/dashboard.js.map +1 -1
- package/dist/tui/effects.d.ts.map +1 -1
- package/dist/tui/effects.js +2 -6
- package/dist/tui/effects.js.map +1 -1
- package/dist/tui/i18n.d.ts +0 -9
- package/dist/tui/i18n.d.ts.map +1 -1
- package/dist/tui/i18n.js +6 -46
- package/dist/tui/i18n.js.map +1 -1
- package/dist/tui/setup.d.ts.map +1 -1
- package/dist/tui/setup.js +17 -2
- package/dist/tui/setup.js.map +1 -1
- package/dist/tui/slash-autocomplete.d.ts +1 -1
- package/dist/tui/slash-autocomplete.d.ts.map +1 -1
- package/dist/tui/slash-autocomplete.js +0 -5
- package/dist/tui/slash-autocomplete.js.map +1 -1
- package/dist/utils.d.ts +8 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +60 -2
- package/dist/utils.js.map +1 -1
- package/package.json +7 -3
- package/dist/tui/output.d.ts +0 -11
- package/dist/tui/output.d.ts.map +0 -1
- package/dist/tui/output.js +0 -24
- package/dist/tui/output.js.map +0 -1
- package/dist/tui/tools.d.ts.map +0 -1
- package/dist/tui/tools.js.map +0 -1
- /package/dist/{tui → interaction}/tools.d.ts +0 -0
package/dist/tui/agent-input.js
CHANGED
|
@@ -24,6 +24,69 @@ export async function processTuiAgentInput(params) {
|
|
|
24
24
|
content: params.input,
|
|
25
25
|
timestamp: userTimestamp,
|
|
26
26
|
});
|
|
27
|
+
if (!resolvedBookId && isCreateBookInstruction(params.input)) {
|
|
28
|
+
const book = parseBookCreationRequest(params.input);
|
|
29
|
+
if (book) {
|
|
30
|
+
await pipeline.initBook(book, {
|
|
31
|
+
externalContext: params.input,
|
|
32
|
+
authorIntent: params.input,
|
|
33
|
+
});
|
|
34
|
+
const responseText = `已创建《${book.title}》,接下来可以直接输入“写第1章”。`;
|
|
35
|
+
nextSession = appendInteractionMessage({
|
|
36
|
+
...nextSession,
|
|
37
|
+
activeBookId: book.id,
|
|
38
|
+
currentExecution: {
|
|
39
|
+
status: "completed",
|
|
40
|
+
bookId: book.id,
|
|
41
|
+
stageLabel: "architect",
|
|
42
|
+
},
|
|
43
|
+
}, {
|
|
44
|
+
role: "assistant",
|
|
45
|
+
content: responseText,
|
|
46
|
+
timestamp: userTimestamp + 1,
|
|
47
|
+
});
|
|
48
|
+
await persistProjectSession(params.projectRoot, nextSession);
|
|
49
|
+
return {
|
|
50
|
+
responseText,
|
|
51
|
+
session: nextSession,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (resolvedBookId && isWriteNextInstruction(params.input)) {
|
|
56
|
+
const writeResult = await pipeline.writeNextChapter(resolvedBookId);
|
|
57
|
+
const chapterNumber = getResultNumber(writeResult, "chapterNumber");
|
|
58
|
+
const title = getResultString(writeResult, "title");
|
|
59
|
+
const wordCount = getResultNumber(writeResult, "wordCount");
|
|
60
|
+
const status = getResultString(writeResult, "status");
|
|
61
|
+
const responseText = [
|
|
62
|
+
`已为 ${resolvedBookId} 完成`,
|
|
63
|
+
chapterNumber ? `第 ${chapterNumber} 章` : "下一章",
|
|
64
|
+
title ? `《${title}》` : "",
|
|
65
|
+
wordCount ? `,字数 ${wordCount}` : "",
|
|
66
|
+
status ? `,状态 ${status}` : "",
|
|
67
|
+
"。",
|
|
68
|
+
].join("");
|
|
69
|
+
nextSession = appendInteractionMessage({
|
|
70
|
+
...nextSession,
|
|
71
|
+
activeBookId: resolvedBookId,
|
|
72
|
+
currentExecution: {
|
|
73
|
+
status: "completed",
|
|
74
|
+
bookId: resolvedBookId,
|
|
75
|
+
...(chapterNumber ? { chapterNumber } : {}),
|
|
76
|
+
stageLabel: "writer",
|
|
77
|
+
},
|
|
78
|
+
...(chapterNumber ? { activeChapterNumber: chapterNumber } : {}),
|
|
79
|
+
}, {
|
|
80
|
+
role: "assistant",
|
|
81
|
+
content: responseText,
|
|
82
|
+
timestamp: userTimestamp + 1,
|
|
83
|
+
});
|
|
84
|
+
await persistProjectSession(params.projectRoot, nextSession);
|
|
85
|
+
return {
|
|
86
|
+
responseText,
|
|
87
|
+
session: nextSession,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
27
90
|
const result = await runAgentSession({
|
|
28
91
|
sessionId: params.session.sessionId,
|
|
29
92
|
bookId: resolvedBookId,
|
|
@@ -40,13 +103,16 @@ export async function processTuiAgentInput(params) {
|
|
|
40
103
|
}
|
|
41
104
|
},
|
|
42
105
|
}, params.input, initialMessages);
|
|
106
|
+
const createdBookId = extractCreatedBookId(result.messages);
|
|
107
|
+
const activeBookId = createdBookId ?? resolvedBookId;
|
|
43
108
|
if (result.responseText?.trim()) {
|
|
44
109
|
const lastAssistant = result.messages.filter((message) => message.role === "assistant").pop();
|
|
45
110
|
nextSession = appendInteractionMessage({
|
|
46
111
|
...nextSession,
|
|
112
|
+
...(activeBookId ? { activeBookId } : {}),
|
|
47
113
|
currentExecution: {
|
|
48
114
|
status: "completed",
|
|
49
|
-
...(
|
|
115
|
+
...(activeBookId ? { bookId: activeBookId } : {}),
|
|
50
116
|
...(params.session.activeChapterNumber ? { chapterNumber: params.session.activeChapterNumber } : {}),
|
|
51
117
|
stageLabel: "agent",
|
|
52
118
|
},
|
|
@@ -60,9 +126,10 @@ export async function processTuiAgentInput(params) {
|
|
|
60
126
|
else {
|
|
61
127
|
nextSession = {
|
|
62
128
|
...nextSession,
|
|
129
|
+
...(activeBookId ? { activeBookId } : {}),
|
|
63
130
|
currentExecution: {
|
|
64
131
|
status: "completed",
|
|
65
|
-
...(
|
|
132
|
+
...(activeBookId ? { bookId: activeBookId } : {}),
|
|
66
133
|
...(params.session.activeChapterNumber ? { chapterNumber: params.session.activeChapterNumber } : {}),
|
|
67
134
|
stageLabel: "agent",
|
|
68
135
|
},
|
|
@@ -74,4 +141,88 @@ export async function processTuiAgentInput(params) {
|
|
|
74
141
|
session: nextSession,
|
|
75
142
|
};
|
|
76
143
|
}
|
|
144
|
+
function isWriteNextInstruction(instruction) {
|
|
145
|
+
const trimmed = instruction.trim();
|
|
146
|
+
return /^(continue|继续|继续写|写下一章|write next|下一章|再来一章)$/i.test(trimmed)
|
|
147
|
+
|| /^写第\s*\d+\s*章$/i.test(trimmed)
|
|
148
|
+
|| /(继续写|写下一章|下一章|再来一章|write\s+next)/i.test(trimmed);
|
|
149
|
+
}
|
|
150
|
+
function isCreateBookInstruction(instruction) {
|
|
151
|
+
return /(建书|新建书|创建|开书|create\s+(?:a\s+)?book)/i.test(instruction)
|
|
152
|
+
&& /(?:标题|书名|title)\s*[《"“]/i.test(instruction);
|
|
153
|
+
}
|
|
154
|
+
function parseBookCreationRequest(instruction) {
|
|
155
|
+
const title = extractTitle(instruction);
|
|
156
|
+
if (!title)
|
|
157
|
+
return undefined;
|
|
158
|
+
const now = new Date().toISOString();
|
|
159
|
+
return {
|
|
160
|
+
id: deriveBookId(title),
|
|
161
|
+
title,
|
|
162
|
+
genre: inferGenre(instruction),
|
|
163
|
+
platform: inferPlatform(instruction),
|
|
164
|
+
language: /[\u4e00-\u9fff]/.test(instruction) ? "zh" : "en",
|
|
165
|
+
status: "outlining",
|
|
166
|
+
targetChapters: extractNumber(instruction, /(\d+)\s*章/) ?? 200,
|
|
167
|
+
chapterWordCount: extractNumber(instruction, /(?:每章|章节|章)\D{0,8}(\d{3,5})\s*字/) ?? 3000,
|
|
168
|
+
createdAt: now,
|
|
169
|
+
updatedAt: now,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function extractTitle(instruction) {
|
|
173
|
+
const match = instruction.match(/(?:标题|书名|title)\s*[《"“]([^》"”]+)[》"”]/i);
|
|
174
|
+
const title = match?.[1]?.trim();
|
|
175
|
+
return title && title.length > 0 ? title : undefined;
|
|
176
|
+
}
|
|
177
|
+
function extractNumber(instruction, pattern) {
|
|
178
|
+
const value = Number.parseInt(instruction.match(pattern)?.[1] ?? "", 10);
|
|
179
|
+
return Number.isFinite(value) && value > 0 ? value : undefined;
|
|
180
|
+
}
|
|
181
|
+
function inferPlatform(instruction) {
|
|
182
|
+
if (/番茄|tomato/i.test(instruction))
|
|
183
|
+
return "tomato";
|
|
184
|
+
if (/飞卢|feilu/i.test(instruction))
|
|
185
|
+
return "feilu";
|
|
186
|
+
if (/起点|qidian/i.test(instruction))
|
|
187
|
+
return "qidian";
|
|
188
|
+
return "other";
|
|
189
|
+
}
|
|
190
|
+
function inferGenre(instruction) {
|
|
191
|
+
if (/都市/.test(instruction))
|
|
192
|
+
return "urban";
|
|
193
|
+
if (/悬疑|推理|mystery/i.test(instruction))
|
|
194
|
+
return "mystery";
|
|
195
|
+
if (/玄幻|xuanhuan/i.test(instruction))
|
|
196
|
+
return "xuanhuan";
|
|
197
|
+
if (/科幻|sci[-\s]?fi/i.test(instruction))
|
|
198
|
+
return "sci-fi";
|
|
199
|
+
if (/言情|甜宠|romance/i.test(instruction))
|
|
200
|
+
return "romance";
|
|
201
|
+
return "other";
|
|
202
|
+
}
|
|
203
|
+
function deriveBookId(title) {
|
|
204
|
+
return title
|
|
205
|
+
.toLowerCase()
|
|
206
|
+
.replace(/[^a-z0-9\u4e00-\u9fff]/g, "-")
|
|
207
|
+
.replace(/-+/g, "-")
|
|
208
|
+
.replace(/^-|-$/g, "")
|
|
209
|
+
.slice(0, 30) || `book-${Date.now().toString(36)}`;
|
|
210
|
+
}
|
|
211
|
+
function extractCreatedBookId(messages) {
|
|
212
|
+
for (const message of messages) {
|
|
213
|
+
const details = message.details;
|
|
214
|
+
if (details?.kind === "book_created" && details.bookId) {
|
|
215
|
+
return details.bookId;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
function getResultString(value, key) {
|
|
221
|
+
const raw = value[key];
|
|
222
|
+
return typeof raw === "string" && raw.length > 0 ? raw : undefined;
|
|
223
|
+
}
|
|
224
|
+
function getResultNumber(value, key) {
|
|
225
|
+
const raw = value[key];
|
|
226
|
+
return typeof raw === "number" && Number.isFinite(raw) ? raw : undefined;
|
|
227
|
+
}
|
|
77
228
|
//# sourceMappingURL=agent-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-input.js","sourceRoot":"","sources":["../../src/tui/agent-input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAM1C;IACC,MAAM,M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QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|
package/dist/tui/app.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type InteractionRuntimeTools } from "@actalk/inkos-core";
|
|
2
1
|
import { type TuiLocale } from "./i18n.js";
|
|
3
2
|
export interface TuiFrameState {
|
|
4
3
|
readonly locale?: TuiLocale;
|
|
@@ -10,119 +9,5 @@ export interface TuiFrameState {
|
|
|
10
9
|
readonly events?: ReadonlyArray<string>;
|
|
11
10
|
}
|
|
12
11
|
export declare function renderTuiFrame(state: TuiFrameState): string;
|
|
13
|
-
export declare function
|
|
14
|
-
session: {
|
|
15
|
-
events: {
|
|
16
|
-
status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
|
|
17
|
-
kind: string;
|
|
18
|
-
timestamp: number;
|
|
19
|
-
detail?: string | undefined;
|
|
20
|
-
bookId?: string | undefined;
|
|
21
|
-
chapterNumber?: number | undefined;
|
|
22
|
-
}[];
|
|
23
|
-
messages: {
|
|
24
|
-
role: "system" | "user" | "assistant";
|
|
25
|
-
content: string;
|
|
26
|
-
timestamp: number;
|
|
27
|
-
thinking?: string | undefined;
|
|
28
|
-
toolExecutions?: {
|
|
29
|
-
status: "completed" | "error" | "running" | "processing";
|
|
30
|
-
id: string;
|
|
31
|
-
tool: string;
|
|
32
|
-
label: string;
|
|
33
|
-
startedAt: number;
|
|
34
|
-
error?: string | undefined;
|
|
35
|
-
agent?: string | undefined;
|
|
36
|
-
args?: Record<string, unknown> | undefined;
|
|
37
|
-
result?: string | undefined;
|
|
38
|
-
stages?: {
|
|
39
|
-
status: "active" | "completed" | "pending";
|
|
40
|
-
label: string;
|
|
41
|
-
}[] | undefined;
|
|
42
|
-
completedAt?: number | undefined;
|
|
43
|
-
}[] | undefined;
|
|
44
|
-
}[];
|
|
45
|
-
sessionId: string;
|
|
46
|
-
projectRoot: string;
|
|
47
|
-
draftRounds: {
|
|
48
|
-
timestamp: number;
|
|
49
|
-
summary: string;
|
|
50
|
-
roundId: number;
|
|
51
|
-
userMessage: string;
|
|
52
|
-
assistantRaw: string;
|
|
53
|
-
fieldsUpdated: string[];
|
|
54
|
-
}[];
|
|
55
|
-
automationMode: "auto" | "semi" | "manual";
|
|
56
|
-
activeBookId?: string | undefined;
|
|
57
|
-
activeChapterNumber?: number | undefined;
|
|
58
|
-
creationDraft?: {
|
|
59
|
-
concept: string;
|
|
60
|
-
missingFields: string[];
|
|
61
|
-
readyToCreate: boolean;
|
|
62
|
-
title?: string | undefined;
|
|
63
|
-
platform?: string | undefined;
|
|
64
|
-
genre?: string | undefined;
|
|
65
|
-
targetChapters?: number | undefined;
|
|
66
|
-
chapterWordCount?: number | undefined;
|
|
67
|
-
language?: "zh" | "en" | undefined;
|
|
68
|
-
protagonist?: string | undefined;
|
|
69
|
-
authorIntent?: string | undefined;
|
|
70
|
-
currentFocus?: string | undefined;
|
|
71
|
-
volumeOutline?: string | undefined;
|
|
72
|
-
blurb?: string | undefined;
|
|
73
|
-
worldPremise?: string | undefined;
|
|
74
|
-
settingNotes?: string | undefined;
|
|
75
|
-
supportingCast?: string | undefined;
|
|
76
|
-
conflictCore?: string | undefined;
|
|
77
|
-
constraints?: string | undefined;
|
|
78
|
-
nextQuestion?: string | undefined;
|
|
79
|
-
} | undefined;
|
|
80
|
-
pendingDecision?: {
|
|
81
|
-
bookId: string;
|
|
82
|
-
kind: string;
|
|
83
|
-
summary: string;
|
|
84
|
-
chapterNumber?: number | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
currentExecution?: {
|
|
87
|
-
status: "completed" | "planning" | "idle" | "composing" | "writing" | "assessing" | "repairing" | "persisting" | "waiting_human" | "blocked" | "failed";
|
|
88
|
-
bookId?: string | undefined;
|
|
89
|
-
chapterNumber?: number | undefined;
|
|
90
|
-
stageLabel?: string | undefined;
|
|
91
|
-
} | undefined;
|
|
92
|
-
};
|
|
93
|
-
request: {
|
|
94
|
-
intent: "chat" | "develop_book" | "show_book_draft" | "create_book" | "discard_book_draft" | "list_books" | "select_book" | "continue_book" | "write_next" | "pause_book" | "resume_book" | "revise_chapter" | "rewrite_chapter" | "patch_chapter_text" | "edit_truth" | "rename_entity" | "update_focus" | "update_author_intent" | "explain_status" | "explain_failure" | "export_book" | "switch_mode";
|
|
95
|
-
title?: string | undefined;
|
|
96
|
-
platform?: string | undefined;
|
|
97
|
-
genre?: string | undefined;
|
|
98
|
-
targetChapters?: number | undefined;
|
|
99
|
-
chapterWordCount?: number | undefined;
|
|
100
|
-
language?: "zh" | "en" | undefined;
|
|
101
|
-
protagonist?: string | undefined;
|
|
102
|
-
authorIntent?: string | undefined;
|
|
103
|
-
currentFocus?: string | undefined;
|
|
104
|
-
volumeOutline?: string | undefined;
|
|
105
|
-
bookId?: string | undefined;
|
|
106
|
-
chapterNumber?: number | undefined;
|
|
107
|
-
blurb?: string | undefined;
|
|
108
|
-
worldPremise?: string | undefined;
|
|
109
|
-
settingNotes?: string | undefined;
|
|
110
|
-
supportingCast?: string | undefined;
|
|
111
|
-
conflictCore?: string | undefined;
|
|
112
|
-
constraints?: string | undefined;
|
|
113
|
-
fileName?: string | undefined;
|
|
114
|
-
format?: "txt" | "md" | "epub" | undefined;
|
|
115
|
-
approvedOnly?: boolean | undefined;
|
|
116
|
-
outputPath?: string | undefined;
|
|
117
|
-
oldValue?: string | undefined;
|
|
118
|
-
newValue?: string | undefined;
|
|
119
|
-
targetText?: string | undefined;
|
|
120
|
-
replacementText?: string | undefined;
|
|
121
|
-
instruction?: string | undefined;
|
|
122
|
-
mode?: "auto" | "semi" | "manual" | undefined;
|
|
123
|
-
};
|
|
124
|
-
responseText?: string;
|
|
125
|
-
details?: Readonly<Record<string, unknown>>;
|
|
126
|
-
}>;
|
|
127
|
-
export declare function launchTui(projectRoot: string, toolsOverride?: InteractionRuntimeTools): Promise<void>;
|
|
12
|
+
export declare function launchTui(projectRoot: string): Promise<void>;
|
|
128
13
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/tui/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/tui/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/tui/app.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAK/G,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAqB3D;AA8BD,wBAAsB,SAAS,CAC7B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAwDf"}
|
package/dist/tui/app.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { access } from "node:fs/promises";
|
|
2
2
|
import { basename, dirname, join } from "node:path";
|
|
3
|
-
import { appendInteractionMessage, processProjectInteractionInput, } from "@actalk/inkos-core";
|
|
4
3
|
import { render } from "ink";
|
|
5
4
|
import React from "react";
|
|
6
5
|
import { InkTuiApp } from "./dashboard.js";
|
|
7
6
|
import { formatModeLabel, getTuiCopy, normalizeStageLabel, resolveTuiLocale } from "./i18n.js";
|
|
8
|
-
import {
|
|
9
|
-
import { loadProjectSession, persistProjectSession } from "./session-store.js";
|
|
7
|
+
import { loadProjectSession } from "./session-store.js";
|
|
10
8
|
import { detectModelInfo, detectProjectLanguage, ensureProject, interactiveLlmSetup } from "./setup.js";
|
|
11
|
-
import { createInteractionTools } from "./tools.js";
|
|
12
9
|
import { animateStartup } from "./effects.js";
|
|
13
10
|
export function renderTuiFrame(state) {
|
|
14
11
|
const locale = state.locale ?? resolveTuiLocale();
|
|
@@ -45,30 +42,6 @@ async function readVersion() {
|
|
|
45
42
|
return "dev";
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
export async function processTuiInput(projectRoot, input, tools) {
|
|
49
|
-
const projectLanguage = await detectProjectLanguage(projectRoot);
|
|
50
|
-
const locale = resolveTuiLocale(process.env, projectLanguage);
|
|
51
|
-
const result = await processProjectInteractionInput({
|
|
52
|
-
projectRoot,
|
|
53
|
-
input,
|
|
54
|
-
tools,
|
|
55
|
-
});
|
|
56
|
-
const summary = formatTuiResult({
|
|
57
|
-
intent: result.request.intent,
|
|
58
|
-
status: result.session.currentExecution?.status ?? "completed",
|
|
59
|
-
bookId: result.session.activeBookId,
|
|
60
|
-
mode: result.request.mode,
|
|
61
|
-
responseText: result.responseText,
|
|
62
|
-
locale,
|
|
63
|
-
});
|
|
64
|
-
const nextSession = appendInteractionMessage(result.session, {
|
|
65
|
-
role: "assistant",
|
|
66
|
-
content: summary,
|
|
67
|
-
timestamp: Date.now(),
|
|
68
|
-
});
|
|
69
|
-
await persistProjectSession(projectRoot, nextSession);
|
|
70
|
-
return { ...result, session: nextSession };
|
|
71
|
-
}
|
|
72
45
|
async function resolveProjectRoot(cwd) {
|
|
73
46
|
// If CWD is a book directory (contains book.json), walk up to the actual project root.
|
|
74
47
|
// Structure: <projectRoot>/books/<bookId>/book.json
|
|
@@ -84,7 +57,7 @@ async function resolveProjectRoot(cwd) {
|
|
|
84
57
|
}
|
|
85
58
|
return cwd;
|
|
86
59
|
}
|
|
87
|
-
export async function launchTui(projectRoot
|
|
60
|
+
export async function launchTui(projectRoot) {
|
|
88
61
|
projectRoot = await resolveProjectRoot(projectRoot);
|
|
89
62
|
const { hasLlmConfig } = await ensureProject(projectRoot);
|
|
90
63
|
const projectLanguage = await detectProjectLanguage(projectRoot);
|
|
@@ -106,23 +79,6 @@ export async function launchTui(projectRoot, toolsOverride) {
|
|
|
106
79
|
: copy.labels.notConfigured;
|
|
107
80
|
const version = await readVersion();
|
|
108
81
|
const chatStreamBridge = {};
|
|
109
|
-
let tools;
|
|
110
|
-
try {
|
|
111
|
-
tools = toolsOverride ?? (await createInteractionTools(projectRoot, {
|
|
112
|
-
onChatTextDelta: (text) => {
|
|
113
|
-
chatStreamBridge.onTextDelta?.(text);
|
|
114
|
-
},
|
|
115
|
-
onDraftTextDelta: (text) => {
|
|
116
|
-
chatStreamBridge.onTextDelta?.(text);
|
|
117
|
-
},
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
122
|
-
console.error(copy.notes.toolInitFailed(message));
|
|
123
|
-
console.error(copy.notes.toolInitHint);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
82
|
const originalEmitWarning = process.emitWarning;
|
|
127
83
|
process.emitWarning = (() => { });
|
|
128
84
|
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
@@ -141,7 +97,6 @@ export async function launchTui(projectRoot, toolsOverride) {
|
|
|
141
97
|
projectName: basename(projectRoot),
|
|
142
98
|
modelLabel,
|
|
143
99
|
initialSession: session,
|
|
144
|
-
tools,
|
|
145
100
|
chatStreamBridge,
|
|
146
101
|
}), { exitOnCtrlC: true });
|
|
147
102
|
await app.waitUntilExit();
|
package/dist/tui/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/tui/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAA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AAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC9E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAQ,mBAAgC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3D,CAAC,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QAEtF,MAAM,GAAG,GAAG,MAAM,CAChB,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE;YAC7B,MAAM;YACN,WAAW;YACX,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC;YAClC,UAAU;YACV,cAAc,EAAE,OAAO;YACvB,gBAAgB;SACjB,CAAC,EACF,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC;QACF,MAAM,GAAG,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,WAAW,GAAG,mBAAmB,CAAC;QAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,mBAAmB,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
package/dist/tui/dashboard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type InteractionSession } from "@actalk/inkos-core";
|
|
3
3
|
import { type TuiLocale } from "./i18n.js";
|
|
4
4
|
export interface InkTuiDashboardProps {
|
|
5
5
|
readonly locale: TuiLocale;
|
|
@@ -25,7 +25,6 @@ export interface InkTuiAppProps {
|
|
|
25
25
|
readonly projectName: string;
|
|
26
26
|
readonly modelLabel: string;
|
|
27
27
|
readonly initialSession: InteractionSession;
|
|
28
|
-
readonly tools: InteractionRuntimeTools;
|
|
29
28
|
readonly chatStreamBridge?: {
|
|
30
29
|
onTextDelta?: (text: string) => void;
|
|
31
30
|
getChatRequestOptions?: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/tui/dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/tui/dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAgB7F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAClD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAC1B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACrC,qBAAqB,CAAC,EAAE,MAAM;YAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;SAC7B,CAAC;KACH,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA8F9E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6QlE"}
|
package/dist/tui/dashboard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { appendInteractionMessage,
|
|
3
|
+
import { appendInteractionMessage, routeNaturalLanguageIntent, } from "@actalk/inkos-core";
|
|
4
4
|
import { Box, Text, useApp, useInput } from "ink";
|
|
5
5
|
import { processTuiAgentInput } from "./agent-input.js";
|
|
6
6
|
import { describeActivityState } from "./activity-state.js";
|
|
@@ -9,27 +9,13 @@ import { resolveChatDepthProfile } from "./chat-depth.js";
|
|
|
9
9
|
import { appendStreamingAssistantChunk, createOptimisticUserMessageSession } from "./chat-draft.js";
|
|
10
10
|
import { renderComposerDisplay } from "./composer-display.js";
|
|
11
11
|
import { renderMarkdown } from "./markdown.js";
|
|
12
|
-
import { formatTuiResult } from "./output.js";
|
|
13
12
|
import { buildDashboardViewModel } from "./dashboard-model.js";
|
|
14
13
|
import { buildInputHistory, moveHistoryCursor } from "./input-history.js";
|
|
15
14
|
import { formatModeLabel, getTuiCopy, normalizeStageLabel } from "./i18n.js";
|
|
16
|
-
import { loadProjectSession,
|
|
15
|
+
import { loadProjectSession, resolveSessionActiveBook } from "./session-store.js";
|
|
17
16
|
import { classifyLocalTuiCommand, parseDepthCommand } from "./local-commands.js";
|
|
18
17
|
import { applySlashSuggestion, getNextSlashSelection, getSlashSuggestions, SLASH_COMMANDS, } from "./slash-autocomplete.js";
|
|
19
18
|
import { WARM_ACCENT, WARM_BORDER, WARM_MUTED, WARM_REPLY, STATUS_SUCCESS, STATUS_ERROR, STATUS_ACTIVE, STATUS_IDLE, ROLE_USER, ROLE_SYSTEM, isAppleTerminal, } from "./theme.js";
|
|
20
|
-
function shouldUseLegacyTuiInteraction(intent) {
|
|
21
|
-
switch (intent) {
|
|
22
|
-
case "list_books":
|
|
23
|
-
case "show_book_draft":
|
|
24
|
-
case "discard_book_draft":
|
|
25
|
-
case "select_book":
|
|
26
|
-
case "pause_book":
|
|
27
|
-
case "switch_mode":
|
|
28
|
-
return true;
|
|
29
|
-
default:
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
19
|
export function InkTuiDashboard(props) {
|
|
34
20
|
const copy = getTuiCopy(props.locale);
|
|
35
21
|
const model = buildDashboardViewModel({
|
|
@@ -219,8 +205,7 @@ export function InkTuiApp(props) {
|
|
|
219
205
|
hasFailed: session.currentExecution?.status === "failed",
|
|
220
206
|
});
|
|
221
207
|
const userTimestamp = Date.now();
|
|
222
|
-
const assistantDraftTimestamp =
|
|
223
|
-
? userTimestamp + 1 : null;
|
|
208
|
+
const assistantDraftTimestamp = userTimestamp + 1;
|
|
224
209
|
assistantDraftTimestampRef.current = assistantDraftTimestamp;
|
|
225
210
|
setActivityIntent(routed.intent);
|
|
226
211
|
setIsSubmitting(true);
|
|
@@ -232,41 +217,16 @@ export function InkTuiApp(props) {
|
|
|
232
217
|
if (routed.intent === "develop_book" && !session.creationDraft) {
|
|
233
218
|
appendSystemNote(copy.notes.newBookGuide);
|
|
234
219
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
bookId: result.session.activeBookId,
|
|
246
|
-
mode: result.request.mode,
|
|
247
|
-
responseText: result.responseText,
|
|
248
|
-
locale: props.locale,
|
|
249
|
-
});
|
|
250
|
-
const nextSession = appendInteractionMessage(result.session, {
|
|
251
|
-
role: "assistant",
|
|
252
|
-
content: summary,
|
|
253
|
-
timestamp: Date.now(),
|
|
254
|
-
});
|
|
255
|
-
await persistProjectSession(props.projectRoot, nextSession);
|
|
256
|
-
setSession(nextSession);
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
const result = await processTuiAgentInput({
|
|
260
|
-
projectRoot: props.projectRoot,
|
|
261
|
-
input,
|
|
262
|
-
session,
|
|
263
|
-
activeBookId,
|
|
264
|
-
onTextDelta: (text) => {
|
|
265
|
-
props.chatStreamBridge?.onTextDelta?.(text);
|
|
266
|
-
},
|
|
267
|
-
});
|
|
268
|
-
setSession(result.session);
|
|
269
|
-
}
|
|
220
|
+
const result = await processTuiAgentInput({
|
|
221
|
+
projectRoot: props.projectRoot,
|
|
222
|
+
input,
|
|
223
|
+
session,
|
|
224
|
+
activeBookId,
|
|
225
|
+
onTextDelta: (text) => {
|
|
226
|
+
props.chatStreamBridge?.onTextDelta?.(text);
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
setSession(result.session);
|
|
270
230
|
}
|
|
271
231
|
catch (error) {
|
|
272
232
|
const message = error instanceof Error ? error.message : String(error);
|