feat: harden runtime readiness and session workflow
This commit is contained in:
@@ -83,8 +83,8 @@ export class ThtRunner {
|
||||
return JSON.parse(stdout) as T;
|
||||
}
|
||||
|
||||
private async ok(args: string[]): Promise<void> {
|
||||
const { code, stderr } = await this.run(args);
|
||||
private async ok(args: string[], workspace?: string): Promise<void> {
|
||||
const { code, stderr } = await this.run(args, workspace);
|
||||
if (code !== 0) throw new Error(`tht ${args.join(" ")} exit ${code}: ${stderr.trim()}`);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,13 @@ export class ThtRunner {
|
||||
return this.json<{ id: string }>(a, o.workspace);
|
||||
}
|
||||
|
||||
/** Build and persist the deterministic F1 retrieval pack for a new session. */
|
||||
async searchPack(question: string, sessionId: string, workspace?: string): Promise<void> {
|
||||
const args = ["search", "pack", question, "--session", sessionId];
|
||||
const { code, stderr } = await this.run(args, workspace);
|
||||
if (code !== 0) throw new Error(`tht ${args.join(" ")} exit ${code}: ${stderr.trim()}`);
|
||||
}
|
||||
|
||||
sessionList(workspace?: string) {
|
||||
return this.json<SessionRow[]>(["session", "list", "--json"], workspace);
|
||||
}
|
||||
@@ -137,6 +144,9 @@ export class ThtRunner {
|
||||
return { path: stdout.trim() };
|
||||
}
|
||||
|
||||
closeSession(id: string, workspace?: string) { return this.ok(["session", "close", id], workspace); }
|
||||
failSession(id: string, workspace?: string) { return this.ok(["session", "fail", id], workspace); }
|
||||
reopenSession(id: string, workspace?: string) { return this.ok(["session", "reopen", id], workspace); }
|
||||
setName(id: string, name: string) { return this.ok(["session", "set-name", id, "--name", name]); }
|
||||
setGroup(id: string, group: string) { return this.ok(["session", "set-group", id, "--group", group]); }
|
||||
archive(id: string) { return this.ok(["session", "archive", id]); }
|
||||
|
||||
Reference in New Issue
Block a user