MCPcopy
hub / github.com/claude-code-best/claude-code / getWorkflowService

Function getWorkflowService

src/workflow/service.ts:98–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96
97/** Process singleton. Tool and panel share the same ports/registry/store. */
98export function getWorkflowService(): WorkflowService {
99 if (cached) return cached
100 const bus = createProgressBus()
101 const store = createProgressStoreFromBus(bus)
102 const ports = createWorkflowPorts({ bus, store })
103 const service = makeService(ports, store)
104 // Subscribe to run_done to write the terminal snapshot to disk (shared entry for completed/failed/killed; shutdown-kill also routes here).
105 // The store registers to the bus before this subscription, so when the listener runs store.get(runId) is already terminal.
106 attachRunStatePersistence(bus, store)
107 // Install the state-change notification bridge (commit 0768d4dc promised "auto-notify on completion" but the old implementation left it unfulfilled)
108 installWorkflowNotifications(service)
109 cached = service
110 return cached
111}
112
113/**
114 * Construct the service (inject ports + store).

Callers 3

descriptorFunction · 0.85
WorkflowsPanelFunction · 0.85

Calls 6

createProgressBusFunction · 0.85
createWorkflowPortsFunction · 0.85
makeServiceFunction · 0.85

Tested by

no test coverage detected