🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@drawcall/market

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@drawcall/market - npm Package Compare versions

Comparing version
0.1.49
to
0.1.50
+6
dist/commands/generate-install.d.ts
export interface GenerateInstallCommandOptions {
cwd?: string;
baseUrl?: string;
}
export declare function generateInstallCommand(jobId: string, opts: GenerateInstallCommandOptions): Promise<void>;
//# sourceMappingURL=generate-install.d.ts.map
{"version":3,"file":"generate-install.d.ts","sourceRoot":"","sources":["../../src/commands/generate-install.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,6BAA6B;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAKD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,IAAI,CAAC,CAmBf"}
import { getCliClient } from '../cli-client.js';
import { waitForGeneration } from '../generate.js';
import { generationRunningResult } from '../output.js';
import { finishGeneration, startSpinner } from './generate.js';
// Install the asset from a generation job. Block-and-polls for a bounded window (the command waits,
// not the agent): installs on completion, fails loudly on error, or prints a note so the caller runs
// it again to continue the same job.
export async function generateInstallCommand(jobId, opts) {
const { client, baseUrl } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true });
const spinner = startSpinner('Generating asset');
try {
const outcome = await waitForGeneration(client, jobId, {
onProgress: (message) => {
spinner.text = message;
},
});
await finishGeneration(client, outcome, {
cwd: opts.cwd,
baseUrl,
spinner,
stillRunning: generationRunningResult(jobId),
});
}
catch (err) {
spinner.stop();
throw err;
}
}
//# sourceMappingURL=generate-install.js.map
{"version":3,"file":"generate-install.js","sourceRoot":"","sources":["../../src/commands/generate-install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAO9D,oGAAoG;AACpG,qGAAqG;AACrG,qCAAqC;AACrC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAAa,EACb,IAAmC;IAEnC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5F,MAAM,OAAO,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAA;IAChD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE;YACrD,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE;gBACtB,OAAO,CAAC,IAAI,GAAG,OAAO,CAAA;YACxB,CAAC;SACF,CAAC,CAAA;QACF,MAAM,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE;YACtC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO;YACP,OAAO;YACP,YAAY,EAAE,uBAAuB,CAAC,KAAK,CAAC;SAC7C,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,EAAE,CAAA;QACd,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC"}
import type { AssetType } from '../schemas.js';
export interface PackCommandOptions {
type?: AssetType;
cwd?: string;
out?: string;
/** npm dependencies, each `name@range` (range defaults to `*`). */
npm?: string[];
/** asset dependencies, each `name@range` (range defaults to `*`). */
asset?: string[];
/** skill dependencies, each `label=source` passed to `skills add`. */
skill?: string[];
}
export declare function packCommand(zipFilter: string, opts: PackCommandOptions): Promise<void>;
//# sourceMappingURL=pack.d.ts.map
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/commands/pack.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B5F"}
import * as fs from 'fs/promises';
import * as path from 'path';
import ora from 'ora';
import { packAsset, packPolicyForType, parsePackDependencies } from '../pack.js';
import { packResult } from '../output.js';
export async function packCommand(zipFilter, opts) {
const spinner = ora({
text: 'Preparing pack',
isEnabled: Boolean(process.stderr.isTTY),
isSilent: !process.stderr.isTTY,
}).start();
try {
const cwd = opts.cwd ?? process.cwd();
const packed = await packAsset(zipFilter, {
cwd,
dependencies: parsePackDependencies({
npm: opts.npm,
asset: opts.asset,
skill: opts.skill,
}),
policy: packPolicyForType(opts.type),
});
const out = opts.out ? path.resolve(cwd, opts.out) : defaultPackPath(packed.sourcePath);
spinner.text = `Writing ${path.relative(cwd, out) || out}`;
await fs.mkdir(path.dirname(out), { recursive: true });
await fs.writeFile(out, packed.zip);
spinner.stop();
console.log(packResult(out, packed));
}
catch (err) {
spinner.stop();
throw err;
}
}
function defaultPackPath(sourcePath) {
const ext = path.extname(sourcePath);
return path.join(path.dirname(sourcePath), `${path.basename(sourcePath, ext)}.packed${ext}`);
}
//# sourceMappingURL=pack.js.map
{"version":3,"file":"pack.js","sourceRoot":"","s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AAE,CAAA;QAC1D,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACtD,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;QAEnC,OAAO,CAAC,IAAI,EAAE,CAAA;QACd,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;IACtC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,EAAE,CAAA;QACd,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,UAAkB;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;AAC9F,CAAC"}
import type { AssetInstallMetadata } from './contract.js';
import { type AssetType } from './schemas.js';
export interface PackDependencySpecs {
npm?: string[];
asset?: string[];
skill?: string[];
}
export interface ParsedPackDependencies {
npmDependencies: Record<string, string>;
assetDependencies: Record<string, string>;
skillDependencies: Record<string, string>;
}
export interface PackPolicy {
readPackageJsonDependencies: boolean;
omitUnchangedInstalledFiles: boolean;
}
export interface PackAssetOptions {
cwd?: string;
dependencies: ParsedPackDependencies;
policy?: PackPolicy;
}
export interface PackedAsset {
sourcePath: string;
zip: Uint8Array;
npmDependencies: Record<string, string>;
assetDependencies: Record<string, string>;
skillDependencies: Record<string, string>;
omittedUnchangedInstalledFiles: boolean;
}
export declare function packAsset(zipFilter: string, opts: PackAssetOptions): Promise<PackedAsset>;
export declare function parsePackDependencies(specs: PackDependencySpecs): ParsedPackDependencies;
export declare function packPolicyForType(type: AssetType | undefined): PackPolicy | undefined;
export declare function packPolicyFromInstallMetadata(metadata: AssetInstallMetadata | undefined): PackPolicy;
/**
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
* range is optional and defaults to `*`. A leading `@` is treated as a scope
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
*/
export declare function parseVersionedDeps(specs: string[], kind: 'npm' | 'asset'): Record<string, string>;
/**
* Parse `label=source` specs into a label→source record. The source is passed
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
* first `=` is treated as the separator.
*/
export declare function parseSkillDeps(specs: string[]): Record<string, string>;
//# sourceMappingURL=pack.d.ts.map
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../src/pack.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAOzD,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAExE,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,UAAU;IACzB,2BAA2B,EAAE,OAAO,CAAA;IACpC,2BAA2B,EAAE,OAAO,CAAA;CACrC;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,sBAAsB,CAAA;IACpC,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,UAAU,CAAA;IACf,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,8BAA8B,EAAE,OAAO,CAAA;CACxC;AAED,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAmC/F;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,GAAG,sBAAsB,CAMxF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAMrF;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,oBAAoB,GAAG,SAAS,GACzC,UAAU,CAKZ;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBjG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBtE"}
import * as fs from 'fs/promises';
import * as path from 'path';
import { unzipSync, zipSync } from 'fflate';
import { findInstallRoot } from './install.js';
import { readMarketLock, sha256 } from './market-lock.js';
import { packageJsonAssetDependenciesFromFiles, packageJsonNpmDependenciesFromFiles, } from './package-json.js';
import { MAX_UPLOAD_ZIP_SIZE_BYTES } from './schemas.js';
export async function packAsset(zipFilter, opts) {
const cwd = opts.cwd ?? process.cwd();
const zipFile = await resolveOneZipFile(cwd, zipFilter);
const zipStat = await fs.stat(zipFile);
if (zipStat.size >= MAX_UPLOAD_ZIP_SIZE_BYTES) {
throw new Error('Packed zip must be smaller than 1 GB');
}
const sourceZip = new Uint8Array(await fs.readFile(zipFile));
const sourceFiles = unzipSync(sourceZip);
const policy = opts.policy ?? inferPackPolicy(sourceFiles);
const packageJsonAssetDependencies = policy.readPackageJsonDependencies
? packageJsonAssetDependenciesFromFiles(sourceFiles)
: {};
const assetDependencies = mergeAssetDependencies(packageJsonAssetDependencies, opts.dependencies.assetDependencies);
const packageJsonNpmDependencies = policy.readPackageJsonDependencies
? packageJsonNpmDependenciesFromFiles(sourceFiles)
: {};
const npmDependencies = { ...packageJsonNpmDependencies, ...opts.dependencies.npmDependencies };
const packed = policy.omitUnchangedInstalledFiles
? await omitUnchangedInstalledFiles(sourceZip, sourceFiles, assetDependencies, cwd)
: { zip: sourceZip, omitted: false };
return {
sourcePath: zipFile,
zip: packed.zip,
npmDependencies,
assetDependencies,
skillDependencies: opts.dependencies.skillDependencies,
omittedUnchangedInstalledFiles: packed.omitted,
};
}
export function parsePackDependencies(specs) {
return {
npmDependencies: parseVersionedDeps(specs.npm ?? [], 'npm'),
assetDependencies: parseVersionedDeps(specs.asset ?? [], 'asset'),
skillDependencies: parseSkillDeps(specs.skill ?? []),
};
}
export function packPolicyForType(type) {
if (!type)
return undefined;
return {
readPackageJsonDependencies: type === 'template',
omitUnchangedInstalledFiles: type === 'template',
};
}
export function packPolicyFromInstallMetadata(metadata) {
return {
readPackageJsonDependencies: metadata?.readAssetDependenciesFromPackageJson ?? false,
omitUnchangedInstalledFiles: metadata?.omitUnchangedInstalledFilesOnUpload ?? false,
};
}
/**
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
* range is optional and defaults to `*`. A leading `@` is treated as a scope
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
*/
export function parseVersionedDeps(specs, kind) {
const out = {};
for (const spec of specs) {
const at = spec.lastIndexOf('@');
const hasRange = at > 0;
const name = hasRange ? spec.slice(0, at) : spec;
const range = hasRange ? spec.slice(at + 1) : '*';
if (!name || !range) {
throw new Error(`Invalid ${kind} dependency "${spec}". Use name@range (e.g. three@^0.178.0).`);
}
if (name in out) {
throw new Error(`Duplicate ${kind} dependency "${name}".`);
}
out[name] = range;
}
return out;
}
/**
* Parse `label=source` specs into a label→source record. The source is passed
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
* first `=` is treated as the separator.
*/
export function parseSkillDeps(specs) {
const out = {};
for (const spec of specs) {
const eq = spec.indexOf('=');
if (eq <= 0 || eq === spec.length - 1) {
throw new Error(`Invalid skill dependency "${spec}". Use label=source ` +
`(e.g. web-design=vercel-labs/agent-skills).`);
}
const label = spec.slice(0, eq);
if (label in out) {
throw new Error(`Duplicate skill dependency "${label}".`);
}
out[label] = spec.slice(eq + 1);
}
return out;
}
function mergeAssetDependencies(fromPackageJson, explicit) {
const merged = { ...fromPackageJson };
for (const [name, range] of Object.entries(explicit)) {
if (name in merged && merged[name] !== range) {
throw new Error(`Conflicting asset dependency "${name}": package.json has ${merged[name]}, --asset has ${range}`);
}
merged[name] = range;
}
return merged;
}
function inferPackPolicy(files) {
const hasRootPackageJson = Boolean(files['package.json']);
return {
readPackageJsonDependencies: hasRootPackageJson,
omitUnchangedInstalledFiles: hasRootPackageJson,
};
}
async function omitUnchangedInstalledFiles(sourceZip, sourceFiles, assetDependencies, cwd) {
const dependencyNames = new Set(Object.keys(assetDependencies));
if (dependencyNames.size === 0)
return { zip: sourceZip, omitted: false };
const installRoot = await findInstallRoot(cwd);
const lock = await readMarketLock(installRoot);
const hashesByPath = new Map();
for (const [name, asset] of Object.entries(lock.assets)) {
if (!dependencyNames.has(name))
continue;
for (const [file, metadata] of Object.entries(asset.files)) {
hashesByPath.set(file, metadata.sha256);
}
}
if (hashesByPath.size === 0)
return { zip: sourceZip, omitted: false };
let omitted = false;
const filtered = {};
for (const [file, content] of Object.entries(sourceFiles)) {
const normalizedPath = normalizedZipPath(file);
const lockedHash = normalizedPath ? hashesByPath.get(normalizedPath) : undefined;
if (lockedHash && lockedHash === sha256(content)) {
omitted = true;
continue;
}
filtered[file] = content;
}
return omitted ? { zip: zipSync(filtered), omitted } : { zip: sourceZip, omitted };
}
function normalizedZipPath(file) {
const zipPath = file.replace(/\\/g, '/');
if (zipPath.split('/').includes('..') ||
path.posix.isAbsolute(zipPath) ||
path.win32.isAbsolute(zipPath)) {
return null;
}
return path.posix.normalize(zipPath);
}
async function resolveOneZipFile(cwd, zipFilter) {
const absolute = path.resolve(cwd, zipFilter);
const stat = await maybeStat(absolute);
if (stat?.isFile())
return assertZipFile(absolute);
const files = await listFiles(cwd);
const matches = files
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
.filter(isZipFile)
.sort();
if (matches.length === 0) {
throw new Error(`No .zip files matched "${zipFilter}"`);
}
if (matches.length > 1) {
throw new Error(`File filter matched ${matches.length} zips; pack one asset at a time`);
}
return matches[0];
}
function assertZipFile(file) {
if (!isZipFile(file))
throw new Error(`Pack source must be a .zip: ${file}`);
return file;
}
function isZipFile(file) {
return /\.zip$/i.test(file);
}
async function maybeStat(file) {
try {
return await fs.stat(file);
}
catch {
return null;
}
}
async function listFiles(dir) {
const entries = await fs.readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
if (entry.name === 'node_modules' || entry.name === '.git')
continue;
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await listFiles(fullPath)));
}
else if (entry.isFile()) {
files.push(fullPath);
}
}
return files;
}
function matchesFilter(file, filter) {
const normalizedFile = file.split(path.sep).join('/');
const normalizedFilter = filter.split(path.sep).join('/');
const pattern = '^' +
escapeRegExp(normalizedFilter)
.replace(/\\\*\\\*/g, '.*')
.replace(/\\\*/g, '[^/]*') +
'$';
return new RegExp(pattern).test(normalizedFile);
}
function escapeRegExp(s) {
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
//# sourceMappingURL=pack.js.map
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../src/pack.ts"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AK,MAAM;YAAE,SAAQ;QACpE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC5C,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,MAAc;IACjD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACrD,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzD,MAAM,OAAO,GACX,GAAG;QACH,YAAY,CAAC,gBAAgB,CAAC;aAC3B,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;aAC1B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;QAC5B,GAAG,CAAA;IACL,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;AACjD,CAAC;AAED,SAAS,YAAY,CAAC,CAAS;IAC7B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AACjD,CAAC"}
import { getCliClient } from '../cli-client.js'
import { waitForGeneration } from '../generate.js'
import { generationRunningResult } from '../output.js'
import { finishGeneration, startSpinner } from './generate.js'
export interface GenerateInstallCommandOptions {
cwd?: string
baseUrl?: string
}
// Install the asset from a generation job. Block-and-polls for a bounded window (the command waits,
// not the agent): installs on completion, fails loudly on error, or prints a note so the caller runs
// it again to continue the same job.
export async function generateInstallCommand(
jobId: string,
opts: GenerateInstallCommandOptions,
): Promise<void> {
const { client, baseUrl } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true })
const spinner = startSpinner('Generating asset')
try {
const outcome = await waitForGeneration(client, jobId, {
onProgress: (message) => {
spinner.text = message
},
})
await finishGeneration(client, outcome, {
cwd: opts.cwd,
baseUrl,
spinner,
stillRunning: generationRunningResult(jobId),
})
} catch (err) {
spinner.stop()
throw err
}
}
import * as fs from 'fs/promises'
import * as path from 'path'
import ora from 'ora'
import { packAsset, packPolicyForType, parsePackDependencies } from '../pack.js'
import { packResult } from '../output.js'
import type { AssetType } from '../schemas.js'
export interface PackCommandOptions {
type?: AssetType
cwd?: string
out?: string
/** npm dependencies, each `name@range` (range defaults to `*`). */
npm?: string[]
/** asset dependencies, each `name@range` (range defaults to `*`). */
asset?: string[]
/** skill dependencies, each `label=source` passed to `skills add`. */
skill?: string[]
}
export async function packCommand(zipFilter: string, opts: PackCommandOptions): Promise<void> {
const spinner = ora({
text: 'Preparing pack',
isEnabled: Boolean(process.stderr.isTTY),
isSilent: !process.stderr.isTTY,
}).start()
try {
const cwd = opts.cwd ?? process.cwd()
const packed = await packAsset(zipFilter, {
cwd,
dependencies: parsePackDependencies({
npm: opts.npm,
asset: opts.asset,
skill: opts.skill,
}),
policy: packPolicyForType(opts.type),
})
const out = opts.out ? path.resolve(cwd, opts.out) : defaultPackPath(packed.sourcePath)
spinner.text = `Writing ${path.relative(cwd, out) || out}`
await fs.mkdir(path.dirname(out), { recursive: true })
await fs.writeFile(out, packed.zip)
spinner.stop()
console.log(packResult(out, packed))
} catch (err) {
spinner.stop()
throw err
}
}
function defaultPackPath(sourcePath: string): string {
const ext = path.extname(sourcePath)
return path.join(path.dirname(sourcePath), `${path.basename(sourcePath, ext)}.packed${ext}`)
}
import * as fs from 'fs/promises'
import * as path from 'path'
import { unzipSync, zipSync } from 'fflate'
import type { AssetInstallMetadata } from './contract.js'
import { findInstallRoot } from './install.js'
import { readMarketLock, sha256 } from './market-lock.js'
import {
packageJsonAssetDependenciesFromFiles,
packageJsonNpmDependenciesFromFiles,
} from './package-json.js'
import { MAX_UPLOAD_ZIP_SIZE_BYTES, type AssetType } from './schemas.js'
export interface PackDependencySpecs {
npm?: string[]
asset?: string[]
skill?: string[]
}
export interface ParsedPackDependencies {
npmDependencies: Record<string, string>
assetDependencies: Record<string, string>
skillDependencies: Record<string, string>
}
export interface PackPolicy {
readPackageJsonDependencies: boolean
omitUnchangedInstalledFiles: boolean
}
export interface PackAssetOptions {
cwd?: string
dependencies: ParsedPackDependencies
policy?: PackPolicy
}
export interface PackedAsset {
sourcePath: string
zip: Uint8Array
npmDependencies: Record<string, string>
assetDependencies: Record<string, string>
skillDependencies: Record<string, string>
omittedUnchangedInstalledFiles: boolean
}
export async function packAsset(zipFilter: string, opts: PackAssetOptions): Promise<PackedAsset> {
const cwd = opts.cwd ?? process.cwd()
const zipFile = await resolveOneZipFile(cwd, zipFilter)
const zipStat = await fs.stat(zipFile)
if (zipStat.size >= MAX_UPLOAD_ZIP_SIZE_BYTES) {
throw new Error('Packed zip must be smaller than 1 GB')
}
const sourceZip = new Uint8Array(await fs.readFile(zipFile))
const sourceFiles = unzipSync(sourceZip)
const policy = opts.policy ?? inferPackPolicy(sourceFiles)
const packageJsonAssetDependencies = policy.readPackageJsonDependencies
? packageJsonAssetDependenciesFromFiles(sourceFiles)
: {}
const assetDependencies = mergeAssetDependencies(
packageJsonAssetDependencies,
opts.dependencies.assetDependencies,
)
const packageJsonNpmDependencies = policy.readPackageJsonDependencies
? packageJsonNpmDependenciesFromFiles(sourceFiles)
: {}
const npmDependencies = { ...packageJsonNpmDependencies, ...opts.dependencies.npmDependencies }
const packed = policy.omitUnchangedInstalledFiles
? await omitUnchangedInstalledFiles(sourceZip, sourceFiles, assetDependencies, cwd)
: { zip: sourceZip, omitted: false }
return {
sourcePath: zipFile,
zip: packed.zip,
npmDependencies,
assetDependencies,
skillDependencies: opts.dependencies.skillDependencies,
omittedUnchangedInstalledFiles: packed.omitted,
}
}
export function parsePackDependencies(specs: PackDependencySpecs): ParsedPackDependencies {
return {
npmDependencies: parseVersionedDeps(specs.npm ?? [], 'npm'),
assetDependencies: parseVersionedDeps(specs.asset ?? [], 'asset'),
skillDependencies: parseSkillDeps(specs.skill ?? []),
}
}
export function packPolicyForType(type: AssetType | undefined): PackPolicy | undefined {
if (!type) return undefined
return {
readPackageJsonDependencies: type === 'template',
omitUnchangedInstalledFiles: type === 'template',
}
}
export function packPolicyFromInstallMetadata(
metadata: AssetInstallMetadata | undefined,
): PackPolicy {
return {
readPackageJsonDependencies: metadata?.readAssetDependenciesFromPackageJson ?? false,
omitUnchangedInstalledFiles: metadata?.omitUnchangedInstalledFilesOnUpload ?? false,
}
}
/**
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
* range is optional and defaults to `*`. A leading `@` is treated as a scope
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
*/
export function parseVersionedDeps(specs: string[], kind: 'npm' | 'asset'): Record<string, string> {
const out: Record<string, string> = {}
for (const spec of specs) {
const at = spec.lastIndexOf('@')
const hasRange = at > 0
const name = hasRange ? spec.slice(0, at) : spec
const range = hasRange ? spec.slice(at + 1) : '*'
if (!name || !range) {
throw new Error(`Invalid ${kind} dependency "${spec}". Use name@range (e.g. three@^0.178.0).`)
}
if (name in out) {
throw new Error(`Duplicate ${kind} dependency "${name}".`)
}
out[name] = range
}
return out
}
/**
* Parse `label=source` specs into a label→source record. The source is passed
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
* first `=` is treated as the separator.
*/
export function parseSkillDeps(specs: string[]): Record<string, string> {
const out: Record<string, string> = {}
for (const spec of specs) {
const eq = spec.indexOf('=')
if (eq <= 0 || eq === spec.length - 1) {
throw new Error(
`Invalid skill dependency "${spec}". Use label=source ` +
`(e.g. web-design=vercel-labs/agent-skills).`,
)
}
const label = spec.slice(0, eq)
if (label in out) {
throw new Error(`Duplicate skill dependency "${label}".`)
}
out[label] = spec.slice(eq + 1)
}
return out
}
function mergeAssetDependencies(
fromPackageJson: Record<string, string>,
explicit: Record<string, string>,
): Record<string, string> {
const merged = { ...fromPackageJson }
for (const [name, range] of Object.entries(explicit)) {
if (name in merged && merged[name] !== range) {
throw new Error(
`Conflicting asset dependency "${name}": package.json has ${merged[name]}, --asset has ${range}`,
)
}
merged[name] = range
}
return merged
}
function inferPackPolicy(files: Record<string, Uint8Array>): PackPolicy {
const hasRootPackageJson = Boolean(files['package.json'])
return {
readPackageJsonDependencies: hasRootPackageJson,
omitUnchangedInstalledFiles: hasRootPackageJson,
}
}
async function omitUnchangedInstalledFiles(
sourceZip: Uint8Array,
sourceFiles: Record<string, Uint8Array>,
assetDependencies: Record<string, string>,
cwd: string,
): Promise<{ zip: Uint8Array; omitted: boolean }> {
const dependencyNames = new Set(Object.keys(assetDependencies))
if (dependencyNames.size === 0) return { zip: sourceZip, omitted: false }
const installRoot = await findInstallRoot(cwd)
const lock = await readMarketLock(installRoot)
const hashesByPath = new Map<string, string>()
for (const [name, asset] of Object.entries(lock.assets)) {
if (!dependencyNames.has(name)) continue
for (const [file, metadata] of Object.entries(asset.files)) {
hashesByPath.set(file, metadata.sha256)
}
}
if (hashesByPath.size === 0) return { zip: sourceZip, omitted: false }
let omitted = false
const filtered: Record<string, Uint8Array> = {}
for (const [file, content] of Object.entries(sourceFiles)) {
const normalizedPath = normalizedZipPath(file)
const lockedHash = normalizedPath ? hashesByPath.get(normalizedPath) : undefined
if (lockedHash && lockedHash === sha256(content)) {
omitted = true
continue
}
filtered[file] = content
}
return omitted ? { zip: zipSync(filtered), omitted } : { zip: sourceZip, omitted }
}
function normalizedZipPath(file: string): string | null {
const zipPath = file.replace(/\\/g, '/')
if (
zipPath.split('/').includes('..') ||
path.posix.isAbsolute(zipPath) ||
path.win32.isAbsolute(zipPath)
) {
return null
}
return path.posix.normalize(zipPath)
}
async function resolveOneZipFile(cwd: string, zipFilter: string): Promise<string> {
const absolute = path.resolve(cwd, zipFilter)
const stat = await maybeStat(absolute)
if (stat?.isFile()) return assertZipFile(absolute)
const files = await listFiles(cwd)
const matches = files
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
.filter(isZipFile)
.sort()
if (matches.length === 0) {
throw new Error(`No .zip files matched "${zipFilter}"`)
}
if (matches.length > 1) {
throw new Error(`File filter matched ${matches.length} zips; pack one asset at a time`)
}
return matches[0]
}
function assertZipFile(file: string): string {
if (!isZipFile(file)) throw new Error(`Pack source must be a .zip: ${file}`)
return file
}
function isZipFile(file: string): boolean {
return /\.zip$/i.test(file)
}
async function maybeStat(file: string) {
try {
return await fs.stat(file)
} catch {
return null
}
}
async function listFiles(dir: string): Promise<string[]> {
const entries = await fs.readdir(dir, { withFileTypes: true })
const files: string[] = []
for (const entry of entries) {
if (entry.name === 'node_modules' || entry.name === '.git') continue
const fullPath = path.join(dir, entry.name)
if (entry.isDirectory()) {
files.push(...(await listFiles(fullPath)))
} else if (entry.isFile()) {
files.push(fullPath)
}
}
return files
}
function matchesFilter(file: string, filter: string): boolean {
const normalizedFile = file.split(path.sep).join('/')
const normalizedFilter = filter.split(path.sep).join('/')
const pattern =
'^' +
escapeRegExp(normalizedFilter)
.replace(/\\\*\\\*/g, '.*')
.replace(/\\\*/g, '[^/]*') +
'$'
return new RegExp(pattern).test(normalizedFile)
}
function escapeRegExp(s: string): string {
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
}
+46
-3

@@ -12,3 +12,5 @@ #!/usr/bin/env node

import { generateCommand } from './commands/generate.js';
import { generateInstallCommand } from './commands/generate-install.js';
import { listCommand } from './commands/list.js';
import { packCommand } from './commands/pack.js';
import { previewCommand } from './commands/preview.js';

@@ -96,2 +98,22 @@ import { uploadCommand } from './commands/upload.js';

program
.command('pack')
.description('Create a Market asset zip using the same packaging step as upload')
.argument('<zip-filter>', '.zip path or glob')
.addOption(typeOption)
.option('--out <file>', 'Output zip path')
.option('--cwd <dir>', 'Project directory')
.option('--npm <dep>', 'npm dependency name@range (repeatable)', collect, [])
.option('--asset <dep>', 'asset dependency name@range (repeatable)', collect, [])
.option('--skill <dep>', 'skill dependency label=source (repeatable)', collect, [])
.action(async (zipFilter, opts) => {
await packCommand(zipFilter, {
type: opts.type,
out: opts.out,
cwd: opts.cwd,
npm: opts.npm,
asset: opts.asset,
skill: opts.skill,
});
});
program
.command('search')

@@ -164,6 +186,6 @@ .description('Find assets')

});
program
const generate = program
.command('generate')
.description('Generate and install')
.argument('<description>', 'Asset prompt')
.description('Generate and install an asset, or check a generation job')
.argument('[description]', 'Asset prompt (omit when using a subcommand)')
.addOption(typeOption)

@@ -174,2 +196,6 @@ .addOption(apiOption)

.action(async (description, opts) => {
if (!description) {
generate.help({ error: true });
return;
}
requireType(opts.type, 'Generate');

@@ -183,2 +209,19 @@ await generateCommand(description, {

});
// `generate install <jobId>` finishes a slow (job-based) generation: it checks the job once and, when
// it has completed, installs the produced asset into the project. Still running → prints a note and
// exits 0 (run again later); failed → exits 1. Fast asset types never need this — `generate` installs
// them inline. ("install" over "status": the command's job is to integrate the asset, not just report.)
generate
.command('install')
.description('Install the asset from a generation job once it has completed')
.argument('<jobId>', 'Job id printed by `market generate`')
.addOption(apiOption)
.option('--cwd <dir>', 'Project directory')
// Read merged options: `--cwd`/`--api` after `generate install` are otherwise captured by the
// parent `generate` command (which declares the same options), leaving this subcommand's own opts
// undefined. `optsWithGlobals()` surfaces whichever level parsed them.
.action(async (jobId, _options, command) => {
const { api, cwd } = command.optsWithGlobals();
await generateInstallCommand(jobId, { baseUrl: api, cwd });
});
if (process.argv.length <= 2) {

@@ -185,0 +228,0 @@ program.outputHelp();

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAA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AQ,EAAE,CAAC,CAAA;IACvF,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,IAAI,IAAI,CAAC,gBAAgB,CAAA;IAE/E,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;IAClD,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAClD,MAAM,IAAI,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAElD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC3E,IAAI,CAAC,MAAM,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;IAC5F,OAAO,MAAM,CAAC,YAAY,CAAA;AAC5B,CAAC"}

@@ -0,1 +1,4 @@

import { type Ora } from 'ora';
import { type PollOutcome } from '../generate.js';
import type { MarketClient } from '../client.js';
import type { AssetAccess, AssetType } from '../schemas.js';

@@ -9,2 +12,12 @@ export interface GenerateCommandOptions {

export declare function generateCommand(description: string, opts: GenerateCommandOptions): Promise<void>;
interface InstallContext {
cwd?: string;
baseUrl: string;
spinner: Ora;
}
export declare function finishGeneration(client: MarketClient, outcome: PollOutcome, ctx: InstallContext & {
stillRunning: string;
}): Promise<void>;
export declare function startSpinner(text: string): Ora;
export {};
//# sourceMappingURL=generate.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE3D,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAsCf"}
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE3D,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,UAAU,cAAc;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,GAAG,CAAA;CACb;AAID,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,IAAI,CAAC,CAUf;AAuBD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAM9C"}
import ora from 'ora';
import { getCliClient } from '../cli-client.js';
import { generateAndWait } from '../generate.js';
import { GenerateError, startGeneration, waitForGeneration } from '../generate.js';
import { resolve } from '../resolve.js';
import { install as runInstall } from '../install.js';
import { generatedInstallResult } from '../output.js';
import { generatedInstallResult, generationStartedResult } from '../output.js';
export async function generateCommand(description, opts) {
const { client, baseUrl } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true });
const spinner = ora({
text: `Generating "${description}"`,
isEnabled: Boolean(process.stderr.isTTY),
isSilent: !process.stderr.isTTY,
}).start();
const spinner = startSpinner(`Generating "${description}"`);
try {
const generated = await generateAndWait(client, { description, type: opts.type, access: opts.access }, {
onProgress: (msg) => {
spinner.text = msg;
const started = await startGeneration(client, {
description,
type: opts.type,
access: opts.access,
});
// Fast providers finish inline; slow, job-based ones return a job to poll.
if (started.status === 'completed') {
await installGenerated(client, started, { cwd: opts.cwd, baseUrl, spinner });
return;
}
// Block-and-poll for a bounded window (the command waits, not the agent). If the job outlasts the
// window, hand back its id so the caller continues with `generate install`.
const outcome = await waitForGeneration(client, started.jobId, {
onProgress: (message) => {
spinner.text = message;
},
});
spinner.text = `Resolving ${generated.assetName}@${generated.version}`;
const resolution = await resolve(client.asset, [
{ name: generated.assetName, range: generated.version },
]);
await runInstall(client, resolution, {
await finishGeneration(client, outcome, {
cwd: opts.cwd,
baseUrl,
onProgress: (msg) => {
spinner.text = msg;
},
spinner,
stillRunning: generationStartedResult(started.jobId),
});
spinner.stop();
console.log(generatedInstallResult(generated.assetName, generated.version));
}

@@ -39,2 +40,38 @@ catch (err) {

}
// Finish a poll outcome: install on completion, fail loudly on error, or print the still-running note
// (the job keeps running server-side). Shared by `generate` and `generate install`.
export async function finishGeneration(client, outcome, ctx) {
if (outcome.status === 'completed') {
await installGenerated(client, outcome, ctx);
return;
}
ctx.spinner.stop();
if (outcome.status === 'failed') {
throw new GenerateError(outcome.error);
}
console.log(ctx.stillRunning);
}
// Install a finished generation into the project and report it.
async function installGenerated(client, generated, ctx) {
ctx.spinner.text = `Resolving ${generated.assetName}@${generated.version}`;
const resolution = await resolve(client.asset, [
{ name: generated.assetName, range: generated.version },
]);
await runInstall(client, resolution, {
cwd: ctx.cwd,
baseUrl: ctx.baseUrl,
onProgress: (message) => {
ctx.spinner.text = message;
},
});
ctx.spinner.stop();
console.log(generatedInstallResult(generated.assetName, generated.version));
}
export function startSpinner(text) {
return ora({
text,
isEnabled: Boolean(process.stderr.isTTY),
isSilent: !process.stderr.isTTY,
}).start();
}
//# sourceMappingURL=generate.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAUrD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,WAAmB,EACnB,IAA4B;IAE5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAE5F,MAAM,OAAO,GAAG,GAAG,CAAC;QAClB,IAAI,EAAE,eAAe,WAAW,GAAG;QACnC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;KAChC,CAAC,CAAC,KAAK,EAAE,CAAA;IACV,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,eAAe,CACrC,MAAM,EACN,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EACrD;YACE,UAAU,E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CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,GAAG,CAAC;QACT,IAAI;QACJ,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;KAChC,CAAC,CAAC,KAAK,EAAE,CAAA;AACZ,CAAC"}

@@ -18,14 +18,2 @@ import { type AssetAccess, type AssetType } from '../schemas.js';

export declare function parseUploadDescription(description: string): string;
/**
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
* range is optional and defaults to `*`. A leading `@` is treated as a scope
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
*/
export declare function parseVersionedDeps(specs: string[], kind: 'npm' | 'asset'): Record<string, string>;
/**
* Parse `label=source` specs into a label→source record. The source is passed
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
* first `=` is treated as the separator.
*/
export declare function parseSkillDeps(specs: string[]): Record<string, string>;
//# sourceMappingURL=upload.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAcA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,eAAe,CAAA;AAEtB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,wBAAsB,aAAa,CACjC,IAAI,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fs from 'fs/promises';
import * as path from 'path';
import { unzipSync, zipSync } from 'fflate';
import ora from 'ora';
import semver from 'semver';
import { getCliClient } from '../cli-client.js';
import { findInstallRoot } from '../install.js';
import { readMarketLock, sha256 } from '../market-lock.js';
import { packageJsonAssetDependenciesFromFiles, packageJsonNpmDependenciesFromFiles, } from '../package-json.js';
import { MAX_ASSET_DESCRIPTION_LENGTH, MAX_UPLOAD_ZIP_SIZE_BYTES } from '../schemas.js';
import { packAsset, packPolicyFromInstallMetadata, parsePackDependencies } from '../pack.js';
import { unchangedUploadResult, uploadResult } from '../output.js';
import { assetDescriptionSchema, assetNameSchema, semverSchema, } from '../schemas.js';
import { assetDescriptionSchema, assetNameSchema, semverSchema, MAX_ASSET_DESCRIPTION_LENGTH, } from '../schemas.js';
export async function uploadCommand(name, zipFilter, description, opts) {

@@ -24,30 +18,17 @@ const spinner = ora({

// Parse dep flags before any network work so a malformed spec fails fast.
const explicitNpmDependencies = parseVersionedDeps(opts.npm ?? [], 'npm');
const explicitAssetDependencies = parseVersionedDeps(opts.asset ?? [], 'asset');
const skillDependencies = parseSkillDeps(opts.skill ?? []);
const dependencies = parsePackDependencies({
npm: opts.npm,
asset: opts.asset,
skill: opts.skill,
});
const cwd = opts.cwd ?? process.cwd();
const type = opts.type;
const zipFile = await resolveOneZipFile(cwd, zipFilter);
const zipStat = await fs.stat(zipFile);
if (zipStat.size >= MAX_UPLOAD_ZIP_SIZE_BYTES) {
throw new Error('Upload zip must be smaller than 1 GB');
}
const sourceZip = new Uint8Array(await fs.readFile(zipFile));
const { client } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true });
const installMetadata = await client.asset.installMetadata();
const typeMetadata = installMetadata[type];
const sourceFiles = unzipSync(sourceZip);
const packageJsonAssetDependencies = typeMetadata?.readAssetDependenciesFromPackageJson
? packageJsonAssetDependenciesFromFiles(sourceFiles)
: {};
const assetDependencies = mergeAssetDependencies(packageJsonAssetDependencies, explicitAssetDependencies);
// A type that ships a package.json (templates) also carries its npm dependencies there; capture
// them so an install over an existing package.json brings them. Explicit --npm wins on conflict.
const packageJsonNpmDependencies = typeMetadata?.readAssetDependenciesFromPackageJson
? packageJsonNpmDependenciesFromFiles(sourceFiles)
: {};
const npmDependencies = { ...packageJsonNpmDependencies, ...explicitNpmDependencies };
const zip = typeMetadata?.omitUnchangedInstalledFilesOnUpload
? await omitUnchangedInstalledFiles(sourceZip, sourceFiles, assetDependencies, cwd)
: sourceZip;
const packed = await packAsset(zipFilter, {
cwd,
dependencies,
policy: packPolicyFromInstallMetadata(installMetadata[type]),
});
const { zip, npmDependencies, assetDependencies, skillDependencies } = packed;
const profile = await client.user.getProfile();

@@ -113,93 +94,2 @@ if (!profile) {

}
/**
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
* range is optional and defaults to `*`. A leading `@` is treated as a scope
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
*/
export function parseVersionedDeps(specs, kind) {
const out = {};
for (const spec of specs) {
const at = spec.lastIndexOf('@');
const hasRange = at > 0;
const name = hasRange ? spec.slice(0, at) : spec;
const range = hasRange ? spec.slice(at + 1) : '*';
if (!name || !range) {
throw new Error(`Invalid ${kind} dependency "${spec}". Use name@range (e.g. three@^0.178.0).`);
}
if (name in out) {
throw new Error(`Duplicate ${kind} dependency "${name}".`);
}
out[name] = range;
}
return out;
}
/**
* Parse `label=source` specs into a label→source record. The source is passed
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
* first `=` is treated as the separator.
*/
export function parseSkillDeps(specs) {
const out = {};
for (const spec of specs) {
const eq = spec.indexOf('=');
if (eq <= 0 || eq === spec.length - 1) {
throw new Error(`Invalid skill dependency "${spec}". Use label=source ` +
`(e.g. web-design=vercel-labs/agent-skills).`);
}
const label = spec.slice(0, eq);
if (label in out) {
throw new Error(`Duplicate skill dependency "${label}".`);
}
out[label] = spec.slice(eq + 1);
}
return out;
}
function mergeAssetDependencies(fromPackageJson, explicit) {
const merged = { ...fromPackageJson };
for (const [name, range] of Object.entries(explicit)) {
if (name in merged && merged[name] !== range) {
throw new Error(`Conflicting asset dependency "${name}": package.json has ${merged[name]}, --asset has ${range}`);
}
merged[name] = range;
}
return merged;
}
async function omitUnchangedInstalledFiles(sourceZip, sourceFiles, assetDependencies, cwd) {
const dependencyNames = new Set(Object.keys(assetDependencies));
if (dependencyNames.size === 0)
return sourceZip;
const installRoot = await findInstallRoot(cwd);
const lock = await readMarketLock(installRoot);
const hashesByPath = new Map();
for (const [name, asset] of Object.entries(lock.assets)) {
if (!dependencyNames.has(name))
continue;
for (const [file, metadata] of Object.entries(asset.files)) {
hashesByPath.set(file, metadata.sha256);
}
}
if (hashesByPath.size === 0)
return sourceZip;
let omitted = false;
const filtered = {};
for (const [file, content] of Object.entries(sourceFiles)) {
const normalizedPath = normalizedZipPath(file);
const lockedHash = normalizedPath ? hashesByPath.get(normalizedPath) : undefined;
if (lockedHash && lockedHash === sha256(content)) {
omitted = true;
continue;
}
filtered[file] = content;
}
return omitted ? zipSync(filtered) : sourceZip;
}
function normalizedZipPath(file) {
const zipPath = file.replace(/\\/g, '/');
if (zipPath.split('/').includes('..') ||
path.posix.isAbsolute(zipPath) ||
path.win32.isAbsolute(zipPath)) {
return null;
}
return path.posix.normalize(zipPath);
}
/** Compare a stored dependency JSON string against a freshly parsed record. */

@@ -217,62 +107,2 @@ function depsEqual(storedJson, next) {

}
async function resolveOneZipFile(cwd, zipFilter) {
const absolute = path.resolve(cwd, zipFilter);
const stat = await maybeStat(absolute);
if (stat?.isFile())
return assertZipFile(absolute);
const files = await listFiles(cwd);
const matches = files
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
.filter(isZipFile)
.sort();
if (matches.length === 0) {
throw new Error(`No .zip files matched "${zipFilter}"`);
}
if (matches.length > 1) {
throw new Error(`File filter matched ${matches.length} zips; upload one asset at a time`);
}
return matches[0];
}
function assertZipFile(file) {
if (!isZipFile(file))
throw new Error(`Upload file must be a .zip: ${file}`);
return file;
}
function isZipFile(file) {
return /\.zip$/i.test(file);
}
async function maybeStat(file) {
try {
return await fs.stat(file);
}
catch {
return null;
}
}
async function listFiles(dir) {
const entries = await fs.readdir(dir, { withFileTypes: true });
const files = [];
for (const entry of entries) {
if (entry.name === 'node_modules' || entry.name === '.git')
continue;
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
files.push(...(await listFiles(fullPath)));
}
else if (entry.isFile()) {
files.push(fullPath);
}
}
return files;
}
function matchesFilter(file, filter) {
const normalizedFile = file.split(path.sep).join('/');
const normalizedFilter = filter.split(path.sep).join('/');
const pattern = '^' +
escapeRegExp(normalizedFilter)
.replace(/\\\*\\\*/g, '.*')
.replace(/\\\*/g, '[^/]*') +
'$';
return new RegExp(pattern).test(normalizedFile);
}
function nextVersion(latest) {

@@ -296,7 +126,4 @@ if (!latest)

function toArrayBuffer(bytes) {
return new Uint8Array(bytes).buffer;
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
}
function escapeRegExp(value) {
return value.replace(/[|\\{}()[\]^$+?.*]/g, '\\$&');
}
//# sourceMappingURL=upload.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EACL,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,oBAAoB,CAAA;AAC3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AE,OAAO,OAAO,CAAA;IAC3B,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC3C,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,GAAG,CAAC,CAAA;IACxE,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,CAAa,EAAE,CAAa;IAC9C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;IACjC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAgB,CAAA;AACjG,CAAC"}
import type { MarketClient } from './client.js';
import type { AssetAccess, AssetType } from './schemas.js';
import type { AssetAccess, AssetType, GenerateJobStatus, GenerateResponse } from './schemas.js';
export declare class GenerateError extends Error {

@@ -12,10 +12,18 @@ constructor(message: string);

}
export interface GenerateResult {
export declare function startGeneration(client: MarketClient, input: GenerateInput): Promise<GenerateResponse>;
export declare function pollGeneration(client: MarketClient, jobId: string): Promise<GenerateJobStatus>;
export type PollOutcome = {
status: 'completed';
assetName: string;
version: string;
}
export interface GenerateOptions {
} | {
status: 'failed';
error: string;
} | {
status: 'running';
};
export declare function waitForGeneration(client: MarketClient, jobId: string, opts?: {
windowMs?: number;
onProgress?: (message: string) => void;
}
export declare function generateAndWait(client: MarketClient, input: GenerateInput, opts?: GenerateOptions): Promise<GenerateResult>;
}): Promise<PollOutcome>;
//# sourceMappingURL=generate.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE1D,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AASD,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,aAAa,EACpB,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,cAAc,CAAC,CAwBzB"}
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/F,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAaD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAE9F;AAID,MAAM,MAAM,WAAW,GACnB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAA;AAIzB,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,GACvE,OAAO,CAAC,WAAW,CAAC,CAoBtB"}

@@ -7,29 +7,40 @@ export class GenerateError extends Error {

}
// Poll cadence for a job-based generation. Each poll is a short, independently-retriable request;
// the client sleeps between them, so no single request is held open for the length of the job (that
// is exactly the client/proxy-timeout trap the async flow removes). The deadline sits above the
// slowest provider's own budget (the humanoid model's upstream job runs up to ~10 min).
// How often the CLI polls a running job.
const POLL_INTERVAL_MS = 4_000;
const POLL_DEADLINE_MS = 15 * 60_000;
export async function generateAndWait(client, input, opts = {}) {
// How long one `generate` / `generate install` call blocks-and-polls before handing back control.
// The command does the waiting (the agent never sleeps between checks). When the window elapses the
// call returns and the caller just runs `generate install <jobId>` again, which picks up the SAME
// server-side job where this left off — so no asset type needs to be flagged "slow" ahead of time;
// anything that outlasts one window simply continues on the next call.
const WINDOW_MS = 120_000;
// Start a generation. Fast providers answer `completed` inline; slow, job-based providers answer
// `pending` with a jobId to poll (see `waitForGeneration` / `generate install`).
export function startGeneration(client, input) {
return client.asset.generate(input);
}
// One poll of a generation job.
export function pollGeneration(client, jobId) {
return client.asset.generateStatus({ jobId });
}
// Poll a job until it settles or `windowMs` elapses. Bounded so a single call stays under a harness
// timeout; on timeout it returns `running` (the job keeps going server-side — run again to continue).
export async function waitForGeneration(client, jobId, opts = {}) {
const windowMs = opts.windowMs ?? WINDOW_MS;
const report = opts.onProgress ?? (() => { });
report('Generating asset');
const started = await client.asset.generate(input);
if (started.status === 'completed') {
return { assetName: started.assetName, version: started.version };
}
const startedAt = Date.now();
for (;;) {
if (Date.now() - startedAt > POLL_DEADLINE_MS) {
throw new GenerateError('Generation timed out.');
}
await delay(POLL_INTERVAL_MS);
report('Generating asset');
const status = await client.asset.generateStatus({ jobId: started.jobId });
const status = await pollGeneration(client, jobId);
if (status.status === 'completed') {
return { assetName: status.assetName, version: status.version };
return { status: 'completed', assetName: status.assetName, version: status.version };
}
if (status.status === 'failed') {
throw new GenerateError(status.error);
return { status: 'failed', error: status.error };
}
const remaining = windowMs - (Date.now() - startedAt);
if (remaining <= 0) {
return { status: 'running' };
}
report('Generating asset');
// Trim the last sleep so the call returns as soon as the window passes, not a poll-interval later.
await delay(Math.min(POLL_INTERVAL_MS, remaining));
}

@@ -36,0 +47,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AAkBD,kGAAkG;AAClG,oGAAoG;AACpG,gGAAgG;AAChG,wFAAwF;AACxF,MAAM,gBAAgB,GAAG,KAAK,CAAA;AAC9B,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAA;AAEpC,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAA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MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAA;QACtF,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;QAClD,CAAC;QACD,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAA;QACrD,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;YACnB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;QAC9B,CAAC;QACD,MAAM,CAAC,kBAAkB,CAAC,CAAA;QAC1B,mGAAmG;QACnG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC"}

@@ -10,4 +10,4 @@ export { createMarketClient } from './client.js';

export type { ResolvedAsset, ResolveResult } from './resolve.js';
export { generateAndWait, GenerateError } from './generate.js';
export type { GenerateInput, GenerateResult, GenerateOptions } from './generate.js';
export { startGeneration, pollGeneration, GenerateError } from './generate.js';
export type { GenerateInput } from './generate.js';
export { agentAndWait, AgentError } from './agent.js';

@@ -14,0 +14,0 @@ export type { AgentInput } from './agent.js';

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AA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AE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9E,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C,OAAO,EACL,WAAW,EACX,yBAAyB,EACzB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAErF,OAAO,EACL,4BAA4B,EAC5B,qCAAqC,EACrC,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA"}

@@ -9,3 +9,3 @@ // Client

// Generate
export { generateAndWait, GenerateError } from './generate.js';
export { startGeneration, pollGeneration, GenerateError } from './generate.js';
// Agent

@@ -12,0 +12,0 @@ export { agentAndWait, AgentError } from './agent.js';

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAyBxC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,2BAA2B,CAAA;AAElC,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvD,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG9D,QAAQ;AACR,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGrD,UAAU;AACV,OAAO,EACL,WAAW,EACX,yBAAyB,EACzB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,cAAc,CAAA;AAWrB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAG1B,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAErF,OAAO,EACL,4BAA4B,EAC5B,qCAAqC,EACrC,gBAAgB,GACjB,MAAM,mBAAmB,CAAA"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAyBxC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,2BAA2B,CAAA;AAElC,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvD,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG9E,QAAQ;AACR,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGrD,UAAU;AACV,OAAO,EACL,WAAW,EACX,yBAAyB,EACzB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,cAAc,CAAA;AAWrB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAG1B,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAErF,OAAO,EACL,4BAA4B,EAC5B,qCAAqC,EACrC,gBAAgB,GACjB,MAAM,mBAAmB,CAAA"}
import type { AssetInstallMetadata, AssetSearchResult } from './contract.js';
import type { ListInstalledAssetsResult } from './commands/list.js';
import type { InstallResult } from './install.js';
import type { PackedAsset } from './pack.js';
export declare function assetVersionRef(name: string, version?: string): string;

@@ -17,4 +18,7 @@ export declare function assetApproval(approved: boolean): 'approved' | 'unapproved';

export declare function generatedInstallResult(name: string, version: string): string;
export declare function generationStartedResult(jobId: string): string;
export declare function generationRunningResult(jobId: string): string;
export declare function uploadResult(name: string, version: string): string;
export declare function unchangedUploadResult(name: string, version: string): string;
export declare function packResult(out: string, packed: PackedAsset): string;
export declare function previewResult(name: string, version: string, out: string): string;

@@ -21,0 +25,0 @@ export declare function loginResult(email: string, configPath: string): string;

@@ -1,1 +0,1 @@

{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,GAAG,YAAY,CAE1E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,iBAAiB,EAAE,OAAO,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,MAAM,CAOT;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAKrE;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,aAAa,EACrB,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAM,GACzD,MAAM,CAuCR;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,MAAM,CAWpE;AAkCD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB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ACd,GAAG,MAAM,CAOT;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAKrE;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,aAAa,EACrB,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAM,GACzD,MAAM,CAuCR;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,MAAM,CAWpE;AAkCD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5E;AAID,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7D;AAGD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CASnE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAGvD"}

@@ -91,2 +91,14 @@ export function assetVersionRef(name, version) {

}
// Printed when `generate` returns before the job finished: it keeps running server-side and the
// caller continues it with `generate install`, which installs the asset once it is ready.
export function generationStartedResult(jobId) {
return [
'Still generating after a couple of minutes — it continues in the background.',
`Run this to pick up where it left off and install when ready: market generate install ${jobId}`,
].join('\n');
}
// Printed by `generate install` when the job is still running after its wait window.
export function generationRunningResult(jobId) {
return `Still generating. Run again to continue: market generate install ${jobId}`;
}
export function uploadResult(name, version) {

@@ -98,2 +110,12 @@ return `Uploaded ${assetVersionRef(name, version)}`;

}
export function packResult(out, packed) {
const lines = [`Packed: ${out}`];
if (packed.omittedUnchangedInstalledFiles) {
lines.push('Omitted unchanged installed dependency files.');
}
lines.push(...dependencyLines('npm dependencies', packed.npmDependencies));
lines.push(...dependencyLines('asset dependencies', packed.assetDependencies));
lines.push(...dependencyLines('skill dependencies', packed.skillDependencies));
return lines.join('\n');
}
export function previewResult(name, version, out) {

@@ -155,2 +177,11 @@ return `Saved preview for ${assetVersionRef(name, version)}: ${out}`;

}
function dependencyLines(label, deps) {
const entries = Object.entries(deps);
if (entries.length === 0)
return [];
return [
`${label}:`,
...entries.sort(([a], [b]) => a.localeCompare(b)).map(([name, value]) => `- ${name}: ${value}`),
];
}
//# sourceMappingURL=output.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,OAAgB;IAC5D,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAiB;IAC7C,OAAO,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAM7B;IACC,MAAM,QAAQ,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,UAAU,CAAA;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KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,IAA4B;IAClE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACnC,OAAO;QACL,GAAG,KAAK,GAAG;QACX,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,CAAC;KAChG,CAAA;AACH,CAAC"}

@@ -1,2 +0,2 @@

export declare const marketSkill = "---\nname: market\ndescription: Find, preview, install, generate, and publish Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\nUse the `market` CLI. Keep commands short and read the summary lines.\n\n## Quick Start\n\n```sh\nmarket search \"wooden chair\" --type model --limit 3\nmarket install wooden-chair --cwd \"$PWD\"\nmarket list --cwd \"$PWD\"\nmarket preview wooden-chair --out /tmp/wooden-chair.png\n```\n\n## Workflow\n\n1. In an existing repo, run `list --cwd \"$PWD\"` first to see installed local assets from `.drawcall/market-lock.json`. Use the listed names with `preview <name>` when you want preview images.\n2. Search first unless the user already gave an exact asset name. `search` requires `--type`; use `model` unless the user names another supported type: `humanoid-model`, `texture`, `humanoid-animation`, `template`, `sound-effect`, `background-music`, `environment`, or `flipbook`.\n3. Use `--limit 1` for lookup, `--limit 3` for choice. Search caps at 5 and prints full descriptions.\n4. `install` takes zero or more exact asset names (optionally `name@range`). With names, it installs those assets; with no names, it installs `assetDependencies` from the nearest `package.json`. It does not search or generate. Find names with `search` first. No `--type` is needed \u2014 asset names are unique. Use `--force` only when the user agrees to overwrite changed local files.\n5. `preview <name>` saves the preview image; no `--type` is needed. Not every type has previews (e.g. `humanoid-animation`, `template`, `sound-effect`, `background-music`); the CLI reports when one is unavailable.\n6. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.\n7. `generate --type <type> \"<prompt>\"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement).\n8. Upload only when publishing is requested: `market upload <name> <zip> \"<description>\" --type <type>`. Declare dependencies with repeatable flags: `--npm name@range`, `--asset name@range`, `--skill label=source`. Template uploads also read root `package.json.assetDependencies`; `--asset` flags are additive and must not conflict. Template upload omits installed dependency files whose hashes still match `.drawcall/market-lock.json`, so edited local files stay in the template. A skill source is a `skills add` argument: a whole repo (`owner/repo` or a git URL), a single skill via the full URL form `https://github.com/owner/repo/tree/<branch>/<subpath>` (the `tree/<branch>/<subpath>` shorthand needs the full URL, not `owner/repo`), or a local path to a skill directory inside the zip. Example: `market upload my-scene scene.zip \"A scene\" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines`.\n9. Installed `environment` assets contain `public/environment/<name>.hdr` for Three.js IBL lighting and `public/environment/<name>-background.webp` for the visible equirectangular background. Use `market preview` to fetch the preview image separately.\n10. Installed `flipbook` assets contain `public/flipbook/<name>.ktx2`. Render them with `@drawcall/flipbook`'s `Flipbook` class and Three.js `KTX2Loader` for Basis-compressed files; `market preview` fetches the middle frame from the flipbook.\n\n## Humanoid animations\n\n`humanoid-animation` assets are single-clip GLBs \u2014 one motion per asset (one idle, one walk-forward, one jump, one attack) on a normalized skeleton that retargets onto any humanoid, whatever its role. A behaving character is therefore a *set* of clips, not one asset: from what the character actually does, budget the clips it needs \u2014 an idle, its locomotion (walk/run, often split by direction: fwd/bwd/left/right), and one clip per distinct action and reaction it performs \u2014 then search for each separately.\n\n`humanoid-model` assets share that same normalized skeleton and are authored to a **consistent real-world scale** \u2014 they come in at roughly the same height as each other. So you do **not** need to rescale one humanoid to match another (player vs. enemy vs. NPC); dropped in as-is they already stand at a consistent size. Avoid the trap of measuring one character's height and scaling others to it \u2014 besides being unnecessary, measuring a rigged/animated character's bounding box is unreliable and produces giants (see the `math` skill on `Box3` and skinned meshes). If you ever do need a deliberate size difference (a boss, a child NPC), apply an explicit chosen multiplier, not a measured one.\n\nSearch one motion per query, named by the motion, because results rank by keyword overlap: a query naming several motions at once is dominated by whichever word matches the most assets and buries the others, so real clips look like a gap when they exist. Names describe the motion, not the character \u2014 so search the motion (`\"walk forward\"`, `\"reload\"`, `\"jump\"`), not the role (`\"player run\"`, `\"boss attack\"`). If a motion finds nothing, retry with synonyms (run/jog/sprint, attack/swing/strike).\n\n## Output\n\nCommands print concise, line-oriented summaries:\n\n```text\nResults: 2/8 query=\"wooden chair\" type=model approval=approved\n- wooden-chair@1.0.0 | model | approved | Low-poly wooden chair\nInstalled:\n- wooden-chair@1.0.0 (asset)\n description: Low-poly wooden chair\n files:\n public/model\n \u2514\u2500 wooden-chair.glb\n- three@^0.178.0 (npm)\n- web-design \u2190 https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines (skill)\nInstalled assets: 1\n- wooden-chair@1.0.0 (model)\n files:\n public/model\n \u2514\u2500 wooden-chair.glb\nSaved preview for wooden-chair@1.0.0: /tmp/wooden-chair.png\n```\n\nAssets may also declare `skill` dependencies, installed for you via the `skills` CLI (`skills add`) during `install`. Sources are either a GitHub/git ref or a local path to a skill directory shipped inside the asset. This requires `npx` to be available.\n\nInstalled non-template assets are saved to `package.json.assetDependencies`; templates are scaffolds and are not saved as project asset dependencies. Exact installed versions and file hashes are recorded in `.drawcall/market-lock.json`.\n\n`list` is offline: it reads `.drawcall/market-lock.json` from the nearest package root and prints exact installed names, versions, types, and installed file paths.\n\nIf search returns no results, try one broader noun phrase. If a command returns `Error: Not logged in...`, ask before running `market login`.\n";
export declare const marketSkill = "---\nname: market\ndescription: Find, preview, install, generate, and publish Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\nUse the `market` CLI. Keep commands short and read the summary lines.\n\n## Quick Start\n\n```sh\nmarket search \"wooden chair\" --type model --limit 3\nmarket install wooden-chair --cwd \"$PWD\"\nmarket list --cwd \"$PWD\"\nmarket preview wooden-chair --out /tmp/wooden-chair.png\nmarket pack scene.zip --out scene.packed.zip\n```\n\n## Workflow\n\n1. In an existing repo, run `list --cwd \"$PWD\"` first to see installed local assets from `.drawcall/market-lock.json`. Use the listed names with `preview <name>` when you want preview images.\n2. Search first unless the user already gave an exact asset name. `search` requires `--type`; use `model` unless the user names another supported type: `humanoid-model`, `texture`, `humanoid-animation`, `template`, `sound-effect`, `background-music`, `environment`, or `flipbook`.\n3. Use `--limit 1` for lookup, `--limit 3` for choice. Search caps at 5 and prints full descriptions.\n4. `install` takes zero or more exact asset names (optionally `name@range`). With names, it installs those assets; with no names, it installs `assetDependencies` from the nearest `package.json`. It does not search or generate. Find names with `search` first. No `--type` is needed \u2014 asset names are unique. Use `--force` only when the user agrees to overwrite changed local files.\n5. `preview <name>` saves the preview image; no `--type` is needed. Not every type has previews (e.g. `humanoid-animation`, `template`, `sound-effect`, `background-music`); the CLI reports when one is unavailable.\n6. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.\n7. `generate --type <type> \"<prompt>\"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement). `generate` waits for the asset and installs it \u2014 one command for quick types. For a long one (e.g. `humanoid-model`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run `market generate install <jobId>` to continue \u2014 it resumes the SAME job where the last call left off and installs when ready. Just re-run `generate install <jobId>` until it prints \"Generated and installed\" (it exits 0 while still generating, 1 on failure). No type is flagged \"slow\" \u2014 anything that outlasts one wait just continues on the next call.\n8. Use `pack <zip>` to create the same Market asset zip that `upload` sends. `pack` runs offline, infers template packing from a root `package.json`, and accepts `--type` only when you need to override that inference. `upload` runs the shared pack step internally, then publishes: `market upload <name> <zip> \"<description>\" --type <type>`. Declare dependencies with repeatable flags on either command: `--npm name@range`, `--asset name@range`, `--skill label=source`. Template pack/upload also reads root `package.json.assetDependencies`; `--asset` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match `.drawcall/market-lock.json`, so edited local files stay in the template. A skill source is a `skills add` argument: a whole repo (`owner/repo` or a git URL), a single skill via the full URL form `https://github.com/owner/repo/tree/<branch>/<subpath>` (the `tree/<branch>/<subpath>` shorthand needs the full URL, not `owner/repo`), or a local path to a skill directory inside the zip. Example: `market upload my-scene scene.zip \"A scene\" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines`.\n9. Installed `environment` assets contain `public/environment/<name>.hdr` for Three.js IBL lighting and `public/environment/<name>-background.webp` for the visible equirectangular background. Use `market preview` to fetch the preview image separately.\n10. Installed `flipbook` assets contain `public/flipbook/<name>.ktx2`. Render them with `@drawcall/flipbook`'s `Flipbook` class and Three.js `KTX2Loader` for Basis-compressed files; `market preview` fetches the middle frame from the flipbook.\n\n## Humanoid animations\n\n`humanoid-animation` assets are single-clip GLBs \u2014 one motion per asset (one idle, one walk-forward, one jump, one attack) on a normalized skeleton that retargets onto any humanoid, whatever its role. A behaving character is therefore a *set* of clips, not one asset: from what the character actually does, budget the clips it needs \u2014 an idle, its locomotion (walk/run, often split by direction: fwd/bwd/left/right), and one clip per distinct action and reaction it performs \u2014 then search for each separately.\n\n`humanoid-model` assets share that same normalized skeleton and are authored to a **consistent real-world scale** \u2014 they come in at roughly the same height as each other. So you do **not** need to rescale one humanoid to match another (player vs. enemy vs. NPC); dropped in as-is they already stand at a consistent size. Avoid the trap of measuring one character's height and scaling others to it \u2014 besides being unnecessary, measuring a rigged/animated character's bounding box is unreliable and produces giants (see the `math` skill on `Box3` and skinned meshes). If you ever do need a deliberate size difference (a boss, a child NPC), apply an explicit chosen multiplier, not a measured one.\n\nSearch one motion per query, named by the motion, because results rank by keyword overlap: a query naming several motions at once is dominated by whichever word matches the most assets and buries the others, so real clips look like a gap when they exist. Names describe the motion, not the character \u2014 so search the motion (`\"walk forward\"`, `\"reload\"`, `\"jump\"`), not the role (`\"player run\"`, `\"boss attack\"`). If a motion finds nothing, retry with synonyms (run/jog/sprint, attack/swing/strike).\n\n## Output\n\nCommands print concise, line-oriented summaries:\n\n```text\nResults: 2/8 query=\"wooden chair\" type=model approval=approved\n- wooden-chair@1.0.0 | model | approved | Low-poly wooden chair\nInstalled:\n- wooden-chair@1.0.0 (asset)\n description: Low-poly wooden chair\n files:\n public/model\n \u2514\u2500 wooden-chair.glb\n- three@^0.178.0 (npm)\n- web-design \u2190 https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines (skill)\nInstalled assets: 1\n- wooden-chair@1.0.0 (model)\n files:\n public/model\n \u2514\u2500 wooden-chair.glb\nSaved preview for wooden-chair@1.0.0: /tmp/wooden-chair.png\n```\n\nAssets may also declare `skill` dependencies, installed for you via the `skills` CLI (`skills add`) during `install`. Sources are either a GitHub/git ref or a local path to a skill directory shipped inside the asset. This requires `npx` to be available.\n\nInstalled non-template assets are saved to `package.json.assetDependencies`; templates are scaffolds and are not saved as project asset dependencies. Exact installed versions and file hashes are recorded in `.drawcall/market-lock.json`.\n\n`list` is offline: it reads `.drawcall/market-lock.json` from the nearest package root and prints exact installed names, versions, types, and installed file paths.\n\nIf search returns no results, try one broader noun phrase. If a command returns `Error: Not logged in...`, ask before running `market login`.\n";
//# sourceMappingURL=skill.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,qqOAqEvB,CAAA"}
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,yhQAsEvB,CAAA"}

@@ -17,2 +17,3 @@ export const marketSkill = `---

market preview wooden-chair --out /tmp/wooden-chair.png
market pack scene.zip --out scene.packed.zip
\`\`\`

@@ -28,4 +29,4 @@

6. Use \`--unapproved\` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
7. \`generate --type <type> "<prompt>"\` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are \`sound-effect\`, \`background-music\`, \`flipbook\`, \`humanoid-model\`, and \`environment\` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add \`--access public\` to publish the generated asset publicly, or \`--access private\` to keep it owner-only; when omitted the server defaults to private if you hold the \`market:private\` entitlement, else public (\`--access private\` requires that entitlement).
8. Upload only when publishing is requested: \`market upload <name> <zip> "<description>" --type <type>\`. Declare dependencies with repeatable flags: \`--npm name@range\`, \`--asset name@range\`, \`--skill label=source\`. Template uploads also read root \`package.json.assetDependencies\`; \`--asset\` flags are additive and must not conflict. Template upload omits installed dependency files whose hashes still match \`.drawcall/market-lock.json\`, so edited local files stay in the template. A skill source is a \`skills add\` argument: a whole repo (\`owner/repo\` or a git URL), a single skill via the full URL form \`https://github.com/owner/repo/tree/<branch>/<subpath>\` (the \`tree/<branch>/<subpath>\` shorthand needs the full URL, not \`owner/repo\`), or a local path to a skill directory inside the zip. Example: \`market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines\`.
7. \`generate --type <type> "<prompt>"\` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are \`sound-effect\`, \`background-music\`, \`flipbook\`, \`humanoid-model\`, and \`environment\` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add \`--access public\` to publish the generated asset publicly, or \`--access private\` to keep it owner-only; when omitted the server defaults to private if you hold the \`market:private\` entitlement, else public (\`--access private\` requires that entitlement). \`generate\` waits for the asset and installs it — one command for quick types. For a long one (e.g. \`humanoid-model\`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run \`market generate install <jobId>\` to continue — it resumes the SAME job where the last call left off and installs when ready. Just re-run \`generate install <jobId>\` until it prints "Generated and installed" (it exits 0 while still generating, 1 on failure). No type is flagged "slow" — anything that outlasts one wait just continues on the next call.
8. Use \`pack <zip>\` to create the same Market asset zip that \`upload\` sends. \`pack\` runs offline, infers template packing from a root \`package.json\`, and accepts \`--type\` only when you need to override that inference. \`upload\` runs the shared pack step internally, then publishes: \`market upload <name> <zip> "<description>" --type <type>\`. Declare dependencies with repeatable flags on either command: \`--npm name@range\`, \`--asset name@range\`, \`--skill label=source\`. Template pack/upload also reads root \`package.json.assetDependencies\`; \`--asset\` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match \`.drawcall/market-lock.json\`, so edited local files stay in the template. A skill source is a \`skills add\` argument: a whole repo (\`owner/repo\` or a git URL), a single skill via the full URL form \`https://github.com/owner/repo/tree/<branch>/<subpath>\` (the \`tree/<branch>/<subpath>\` shorthand needs the full URL, not \`owner/repo\`), or a local path to a skill directory inside the zip. Example: \`market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines\`.
9. Installed \`environment\` assets contain \`public/environment/<name>.hdr\` for Three.js IBL lighting and \`public/environment/<name>-background.webp\` for the visible equirectangular background. Use \`market preview\` to fetch the preview image separately.

@@ -32,0 +33,0 @@ 10. Installed \`flipbook\` assets contain \`public/flipbook/<name>.ktx2\`. Render them with \`@drawcall/flipbook\`'s \`Flipbook\` class and Three.js \`KTX2Loader\` for Basis-compressed files; \`market preview\` fetches the middle frame from the flipbook.

@@ -1,1 +0,1 @@

{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE1B,CAAA"}
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsE1B,CAAA"}
{
"name": "@drawcall/market",
"version": "0.1.49",
"version": "0.1.50",
"repository": {

@@ -39,3 +39,3 @@ "type": "git",

"dev": "tsx src/cli.ts",
"test:install-layout": "tsx --test tests/install-layout.test.ts tests/install-command.test.ts tests/list-command.test.ts",
"test:install-layout": "tsx --test tests/install-layout.test.ts tests/install-command.test.ts tests/list-command.test.ts tests/pack.test.ts",
"typecheck": "tsc --noEmit"

@@ -42,0 +42,0 @@ },

@@ -130,2 +130,3 @@ # @drawcall/market

npx @drawcall/market preview my-model # save the preview image
npx @drawcall/market pack ./my-model.zip --out ./my-model.packed.zip
npx @drawcall/market upload my-model ./my-model.zip "A robot" --type model

@@ -135,6 +136,8 @@ npx @drawcall/market login # device-authorization sign-in

Reads (`install`, `list`, `search`, `preview`) work without auth; `upload` and `generate` require `market login`. After an install, the CLI prints each asset's type-specific post-install note beneath that asset.
Reads (`install`, `list`, `search`, `preview`) work without auth; `pack` is offline; `upload` and `generate` require `market login`. After an install, the CLI prints each asset's type-specific post-install note beneath that asset.
`pack` creates the same asset zip that `upload` sends. It runs offline, infers template packing from a root `package.json`, and accepts `--type` only when you need to override that inference. `upload` calls the shared pack step internally, then publishes.
`list` is an offline local inventory command. It reads `.drawcall/market-lock.json` from the nearest package root and prints exact installed asset names, versions, types, and installed file paths.
Run `npx @drawcall/market skill` to print the agent workflow guidance, or `npx @drawcall/market --help` for the full command list.

@@ -17,2 +17,3 @@ ---

npx @drawcall/market preview wooden-chair --out /tmp/wooden-chair.png
npx @drawcall/market pack scene.zip --out scene.packed.zip
```

@@ -28,4 +29,4 @@

6. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
7. `generate --type <type> "<prompt>"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement).
8. Upload only when publishing is requested: `market upload <name> <zip> "<description>" --type <type>`. Declare dependencies with repeatable flags: `--npm name@range`, `--asset name@range`, `--skill label=source`. Use `--access public|private` to set visibility (same default rule as generate): a private asset is visible and installable only by you. Template uploads also read root `package.json.assetDependencies`; `--asset` flags are additive and must not conflict. Template upload omits installed dependency files whose hashes still match `.drawcall/market-lock.json`, so edited local files stay in the template. A skill source is a `skills add` argument: a whole repo (`owner/repo` or a git URL), a single skill via the full URL form `https://github.com/owner/repo/tree/<branch>/<subpath>` (the `tree/<branch>/<subpath>` shorthand needs the full URL, not `owner/repo`), or a local path to a skill directory inside the zip. Example: `market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines`.
7. `generate --type <type> "<prompt>"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement). `generate` waits for the asset and installs it — one command for quick types. For a long one (e.g. `humanoid-model`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run `market generate install <jobId>` to continue — it resumes the SAME job where the last call left off and installs when ready. Just re-run `generate install <jobId>` until it prints "Generated and installed" (it exits 0 while still generating, 1 on failure). No type is flagged "slow" — anything that outlasts one wait just continues on the next call.
8. Use `pack <zip>` to create the same Market asset zip that `upload` sends. `pack` runs offline, infers template packing from a root `package.json`, and accepts `--type` only when you need to override that inference. `upload` runs the shared pack step internally, then publishes: `market upload <name> <zip> "<description>" --type <type>`. Declare dependencies with repeatable flags on either command: `--npm name@range`, `--asset name@range`, `--skill label=source`. Use `--access public|private` on upload to set visibility (same default rule as generate): a private asset is visible and installable only by you. Template pack/upload also reads root `package.json.assetDependencies`; `--asset` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match `.drawcall/market-lock.json`, so edited local files stay in the template. A skill source is a `skills add` argument: a whole repo (`owner/repo` or a git URL), a single skill via the full URL form `https://github.com/owner/repo/tree/<branch>/<subpath>` (the `tree/<branch>/<subpath>` shorthand needs the full URL, not `owner/repo`), or a local path to a skill directory inside the zip. Example: `market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines`.
9. Installed `environment` assets contain `public/environment/<name>.hdr` for Three.js IBL lighting and `public/environment/<name>-background.webp` for the visible equirectangular background. Use `market preview` to fetch the preview image separately.

@@ -32,0 +33,0 @@ 10. Installed `flipbook` assets contain `public/flipbook/<name>.ktx2`. Render them with `@drawcall/flipbook`'s `Flipbook` class and Three.js `KTX2Loader` for Basis-compressed files; `market preview` fetches the middle frame from the flipbook.

@@ -13,3 +13,5 @@ #!/usr/bin/env node

import { generateCommand } from './commands/generate.js'
import { generateInstallCommand } from './commands/generate-install.js'
import { listCommand } from './commands/list.js'
import { packCommand } from './commands/pack.js'
import { previewCommand } from './commands/preview.js'

@@ -118,2 +120,35 @@ import { uploadCommand } from './commands/upload.js'

program
.command('pack')
.description('Create a Market asset zip using the same packaging step as upload')
.argument('<zip-filter>', '.zip path or glob')
.addOption(typeOption)
.option('--out <file>', 'Output zip path')
.option('--cwd <dir>', 'Project directory')
.option('--npm <dep>', 'npm dependency name@range (repeatable)', collect, [])
.option('--asset <dep>', 'asset dependency name@range (repeatable)', collect, [])
.option('--skill <dep>', 'skill dependency label=source (repeatable)', collect, [])
.action(
async (
zipFilter: string,
opts: {
type?: AssetType
out?: string
cwd?: string
npm: string[]
asset: string[]
skill: string[]
},
) => {
await packCommand(zipFilter, {
type: opts.type,
out: opts.out,
cwd: opts.cwd,
npm: opts.npm,
asset: opts.asset,
skill: opts.skill,
})
},
)
program
.command('search')

@@ -216,6 +251,6 @@ .description('Find assets')

program
const generate = program
.command('generate')
.description('Generate and install')
.argument('<description>', 'Asset prompt')
.description('Generate and install an asset, or check a generation job')
.argument('[description]', 'Asset prompt (omit when using a subcommand)')
.addOption(typeOption)

@@ -227,5 +262,9 @@ .addOption(apiOption)

async (
description: string,
description: string | undefined,
opts: { type?: AssetType; api?: string; cwd?: string; access?: AssetAccess },
) => {
if (!description) {
generate.help({ error: true })
return
}
requireType(opts.type, 'Generate')

@@ -241,2 +280,20 @@ await generateCommand(description, {

// `generate install <jobId>` finishes a slow (job-based) generation: it checks the job once and, when
// it has completed, installs the produced asset into the project. Still running → prints a note and
// exits 0 (run again later); failed → exits 1. Fast asset types never need this — `generate` installs
// them inline. ("install" over "status": the command's job is to integrate the asset, not just report.)
generate
.command('install')
.description('Install the asset from a generation job once it has completed')
.argument('<jobId>', 'Job id printed by `market generate`')
.addOption(apiOption)
.option('--cwd <dir>', 'Project directory')
// Read merged options: `--cwd`/`--api` after `generate install` are otherwise captured by the
// parent `generate` command (which declares the same options), leaving this subcommand's own opts
// undefined. `optsWithGlobals()` surfaces whichever level parsed them.
.action(async (jobId: string, _options, command: Command) => {
const { api, cwd } = command.optsWithGlobals()
await generateInstallCommand(jobId, { baseUrl: api, cwd })
})
if (process.argv.length <= 2) {

@@ -243,0 +300,0 @@ program.outputHelp()

@@ -7,3 +7,3 @@ import { readFile } from 'node:fs/promises'

import { assetVersionRef } from '../output.js'
import type { AgentResult } from '../index.js'
import type { AgentResult } from '../schemas.js'

@@ -10,0 +10,0 @@ export interface AgentCommandOptions {

@@ -1,7 +0,8 @@

import ora from 'ora'
import ora, { type Ora } from 'ora'
import { getCliClient } from '../cli-client.js'
import { generateAndWait } from '../generate.js'
import { GenerateError, startGeneration, waitForGeneration, type PollOutcome } from '../generate.js'
import type { MarketClient } from '../client.js'
import { resolve } from '../resolve.js'
import { install as runInstall } from '../install.js'
import { generatedInstallResult } from '../output.js'
import { generatedInstallResult, generationStartedResult } from '../output.js'
import type { AssetAccess, AssetType } from '../schemas.js'

@@ -21,34 +22,27 @@

const { client, baseUrl } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true })
const spinner = ora({
text: `Generating "${description}"`,
isEnabled: Boolean(process.stderr.isTTY),
isSilent: !process.stderr.isTTY,
}).start()
const spinner = startSpinner(`Generating "${description}"`)
try {
const generated = await generateAndWait(
client,
{ description, type: opts.type, access: opts.access },
{
onProgress: (msg) => {
spinner.text = msg
},
const started = await startGeneration(client, {
description,
type: opts.type,
access: opts.access,
})
// Fast providers finish inline; slow, job-based ones return a job to poll.
if (started.status === 'completed') {
await installGenerated(client, started, { cwd: opts.cwd, baseUrl, spinner })
return
}
// Block-and-poll for a bounded window (the command waits, not the agent). If the job outlasts the
// window, hand back its id so the caller continues with `generate install`.
const outcome = await waitForGeneration(client, started.jobId, {
onProgress: (message) => {
spinner.text = message
},
)
spinner.text = `Resolving ${generated.assetName}@${generated.version}`
const resolution = await resolve(client.asset, [
{ name: generated.assetName, range: generated.version },
])
await runInstall(client, resolution, {
})
await finishGeneration(client, outcome, {
cwd: opts.cwd,
baseUrl,
onProgress: (msg) => {
spinner.text = msg
},
spinner,
stillRunning: generationStartedResult(started.jobId),
})
spinner.stop()
console.log(generatedInstallResult(generated.assetName, generated.version))
} catch (err) {

@@ -59,1 +53,54 @@ spinner.stop()

}
interface InstallContext {
cwd?: string
baseUrl: string
spinner: Ora
}
// Finish a poll outcome: install on completion, fail loudly on error, or print the still-running note
// (the job keeps running server-side). Shared by `generate` and `generate install`.
export async function finishGeneration(
client: MarketClient,
outcome: PollOutcome,
ctx: InstallContext & { stillRunning: string },
): Promise<void> {
if (outcome.status === 'completed') {
await installGenerated(client, outcome, ctx)
return
}
ctx.spinner.stop()
if (outcome.status === 'failed') {
throw new GenerateError(outcome.error)
}
console.log(ctx.stillRunning)
}
// Install a finished generation into the project and report it.
async function installGenerated(
client: MarketClient,
generated: { assetName: string; version: string },
ctx: InstallContext,
): Promise<void> {
ctx.spinner.text = `Resolving ${generated.assetName}@${generated.version}`
const resolution = await resolve(client.asset, [
{ name: generated.assetName, range: generated.version },
])
await runInstall(client, resolution, {
cwd: ctx.cwd,
baseUrl: ctx.baseUrl,
onProgress: (message) => {
ctx.spinner.text = message
},
})
ctx.spinner.stop()
console.log(generatedInstallResult(generated.assetName, generated.version))
}
export function startSpinner(text: string): Ora {
return ora({
text,
isEnabled: Boolean(process.stderr.isTTY),
isSilent: !process.stderr.isTTY,
}).start()
}

@@ -1,14 +0,5 @@

import * as fs from 'fs/promises'
import * as path from 'path'
import { unzipSync, zipSync } from 'fflate'
import ora from 'ora'
import semver from 'semver'
import { getCliClient } from '../cli-client.js'
import { findInstallRoot } from '../install.js'
import { readMarketLock, sha256 } from '../market-lock.js'
import {
packageJsonAssetDependenciesFromFiles,
packageJsonNpmDependenciesFromFiles,
} from '../package-json.js'
import { MAX_ASSET_DESCRIPTION_LENGTH, MAX_UPLOAD_ZIP_SIZE_BYTES } from '../schemas.js'
import { packAsset, packPolicyFromInstallMetadata, parsePackDependencies } from '../pack.js'
import { unchangedUploadResult, uploadResult } from '../output.js'

@@ -19,2 +10,3 @@ import {

semverSchema,
MAX_ASSET_DESCRIPTION_LENGTH,
type AssetAccess,

@@ -56,33 +48,17 @@ type AssetType,

// Parse dep flags before any network work so a malformed spec fails fast.
const explicitNpmDependencies = parseVersionedDeps(opts.npm ?? [], 'npm')
const explicitAssetDependencies = parseVersionedDeps(opts.asset ?? [], 'asset')
const skillDependencies = parseSkillDeps(opts.skill ?? [])
const dependencies = parsePackDependencies({
npm: opts.npm,
asset: opts.asset,
skill: opts.skill,
})
const cwd = opts.cwd ?? process.cwd()
const type = opts.type
const zipFile = await resolveOneZipFile(cwd, zipFilter)
const zipStat = await fs.stat(zipFile)
if (zipStat.size >= MAX_UPLOAD_ZIP_SIZE_BYTES) {
throw new Error('Upload zip must be smaller than 1 GB')
}
const sourceZip = new Uint8Array(await fs.readFile(zipFile))
const { client } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true })
const installMetadata = await client.asset.installMetadata()
const typeMetadata = installMetadata[type]
const sourceFiles = unzipSync(sourceZip)
const packageJsonAssetDependencies = typeMetadata?.readAssetDependenciesFromPackageJson
? packageJsonAssetDependenciesFromFiles(sourceFiles)
: {}
const assetDependencies = mergeAssetDependencies(
packageJsonAssetDependencies,
explicitAssetDependencies,
)
// A type that ships a package.json (templates) also carries its npm dependencies there; capture
// them so an install over an existing package.json brings them. Explicit --npm wins on conflict.
const packageJsonNpmDependencies = typeMetadata?.readAssetDependenciesFromPackageJson
? packageJsonNpmDependenciesFromFiles(sourceFiles)
: {}
const npmDependencies = { ...packageJsonNpmDependencies, ...explicitNpmDependencies }
const zip = typeMetadata?.omitUnchangedInstalledFilesOnUpload
? await omitUnchangedInstalledFiles(sourceZip, sourceFiles, assetDependencies, cwd)
: sourceZip
const packed = await packAsset(zipFilter, {
cwd,
dependencies,
policy: packPolicyFromInstallMetadata(installMetadata[type]),
})
const { zip, npmDependencies, assetDependencies, skillDependencies } = packed
const profile = await client.user.getProfile()

@@ -156,114 +132,2 @@ if (!profile) {

/**
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
* range is optional and defaults to `*`. A leading `@` is treated as a scope
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
*/
export function parseVersionedDeps(specs: string[], kind: 'npm' | 'asset'): Record<string, string> {
const out: Record<string, string> = {}
for (const spec of specs) {
const at = spec.lastIndexOf('@')
const hasRange = at > 0
const name = hasRange ? spec.slice(0, at) : spec
const range = hasRange ? spec.slice(at + 1) : '*'
if (!name || !range) {
throw new Error(`Invalid ${kind} dependency "${spec}". Use name@range (e.g. three@^0.178.0).`)
}
if (name in out) {
throw new Error(`Duplicate ${kind} dependency "${name}".`)
}
out[name] = range
}
return out
}
/**
* Parse `label=source` specs into a label→source record. The source is passed
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
* first `=` is treated as the separator.
*/
export function parseSkillDeps(specs: string[]): Record<string, string> {
const out: Record<string, string> = {}
for (const spec of specs) {
const eq = spec.indexOf('=')
if (eq <= 0 || eq === spec.length - 1) {
throw new Error(
`Invalid skill dependency "${spec}". Use label=source ` +
`(e.g. web-design=vercel-labs/agent-skills).`,
)
}
const label = spec.slice(0, eq)
if (label in out) {
throw new Error(`Duplicate skill dependency "${label}".`)
}
out[label] = spec.slice(eq + 1)
}
return out
}
function mergeAssetDependencies(
fromPackageJson: Record<string, string>,
explicit: Record<string, string>,
): Record<string, string> {
const merged = { ...fromPackageJson }
for (const [name, range] of Object.entries(explicit)) {
if (name in merged && merged[name] !== range) {
throw new Error(
`Conflicting asset dependency "${name}": package.json has ${merged[name]}, --asset has ${range}`,
)
}
merged[name] = range
}
return merged
}
async function omitUnchangedInstalledFiles(
sourceZip: Uint8Array,
sourceFiles: Record<string, Uint8Array>,
assetDependencies: Record<string, string>,
cwd: string,
): Promise<Uint8Array> {
const dependencyNames = new Set(Object.keys(assetDependencies))
if (dependencyNames.size === 0) return sourceZip
const installRoot = await findInstallRoot(cwd)
const lock = await readMarketLock(installRoot)
const hashesByPath = new Map<string, string>()
for (const [name, asset] of Object.entries(lock.assets)) {
if (!dependencyNames.has(name)) continue
for (const [file, metadata] of Object.entries(asset.files)) {
hashesByPath.set(file, metadata.sha256)
}
}
if (hashesByPath.size === 0) return sourceZip
let omitted = false
const filtered: Record<string, Uint8Array> = {}
for (const [file, content] of Object.entries(sourceFiles)) {
const normalizedPath = normalizedZipPath(file)
const lockedHash = normalizedPath ? hashesByPath.get(normalizedPath) : undefined
if (lockedHash && lockedHash === sha256(content)) {
omitted = true
continue
}
filtered[file] = content
}
return omitted ? zipSync(filtered) : sourceZip
}
function normalizedZipPath(file: string): string | null {
const zipPath = file.replace(/\\/g, '/')
if (
zipPath.split('/').includes('..') ||
path.posix.isAbsolute(zipPath) ||
path.win32.isAbsolute(zipPath)
) {
return null
}
return path.posix.normalize(zipPath)
}
/** Compare a stored dependency JSON string against a freshly parsed record. */

@@ -281,67 +145,2 @@ function depsEqual(storedJson: string, next: Record<string, string>): boolean {

async function resolveOneZipFile(cwd: string, zipFilter: string): Promise<string> {
const absolute = path.resolve(cwd, zipFilter)
const stat = await maybeStat(absolute)
if (stat?.isFile()) return assertZipFile(absolute)
const files = await listFiles(cwd)
const matches = files
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
.filter(isZipFile)
.sort()
if (matches.length === 0) {
throw new Error(`No .zip files matched "${zipFilter}"`)
}
if (matches.length > 1) {
throw new Error(`File filter matched ${matches.length} zips; upload one asset at a time`)
}
return matches[0]
}
function assertZipFile(file: string): string {
if (!isZipFile(file)) throw new Error(`Upload file must be a .zip: ${file}`)
return file
}
function isZipFile(file: string): boolean {
return /\.zip$/i.test(file)
}
async function maybeStat(file: string) {
try {
return await fs.stat(file)
} catch {
return null
}
}
async function listFiles(dir: string): Promise<string[]> {
const entries = await fs.readdir(dir, { withFileTypes: true })
const files: string[] = []
for (const entry of entries) {
if (entry.name === 'node_modules' || entry.name === '.git') continue
const fullPath = path.join(dir, entry.name)
if (entry.isDirectory()) {
files.push(...(await listFiles(fullPath)))
} else if (entry.isFile()) {
files.push(fullPath)
}
}
return files
}
function matchesFilter(file: string, filter: string): boolean {
const normalizedFile = file.split(path.sep).join('/')
const normalizedFilter = filter.split(path.sep).join('/')
const pattern =
'^' +
escapeRegExp(normalizedFilter)
.replace(/\\\*\\\*/g, '.*')
.replace(/\\\*/g, '[^/]*') +
'$'
return new RegExp(pattern).test(normalizedFile)
}
function nextVersion(latest?: string): string {

@@ -363,7 +162,3 @@ if (!latest) return '1.0.0'

function toArrayBuffer(bytes: Uint8Array): ArrayBuffer {
return new Uint8Array(bytes).buffer
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer
}
function escapeRegExp(value: string): string {
return value.replace(/[|\\{}()[\]^$+?.*]/g, '\\$&')
}
import type { MarketClient } from './client.js'
import type { AssetAccess, AssetType } from './schemas.js'
import type { AssetAccess, AssetType, GenerateJobStatus, GenerateResponse } from './schemas.js'

@@ -18,45 +18,57 @@ export class GenerateError extends Error {

export interface GenerateResult {
assetName: string
version: string
// How often the CLI polls a running job.
const POLL_INTERVAL_MS = 4_000
// How long one `generate` / `generate install` call blocks-and-polls before handing back control.
// The command does the waiting (the agent never sleeps between checks). When the window elapses the
// call returns and the caller just runs `generate install <jobId>` again, which picks up the SAME
// server-side job where this left off — so no asset type needs to be flagged "slow" ahead of time;
// anything that outlasts one window simply continues on the next call.
const WINDOW_MS = 120_000
// Start a generation. Fast providers answer `completed` inline; slow, job-based providers answer
// `pending` with a jobId to poll (see `waitForGeneration` / `generate install`).
export function startGeneration(
client: MarketClient,
input: GenerateInput,
): Promise<GenerateResponse> {
return client.asset.generate(input)
}
export interface GenerateOptions {
onProgress?: (message: string) => void
// One poll of a generation job.
export function pollGeneration(client: MarketClient, jobId: string): Promise<GenerateJobStatus> {
return client.asset.generateStatus({ jobId })
}
// Poll cadence for a job-based generation. Each poll is a short, independently-retriable request;
// the client sleeps between them, so no single request is held open for the length of the job (that
// is exactly the client/proxy-timeout trap the async flow removes). The deadline sits above the
// slowest provider's own budget (the humanoid model's upstream job runs up to ~10 min).
const POLL_INTERVAL_MS = 4_000
const POLL_DEADLINE_MS = 15 * 60_000
// The bounded outcome of waiting on a job: it settled (completed/failed), or the window elapsed while
// it was still running.
export type PollOutcome =
| { status: 'completed'; assetName: string; version: string }
| { status: 'failed'; error: string }
| { status: 'running' }
export async function generateAndWait(
// Poll a job until it settles or `windowMs` elapses. Bounded so a single call stays under a harness
// timeout; on timeout it returns `running` (the job keeps going server-side — run again to continue).
export async function waitForGeneration(
client: MarketClient,
input: GenerateInput,
opts: GenerateOptions = {},
): Promise<GenerateResult> {
jobId: string,
opts: { windowMs?: number; onProgress?: (message: string) => void } = {},
): Promise<PollOutcome> {
const windowMs = opts.windowMs ?? WINDOW_MS
const report = opts.onProgress ?? (() => {})
report('Generating asset')
const started = await client.asset.generate(input)
if (started.status === 'completed') {
return { assetName: started.assetName, version: started.version }
}
const startedAt = Date.now()
for (;;) {
if (Date.now() - startedAt > POLL_DEADLINE_MS) {
throw new GenerateError('Generation timed out.')
}
await delay(POLL_INTERVAL_MS)
report('Generating asset')
const status = await client.asset.generateStatus({ jobId: started.jobId })
const status = await pollGeneration(client, jobId)
if (status.status === 'completed') {
return { assetName: status.assetName, version: status.version }
return { status: 'completed', assetName: status.assetName, version: status.version }
}
if (status.status === 'failed') {
throw new GenerateError(status.error)
return { status: 'failed', error: status.error }
}
const remaining = windowMs - (Date.now() - startedAt)
if (remaining <= 0) {
return { status: 'running' }
}
report('Generating asset')
// Trim the last sleep so the call returns as soon as the window passes, not a poll-interval later.
await delay(Math.min(POLL_INTERVAL_MS, remaining))
}

@@ -63,0 +75,0 @@ }

@@ -43,4 +43,4 @@ // Client

// Generate
export { generateAndWait, GenerateError } from './generate.js'
export type { GenerateInput, GenerateResult, GenerateOptions } from './generate.js'
export { startGeneration, pollGeneration, GenerateError } from './generate.js'
export type { GenerateInput } from './generate.js'

@@ -47,0 +47,0 @@ // Agent

import type { AssetInstallMetadata, AssetSearchResult } from './contract.js'
import type { ListInstalledAssetsResult } from './commands/list.js'
import type { InstallResult } from './install.js'
import type { PackedAsset } from './pack.js'

@@ -128,2 +129,16 @@ export function assetVersionRef(name: string, version?: string): string {

// Printed when `generate` returns before the job finished: it keeps running server-side and the
// caller continues it with `generate install`, which installs the asset once it is ready.
export function generationStartedResult(jobId: string): string {
return [
'Still generating after a couple of minutes — it continues in the background.',
`Run this to pick up where it left off and install when ready: market generate install ${jobId}`,
].join('\n')
}
// Printed by `generate install` when the job is still running after its wait window.
export function generationRunningResult(jobId: string): string {
return `Still generating. Run again to continue: market generate install ${jobId}`
}
export function uploadResult(name: string, version: string): string {

@@ -137,2 +152,13 @@ return `Uploaded ${assetVersionRef(name, version)}`

export function packResult(out: string, packed: PackedAsset): string {
const lines = [`Packed: ${out}`]
if (packed.omittedUnchangedInstalledFiles) {
lines.push('Omitted unchanged installed dependency files.')
}
lines.push(...dependencyLines('npm dependencies', packed.npmDependencies))
lines.push(...dependencyLines('asset dependencies', packed.assetDependencies))
lines.push(...dependencyLines('skill dependencies', packed.skillDependencies))
return lines.join('\n')
}
export function previewResult(name: string, version: string, out: string): string {

@@ -209,1 +235,10 @@ return `Saved preview for ${assetVersionRef(name, version)}: ${out}`

}
function dependencyLines(label: string, deps: Record<string, string>): string[] {
const entries = Object.entries(deps)
if (entries.length === 0) return []
return [
`${label}:`,
...entries.sort(([a], [b]) => a.localeCompare(b)).map(([name, value]) => `- ${name}: ${value}`),
]
}

@@ -17,2 +17,3 @@ export const marketSkill = `---

market preview wooden-chair --out /tmp/wooden-chair.png
market pack scene.zip --out scene.packed.zip
\`\`\`

@@ -28,4 +29,4 @@

6. Use \`--unapproved\` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
7. \`generate --type <type> "<prompt>"\` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are \`sound-effect\`, \`background-music\`, \`flipbook\`, \`humanoid-model\`, and \`environment\` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add \`--access public\` to publish the generated asset publicly, or \`--access private\` to keep it owner-only; when omitted the server defaults to private if you hold the \`market:private\` entitlement, else public (\`--access private\` requires that entitlement).
8. Upload only when publishing is requested: \`market upload <name> <zip> "<description>" --type <type>\`. Declare dependencies with repeatable flags: \`--npm name@range\`, \`--asset name@range\`, \`--skill label=source\`. Template uploads also read root \`package.json.assetDependencies\`; \`--asset\` flags are additive and must not conflict. Template upload omits installed dependency files whose hashes still match \`.drawcall/market-lock.json\`, so edited local files stay in the template. A skill source is a \`skills add\` argument: a whole repo (\`owner/repo\` or a git URL), a single skill via the full URL form \`https://github.com/owner/repo/tree/<branch>/<subpath>\` (the \`tree/<branch>/<subpath>\` shorthand needs the full URL, not \`owner/repo\`), or a local path to a skill directory inside the zip. Example: \`market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines\`.
7. \`generate --type <type> "<prompt>"\` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are \`sound-effect\`, \`background-music\`, \`flipbook\`, \`humanoid-model\`, and \`environment\` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add \`--access public\` to publish the generated asset publicly, or \`--access private\` to keep it owner-only; when omitted the server defaults to private if you hold the \`market:private\` entitlement, else public (\`--access private\` requires that entitlement). \`generate\` waits for the asset and installs it — one command for quick types. For a long one (e.g. \`humanoid-model\`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run \`market generate install <jobId>\` to continue — it resumes the SAME job where the last call left off and installs when ready. Just re-run \`generate install <jobId>\` until it prints "Generated and installed" (it exits 0 while still generating, 1 on failure). No type is flagged "slow" — anything that outlasts one wait just continues on the next call.
8. Use \`pack <zip>\` to create the same Market asset zip that \`upload\` sends. \`pack\` runs offline, infers template packing from a root \`package.json\`, and accepts \`--type\` only when you need to override that inference. \`upload\` runs the shared pack step internally, then publishes: \`market upload <name> <zip> "<description>" --type <type>\`. Declare dependencies with repeatable flags on either command: \`--npm name@range\`, \`--asset name@range\`, \`--skill label=source\`. Template pack/upload also reads root \`package.json.assetDependencies\`; \`--asset\` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match \`.drawcall/market-lock.json\`, so edited local files stay in the template. A skill source is a \`skills add\` argument: a whole repo (\`owner/repo\` or a git URL), a single skill via the full URL form \`https://github.com/owner/repo/tree/<branch>/<subpath>\` (the \`tree/<branch>/<subpath>\` shorthand needs the full URL, not \`owner/repo\`), or a local path to a skill directory inside the zip. Example: \`market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines\`.
9. Installed \`environment\` assets contain \`public/environment/<name>.hdr\` for Three.js IBL lighting and \`public/environment/<name>-background.webp\` for the visible equirectangular background. Use \`market preview\` to fetch the preview image separately.

@@ -32,0 +33,0 @@ 10. Installed \`flipbook\` assets contain \`public/flipbook/<name>.ktx2\`. Render them with \`@drawcall/flipbook\`'s \`Flipbook\` class and Three.js \`KTX2Loader\` for Basis-compressed files; \`market preview\` fetches the middle frame from the flipbook.