Files
clawhub/convex/lib/artifactText.ts
T
Patrick Erichsen 3097319ef6 fix: publish complete skill artifacts (#3196)
* fix: preserve complete skill artifacts

* test: align artifact metadata expectations

* fix: harden complete skill artifact handling

* fix: close complete artifact review gaps

* fix: preserve legacy skill file metadata hints

* fix: close artifact presentation review gaps

* fix(cli): preserve legacy skill file collector export

* refactor: centralize artifact upload helpers

* fix: preserve artifact scan and publish bounds

* fix: scan complete published text artifacts

* fix: harden artifact download presentation

* test: avoid secret-like fixture text

* refactor: preview artifacts by content

* chore(deps): patch transitive audit advisories
2026-07-20 15:54:47 -07:00

14 lines
356 B
TypeScript

import { decodeUtf8Text } from "clawhub-schema";
export function decodeBoundedUtf8Text(bytes: Uint8Array, maxBytes: number) {
if (bytes.byteLength <= maxBytes) return decodeUtf8Text(bytes);
try {
return new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(0, maxBytes), {
stream: true,
});
} catch {
return null;
}
}