Skip to main content

Mountain/Vine/Server/Notification/
OutputAppendLine.rs

1//! Cocoon → Mountain `output.appendLine` notification.
2//! Emitted by `Cocoon/.../Services/Window/OutputChannel.ts:56` whenever
3//! an extension calls `OutputChannel.appendLine(text)`. The stock
4//! semantic contract is "append + trailing \n"; we suffix the newline
5//! here so the downstream `sky://output/append` listener stays a single
6//! append code path (no `appendLine` listener in Sky).
7
8use serde_json::{Value, json};
9use tauri::Emitter;
10
11use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
12
13pub async fn OutputAppendLine(Service:&MountainVinegRPCService, Parameter:&Value) {
14	let Channel = Parameter.get("channel").and_then(Value::as_str).unwrap_or("");
15
16	let Text = Parameter.get("text").and_then(Value::as_str).unwrap_or("");
17
18	let _ = Service.ApplicationHandle().emit(
19		"sky://output/append",
20		json!({
21			"channel": Channel,
22			"text": format!("{}\n", Text),
23		}),
24	);
25
26	dev_log!("grpc", "[Output] appendLine channel={} bytes={}", Channel, Text.len());
27}