opencode/types.rs
1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4/// Input for creating a new session.
5#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct SessionCreateInput {
8 /// Optional parent session id when creating a child session.
9 pub parent_id: Option<String>,
10 /// Optional human-readable session title.
11 pub title: Option<String>,
12 /// Optional permission configuration payload.
13 pub permission: Option<Value>,
14}
15
16/// A prompt part payload for session message input.
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum PartInput {
20 /// Free-form part object for forward compatibility with official schema.
21 Raw(Value),
22}
23
24/// Input payload for session prompt/prompt_async endpoints.
25#[derive(Debug, Clone, Default, Serialize, Deserialize)]
26#[serde(rename_all = "camelCase")]
27pub struct PromptInput {
28 /// Optional message id for follow-up operations.
29 pub message_id: Option<String>,
30 /// Optional model selection payload.
31 pub model: Option<Value>,
32 /// Optional agent selector.
33 pub agent: Option<String>,
34 /// Whether to suppress immediate reply behavior.
35 pub no_reply: Option<bool>,
36 /// Optional tools configuration.
37 pub tools: Option<Value>,
38 /// Optional output format configuration.
39 pub format: Option<Value>,
40 /// Optional system instruction text.
41 pub system: Option<String>,
42 /// Optional prompt variant key.
43 pub variant: Option<String>,
44 /// Prompt parts in official schema-compatible shape.
45 pub parts: Vec<PartInput>,
46}