@drawcall/market 0.9.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -12
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -1
- package/dist/auth.js.map +1 -1
- package/dist/cli-client.d.ts +6 -0
- package/dist/cli-client.d.ts.map +1 -1
- package/dist/cli-client.js +7 -2
- package/dist/cli-client.js.map +1 -1
- package/dist/commands/agent.js +1 -1
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/install.d.ts +2 -2
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +24 -6
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/reference-images.d.ts.map +1 -1
- package/dist/commands/reference-images.js +2 -1
- package/dist/commands/reference-images.js.map +1 -1
- package/dist/commands/upload.js +1 -1
- package/dist/commands/upload.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -3
- package/dist/config.js.map +1 -1
- package/dist/install-entry.d.ts +1 -1
- package/dist/install-entry.d.ts.map +1 -1
- package/dist/install.d.ts +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/installation-id.d.ts +4 -0
- package/dist/installation-id.d.ts.map +1 -0
- package/dist/installation-id.js +39 -0
- package/dist/installation-id.js.map +1 -0
- package/dist/mcp/agent.d.ts.map +1 -1
- package/dist/mcp/agent.js +2 -13
- package/dist/mcp/agent.js.map +1 -1
- package/dist/mcp/asset.d.ts.map +1 -1
- package/dist/mcp/asset.js +73 -29
- package/dist/mcp/asset.js.map +1 -1
- package/dist/mcp/generation.d.ts.map +1 -1
- package/dist/mcp/generation.js +31 -3
- package/dist/mcp/generation.js.map +1 -1
- package/dist/output.js +1 -1
- package/dist/output.js.map +1 -1
- package/dist/pack.d.ts +1 -1
- package/dist/pack.js +1 -1
- package/dist/skill.generated.d.ts +2 -2
- package/dist/skill.generated.d.ts.map +1 -1
- package/dist/skill.generated.js +2 -2
- package/dist/skill.generated.js.map +1 -1
- package/dist/v1/client.d.ts +5 -0
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +10 -1
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/contract.d.ts +22 -0
- package/dist/v1/contract.d.ts.map +1 -1
- package/dist/v1/contract.js +15 -0
- package/dist/v1/contract.js.map +1 -1
- package/package.json +1 -1
- package/skills/market/SKILL.md +10 -10
- package/src/auth.ts +2 -1
- package/src/cli-client.ts +15 -2
- package/src/commands/agent.ts +3 -1
- package/src/commands/install.ts +34 -6
- package/src/commands/reference-images.ts +2 -1
- package/src/commands/upload.ts +1 -1
- package/src/config.ts +3 -3
- package/src/install-entry.ts +1 -1
- package/src/install.ts +1 -1
- package/src/installation-id.ts +44 -0
- package/src/mcp/agent.ts +3 -19
- package/src/mcp/asset.ts +86 -31
- package/src/mcp/generation.ts +32 -3
- package/src/output.ts +1 -1
- package/src/pack.ts +1 -1
- package/src/skill.generated.ts +2 -2
- package/src/v1/client.ts +12 -1
- package/src/v1/contract.ts +17 -0
package/src/skill.generated.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated from skill/SKILL.template.md.
|
|
2
2
|
export const cliMarketSkill =
|
|
3
|
-
'---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## CLI transport\n\nRun commands as `npx
|
|
3
|
+
'---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## CLI transport\n\nRun commands as `npx drawcall market <command>`; do not assume a global `market` binary or switch to MCP after a CLI failure. Use `npx drawcall market skill` when these instructions are not already available.\n\nDiscover the current vocabulary and choose an asset:\n\n```sh\nnpx drawcall market types\nnpx drawcall market search "<query>" --type <type> --limit 3\nnpx drawcall market preview <name@version> --out /tmp/<name>.png\nnpx drawcall market urls <name@version>\n```\n\n`urls` prints one base URL, file subpaths, and a preview URL without changing the project. Install exact refs together when the project needs local files:\n\n```sh\nnpx drawcall market install <name@range...> --cwd "$PWD"\n```\n\nInstall records `assetDependencies` in the nearest `package.json`. `list --cwd "$PWD"` reads that inventory without network access. Run `sync --cwd "$PWD"` after moving installed files so aliases continue to resolve. Use `--force` only with permission to overwrite changed files.\n\nGenerate and install one asset with:\n\n```sh\nnpx drawcall market generate --type <type> "<description>"\n```\n\nIf it returns a continuation, run the printed `generate install <jobId>` command. The Market agent can source a coherent set of assets from a broader goal:\n\n```sh\nnpx drawcall market agent "<goal>"\n```\n\nPublish only when asked. `pack <source> --out <zip>` creates a Market archive and `upload <name> <source> "<description>" --type <type>` publishes it. Use command help for dependency and visibility options. If authentication is required, ask before running `npx drawcall auth login`.\n\n## Choose assets\n\nSearch one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.\n\nThe exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.\n\nPreview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.\n\n## Generate\n\nGeneration creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.\n\nReference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.\n\nA generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.\n\nTreat visibility as a publication decision. Choose public only when the user explicitly approves publication; choose private when the asset should remain owner-only. Private generation requires the account\'s `market:private` entitlement.\n\n## Failures\n\nAn error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.\n'
|
|
4
4
|
export const mcpMarketSkill =
|
|
5
|
-
"---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## MCP transport\n\nMCP tools are the only Market transport in this environment. Do not invoke the CLI, make direct API requests, or switch transports after a failed call.\n\nUse the same conceptual workflow as the Market CLI:\n\n```text\nlist_market_asset_types\nsearch_market\nget_market_asset\nget_market_asset_preview\n```\n\n`search_market` requires an asset type and returns exact `name@version` references. Inspect the exact manifest with `get_market_asset`; request its preview only when visual evidence matters. Remote MCP tools return immutable references and
|
|
5
|
+
"---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## MCP transport\n\nMCP tools are the only Market transport in this environment. Do not invoke the CLI, make direct API requests, or switch transports after a failed call.\n\nUse the same conceptual workflow as the Market CLI:\n\n```text\nlist_market_asset_types\nsearch_market\nget_market_asset\nget_market_asset_preview\n```\n\n`search_market` requires an asset type and returns exact `name@version` references. Inspect the exact manifest with `get_market_asset`; request its preview only when visual evidence matters. Remote MCP tools return immutable references and public URLs, but keep restricted capability-bearing URLs server-side. They do not install files into the caller's local project.\n\nWhen generation is available, call `generate_market_asset` only after the user chooses public or private visibility. Public generation also requires the user's explicit consent to publish. If it returns a `jobId`, continue with `get_market_asset_generation`. Do not start the same generation again.\n\nMCP cannot start Market agent runs until the Market API supports explicit output visibility. When status access is available, `get_market_agent_run` may resume an existing run by ID.\n\nUse an exact Market reference with `create_design_frame` when the selected asset belongs in Drawcall Design.\n\n## Choose assets\n\nSearch one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.\n\nThe exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.\n\nPreview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.\n\n## Generate\n\nGeneration creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.\n\nReference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.\n\nA generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.\n\nTreat visibility as a publication decision. Choose public only when the user explicitly approves publication; choose private when the asset should remain owner-only. Private generation requires the account's `market:private` entitlement.\n\n## Failures\n\nAn error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.\n"
|
package/src/v1/client.ts
CHANGED
|
@@ -20,6 +20,11 @@ export interface MarketV1ClientOptions {
|
|
|
20
20
|
baseUrl?: string
|
|
21
21
|
fetch?: typeof globalThis.fetch
|
|
22
22
|
authToken?: string
|
|
23
|
+
source?: {
|
|
24
|
+
surface: 'cli' | 'mcp' | 'sdk' | 'web'
|
|
25
|
+
distinctId?: string
|
|
26
|
+
analyticsDisabled?: boolean
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -54,10 +59,16 @@ function resilientReads(baseFetch: typeof globalThis.fetch): typeof globalThis.f
|
|
|
54
59
|
* they are curl-able, shareable and cacheable.
|
|
55
60
|
*/
|
|
56
61
|
export function createClient(opts: MarketV1ClientOptions = {}): MarketV1Client {
|
|
62
|
+
const headers: Record<string, string> = {}
|
|
63
|
+
if (opts.authToken) headers.authorization = `Bearer ${opts.authToken}`
|
|
64
|
+
if (opts.source) headers['x-market-surface'] = opts.source.surface
|
|
65
|
+
if (opts.source?.distinctId) headers['x-posthog-distinct-id'] = opts.source.distinctId
|
|
66
|
+
if (opts.source?.analyticsDisabled) headers['x-market-analytics-disabled'] = 'true'
|
|
67
|
+
|
|
57
68
|
const link = new OpenAPILink(contract, {
|
|
58
69
|
url: new URL('/api/v1', opts.baseUrl ?? DEFAULT_BASE_URL).href,
|
|
59
70
|
fetch: resilientReads(opts.fetch ?? ((input, init) => globalThis.fetch(input, init))),
|
|
60
|
-
headers
|
|
71
|
+
headers,
|
|
61
72
|
})
|
|
62
73
|
return createORPCClient<MarketV1Client>(link)
|
|
63
74
|
}
|
package/src/v1/contract.ts
CHANGED
|
@@ -64,6 +64,16 @@ export interface AssetQueryResult {
|
|
|
64
64
|
assets: AssetSearchResult[]
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
export const installReceiptSchema = z.object({
|
|
68
|
+
assetCount: z.number().int().nonnegative(),
|
|
69
|
+
assetTypes: z.array(z.string().min(1).max(64)).max(64),
|
|
70
|
+
fileCount: z.number().int().nonnegative(),
|
|
71
|
+
npmDependencyCount: z.number().int().nonnegative(),
|
|
72
|
+
redirectedFileCount: z.number().int().nonnegative(),
|
|
73
|
+
skillDependencyCount: z.number().int().nonnegative(),
|
|
74
|
+
warningCount: z.number().int().nonnegative(),
|
|
75
|
+
})
|
|
76
|
+
|
|
67
77
|
/**
|
|
68
78
|
* The v1 contract: the same procedure tree as the legacy RPC surface (so call sites migrate by
|
|
69
79
|
* swapping only the client), with HTTP routes attached — served as plain REST under `/api/v1`.
|
|
@@ -122,6 +132,13 @@ export const contract = {
|
|
|
122
132
|
},
|
|
123
133
|
},
|
|
124
134
|
|
|
135
|
+
installation: {
|
|
136
|
+
complete: oc
|
|
137
|
+
.route({ method: 'POST', path: '/installs' })
|
|
138
|
+
.input(installReceiptSchema)
|
|
139
|
+
.output(z.object({ accepted: z.literal(true) })),
|
|
140
|
+
},
|
|
141
|
+
|
|
125
142
|
user: {
|
|
126
143
|
getProfile: oc.route({ method: 'GET', path: '/me' }).output(z.custom<User | null>()),
|
|
127
144
|
|