Remove Ask/Execute modes and general product tool approvals so requests use the selected runtime, enabled capabilities, and execution account permissions. Migrate retired application metadata while preserving user content. Retire the Results page while retaining conversation images and stored artifacts. Add local and remote workspace file imports, timestamps and sorting, improve image discovery and saving, and refine workspace navigation and supervision responsiveness. Include the accompanying web-search changes, tests, probes, and product documentation. Remote imports require an updated Agent. Existing artifacts are not automatically copied into project directories. Validation evidence and outstanding failures remain documented in feature progress files; no full test suite or real-model calls were rerun for this commit. Release note: Run requests without switching work modes, import files into a selected local or remote workspace folder, sort workspace files by date, and keep using conversation images after removal of the Results page.
171 lines
5.4 KiB
TypeScript
171 lines
5.4 KiB
TypeScript
import type {
|
|
ApprovalDecision,
|
|
AgentEvent,
|
|
AgentQuestionAnswer,
|
|
AgentRequest,
|
|
AgentRuntimeStatus,
|
|
BrowserTabId,
|
|
RuntimeConversationCompactInput,
|
|
RuntimeConversationCompactResult,
|
|
RuntimeNativeSnapshot
|
|
} from '../../shared/contracts'
|
|
import type {
|
|
ConversationSubagentActivity,
|
|
ConversationMessage,
|
|
ConversationToolActivity
|
|
} from '../../shared/assistant-contracts'
|
|
|
|
export type RuntimeApprovalRequest = {
|
|
scopeKey: string
|
|
title: string
|
|
description: string
|
|
toolName?: string
|
|
argumentSummary?: string
|
|
allowPermanent?: boolean
|
|
}
|
|
|
|
export type RuntimeAuthorizer = (
|
|
request: RuntimeApprovalRequest,
|
|
signal?: AbortSignal
|
|
) => Promise<ApprovalDecision>
|
|
|
|
export type RuntimeGeneratedImageEvent = {
|
|
requestId: string
|
|
type: 'generated-image'
|
|
mimeType: 'image/png' | 'image/jpeg' | 'image/webp'
|
|
data: string
|
|
title: string
|
|
imageContextNotice?: ConversationMessage['imageContextNotice']
|
|
}
|
|
|
|
export type RuntimeModelUsageEvent = {
|
|
requestId: string
|
|
type: 'model-usage'
|
|
callId: string
|
|
runtime: 'model' | 'continue' | 'opencode' | 'deepseek-harness'
|
|
provider: string
|
|
model: string
|
|
inputTokens: number
|
|
outputTokens: number
|
|
cacheReadTokens: number
|
|
cacheWriteTokens: number
|
|
reportedTotalTokens?: number
|
|
}
|
|
|
|
export type RuntimePublicEvent =
|
|
| AgentEvent
|
|
| RuntimeGeneratedImageEvent
|
|
| RuntimeModelUsageEvent
|
|
|
|
export type RemoteSemanticEventProvenance = {
|
|
source: 'remote-semantic-transcript'
|
|
bindingId: string
|
|
operationId: string
|
|
semanticSequence: string
|
|
eventIndex: number
|
|
}
|
|
|
|
export type RemoteSemanticRuntimeEvent = RuntimePublicEvent & {
|
|
remoteProvenance: RemoteSemanticEventProvenance
|
|
}
|
|
|
|
export type RemoteSemanticCheckpointEvent = {
|
|
requestId: string
|
|
type: 'remote-semantic-checkpoint'
|
|
remoteProvenance: RemoteSemanticEventProvenance
|
|
}
|
|
|
|
export type RuntimeEvent =
|
|
| RuntimePublicEvent
|
|
| RemoteSemanticCheckpointEvent
|
|
|
|
export type RuntimeConversationCompactOutcome = {
|
|
result: RuntimeConversationCompactResult
|
|
usageEvents?: RuntimeModelUsageEvent[]
|
|
}
|
|
|
|
export interface AgentRuntime {
|
|
/** A workspace facade whose sessions are owned by a shared local Runtime. */
|
|
readonly sharedProcess?: boolean
|
|
readonly hasRetainedSessions?: boolean
|
|
readonly runtimeId?: AgentRuntimeStatus['id']
|
|
readonly requiresToolApproval: boolean
|
|
readonly supportsToolExecution: boolean
|
|
/** Whether request-scoped GoodBuddy data tools can reach this runtime. */
|
|
readonly supportsScopedDataTools?: boolean
|
|
/**
|
|
* Whether `trustedInstructions` reach the model's system layer for every
|
|
* turn. Runtimes without this guarantee receive them inside the prompt.
|
|
*/
|
|
readonly consumesTrustedInstructions?: boolean
|
|
readonly capability?: 'chat' | 'image-generation'
|
|
getStatus(): Promise<AgentRuntimeStatus>
|
|
testConnection?(): Promise<AgentRuntimeStatus>
|
|
getNativeSnapshot?(workspace?: string): Promise<RuntimeNativeSnapshot>
|
|
compactConversation?(
|
|
request: RuntimeConversationCompactInput,
|
|
signal: AbortSignal
|
|
): Promise<RuntimeConversationCompactOutcome>
|
|
run(
|
|
request: AgentExecutionRequest,
|
|
signal: AbortSignal,
|
|
authorize?: RuntimeAuthorizer
|
|
): AsyncGenerator<RuntimeEvent, void, void>
|
|
respondToQuestion?(
|
|
questionId: string,
|
|
answers?: AgentQuestionAnswer[]
|
|
): Promise<void>
|
|
releaseConversation?(conversationId: string): Promise<void>
|
|
/**
|
|
* Stop Main-process admission during a normal application exit. Runtimes
|
|
* that implement this hook may intentionally leave remote work owned by
|
|
* another process running after Desktop disconnects.
|
|
*/
|
|
detachForApplicationExit?(): void | Promise<void>
|
|
dispose(): Promise<void>
|
|
}
|
|
|
|
export type AgentImage = {
|
|
name: string
|
|
mediaType: 'image/png' | 'image/jpeg'
|
|
data: string
|
|
}
|
|
|
|
export type RemoteRecoveredTool = ConversationToolActivity & {
|
|
callId: string
|
|
}
|
|
|
|
export type RemoteRecoveredSubagent =
|
|
ConversationSubagentActivity
|
|
|
|
export type AgentExecutionRequest = AgentRequest & {
|
|
/** Resolved Main-side workspace, never taken from the current UI selection. */
|
|
executionWorkspace?: string
|
|
images?: AgentImage[]
|
|
imageContextNotice?: ConversationMessage['imageContextNotice']
|
|
/** Main-process-only recursion guard for direct-model programming delegation. */
|
|
directModelDelegationDepth?: 0 | 1
|
|
/** Main-process-only instructions placed in the model system layer. */
|
|
trustedInstructions?: string
|
|
/** Main-process-only request-scoped authorization for built-in data tools. */
|
|
knowledgeCapabilityToken?: string
|
|
storyGraphBinding?: import('./knowledge-mcp-gateway').StoryGraphRemoteBinding
|
|
imageToolBinding?: ImageToolBinding
|
|
/** Main-process-only browser tab fixed for this request. */
|
|
browserTabId?: BrowserTabId
|
|
/**
|
|
* Main-process recovery cursor for an Agent-owned semantic prompt.
|
|
* It is never sent as prompt content and is ignored by local runtimes.
|
|
*/
|
|
remoteSemanticAfterSequence?: string
|
|
/** Recovery may attach an accepted Agent prompt but must never replay it. */
|
|
remoteRecoveryOnly?: boolean
|
|
/** Main-only durable tool state used to merge partial recovery updates. */
|
|
remoteRecoveredTools?: readonly RemoteRecoveredTool[]
|
|
/** Derived from committed task events, including text before disconnect. */
|
|
remoteHasResponseTextAfterToolFailure?: boolean
|
|
/** Main-only durable native subagent state for partial recovery updates. */
|
|
remoteRecoveredSubagents?: readonly RemoteRecoveredSubagent[]
|
|
}
|
|
import type { ImageToolBinding } from './image-tool-binding'
|