image-skill 0.1.64 → 0.1.65

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,15 @@ 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.65 - 2026-06-17
8
+
9
+ - Release (activation/self-fund): make hosted create/edit success
10
+ `data.quota.top_up` and `data.next_actions.self_fund` commands copy-runnable
11
+ from the public CLI, so near-wall agents can move from a successful media
12
+ response into the same zero-setup `npx image-skill@latest` top-up path as
13
+ quota reads and quota errors. No payment caps, wallet action, provider spend,
14
+ hosted deploy, or production write changed in this release bump.
15
+
7
16
  ## 0.1.64 - 2026-06-17
8
17
 
9
18
  - Release (activation/self-fund): publish the hosted success-surface
@@ -15,7 +15,7 @@ import { Readable } from "node:stream";
15
15
  import { pipeline } from "node:stream/promises";
16
16
  import os from "node:os";
17
17
 
18
- const VERSION = "0.1.64";
18
+ const VERSION = "0.1.65";
19
19
  const PACKAGE_NAME = "image-skill";
20
20
  const DEFAULT_API_BASE_URL = "https://api.image-skill.com";
21
21
  const DEFAULT_DOCS_BASE_URL = "https://image-skill.com";
@@ -2829,14 +2829,38 @@ function withCopyRunnablePaymentNextActionCommands(result, commandPrefix) {
2829
2829
  }
2830
2830
 
2831
2831
  function paymentNextActionsWithCopyRunnableCommands(data, commandPrefix) {
2832
+ let changed = false;
2833
+ let updated = data;
2834
+
2835
+ if (
2836
+ data.quota !== null &&
2837
+ typeof data.quota === "object" &&
2838
+ !Array.isArray(data.quota) &&
2839
+ data.quota.top_up !== null &&
2840
+ typeof data.quota.top_up === "object" &&
2841
+ !Array.isArray(data.quota.top_up)
2842
+ ) {
2843
+ updated = {
2844
+ ...updated,
2845
+ quota: {
2846
+ ...data.quota,
2847
+ top_up: quotaTopUpWithCopyRunnableCommands(
2848
+ data.quota.top_up,
2849
+ commandPrefix,
2850
+ ),
2851
+ },
2852
+ };
2853
+ changed = true;
2854
+ }
2855
+
2832
2856
  if (
2833
2857
  data.next_actions === null ||
2834
2858
  typeof data.next_actions !== "object" ||
2835
2859
  Array.isArray(data.next_actions)
2836
2860
  ) {
2837
- return data;
2861
+ return changed ? updated : data;
2838
2862
  }
2839
- let changed = false;
2863
+
2840
2864
  const nextActions = { ...data.next_actions };
2841
2865
 
2842
2866
  if (
@@ -2893,7 +2917,18 @@ function paymentNextActionsWithCopyRunnableCommands(data, commandPrefix) {
2893
2917
  nextActions.recommended_settlement = recommendedSettlement;
2894
2918
  }
2895
2919
 
2896
- return changed ? { ...data, next_actions: nextActions } : data;
2920
+ if (
2921
+ nextActions.self_fund !== null &&
2922
+ typeof nextActions.self_fund === "object" &&
2923
+ !Array.isArray(nextActions.self_fund)
2924
+ ) {
2925
+ const selfFund = { ...nextActions.self_fund };
2926
+ changed =
2927
+ renderSelfFundActionCommandFields(selfFund, commandPrefix) || changed;
2928
+ nextActions.self_fund = selfFund;
2929
+ }
2930
+
2931
+ return changed ? { ...updated, next_actions: nextActions } : data;
2897
2932
  }
2898
2933
 
2899
2934
  function renderPaymentActionCommandField(record, field, commandPrefix) {
@@ -2911,6 +2946,57 @@ function renderPaymentActionCommandField(record, field, commandPrefix) {
2911
2946
  return true;
2912
2947
  }
2913
2948
 
2949
+ function renderSelfFundActionCommandFields(record, commandPrefix) {
2950
+ let changed = false;
2951
+ for (const field of [
2952
+ "first_safe_command",
2953
+ "inspect_methods_command",
2954
+ "inspect_packs_command",
2955
+ "quote_command",
2956
+ "buy_command",
2957
+ "status_command",
2958
+ "fallback_quote_command",
2959
+ "fallback_buy_command",
2960
+ ]) {
2961
+ changed =
2962
+ renderPaymentActionCommandField(record, field, commandPrefix) || changed;
2963
+ }
2964
+
2965
+ if (
2966
+ record.workflow !== null &&
2967
+ typeof record.workflow === "object" &&
2968
+ !Array.isArray(record.workflow) &&
2969
+ Array.isArray(record.workflow.steps)
2970
+ ) {
2971
+ let workflowChanged = false;
2972
+ const steps = record.workflow.steps.map((step) => {
2973
+ if (
2974
+ step === null ||
2975
+ typeof step !== "object" ||
2976
+ Array.isArray(step) ||
2977
+ typeof step.command !== "string"
2978
+ ) {
2979
+ return step;
2980
+ }
2981
+ const command = renderCopyRunnablePaymentCommand(
2982
+ commandPrefix,
2983
+ step.command,
2984
+ );
2985
+ if (command === step.command) {
2986
+ return step;
2987
+ }
2988
+ workflowChanged = true;
2989
+ return { ...step, command };
2990
+ });
2991
+ if (workflowChanged) {
2992
+ record.workflow = { ...record.workflow, steps };
2993
+ changed = true;
2994
+ }
2995
+ }
2996
+
2997
+ return changed;
2998
+ }
2999
+
2914
3000
  function creditQuoteWithCopyRunnableCommands(quote, commandPrefix) {
2915
3001
  const recommendedBuy =
2916
3002
  quote.next_actions?.recommended_buy !== null &&
@@ -4057,50 +4143,56 @@ async function create(argv) {
4057
4143
  argv,
4058
4144
  })
4059
4145
  : null;
4060
- const result = withCopyRunnableQuotaRecoveryCommands(
4061
- await apiRequest({
4062
- command: "image-skill create",
4063
- method: "POST",
4064
- apiBaseUrl: apiBase(args),
4065
- path: "/v1/create",
4066
- ...(token.token === null ? {} : { token: token.token }),
4067
- body: {
4068
- prompt: prompt.value,
4069
- ...(flagString(args, "provider") === null
4070
- ? {}
4071
- : { provider: flagString(args, "provider") }),
4072
- ...(flagString(args, "model") === null
4073
- ? {}
4074
- : { model: flagString(args, "model") }),
4075
- ...(flagString(args, "intent") === null
4076
- ? {}
4077
- : { intent: flagString(args, "intent") }),
4078
- aspect_ratio: flagString(args, "aspect-ratio") ?? "1:1",
4079
- ...(references.references.length === 0
4080
- ? {}
4081
- : { references: references.references }),
4082
- ...(outputCount.value === null
4083
- ? {}
4084
- : { output_count: outputCount.value }),
4085
- ...(flagNumber(args, "max-estimated-usd-per-image") === null
4086
- ? {}
4087
- : {
4088
- max_estimated_usd_per_image: flagNumber(
4089
- args,
4090
- "max-estimated-usd-per-image",
4091
- ),
4092
- }),
4093
- ...(modelParameters.value === null
4094
- ? {}
4095
- : { model_parameters: modelParameters.value }),
4096
- // Retry-safe dedupe (#1228/#1789): a live create always carries a key so a
4097
- // retry (or an interrupted-then-recovered run) dedupes to one charge.
4098
- ...(idempotencyKey === null ? {} : { idempotency_key: idempotencyKey }),
4099
- dry_run: flagBool(args, "dry-run"),
4100
- accept_unknown_cost: flagBool(args, "accept-unknown-cost"),
4101
- },
4102
- }),
4103
- createGuideCommandPrefix(),
4146
+ const commandPrefix = createGuideCommandPrefix();
4147
+ const result = withCopyRunnablePaymentNextActionCommands(
4148
+ withCopyRunnableQuotaRecoveryCommands(
4149
+ await apiRequest({
4150
+ command: "image-skill create",
4151
+ method: "POST",
4152
+ apiBaseUrl: apiBase(args),
4153
+ path: "/v1/create",
4154
+ ...(token.token === null ? {} : { token: token.token }),
4155
+ body: {
4156
+ prompt: prompt.value,
4157
+ ...(flagString(args, "provider") === null
4158
+ ? {}
4159
+ : { provider: flagString(args, "provider") }),
4160
+ ...(flagString(args, "model") === null
4161
+ ? {}
4162
+ : { model: flagString(args, "model") }),
4163
+ ...(flagString(args, "intent") === null
4164
+ ? {}
4165
+ : { intent: flagString(args, "intent") }),
4166
+ aspect_ratio: flagString(args, "aspect-ratio") ?? "1:1",
4167
+ ...(references.references.length === 0
4168
+ ? {}
4169
+ : { references: references.references }),
4170
+ ...(outputCount.value === null
4171
+ ? {}
4172
+ : { output_count: outputCount.value }),
4173
+ ...(flagNumber(args, "max-estimated-usd-per-image") === null
4174
+ ? {}
4175
+ : {
4176
+ max_estimated_usd_per_image: flagNumber(
4177
+ args,
4178
+ "max-estimated-usd-per-image",
4179
+ ),
4180
+ }),
4181
+ ...(modelParameters.value === null
4182
+ ? {}
4183
+ : { model_parameters: modelParameters.value }),
4184
+ // Retry-safe dedupe (#1228/#1789): a live create always carries a key so a
4185
+ // retry (or an interrupted-then-recovered run) dedupes to one charge.
4186
+ ...(idempotencyKey === null
4187
+ ? {}
4188
+ : { idempotency_key: idempotencyKey }),
4189
+ dry_run: flagBool(args, "dry-run"),
4190
+ accept_unknown_cost: flagBool(args, "accept-unknown-cost"),
4191
+ },
4192
+ }),
4193
+ commandPrefix,
4194
+ ),
4195
+ commandPrefix,
4104
4196
  );
4105
4197
  await clearInFlightSpendForResult(inFlight, result);
4106
4198
  return result;
@@ -4194,47 +4286,55 @@ async function edit(argv) {
4194
4286
  argv,
4195
4287
  })
4196
4288
  : null;
4197
- const result = withCopyRunnableQuotaRecoveryCommands(
4198
- await apiRequest({
4199
- command: "image-skill edit",
4200
- method: "POST",
4201
- apiBaseUrl: apiBase(args),
4202
- path: "/v1/edit",
4203
- token: token.token,
4204
- body: {
4205
- input_asset_id: assetId.assetId,
4206
- ...(maskAssetId === null ? {} : { mask_asset_id: maskAssetId.assetId }),
4207
- ...(references.references.length === 0
4208
- ? {}
4209
- : { references: references.references }),
4210
- ...(prompt.value.length === 0 ? {} : { prompt: prompt.value }),
4211
- ...(flagString(args, "provider") === null
4212
- ? {}
4213
- : { provider: flagString(args, "provider") }),
4214
- ...(modelId === null ? {} : { model: modelId }),
4215
- ...(flagString(args, "intent") === null
4216
- ? {}
4217
- : { intent: flagString(args, "intent") }),
4218
- aspect_ratio: flagString(args, "aspect-ratio") ?? "auto",
4219
- ...(flagNumber(args, "max-estimated-usd-per-image") === null
4220
- ? {}
4221
- : {
4222
- max_estimated_usd_per_image: flagNumber(
4223
- args,
4224
- "max-estimated-usd-per-image",
4225
- ),
4226
- }),
4227
- ...(modelParameters.value === null
4228
- ? {}
4229
- : { model_parameters: modelParameters.value }),
4230
- ...(flagBool(args, "dry-run") ? { dry_run: true } : {}),
4231
- // Retry-safe dedupe (#1228/#1789): a live edit always carries a key so a
4232
- // retry (or an interrupted-then-recovered run) dedupes to one charge.
4233
- ...(idempotencyKey === null ? {} : { idempotency_key: idempotencyKey }),
4234
- accept_unknown_cost: flagBool(args, "accept-unknown-cost"),
4235
- },
4236
- }),
4237
- createGuideCommandPrefix(),
4289
+ const commandPrefix = createGuideCommandPrefix();
4290
+ const result = withCopyRunnablePaymentNextActionCommands(
4291
+ withCopyRunnableQuotaRecoveryCommands(
4292
+ await apiRequest({
4293
+ command: "image-skill edit",
4294
+ method: "POST",
4295
+ apiBaseUrl: apiBase(args),
4296
+ path: "/v1/edit",
4297
+ token: token.token,
4298
+ body: {
4299
+ input_asset_id: assetId.assetId,
4300
+ ...(maskAssetId === null
4301
+ ? {}
4302
+ : { mask_asset_id: maskAssetId.assetId }),
4303
+ ...(references.references.length === 0
4304
+ ? {}
4305
+ : { references: references.references }),
4306
+ ...(prompt.value.length === 0 ? {} : { prompt: prompt.value }),
4307
+ ...(flagString(args, "provider") === null
4308
+ ? {}
4309
+ : { provider: flagString(args, "provider") }),
4310
+ ...(modelId === null ? {} : { model: modelId }),
4311
+ ...(flagString(args, "intent") === null
4312
+ ? {}
4313
+ : { intent: flagString(args, "intent") }),
4314
+ aspect_ratio: flagString(args, "aspect-ratio") ?? "auto",
4315
+ ...(flagNumber(args, "max-estimated-usd-per-image") === null
4316
+ ? {}
4317
+ : {
4318
+ max_estimated_usd_per_image: flagNumber(
4319
+ args,
4320
+ "max-estimated-usd-per-image",
4321
+ ),
4322
+ }),
4323
+ ...(modelParameters.value === null
4324
+ ? {}
4325
+ : { model_parameters: modelParameters.value }),
4326
+ ...(flagBool(args, "dry-run") ? { dry_run: true } : {}),
4327
+ // Retry-safe dedupe (#1228/#1789): a live edit always carries a key so a
4328
+ // retry (or an interrupted-then-recovered run) dedupes to one charge.
4329
+ ...(idempotencyKey === null
4330
+ ? {}
4331
+ : { idempotency_key: idempotencyKey }),
4332
+ accept_unknown_cost: flagBool(args, "accept-unknown-cost"),
4333
+ },
4334
+ }),
4335
+ commandPrefix,
4336
+ ),
4337
+ commandPrefix,
4238
4338
  );
4239
4339
  await clearInFlightSpendForResult(inFlight, result);
4240
4340
  return result;
@@ -4259,22 +4359,28 @@ async function assets(argv) {
4259
4359
  return token.result;
4260
4360
  }
4261
4361
  if (subcommand === "show") {
4262
- return apiRequest({
4263
- command: "image-skill assets show",
4264
- method: "GET",
4265
- apiBaseUrl: apiBase(args),
4266
- path: `/v1/assets/${encodeURIComponent(assetId)}`,
4267
- token: token.token,
4268
- });
4362
+ return withCopyRunnablePaymentNextActionCommands(
4363
+ await apiRequest({
4364
+ command: "image-skill assets show",
4365
+ method: "GET",
4366
+ apiBaseUrl: apiBase(args),
4367
+ path: `/v1/assets/${encodeURIComponent(assetId)}`,
4368
+ token: token.token,
4369
+ }),
4370
+ createGuideCommandPrefix(),
4371
+ );
4269
4372
  }
4270
4373
  if (subcommand === "get") {
4271
- const shown = await apiRequest({
4272
- command: "image-skill assets get",
4273
- method: "GET",
4274
- apiBaseUrl: apiBase(args),
4275
- path: `/v1/assets/${encodeURIComponent(assetId)}`,
4276
- token: token.token,
4277
- });
4374
+ const shown = withCopyRunnablePaymentNextActionCommands(
4375
+ await apiRequest({
4376
+ command: "image-skill assets get",
4377
+ method: "GET",
4378
+ apiBaseUrl: apiBase(args),
4379
+ path: `/v1/assets/${encodeURIComponent(assetId)}`,
4380
+ token: token.token,
4381
+ }),
4382
+ createGuideCommandPrefix(),
4383
+ );
4278
4384
  if (!shown.envelope.ok) {
4279
4385
  return shown;
4280
4386
  }
@@ -4315,26 +4421,32 @@ async function jobs(argv) {
4315
4421
  return token.result;
4316
4422
  }
4317
4423
  if (subcommand === "show") {
4318
- return apiRequest({
4319
- command: "image-skill jobs show",
4320
- method: "GET",
4321
- apiBaseUrl: apiBase(args),
4322
- path: `/v1/jobs/${encodeURIComponent(jobId)}`,
4323
- token: token.token,
4324
- });
4424
+ return withCopyRunnablePaymentNextActionCommands(
4425
+ await apiRequest({
4426
+ command: "image-skill jobs show",
4427
+ method: "GET",
4428
+ apiBaseUrl: apiBase(args),
4429
+ path: `/v1/jobs/${encodeURIComponent(jobId)}`,
4430
+ token: token.token,
4431
+ }),
4432
+ createGuideCommandPrefix(),
4433
+ );
4325
4434
  }
4326
4435
  if (subcommand === "wait") {
4327
4436
  const timeoutMs = flagNumber(args, "timeout-ms") ?? 30_000;
4328
4437
  const pollIntervalMs = flagNumber(args, "poll-interval-ms") ?? 1_000;
4329
4438
  const started = Date.now();
4330
4439
  while (Date.now() - started <= timeoutMs) {
4331
- const current = await apiRequest({
4332
- command: "image-skill jobs wait",
4333
- method: "GET",
4334
- apiBaseUrl: apiBase(args),
4335
- path: `/v1/jobs/${encodeURIComponent(jobId)}`,
4336
- token: token.token,
4337
- });
4440
+ const current = withCopyRunnablePaymentNextActionCommands(
4441
+ await apiRequest({
4442
+ command: "image-skill jobs wait",
4443
+ method: "GET",
4444
+ apiBaseUrl: apiBase(args),
4445
+ path: `/v1/jobs/${encodeURIComponent(jobId)}`,
4446
+ token: token.token,
4447
+ }),
4448
+ createGuideCommandPrefix(),
4449
+ );
4338
4450
  if (!current.envelope.ok) {
4339
4451
  return current;
4340
4452
  }
@@ -4380,13 +4492,16 @@ async function activity(argv) {
4380
4492
  "activity show requires REFERENCE",
4381
4493
  );
4382
4494
  }
4383
- return apiRequest({
4384
- command: "image-skill activity show",
4385
- method: "GET",
4386
- apiBaseUrl: apiBase(args),
4387
- path: `/v1/activity/${encodeURIComponent(reference)}`,
4388
- token: token.token,
4389
- });
4495
+ return withCopyRunnablePaymentNextActionCommands(
4496
+ await apiRequest({
4497
+ command: "image-skill activity show",
4498
+ method: "GET",
4499
+ apiBaseUrl: apiBase(args),
4500
+ path: `/v1/activity/${encodeURIComponent(reference)}`,
4501
+ token: token.token,
4502
+ }),
4503
+ createGuideCommandPrefix(),
4504
+ );
4390
4505
  }
4391
4506
  if (subcommand === "list") {
4392
4507
  const query = new URLSearchParams();
@@ -4398,13 +4513,16 @@ async function activity(argv) {
4398
4513
  if (subject !== null) {
4399
4514
  query.set("subject", subject);
4400
4515
  }
4401
- return apiRequest({
4402
- command: "image-skill activity list",
4403
- method: "GET",
4404
- apiBaseUrl: apiBase(args),
4405
- path: `/v1/activity${query.size > 0 ? `?${query.toString()}` : ""}`,
4406
- token: token.token,
4407
- });
4516
+ return withCopyRunnablePaymentNextActionCommands(
4517
+ await apiRequest({
4518
+ command: "image-skill activity list",
4519
+ method: "GET",
4520
+ apiBaseUrl: apiBase(args),
4521
+ path: `/v1/activity${query.size > 0 ? `?${query.toString()}` : ""}`,
4522
+ token: token.token,
4523
+ }),
4524
+ createGuideCommandPrefix(),
4525
+ );
4408
4526
  }
4409
4527
  return invalid("image-skill activity", "activity requires list or show");
4410
4528
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-skill",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
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,