refactor(call-omo-agent): split tools.ts into agent execution modules
Extract agent call pipeline: - agent-type-normalizer.ts, tool-context-with-metadata.ts - subagent-session-creator.ts, subagent-session-prompter.ts - sync-agent-executor.ts, background-agent-executor.ts - session-completion-poller.ts, session-message-output-extractor.ts - message-storage-directory.ts
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { log, getAgentToolRestrictions } from "../../shared"
|
||||
|
||||
export async function promptSubagentSession(
|
||||
ctx: PluginInput,
|
||||
options: { sessionID: string; agent: string; prompt: string },
|
||||
): Promise<{ ok: true } | { ok: false; error: string }> {
|
||||
try {
|
||||
await ctx.client.session.promptAsync({
|
||||
path: { id: options.sessionID },
|
||||
body: {
|
||||
agent: options.agent,
|
||||
tools: {
|
||||
...getAgentToolRestrictions(options.agent),
|
||||
task: false,
|
||||
},
|
||||
parts: [{ type: "text", text: options.prompt }],
|
||||
},
|
||||
})
|
||||
return { ok: true }
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error)
|
||||
log("[call_omo_agent] Prompt error", { error: errorMessage })
|
||||
return { ok: false, error: errorMessage }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user