Skip to main content

Mountain/Vine/Server/Notification/
OutputAppendLine.rs

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