UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

40 lines • 1.73 kB
import { parseStreamingJson } from "@earendil-works/pi-ai"; import { CompactValues } from "./compact-values.js"; export async function readSeededFields(store, fields, valid) { const values = new CompactValues(store); const result = {}; for (const [key, ref] of Object.entries(fields)) { const value = await values.read(ref, valid); valid(); Object.defineProperty(result, key, { value, enumerable: true, configurable: true, writable: true }); } return result; } /** Compatibility observation only: acceptance neither parses raw spelling nor assembles public values. */ export async function readSeededBlock(store, block, context) { const fields = await readSeededFields(store, block.fields, context.valid); let signature = ""; for (const root of [block.signature.root, block.signature.tailRoot]) for await (const part of store.text.chunks(root, context.valid)) signature += part; switch (block.type) { case "text": return { ...fields, text: context.text, ...("textSignature" in fields ? { textSignature: signature } : {}) }; case "thinking": return { ...fields, thinking: context.text, ...("thinkingSignature" in fields ? { thinkingSignature: signature } : {}), }; case "toolCall": return { ...fields, ...(block.phase === "open" && block.parsedThrough > 0 ? { arguments: parseStreamingJson(context.text.slice(0, block.parsedThrough)) } : {}), }; default: return fields; } } //# sourceMappingURL=compact-seeded-block-view.js.map