[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
73
electron/bridges/aiBridge/sdk/emit.cjs
Normal file
73
electron/bridges/aiBridge/sdk/emit.cjs
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Stream emitter: forwards translated SDK events to the renderer over the
|
||||
* SDK agent IPC channels consumed by sdkAgentAdapter.ts.
|
||||
*
|
||||
* Canonical event shapes consumed by sdkAgentAdapter.handleStreamEvent:
|
||||
* { type: 'text-delta', textDelta }
|
||||
* { type: 'reasoning-delta', delta }
|
||||
* { type: 'reasoning-end' }
|
||||
* { type: 'tool-call', toolName, args, toolCallId }
|
||||
* { type: 'tool-result', toolCallId, output, toolName }
|
||||
* { type: 'file-change', itemId, changes, status }
|
||||
* { type: 'web-search', itemId, query, status }
|
||||
* { type: 'plan-update', itemId, items, status }
|
||||
* { type: 'warning', itemId, message }
|
||||
* { type: 'usage', inputTokens, cachedInputTokens, outputTokens, reasoningTokens, totalTokens }
|
||||
* { type: 'status', message }
|
||||
* { type: 'session-id', sessionId }
|
||||
* { type: 'error', error }
|
||||
*/
|
||||
function createStreamEmitter({ safeSend, sender, requestId }) {
|
||||
const emitEvent = (event) => {
|
||||
safeSend(sender, "netcatty:ai:sdk-agent:event", { requestId, event });
|
||||
};
|
||||
return {
|
||||
emitEvent,
|
||||
emitDone() {
|
||||
safeSend(sender, "netcatty:ai:sdk-agent:done", { requestId });
|
||||
},
|
||||
emitError(error) {
|
||||
safeSend(sender, "netcatty:ai:sdk-agent:error", { requestId, error });
|
||||
},
|
||||
text(textDelta) {
|
||||
if (textDelta) emitEvent({ type: "text-delta", textDelta });
|
||||
},
|
||||
reasoning(delta) {
|
||||
if (delta) emitEvent({ type: "reasoning-delta", delta });
|
||||
},
|
||||
reasoningEnd() {
|
||||
emitEvent({ type: "reasoning-end" });
|
||||
},
|
||||
toolCall(toolName, args, toolCallId) {
|
||||
emitEvent({ type: "tool-call", toolName: toolName || "unknown", args: args || {}, toolCallId });
|
||||
},
|
||||
toolResult(toolCallId, output, toolName) {
|
||||
emitEvent({ type: "tool-result", toolCallId: toolCallId || "", output, toolName });
|
||||
},
|
||||
fileChange(itemId, changes, status) {
|
||||
emitEvent({ type: "file-change", itemId: itemId || "", changes: changes || [], status });
|
||||
},
|
||||
webSearch(itemId, query, status) {
|
||||
emitEvent({ type: "web-search", itemId: itemId || "", query: query || "", status });
|
||||
},
|
||||
planUpdate(itemId, items, status) {
|
||||
emitEvent({ type: "plan-update", itemId: itemId || "", items: items || [], status });
|
||||
},
|
||||
warning(itemId, message) {
|
||||
if (message) emitEvent({ type: "warning", itemId: itemId || "", message });
|
||||
},
|
||||
usage(usage) {
|
||||
if (usage) emitEvent({ type: "usage", ...usage });
|
||||
},
|
||||
status(message) {
|
||||
if (message) emitEvent({ type: "status", message });
|
||||
},
|
||||
sessionId(sessionId) {
|
||||
if (sessionId) emitEvent({ type: "session-id", sessionId });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { createStreamEmitter };
|
||||
Reference in New Issue
Block a user