mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-07 14:21:16 -10:00
chore(skills): follow repository comment policy
This commit is contained in:
1 parent
c9d04cba60
commit
33fa3d3d4c
3 files changed
-6
No files matched your search
@@ -13,7 +13,6 @@ import { settleRunnerBridgeRead } from "./runner-bridge-tools.js";
|
||||
|
||||
const MAX_TEXT_FILE_BYTES = 16 * 1024 * 1024;
|
||||
type SkillText = { text: string; sha256: string; byteSize: number };
|
||||
/** Owned by one run authority. Retain at most 64 MiB of text and 64 entries. */
|
||||
export class SkillLibraryReadCache {
|
||||
#entries = new Map<string, SkillText>();
|
||||
#bytes = 0;
|
||||
|
||||
@@ -38,8 +38,6 @@ function originalFiles(version: StoredSkillVersion, manifest: SkillPackageManife
|
||||
export function skillPackageRuntime(db: Db) {
|
||||
const store = skillPackageStore(db);
|
||||
function readOriginalFile(version: StoredSkillVersion, sourcePath: string, maxBytes?: number, projected?: ProjectedFile) {
|
||||
// Use verified warm reads and isolated recovery, without the company-wide
|
||||
// preparation lock. The projection has already resolved the source path.
|
||||
return store.readVersionFile({ ...version, packageSnapshotId: version.repositorySnapshotId ?? version.packageSnapshotId,
|
||||
packageFileMap: projected ? [{ path: sourcePath, sourcePath, kind: projected.kind, encoding: projected.encoding }] : null }, sourcePath, true, maxBytes);
|
||||
}
|
||||
@@ -119,7 +117,6 @@ export function skillPackageRuntime(db: Db) {
|
||||
async function readFile(version: StoredSkillVersion, relative: string, maxBytes?: number) {
|
||||
const id = (version.repositorySnapshotId ?? version.packageSnapshotId)!;
|
||||
const manifest = await store.manifest(version.companyId, id);
|
||||
// Original references need no wrapper generation or entrypoint-body read.
|
||||
const file = originalFiles(version, manifest).find(file => file.path === relative)
|
||||
?? (await projection(version, maxBytes)).find(file => file.path === relative);
|
||||
if (!file) return null;
|
||||
|
||||
@@ -645,8 +645,6 @@ export function skillPackageStore(db: Db, suppliedStorage?: StorageService, cach
|
||||
async function readVersionFile(version: StoredSkillVersion, relativePath: string, allowRecovery = true, maxBytes = Number.MAX_SAFE_INTEGER) {
|
||||
assertSkillSnapshotPath(relativePath);
|
||||
if (!version.packageSnapshotId) {
|
||||
// Select only the requested legacy file. Apply the bound in PostgreSQL so
|
||||
// an oversized inline body never crosses into the server process.
|
||||
const [row] = await db.select({ ...skillVersionMetadataColumns,
|
||||
file: sql<(CompanySkillVersionFileInventoryEntry & { tooLarge?: boolean }) | null>`(
|
||||
select case when octet_length(f->>'content')::bigint > ${maxBytes}::bigint
|
||||
|
||||
Reference in new issue
Block a user