feat(sdk): add LLM round execution, script bindings, Lua runtime, and hybrid memory#10
Merged
Merged
Conversation
… hybrid memory Introduce several new SDK subsystems and harden existing ones: - sdk/llm: add RunRound / StreamRound / RoundStream for structured LLM round execution with streaming, tool calling, and span context propagation. RoundStream.Close() is idempotent. Temperature changed to *float64 to distinguish zero from unset. RoundConfigFromMap now returns error. - sdk/script/bindings: extract reusable bridge layer from scriptnode into a standalone package (board, expr, fs, llm, runtime, shell, stream). Shell bridge supports filepath.Base matching for allow-list. - sdk/script/luart: pure-Go Lua 5.1 runtime (gopher-lua) with VM pooling, idempotent Close via sync.Once + atomic.Bool, and automatic VM discard on script error to prevent global state leakage. pushGoValue supports integer map keys and warns on unsupported key types. - sdk/memory: add HybridStore combining BM25 and vector similarity search with graceful fallback on embed/vector errors. NewHybridStore panics on nil inner store. Assembler refactored for hybrid search integration. - sdk/speech: add semantic endpoint detection, fix framesToLimit ceiling division, refactor pipeline, remove dead Pipeline.Abort() calls in session loop. Comprehensive test coverage for pipeline and endpoint. - sdk/graph/node: LLM node Temperature → *float64, ConfigFromMap returns error, buildMessages shallow-copies board messages to prevent mutation. Made-with: Cursor
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RunRound/StreamRound/RoundStreamfor structured LLM round execution with streaming tokens, tool calling, and OpenTelemetry span propagation.RoundStream.Close()is idempotent.Temperaturechanged to*float64to distinguish zero from unset.RoundConfigFromMapnow returns an error.scriptnodeinto a standalone package (board / expr / fs / llm / runtime / shell / stream). Shell bridge supportsfilepath.Basematching for allow-listed commands.Close()is idempotent viasync.Once+atomic.Bool. Automatically discards tainted VMs after script errors to prevent global state leakage.pushGoValuesupports integer map keys and logs warnings for unsupported key types.HybridStorecombining BM25 and vector similarity search with graceful fallback to BM25 on embed/vector errors.NewHybridStore(nil)panics with a clear message. Assembler refactored for hybrid search integration.framesToLimitceiling division, refactor pipeline, remove deadPipeline.Abort()calls in session loop.Temperature→*float64,ConfigFromMapreturns error,buildMessagesshallow-copies board messages to prevent mutation.Review fixes included
Issues identified and fixed during code review:
RoundStream.Close()idempotent — nil-out inner after close to prevent double-closeRunRoundspan context correctly captured and propagatedluart.Runtime.Close()idempotent +acquire()closed guard returnsErrRuntimeClosedpushGoValuesupportsmap[int]T/map[uint]T; unsupported key types emit stderr warningframesToLimituses ceiling division to avoid premature silence threshold truncationfilepath.Basematching allows full-path commands (e.g./usr/bin/echomatchesecho)NewHybridStore(nil)panic guardHybridStore.Searchemits telemetry warnings on embed/vector failure before BM25 fallbackbuildMessagesshallow-copies messages from board to prevent in-place mutationTemperature→*float64to distinguish explicit zero from unsetConfigFromMap/RoundConfigFromMapreturn errors instead of silently ignoring bad inputPipeline.Abort()calls insession_loop.goTest plan
sdk/llm: RunRound normal/failure/callback/stream-error, StreamRound manual iteration, Close idempotency, RoundConfigFromMap valid/nil/zero (10 tests)sdk/script/luart: Close idempotent, Exec after close, VM discard no state leak, signal does not discard, int/uint key map (6 tests)sdk/speech/endpoint: ceiling division 150ms/100ms=2, single frame 50ms/100ms=1, zero-value fallback (4 tests)sdk/script/bindings: full-path command/usr/bin/echoallowed, full-path not in list blocked (2 tests)sdk/memory: NewHybridStore(nil) panics, embed error falls back to BM25, vector search error falls back to BM25 (3 tests)go build ./...+go test ./...+go vet ./...