UNPKG

@autobe/agent

Version:

AI backend server code generator

27 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createAgenticaHistory = createAgenticaHistory; function createAgenticaHistory(props) { if (props.history.type === "userMessage") return Object.assign(Object.assign({}, props.history), { toJSON: () => props.history }); else if (props.history.type === "assistantMessage") return Object.assign(Object.assign({}, props.history), { toJSON: () => props.history }); const operation = props.operations.find((op) => op.function.name === props.history.type); if (operation === undefined) return null; const partial = { id: props.history.id, created_at: props.history.created_at, type: "execute", arguments: { reason: props.history.reason, }, value: { success: props.history.type === "analyze" || props.history.type === "interface" ? true : props.history.compiled.type === "success", }, }; return Object.assign(Object.assign({}, partial), { protocol: operation.protocol, operation: operation, toJSON: () => (Object.assign(Object.assign({}, partial), { protocol: operation.protocol, operation: operation.toJSON() })) }); } //# sourceMappingURL=createAgenticaHistory.js.map