mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* refactor(shared): organize session contracts and projections * chore: tighten dropped-path flaky pattern allowance * docs: preserve current agent instructions with valid formatting
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { pendingStructuredSessionPrompts } from '../../../src/shared/agent-session/view/structured-agent-session-message-projection'
|
|
import type { StructuredAgentSessionState } from '../../../src/shared/agent-session/structured-agent-session-reducer'
|
|
import type {
|
|
StructuredApprovalItem,
|
|
StructuredQuestionItem
|
|
} from './mobile-structured-agent-prompts'
|
|
|
|
type PromptState = Pick<
|
|
StructuredAgentSessionState,
|
|
'items' | 'currentRequests' | 'actionablePromptIds'
|
|
>
|
|
|
|
export function actionableStructuredPrompts(state: PromptState) {
|
|
return pendingStructuredSessionPrompts({
|
|
journalItems: state.items,
|
|
currentRequests: state.currentRequests,
|
|
actionablePromptIds: state.actionablePromptIds
|
|
})
|
|
}
|
|
|
|
export function actionableStructuredApproval(state: PromptState): StructuredApprovalItem | null {
|
|
return (
|
|
actionableStructuredPrompts(state).find(
|
|
(item): item is StructuredApprovalItem => item.body.kind === 'approval'
|
|
) ?? null
|
|
)
|
|
}
|
|
|
|
export function actionableStructuredQuestion(state: PromptState): StructuredQuestionItem | null {
|
|
return (
|
|
actionableStructuredPrompts(state).find(
|
|
(item): item is StructuredQuestionItem => item.body.kind === 'question'
|
|
) ?? null
|
|
)
|
|
}
|