image-skill 0.1.22 → 0.1.23

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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ This changelog tracks the public `image-skill` CLI package and public skill
4
4
  mirror. The npm package metadata remains the authority for tarball integrity and
5
5
  provenance; this file is the human- and agent-readable release map.
6
6
 
7
+ ## 0.1.23 - 2026-06-02
8
+
9
+ - Fix (guide payments): `create --guide` now distinguishes browserless,
10
+ agent-payable, and human-handoff payment rails instead of collapsing the
11
+ payment summary into a single browser-required flag. When the hosted catalog
12
+ exposes `stripe_x402.exact.usdc` as available and browserless, the guide marks
13
+ it as the preferred method and puts the x402 quote/buy/status commands before
14
+ the Stripe Checkout fallback.
15
+ - Fix (quota recovery): when an authenticated agent has no remaining credits,
16
+ guide mode now points `data.next_command` at the preferred credit quote command
17
+ instead of the generic `credits methods` inspection command.
18
+
7
19
  ## 0.1.22 - 2026-06-02
8
20
 
9
21
  - Fix (guide): `create --guide` now reports `cost.estimated_usd_per_image` as
@@ -7,7 +7,7 @@ import { Readable } from "node:stream";
7
7
  import { pipeline } from "node:stream/promises";
8
8
  import os from "node:os";
9
9
 
10
- const VERSION = "0.1.22";
10
+ const VERSION = "0.1.23";
11
11
  const PACKAGE_NAME = "image-skill";
12
12
  const DEFAULT_API_BASE_URL = "https://api.image-skill.com";
13
13
  const DEFAULT_DOCS_BASE_URL = "https://image-skill.com";
@@ -1171,28 +1171,71 @@ function createGuidePaymentSummary(data) {
1171
1171
  const methods = Array.isArray(data?.methods)
1172
1172
  ? data.methods.filter((method) => method.live_money)
1173
1173
  : [];
1174
+ const availableMethods = methods.filter((method) => method.available);
1175
+ const browserlessMethods = availableMethods.filter(
1176
+ (method) => method.requires_browser === false,
1177
+ );
1178
+ const agentPayableMethods = browserlessMethods.filter((method) =>
1179
+ (method.buyer_modes ?? []).some(
1180
+ (mode) => mode === "agent_only" || mode === "hybrid",
1181
+ ),
1182
+ );
1183
+ const humanHandoffMethods = availableMethods.filter(
1184
+ (method) =>
1185
+ method.requires_browser === true ||
1186
+ (method.buyer_modes ?? []).some((mode) => mode === "human_only"),
1187
+ );
1188
+ const preferredMethod =
1189
+ agentPayableMethods[0] ?? browserlessMethods[0] ?? availableMethods[0];
1174
1190
  return {
1175
1191
  checked: data !== null && typeof data === "object",
1176
- live_money_methods: methods
1177
- .filter((method) => method.available)
1178
- .map((method) => method.method_id),
1179
- requires_browser: methods.some((method) => method.requires_browser),
1192
+ live_money_methods: availableMethods.map((method) => method.method_id),
1193
+ requires_browser:
1194
+ availableMethods.length > 0 &&
1195
+ availableMethods.every((method) => method.requires_browser === true),
1196
+ browserless_methods: browserlessMethods.map((method) => method.method_id),
1197
+ agent_payable_methods: agentPayableMethods.map(
1198
+ (method) => method.method_id,
1199
+ ),
1200
+ human_handoff_methods: humanHandoffMethods.map(
1201
+ (method) => method.method_id,
1202
+ ),
1203
+ preferred_method: preferredMethod?.method_id ?? null,
1180
1204
  buyer_modes: [
1181
1205
  ...new Set(methods.flatMap((method) => method.buyer_modes ?? [])),
1182
1206
  ],
1183
- suggested_commands: [
1184
- "image-skill credits methods --json",
1185
- "image-skill credits packs list --json",
1186
- methods[0]?.recovery?.quote_command ??
1187
- "image-skill credits quote --pack starter-500 --payment-method stripe_checkout --idempotency-key KEY --json",
1188
- methods[0]?.recovery?.purchase_command ??
1189
- "image-skill credits buy --provider stripe --quote-id QUOTE_ID --idempotency-key KEY --json",
1190
- methods[0]?.recovery?.status_command ??
1191
- "image-skill credits status --payment-attempt-id PAYMENT_ATTEMPT_ID --json",
1192
- ],
1207
+ suggested_commands: createGuidePaymentCommands(
1208
+ preferredMethod,
1209
+ availableMethods.filter((method) => method !== preferredMethod),
1210
+ ),
1193
1211
  };
1194
1212
  }
1195
1213
 
1214
+ function createGuidePaymentCommands(preferredMethod, fallbackMethods) {
1215
+ const commands = [
1216
+ "image-skill credits methods --json",
1217
+ "image-skill credits packs list --json",
1218
+ preferredMethod?.recovery?.quote_command ??
1219
+ "image-skill credits quote --pack starter-500 --payment-method stripe_x402.exact.usdc --idempotency-key KEY --json",
1220
+ preferredMethod?.recovery?.purchase_command ??
1221
+ "image-skill credits buy --provider stripe_x402 --quote-id QUOTE_ID --idempotency-key KEY --json",
1222
+ preferredMethod?.recovery?.status_command ??
1223
+ "image-skill credits status --payment-attempt-id PAYMENT_ATTEMPT_ID --json",
1224
+ ];
1225
+ for (const method of fallbackMethods) {
1226
+ for (const command of [
1227
+ method.recovery?.quote_command,
1228
+ method.recovery?.purchase_command,
1229
+ method.recovery?.status_command,
1230
+ ]) {
1231
+ if (typeof command === "string" && !commands.includes(command)) {
1232
+ commands.push(command);
1233
+ }
1234
+ }
1235
+ }
1236
+ return commands;
1237
+ }
1238
+
1196
1239
  function createGuideStage(input) {
1197
1240
  if (input.prompt.length === 0) {
1198
1241
  return "prompt_required";
@@ -1329,7 +1372,9 @@ function createGuideNextCommand(stage, input) {
1329
1372
  if (stage === "quota_required") {
1330
1373
  return renderGuidePrefixedCommand(
1331
1374
  input.commandPrefix,
1332
- stripImageSkillCommandPrefix(input.paymentSummary.suggested_commands[0]),
1375
+ stripImageSkillCommandPrefix(
1376
+ firstPaymentActionCommand(input.paymentSummary.suggested_commands),
1377
+ ),
1333
1378
  );
1334
1379
  }
1335
1380
  return renderCreateCommand({
@@ -1362,6 +1407,16 @@ function renderTokenStdinCommand(command) {
1362
1407
  return `printf '%s\\n' "$IMAGE_SKILL_TOKEN" | ${command} --token-stdin`;
1363
1408
  }
1364
1409
 
1410
+ function firstPaymentActionCommand(commands) {
1411
+ return (
1412
+ commands.find((command) => /\bcredits\s+quote\b/.test(command)) ??
1413
+ commands.find((command) => /\bcredits\s+buy\b/.test(command)) ??
1414
+ commands.find((command) => /\bcredits\s+methods\b/.test(command)) ??
1415
+ commands[0] ??
1416
+ "image-skill credits methods --json"
1417
+ );
1418
+ }
1419
+
1365
1420
  function renderCreateCommand(input) {
1366
1421
  return [
1367
1422
  input.commandPrefix ?? "image-skill",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-skill",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Zero-setup durable creative-media CLI for agents (image + video + audio + 3D): guide-first creation, model and cost inspection, owned URLs, JSON recovery, payments, reusable assets, and feedback.",
5
5
  "type": "module",
6
6
  "private": false,