feat(agent): sandbox conversation analysis
Generic Container CI/CD / test-build-publish (push) Successful in 2m44s
Agent CI/CD v2 / build-test-publish-and-deploy (push) Successful in 2m44s

This commit is contained in:
2026-08-25 16:08:33 +08:00
parent ce04704af2
commit 80cfc1f2ab
27 changed files with 2387 additions and 125 deletions
+47
View File
@@ -0,0 +1,47 @@
import { config } from "../config.js";
import { type RuntimeSessionContext } from "./sessionContext.js";
import { stageConversationText } from "./conversationWorkspace.js";
export type ToolDataFilePayload = {
bytes: number;
content_type: string;
file_path: string;
};
export const stageLargeToolOutput = async (
context: RuntimeSessionContext,
content: string,
options: {
contentType: string;
extension: string;
force?: boolean;
prefix: string;
},
): Promise<ToolDataFilePayload | null> => {
if (!options.force && Buffer.byteLength(content) <= config.MAX_INLINE_RESULT_BYTES) {
return null;
}
if (!context.workspaceDirectory) {
throw new Error(
"large tool output requires a conversation workspace; create a new conversation",
);
}
const staged = await stageConversationText(
context.workspaceDirectory,
config.RESULT_REF_IMPORT_DIR,
content,
options,
);
return {
bytes: staged.bytes,
content_type: staged.contentType,
file_path: staged.filePath,
};
};
export const buildLargeCliResult = (dataFile: ToolDataFilePayload) => ({
ok: true,
schema_version: "tjwater-cli/v1",
summary: "CLI 结果已保存到当前对话工作区",
data_file: dataFile,
});