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
17	let Text = Parameter.get("text").and_then(Value::as_str).unwrap_or("");
18
19	let _ = Service.ApplicationHandle().emit(
20		"sky://output/append",
21		json!({
22			"channel": Channel,
23			"text": format!("{}\n", Text),
24		}),
25	);
26
27	dev_log!("grpc", "[Output] appendLine channel={} bytes={}", Channel, Text.len());
28}