MCPcopy
hub / github.com/wavetermdev/waveterm / ResolveBlockIdFromPrefix

Function ResolveBlockIdFromPrefix

pkg/wcore/wcore.go:129–146  ·  view source on GitHub ↗
(ctx context.Context, tabId string, blockIdPrefix string)

Source from the content-addressed store, hash-verified

127}
128
129func ResolveBlockIdFromPrefix(ctx context.Context, tabId string, blockIdPrefix string) (string, error) {
130 if len(blockIdPrefix) != 8 {
131 return "", fmt.Errorf("widget_id must be 8 characters")
132 }
133
134 tab, err := wstore.DBMustGet[*waveobj.Tab](ctx, tabId)
135 if err != nil {
136 return "", fmt.Errorf("error getting tab: %w", err)
137 }
138
139 for _, blockId := range tab.BlockIds {
140 if strings.HasPrefix(blockId, blockIdPrefix) {
141 return blockId, nil
142 }
143 }
144
145 return "", fmt.Errorf("widget_id not found: %q", blockIdPrefix)
146}
147
148func GoSendNoTelemetryUpdate(telemetryEnabled bool) {
149 go func() {

Callers 5

getTermScrollbackOutputFunction · 0.92
CreateToolUseDataFunction · 0.92

Calls 1

DBMustGetFunction · 0.92

Tested by

no test coverage detected