UNPKG

n8n-nodes-octavehq

Version:

Octave is the AI-powered messaging brain for B2B go-to-market teams, helping articulate product value, synthesize customer interaction data, and deploy consistent, effective messaging across all channels.

68 lines 2.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.exportedProperties = void 0; exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const OctaveApiRequest_1 = require("../../transport/OctaveApiRequest"); const utils_1 = require("../utils"); const properties = [ { displayName: 'Agent Name or ID', name: 'agentOId', type: 'options', required: true, typeOptions: { loadOptionsMethod: 'getAgents' }, default: '', description: 'Context agent OId. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.', }, { displayName: 'Query', name: 'query', type: 'string', default: '', description: 'Question or task to fetch context for', typeOptions: { rows: 3 }, }, { displayName: 'Runtime Context', name: 'runtimeContext', type: 'string', default: '', description: 'Runtime context string — used as the query if Query is not provided', typeOptions: { rows: 3 }, }, { displayName: 'Additional Context (JSON)', name: 'additionalContext', type: 'json', default: '{}', description: 'Optional person/company/details to enhance search: { person: {firstName, lastName, title, email, ...}, company: {name, domain, ...}, details: "..." }', typeOptions: { rows: 5 }, }, ]; const displayOptions = { show: { resource: ['agent'], operation: ['runContext'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const agentOId = this.getNodeParameter('agentOId', itemIndex); if (!agentOId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Agent OId is required.', { itemIndex }); } const body = { agentOId }; const query = this.getNodeParameter('query', itemIndex); if (query) body.query = query; const runtimeContext = this.getNodeParameter('runtimeContext', itemIndex); if (runtimeContext) body.runtimeContext = runtimeContext; const additionalContext = utils_1.parseJsonParameter.call(this, 'additionalContext', itemIndex, '{}'); if (additionalContext && Object.keys(additionalContext).length > 0) body.additionalContext = additionalContext; const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/agents/context/run', body); return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })]; } //# sourceMappingURL=runContext.operation.js.map