refactor(prompt-callers): migrate shared and cli dispatch
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -13,7 +13,7 @@ import { loadAgentProfileColors } from "./agent-profile-colors"
|
||||
import { suppressRunInput } from "./stdin-suppression"
|
||||
import { createTimestampedStdoutController } from "./timestamp-output"
|
||||
import { createCliPostHog, getPostHogDistinctId } from "../../shared/posthog"
|
||||
import { promptAsyncAfterSessionIdle } from "../../shared/prompt-async-gate"
|
||||
import { dispatchInternalPrompt } from "../../shared/prompt-async-gate"
|
||||
|
||||
export { resolveRunAgent }
|
||||
|
||||
@@ -110,7 +110,8 @@ export async function run(options: RunOptions): Promise<number> {
|
||||
() => {},
|
||||
)
|
||||
|
||||
const promptResult = await promptAsyncAfterSessionIdle({
|
||||
const promptResult = await dispatchInternalPrompt({
|
||||
mode: "async",
|
||||
client,
|
||||
sessionID,
|
||||
source: "cli-run",
|
||||
|
||||
@@ -4,7 +4,7 @@ const { afterEach, describe, expect, test } = require("bun:test")
|
||||
import { injectContinuation } from "./continuation-injection"
|
||||
import { OMO_INTERNAL_INITIATOR_MARKER } from "../../shared/internal-initiator-marker"
|
||||
import {
|
||||
promptAsyncAfterSessionIdle,
|
||||
dispatchInternalPrompt,
|
||||
releaseAllPromptAsyncReservationsForTesting,
|
||||
releasePromptAsyncReservation,
|
||||
} from "../shared/prompt-async-gate"
|
||||
@@ -260,7 +260,8 @@ describe("injectContinuation", () => {
|
||||
}
|
||||
|
||||
// when
|
||||
const peerMessageResult = await promptAsyncAfterSessionIdle({
|
||||
const peerMessageResult = await dispatchInternalPrompt({
|
||||
mode: "async",
|
||||
client: ctx.client,
|
||||
sessionID,
|
||||
source: "team-live-delivery",
|
||||
|
||||
@@ -6,8 +6,7 @@ import {
|
||||
type PromptRetryOptions,
|
||||
} from "./prompt-timeout-context"
|
||||
import {
|
||||
promptAfterSessionIdle,
|
||||
promptAsyncAfterSessionIdle,
|
||||
dispatchInternalPrompt,
|
||||
releasePromptAsyncReservation,
|
||||
} from "./prompt-async-gate"
|
||||
|
||||
@@ -100,7 +99,8 @@ export async function promptWithModelSuggestionRetry(
|
||||
const timeoutContext = createPromptTimeoutContext(args, timeoutMs)
|
||||
|
||||
try {
|
||||
const promptResult = await promptAsyncAfterSessionIdle({
|
||||
const promptResult = await dispatchInternalPrompt({
|
||||
mode: "async",
|
||||
client,
|
||||
sessionID: args.path.id,
|
||||
input: {
|
||||
@@ -140,7 +140,8 @@ export async function promptSyncWithModelSuggestionRetry(
|
||||
try {
|
||||
const timeoutContext = createPromptTimeoutContext(args, timeoutMs)
|
||||
try {
|
||||
const promptResult = await promptAfterSessionIdle({
|
||||
const promptResult = await dispatchInternalPrompt({
|
||||
mode: "sync",
|
||||
client,
|
||||
sessionID: args.path.id,
|
||||
input: {
|
||||
@@ -197,7 +198,8 @@ export async function promptSyncWithModelSuggestionRetry(
|
||||
|
||||
const timeoutContext = createPromptTimeoutContext(retryArgs, timeoutMs)
|
||||
try {
|
||||
const promptResult = await promptAfterSessionIdle({
|
||||
const promptResult = await dispatchInternalPrompt({
|
||||
mode: "sync",
|
||||
client,
|
||||
sessionID: retryArgs.path.id,
|
||||
input: {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
promptSyncWithModelSuggestionRetry,
|
||||
promptWithModelSuggestionRetry,
|
||||
} from "./model-suggestion-retry"
|
||||
import { promptAsyncAfterSessionIdle } from "./prompt-async-gate"
|
||||
import { dispatchInternalPrompt } from "./prompt-async-gate"
|
||||
|
||||
type OpencodeClient = PluginInput["client"]
|
||||
|
||||
@@ -59,7 +59,8 @@ export function promptAsyncInDirectory(
|
||||
return Promise.reject(new Error("session id is required for routed promptAsync"))
|
||||
}
|
||||
|
||||
return promptAsyncAfterSessionIdle({
|
||||
return dispatchInternalPrompt({
|
||||
mode: "async",
|
||||
client,
|
||||
sessionID,
|
||||
input: routedArgs,
|
||||
|
||||
Reference in New Issue
Block a user