The agent got stuck where the editor has it easy: it could not make a
Sample play without a sound asset, it built instruments node by node
although the Preset menu has them ready, and it could not tell what
names an asset before reworking or deleting it.
- list_files is a new tool. It lists the pictures, fonts, sounds or
videos the server holds, with size, video state and the asset that
already wears a file. Bakes and stream copies of songs are left out.
- add_file_asset makes an asset of such a file, as the picker does.
It reuses the create rules of the import pipeline, so the four
import kinds are exported now. It refuses a file already in the
project (naming that asset), a picture without a size, a video not
yet converted and a file the server does not hold.
- run_commands fetches the file lists its steps need before it runs,
so the commands themselves stay synchronous.
- apply_preset sets one of the 16 instrument presets or 7 sfxr
presets, like the Preset menu. Presets take every note, so the
C4 to B4 range of a new Notes node is no trap there.
- get_asset gains usedBy: every asset naming the asset or one of its
frames or clips, with the object, node, item or key that does, plus
start scene, master FX and master routing of the project.
- usesOf in src/core/model/usages.ts walks the project data instead of
a list of fields, so no new field can be missed. The node every
asset has in the master routing does not count as a use.
- The relay tells the agent about all three ways.
Found on the way: suite 740 for 2e4c0a0 (#430) was red in e2e 68h
only, a sound clip 61 ms early against 50 allowed. #430 did not touch
sound timing, and e2e 68 on the same tree was green on atx (-4 ms).
Taken as a timing wobble under load until the next suite says more.
Tests:
- agent-files (new, 4 tests) with the other agent and relay tests:
130/130.
- 8 counter checks, all compiling, all red.
- e2e 71 on atx: 26/26, new 71g9 lists an uploaded sound, makes an
asset of it and fills an instrument from a preset.
- Gate on atx: CHECK EXIT 0, 326 files, 5021 tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e4c0a09ea
commit
24cd9fdeaa
20 files changed
+644
-17
No files matched your search
@@ -7,7 +7,9 @@ import { isKindWith } from '../properties/kinds';
|
||||
import { schemaForAsset } from '../properties/PropertySchema';
|
||||
import { referencesAny, trackDef } from './animation';
|
||||
import type { AnimationAsset, Asset, TileAsset } from './Asset';
|
||||
import { partsOf } from './assetParts';
|
||||
import { overrideSites } from './instance';
|
||||
import { pixelArtRefIds } from './pixelart';
|
||||
import { type ObjectHolder, objectHolders, type Project } from './Project';
|
||||
import type { SceneObject } from './SceneObject';
|
||||
|
||||
@@ -84,6 +86,79 @@ export function cellsPainted(project: Project, tileId: string): { tilemaps: numb
|
||||
return { tilemaps, cells };
|
||||
}
|
||||
|
||||
/** The nearest thing with an id of its own a use sits in: an object, a node, an item, a key. */
|
||||
export interface UsePlace {
|
||||
id: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
kind?: string;
|
||||
}
|
||||
|
||||
/** An asset naming another, and where in it; no places for a use on the asset itself, like a property. */
|
||||
export interface AssetUse {
|
||||
asset: Asset;
|
||||
at: UsePlace[];
|
||||
}
|
||||
|
||||
export interface Uses {
|
||||
assets: AssetUse[];
|
||||
/** The project's own settings naming it: its start scene, the master's FX, the Master routing. */
|
||||
project: ('startScene' | 'masterFx' | 'routing')[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Everything naming an asset or one of its parts – a frame, a clip (#433). Read as data, not field
|
||||
* by field, as `namedStrings` reads it for sounds, so no place is missed: a song item, a Sample, a
|
||||
* key, a cell of a tilemap and kinds of asset still to come alike. Ids, the owner a song keeps an
|
||||
* asset for and the nodes an edge joins are no uses: the Master routing has a node per asset.
|
||||
*/
|
||||
export function usesOf(project: Project, assetId: string): Uses {
|
||||
const target = project.assets.find((asset) => asset.id === assetId);
|
||||
if (!target) return { assets: [], project: [] };
|
||||
const wanted = new Set(
|
||||
target.type === 'pixelart' ? pixelArtRefIds(target) : [target.id, ...partsOf(target).map((p) => p.id)],
|
||||
);
|
||||
const assets: AssetUse[] = [];
|
||||
for (const asset of project.assets) {
|
||||
if (asset.id === target.id) continue;
|
||||
const found = placesNaming(asset, wanted);
|
||||
if (found) assets.push({ asset, at: found });
|
||||
}
|
||||
const settings: Uses['project'] = [];
|
||||
if (wanted.has(project.startSceneId)) settings.push('startScene');
|
||||
if (wanted.has(project.masterFx)) settings.push('masterFx');
|
||||
if (placesNaming(project.routing, wanted)) settings.push('routing');
|
||||
return { assets, project: settings };
|
||||
}
|
||||
|
||||
const NO_USE: ReadonlySet<string> = new Set(['id', 'owner', 'node']);
|
||||
|
||||
/** Where in `value` one of the ids is named; null for nowhere, no places for only outside anything with an id. */
|
||||
function placesNaming(value: unknown, wanted: ReadonlySet<string>): UsePlace[] | null {
|
||||
const places = new Map<string, UsePlace | null>();
|
||||
const walk = (inner: unknown, place: UsePlace | null): void => {
|
||||
if (typeof inner === 'string') {
|
||||
if (wanted.has(inner)) places.set(place?.id ?? '', place);
|
||||
} else if (Array.isArray(inner)) {
|
||||
for (const item of inner) walk(item, place);
|
||||
} else if (typeof inner === 'object' && inner !== null && !ArrayBuffer.isView(inner)) {
|
||||
const record = inner as Record<string, unknown>;
|
||||
const here = typeof record.id === 'string' && inner !== value ? placeOf(record) : place;
|
||||
for (const [key, field] of Object.entries(record)) if (!NO_USE.has(key)) walk(field, here);
|
||||
}
|
||||
};
|
||||
walk(value, null);
|
||||
if (places.size === 0) return null;
|
||||
return [...places.values()].filter((place): place is UsePlace => place !== null);
|
||||
}
|
||||
|
||||
function placeOf(record: Record<string, unknown>): UsePlace {
|
||||
const place: UsePlace = { id: record.id as string };
|
||||
for (const key of ['name', 'type', 'kind'] as const)
|
||||
if (typeof record[key] === 'string' && record[key] !== '') place[key] = record[key];
|
||||
return place;
|
||||
}
|
||||
|
||||
/** The animations keying any of these ids – intrinsic data, which `findPropertyUsages` does not see. */
|
||||
export function animationsUsing(project: Project, ids: readonly string[]): AnimationAsset[] {
|
||||
const wanted = new Set(ids);
|
||||
|
||||
Reference in new issue
Block a user