@usenaive-sdk/cli 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +407 -122
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -11953,7 +11953,7 @@ function resolveConfig(args, env2, readConfig, { login = false } = {}) {
11953
11953
  `unknown profile "${profile}"; run \`naive login --profile ${profile}\` first (add --api-base-url <url> for a non-production API)`
11954
11954
  );
11955
11955
  }
11956
- const given = set(args.str("api-key")) ?? set(env2["VETTA_API_KEY"]) ?? set(env2["NAIVE_API_KEY"]);
11956
+ const given = set(args.str("api-key")) ?? set(env2["NAIVE_API_KEY"]) ?? set(env2["VETTA_API_KEY"]);
11957
11957
  return {
11958
11958
  profile,
11959
11959
  baseUrl,
@@ -26963,6 +26963,8 @@ var LedgerEntrySchema = external_exports.object({
26963
26963
  session_id: idOf("ses").nullable(),
26964
26964
  agent_id: idOf("agt").nullable(),
26965
26965
  deployment_id: idOf("dep").nullable(),
26966
+ /** The computer (`cmp_`), browser (`brw_`) or phone (`mob_`) a debit bills; `null` for anything else, and from a server older than the field. */
26967
+ resource_id: external_exports.string().nullable().default(null),
26966
26968
  line_items: external_exports.array(external_exports.object({ tier: LineItemTierSchema, amount_micro_usd: MicroUsdField })),
26967
26969
  created_at: Timestamp
26968
26970
  });
@@ -28421,7 +28423,11 @@ var transposed = (a, b) => {
28421
28423
  };
28422
28424
  function toolNameProblem(name6) {
28423
28425
  if (BUILTIN_TOOLS.includes(name6) || name6 in FOLLOWS_TOOL || PLATFORM_TOOLS.includes(name6)) return null;
28424
- if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) return `\`${name6}\` is not a tool: name a built-in, or a namespaced \`<namespace>.<tool>\``;
28426
+ if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) {
28427
+ const bare = [...BUILTIN_TOOLS, ...Object.keys(FOLLOWS_TOOL)].find((tool) => transposed(tool, name6));
28428
+ const hint = bare === void 0 ? "name a built-in, or a namespaced `<namespace>.<tool>`" : `did you mean \`${bare}\`?`;
28429
+ return `\`${name6}\` is not a tool; ${hint}`;
28430
+ }
28425
28431
  const namespace = name6.slice(0, name6.indexOf("."));
28426
28432
  if (PLATFORM_NAMESPACES.has(namespace)) {
28427
28433
  const known = [...PLATFORM_TOOLS, ...Object.keys(FOLLOWS_TOOL)].filter((tool) => tool.startsWith(`${namespace}.`));
@@ -28432,7 +28438,8 @@ function toolNameProblem(name6) {
28432
28438
  }
28433
28439
  var isToolName = (name6) => toolNameProblem(name6) === null;
28434
28440
  var ToolConfigSchema = external_exports.object({
28435
- enabled: external_exports.boolean(),
28441
+ /** Absent is enabled (ADR-1911): naming a tool to set its permission already says it is wanted. */
28442
+ enabled: external_exports.boolean().default(true),
28436
28443
  permission: ToolPermissionSchema,
28437
28444
  config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
28438
28445
  });
@@ -28705,7 +28712,24 @@ var CREATOR_PROGRAM = {
28705
28712
  upload_token_minutes: 15,
28706
28713
  skill_max_bytes: 32 * 1024,
28707
28714
  /** The reviewer's install check (§42.5): the hard cap on its one session, never charged to the draft. */
28708
- review_check_budget_micro_usd: 5e6
28715
+ review_check_budget_micro_usd: 5e6,
28716
+ /** A `video` origin build (§42.14): one raw clip and its characters, recast by Mira. */
28717
+ video: {
28718
+ min_seconds: 3,
28719
+ max_seconds: 15,
28720
+ video_max_bytes: 95 * 1024 * 1024,
28721
+ image_max_bytes: 10 * 1024 * 1024,
28722
+ characters_min: 1,
28723
+ characters_max: 3,
28724
+ /** After the first render. A refused or failed render does not use one up. */
28725
+ revisions: 5,
28726
+ /** Per doomscroll account, until one of its templates is approved. */
28727
+ unapproved_templates: 2,
28728
+ /** Upload tickets a doomscroll account may ask for, per template. */
28729
+ upload_tickets: 20,
28730
+ /** A draft never submitted loses its source and character bytes this long after `updated_at`. */
28731
+ draft_retention_days: 30
28732
+ }
28709
28733
  }
28710
28734
  };
28711
28735
  var DOOMSCROLL_PROGRAM = {
@@ -28749,6 +28773,8 @@ var StudioStateSchema = external_exports.enum([
28749
28773
  "setup",
28750
28774
  "building",
28751
28775
  "ready",
28776
+ /** A `video` origin only: a version was submitted and its author is writing the skill. */
28777
+ "finalizing",
28752
28778
  "in_review",
28753
28779
  "live",
28754
28780
  "changes_requested"
@@ -28812,10 +28838,26 @@ var StudioSkillSchema = SavedSkillSchema.extend({
28812
28838
  id: idOf("skl").nullable(),
28813
28839
  version: external_exports.number().int().positive().nullable()
28814
28840
  });
28841
+ var StudioImageContentTypeSchema = external_exports.enum(["image/png", "image/jpeg", "image/webp"]);
28842
+ var StudioSourceVideoSchema = external_exports.object({
28843
+ file_id: external_exports.string().nullable(),
28844
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM.studio.video.video_max_bytes),
28845
+ content_type: StudioUploadContentTypeSchema,
28846
+ filename: external_exports.string().min(1).max(200),
28847
+ seconds: external_exports.number().nonnegative().nullable()
28848
+ });
28849
+ var CharacterPosition = external_exports.number().int().min(1).max(CREATOR_PROGRAM.studio.video.characters_max);
28850
+ var StudioCharacterSchema = external_exports.object({
28851
+ position: CharacterPosition,
28852
+ file_id: external_exports.string().nullable(),
28853
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM.studio.video.image_max_bytes),
28854
+ content_type: StudioImageContentTypeSchema,
28855
+ filename: external_exports.string().min(1).max(200)
28856
+ });
28815
28857
  var CreatorStudioSchema = external_exports.object({
28816
28858
  uploads: external_exports.array(StudioUploadSchema).max(CREATOR_PROGRAM.studio.uploads).default([]),
28817
- /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos. */
28818
- origin: external_exports.enum(["upload", "links"]).default("upload"),
28859
+ /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos; `video`: one raw clip recast by Mira (§42.14). */
28860
+ origin: external_exports.enum(["upload", "links", "video"]).default("upload"),
28819
28861
  imports: external_exports.array(StudioImportSchema).max(CREATOR_PROGRAM.studio.uploads).default([]),
28820
28862
  state: StudioStateSchema.default("setup"),
28821
28863
  spend_micro_usd: MicroUsdField.nonnegative().default(0),
@@ -28826,7 +28868,11 @@ var CreatorStudioSchema = external_exports.object({
28826
28868
  /** An org build's asked sample length (§57.2, ADR-1762); `null` is `sample_seconds`. */
28827
28869
  seconds: external_exports.number().int().min(10).max(60).nullable().default(null),
28828
28870
  /** An org build's own catalog text: its request's description when that fits a tagline; `null` lets the judge write one. */
28829
- tagline: external_exports.string().max(140).nullable().default(null)
28871
+ tagline: external_exports.string().max(140).nullable().default(null),
28872
+ /** A `video` origin's raw clip, its characters, and the round submitted (§42.14). */
28873
+ source_video: StudioSourceVideoSchema.nullable().default(null),
28874
+ characters: external_exports.array(StudioCharacterSchema).max(CREATOR_PROGRAM.studio.video.characters_max).default([]),
28875
+ chosen_round: external_exports.number().int().positive().nullable().default(null)
28830
28876
  });
28831
28877
  var CreatorTemplateListingSchema = external_exports.object({
28832
28878
  listed: external_exports.boolean(),
@@ -28880,7 +28926,15 @@ var CreatorTemplateRoundSchema = external_exports.object({
28880
28926
  spend_micro_usd: MicroUsdField.nonnegative(),
28881
28927
  error: external_exports.string().nullable(),
28882
28928
  created_at: Timestamp,
28883
- finished_at: Timestamp.nullable()
28929
+ finished_at: Timestamp.nullable(),
28930
+ /** A `video` origin round's Mira edit and its result (migration 0172, §42.14). */
28931
+ edit_job_id: external_exports.string().nullable().default(null),
28932
+ sample_file_id: external_exports.string().nullable().default(null)
28933
+ });
28934
+ var StudioPlateSchema = external_exports.object({
28935
+ file: external_exports.string().min(1),
28936
+ kind: external_exports.enum(["video", "image"]),
28937
+ file_id: external_exports.string().min(1)
28884
28938
  });
28885
28939
  var NicheVersionStudioSchema = external_exports.object({
28886
28940
  round: external_exports.number().int().positive(),
@@ -28889,7 +28943,9 @@ var NicheVersionStudioSchema = external_exports.object({
28889
28943
  frames: external_exports.array(StudioFrameSchema),
28890
28944
  samples: external_exports.array(StudioSampleSchema),
28891
28945
  tagline: external_exports.string().max(140),
28892
- hero_sample_index: external_exports.number().int().nonnegative()
28946
+ hero_sample_index: external_exports.number().int().nonnegative(),
28947
+ /** A `video` origin's default clip and characters. */
28948
+ plates: external_exports.array(StudioPlateSchema).optional()
28893
28949
  });
28894
28950
  var CreatorTemplateSchema = external_exports.object({
28895
28951
  id: idOf("ctp"),
@@ -28986,13 +29042,26 @@ var CreatorAnalyticsSchema = external_exports.object({
28986
29042
  install_windows: external_exports.array(external_exports.object({ install_id: idOf("bpi"), from: Day, until: Day })).optional()
28987
29043
  });
28988
29044
  var CreatorTemplateCreateKindSchema = external_exports.object({
28989
- kind: CreatorTemplateKindSchema.default("crew")
29045
+ kind: CreatorTemplateKindSchema.default("crew"),
29046
+ /** `video` makes a draft built from one raw clip (§42.14); it needs `kind: niche`. */
29047
+ origin: external_exports.literal("video").optional()
28990
29048
  });
28991
29049
  var StudioUploadCreateSchema = external_exports.object({
28992
- position: UploadPosition,
29050
+ purpose: external_exports.enum(["source", "character"]).optional(),
29051
+ position: UploadPosition.optional(),
28993
29052
  filename: external_exports.string().min(1).max(200),
28994
- content_type: StudioUploadContentTypeSchema,
28995
- bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM.studio.upload_max_bytes)
29053
+ content_type: external_exports.union([StudioUploadContentTypeSchema, StudioImageContentTypeSchema]),
29054
+ bytes: external_exports.number().int().positive()
29055
+ }).superRefine((body2, ctx) => {
29056
+ const { video, upload_max_bytes } = CREATOR_PROGRAM.studio;
29057
+ const character2 = body2.purpose === "character";
29058
+ const issue2 = (path, message4) => ctx.addIssue({ code: "custom", path: [path], message: message4 });
29059
+ if (body2.purpose !== "source" && body2.position === void 0) issue2("position", "position is required");
29060
+ if (character2 !== StudioImageContentTypeSchema.safeParse(body2.content_type).success) {
29061
+ issue2("content_type", character2 ? "a character must be a PNG, JPEG or WebP image" : "this upload must be an MP4, MOV or WebM video");
29062
+ }
29063
+ const max = character2 ? video.image_max_bytes : body2.purpose === "source" ? video.video_max_bytes : upload_max_bytes;
29064
+ if (body2.bytes > max) issue2("bytes", `this upload may be at most ${max} bytes`);
28996
29065
  });
28997
29066
  var StudioUploadTicketSchema = external_exports.object({
28998
29067
  object: external_exports.literal("studio_upload_ticket"),
@@ -29006,6 +29075,12 @@ var StudioUploadResultSchema = external_exports.object({
29006
29075
  template_id: idOf("ctp"),
29007
29076
  upload: StudioUploadSchema
29008
29077
  });
29078
+ var StudioVideoUploadResultSchema = external_exports.object({
29079
+ object: external_exports.literal("studio_upload"),
29080
+ template_id: idOf("ctp"),
29081
+ source_video: StudioSourceVideoSchema.nullable(),
29082
+ characters: external_exports.array(StudioCharacterSchema)
29083
+ });
29009
29084
  var StudioRoundCreateSchema = external_exports.object({
29010
29085
  feedback: external_exports.string().min(1).max(4e3).optional(),
29011
29086
  rights_attested: external_exports.boolean().optional()
@@ -29018,9 +29093,12 @@ var StudioBudgetSchema = external_exports.object({
29018
29093
  var CreatorStudioViewSchema = external_exports.object({
29019
29094
  object: external_exports.literal("creator_studio"),
29020
29095
  template_id: idOf("ctp"),
29021
- studio: CreatorStudioSchema,
29022
- /** Newest first. */
29023
- rounds: external_exports.array(CreatorTemplateRoundSchema),
29096
+ /** A `video` origin's `source_video` also carries a signed `url` once its bytes landed. */
29097
+ studio: CreatorStudioSchema.extend({
29098
+ source_video: StudioSourceVideoSchema.extend({ url: external_exports.string().nullable().optional() }).nullable().default(null)
29099
+ }),
29100
+ /** Newest first. A `video` round also carries a signed `sample_url`. */
29101
+ rounds: external_exports.array(CreatorTemplateRoundSchema.extend({ sample_url: external_exports.string().nullable().optional() })),
29024
29102
  budget: StudioBudgetSchema
29025
29103
  });
29026
29104
  var NicheSubmitSchema = external_exports.object({
@@ -29030,6 +29108,7 @@ var NicheSubmitSchema = external_exports.object({
29030
29108
  hero_sample_index: external_exports.number().int().nonnegative()
29031
29109
  })
29032
29110
  });
29111
+ var VideoSubmitSchema = external_exports.object({ round: external_exports.number().int().positive() });
29033
29112
  var CreatorListingPatchSchema = CreatorTemplateListingSchema.partial();
29034
29113
  var CreatorListingSchema = external_exports.object({
29035
29114
  object: external_exports.literal("creator_listing"),
@@ -29255,6 +29334,10 @@ var EventTypeSchema = external_exports.enum([
29255
29334
  "span.harness_build.end",
29256
29335
  "span.box_resume.start",
29257
29336
  "span.box_resume.end",
29337
+ "span.tools_resolve.start",
29338
+ "span.tools_resolve.end",
29339
+ "span.model_gate.start",
29340
+ "span.model_gate.end",
29258
29341
  /**
29259
29342
  * A delegated thread's lifecycle, on the **coordinator's** stream (§28). The child's own
29260
29343
  * `ses_…` rides inside `data.thread_id` — the event schema gains no field and `vetta.event` gains
@@ -30865,11 +30948,12 @@ var MusicGenerationSchema = external_exports.object({
30865
30948
  duration_seconds: Seconds2.nullable(),
30866
30949
  cost_micro_usd: MicroUsdField
30867
30950
  });
30951
+ var EditModeSchema = external_exports.enum(["scene", "outfit_or_object", "person_swap", "recast"]);
30868
30952
  var EditRequestSchema = external_exports.object({
30869
30953
  video: external_exports.string().min(1),
30870
30954
  prompt: external_exports.string().min(1).max(1e3),
30871
30955
  references: external_exports.array(external_exports.string().min(1)).max(4).optional(),
30872
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).optional()
30956
+ mode: EditModeSchema.optional()
30873
30957
  });
30874
30958
  var EditFailureCodeSchema = external_exports.enum(["bad_source", "refused", "timed_out", "provider_error", "cancelled"]);
30875
30959
  var EditJobSchema = external_exports.object({
@@ -30879,7 +30963,7 @@ var EditJobSchema = external_exports.object({
30879
30963
  video: external_exports.string(),
30880
30964
  prompt: external_exports.string(),
30881
30965
  references: external_exports.array(external_exports.string()),
30882
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).nullable(),
30966
+ mode: EditModeSchema.nullable(),
30883
30967
  result: external_exports.object({ file_id: external_exports.string().startsWith("fil_") }).nullable(),
30884
30968
  error: external_exports.object({ code: EditFailureCodeSchema, message: external_exports.string() }).nullable(),
30885
30969
  cost_micro_usd: MicroUsdField.nullable(),
@@ -32286,6 +32370,8 @@ var LedgerEntrySchema2 = external_exports.object({
32286
32370
  session_id: idOf2("ses").nullable(),
32287
32371
  agent_id: idOf2("agt").nullable(),
32288
32372
  deployment_id: idOf2("dep").nullable(),
32373
+ /** The computer (`cmp_`), browser (`brw_`) or phone (`mob_`) a debit bills; `null` for anything else, and from a server older than the field. */
32374
+ resource_id: external_exports.string().nullable().default(null),
32289
32375
  line_items: external_exports.array(external_exports.object({ tier: LineItemTierSchema2, amount_micro_usd: MicroUsdField2 })),
32290
32376
  created_at: Timestamp2
32291
32377
  });
@@ -33720,7 +33806,11 @@ var transposed2 = (a, b) => {
33720
33806
  };
33721
33807
  function toolNameProblem2(name6) {
33722
33808
  if (BUILTIN_TOOLS2.includes(name6) || name6 in FOLLOWS_TOOL2 || PLATFORM_TOOLS2.includes(name6)) return null;
33723
- if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) return `\`${name6}\` is not a tool: name a built-in, or a namespaced \`<namespace>.<tool>\``;
33809
+ if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) {
33810
+ const bare = [...BUILTIN_TOOLS2, ...Object.keys(FOLLOWS_TOOL2)].find((tool) => transposed2(tool, name6));
33811
+ const hint = bare === void 0 ? "name a built-in, or a namespaced `<namespace>.<tool>`" : `did you mean \`${bare}\`?`;
33812
+ return `\`${name6}\` is not a tool; ${hint}`;
33813
+ }
33724
33814
  const namespace = name6.slice(0, name6.indexOf("."));
33725
33815
  if (PLATFORM_NAMESPACES2.has(namespace)) {
33726
33816
  const known = [...PLATFORM_TOOLS2, ...Object.keys(FOLLOWS_TOOL2)].filter((tool) => tool.startsWith(`${namespace}.`));
@@ -33731,7 +33821,8 @@ function toolNameProblem2(name6) {
33731
33821
  }
33732
33822
  var isToolName2 = (name6) => toolNameProblem2(name6) === null;
33733
33823
  var ToolConfigSchema2 = external_exports.object({
33734
- enabled: external_exports.boolean(),
33824
+ /** Absent is enabled (ADR-1911): naming a tool to set its permission already says it is wanted. */
33825
+ enabled: external_exports.boolean().default(true),
33735
33826
  permission: ToolPermissionSchema2,
33736
33827
  config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
33737
33828
  });
@@ -33991,7 +34082,24 @@ var CREATOR_PROGRAM2 = {
33991
34082
  upload_token_minutes: 15,
33992
34083
  skill_max_bytes: 32 * 1024,
33993
34084
  /** The reviewer's install check (§42.5): the hard cap on its one session, never charged to the draft. */
33994
- review_check_budget_micro_usd: 5e6
34085
+ review_check_budget_micro_usd: 5e6,
34086
+ /** A `video` origin build (§42.14): one raw clip and its characters, recast by Mira. */
34087
+ video: {
34088
+ min_seconds: 3,
34089
+ max_seconds: 15,
34090
+ video_max_bytes: 95 * 1024 * 1024,
34091
+ image_max_bytes: 10 * 1024 * 1024,
34092
+ characters_min: 1,
34093
+ characters_max: 3,
34094
+ /** After the first render. A refused or failed render does not use one up. */
34095
+ revisions: 5,
34096
+ /** Per doomscroll account, until one of its templates is approved. */
34097
+ unapproved_templates: 2,
34098
+ /** Upload tickets a doomscroll account may ask for, per template. */
34099
+ upload_tickets: 20,
34100
+ /** A draft never submitted loses its source and character bytes this long after `updated_at`. */
34101
+ draft_retention_days: 30
34102
+ }
33995
34103
  }
33996
34104
  };
33997
34105
  var DOOMSCROLL_PROGRAM2 = {
@@ -34035,6 +34143,8 @@ var StudioStateSchema2 = external_exports.enum([
34035
34143
  "setup",
34036
34144
  "building",
34037
34145
  "ready",
34146
+ /** A `video` origin only: a version was submitted and its author is writing the skill. */
34147
+ "finalizing",
34038
34148
  "in_review",
34039
34149
  "live",
34040
34150
  "changes_requested"
@@ -34098,10 +34208,26 @@ var StudioSkillSchema2 = SavedSkillSchema2.extend({
34098
34208
  id: idOf2("skl").nullable(),
34099
34209
  version: external_exports.number().int().positive().nullable()
34100
34210
  });
34211
+ var StudioImageContentTypeSchema2 = external_exports.enum(["image/png", "image/jpeg", "image/webp"]);
34212
+ var StudioSourceVideoSchema2 = external_exports.object({
34213
+ file_id: external_exports.string().nullable(),
34214
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM2.studio.video.video_max_bytes),
34215
+ content_type: StudioUploadContentTypeSchema2,
34216
+ filename: external_exports.string().min(1).max(200),
34217
+ seconds: external_exports.number().nonnegative().nullable()
34218
+ });
34219
+ var CharacterPosition2 = external_exports.number().int().min(1).max(CREATOR_PROGRAM2.studio.video.characters_max);
34220
+ var StudioCharacterSchema2 = external_exports.object({
34221
+ position: CharacterPosition2,
34222
+ file_id: external_exports.string().nullable(),
34223
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM2.studio.video.image_max_bytes),
34224
+ content_type: StudioImageContentTypeSchema2,
34225
+ filename: external_exports.string().min(1).max(200)
34226
+ });
34101
34227
  var CreatorStudioSchema2 = external_exports.object({
34102
34228
  uploads: external_exports.array(StudioUploadSchema2).max(CREATOR_PROGRAM2.studio.uploads).default([]),
34103
- /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos. */
34104
- origin: external_exports.enum(["upload", "links"]).default("upload"),
34229
+ /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos; `video`: one raw clip recast by Mira (§42.14). */
34230
+ origin: external_exports.enum(["upload", "links", "video"]).default("upload"),
34105
34231
  imports: external_exports.array(StudioImportSchema2).max(CREATOR_PROGRAM2.studio.uploads).default([]),
34106
34232
  state: StudioStateSchema2.default("setup"),
34107
34233
  spend_micro_usd: MicroUsdField2.nonnegative().default(0),
@@ -34112,7 +34238,11 @@ var CreatorStudioSchema2 = external_exports.object({
34112
34238
  /** An org build's asked sample length (§57.2, ADR-1762); `null` is `sample_seconds`. */
34113
34239
  seconds: external_exports.number().int().min(10).max(60).nullable().default(null),
34114
34240
  /** An org build's own catalog text: its request's description when that fits a tagline; `null` lets the judge write one. */
34115
- tagline: external_exports.string().max(140).nullable().default(null)
34241
+ tagline: external_exports.string().max(140).nullable().default(null),
34242
+ /** A `video` origin's raw clip, its characters, and the round submitted (§42.14). */
34243
+ source_video: StudioSourceVideoSchema2.nullable().default(null),
34244
+ characters: external_exports.array(StudioCharacterSchema2).max(CREATOR_PROGRAM2.studio.video.characters_max).default([]),
34245
+ chosen_round: external_exports.number().int().positive().nullable().default(null)
34116
34246
  });
34117
34247
  var CreatorTemplateListingSchema2 = external_exports.object({
34118
34248
  listed: external_exports.boolean(),
@@ -34166,7 +34296,15 @@ var CreatorTemplateRoundSchema2 = external_exports.object({
34166
34296
  spend_micro_usd: MicroUsdField2.nonnegative(),
34167
34297
  error: external_exports.string().nullable(),
34168
34298
  created_at: Timestamp2,
34169
- finished_at: Timestamp2.nullable()
34299
+ finished_at: Timestamp2.nullable(),
34300
+ /** A `video` origin round's Mira edit and its result (migration 0172, §42.14). */
34301
+ edit_job_id: external_exports.string().nullable().default(null),
34302
+ sample_file_id: external_exports.string().nullable().default(null)
34303
+ });
34304
+ var StudioPlateSchema2 = external_exports.object({
34305
+ file: external_exports.string().min(1),
34306
+ kind: external_exports.enum(["video", "image"]),
34307
+ file_id: external_exports.string().min(1)
34170
34308
  });
34171
34309
  var NicheVersionStudioSchema2 = external_exports.object({
34172
34310
  round: external_exports.number().int().positive(),
@@ -34175,7 +34313,9 @@ var NicheVersionStudioSchema2 = external_exports.object({
34175
34313
  frames: external_exports.array(StudioFrameSchema2),
34176
34314
  samples: external_exports.array(StudioSampleSchema2),
34177
34315
  tagline: external_exports.string().max(140),
34178
- hero_sample_index: external_exports.number().int().nonnegative()
34316
+ hero_sample_index: external_exports.number().int().nonnegative(),
34317
+ /** A `video` origin's default clip and characters. */
34318
+ plates: external_exports.array(StudioPlateSchema2).optional()
34179
34319
  });
34180
34320
  var CreatorTemplateSchema2 = external_exports.object({
34181
34321
  id: idOf2("ctp"),
@@ -34272,13 +34412,26 @@ var CreatorAnalyticsSchema2 = external_exports.object({
34272
34412
  install_windows: external_exports.array(external_exports.object({ install_id: idOf2("bpi"), from: Day3, until: Day3 })).optional()
34273
34413
  });
34274
34414
  var CreatorTemplateCreateKindSchema2 = external_exports.object({
34275
- kind: CreatorTemplateKindSchema2.default("crew")
34415
+ kind: CreatorTemplateKindSchema2.default("crew"),
34416
+ /** `video` makes a draft built from one raw clip (§42.14); it needs `kind: niche`. */
34417
+ origin: external_exports.literal("video").optional()
34276
34418
  });
34277
34419
  var StudioUploadCreateSchema2 = external_exports.object({
34278
- position: UploadPosition2,
34420
+ purpose: external_exports.enum(["source", "character"]).optional(),
34421
+ position: UploadPosition2.optional(),
34279
34422
  filename: external_exports.string().min(1).max(200),
34280
- content_type: StudioUploadContentTypeSchema2,
34281
- bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM2.studio.upload_max_bytes)
34423
+ content_type: external_exports.union([StudioUploadContentTypeSchema2, StudioImageContentTypeSchema2]),
34424
+ bytes: external_exports.number().int().positive()
34425
+ }).superRefine((body2, ctx) => {
34426
+ const { video, upload_max_bytes } = CREATOR_PROGRAM2.studio;
34427
+ const character2 = body2.purpose === "character";
34428
+ const issue2 = (path, message4) => ctx.addIssue({ code: "custom", path: [path], message: message4 });
34429
+ if (body2.purpose !== "source" && body2.position === void 0) issue2("position", "position is required");
34430
+ if (character2 !== StudioImageContentTypeSchema2.safeParse(body2.content_type).success) {
34431
+ issue2("content_type", character2 ? "a character must be a PNG, JPEG or WebP image" : "this upload must be an MP4, MOV or WebM video");
34432
+ }
34433
+ const max = character2 ? video.image_max_bytes : body2.purpose === "source" ? video.video_max_bytes : upload_max_bytes;
34434
+ if (body2.bytes > max) issue2("bytes", `this upload may be at most ${max} bytes`);
34282
34435
  });
34283
34436
  var StudioUploadTicketSchema2 = external_exports.object({
34284
34437
  object: external_exports.literal("studio_upload_ticket"),
@@ -34292,6 +34445,12 @@ var StudioUploadResultSchema2 = external_exports.object({
34292
34445
  template_id: idOf2("ctp"),
34293
34446
  upload: StudioUploadSchema2
34294
34447
  });
34448
+ var StudioVideoUploadResultSchema2 = external_exports.object({
34449
+ object: external_exports.literal("studio_upload"),
34450
+ template_id: idOf2("ctp"),
34451
+ source_video: StudioSourceVideoSchema2.nullable(),
34452
+ characters: external_exports.array(StudioCharacterSchema2)
34453
+ });
34295
34454
  var StudioRoundCreateSchema2 = external_exports.object({
34296
34455
  feedback: external_exports.string().min(1).max(4e3).optional(),
34297
34456
  rights_attested: external_exports.boolean().optional()
@@ -34304,9 +34463,12 @@ var StudioBudgetSchema2 = external_exports.object({
34304
34463
  var CreatorStudioViewSchema2 = external_exports.object({
34305
34464
  object: external_exports.literal("creator_studio"),
34306
34465
  template_id: idOf2("ctp"),
34307
- studio: CreatorStudioSchema2,
34308
- /** Newest first. */
34309
- rounds: external_exports.array(CreatorTemplateRoundSchema2),
34466
+ /** A `video` origin's `source_video` also carries a signed `url` once its bytes landed. */
34467
+ studio: CreatorStudioSchema2.extend({
34468
+ source_video: StudioSourceVideoSchema2.extend({ url: external_exports.string().nullable().optional() }).nullable().default(null)
34469
+ }),
34470
+ /** Newest first. A `video` round also carries a signed `sample_url`. */
34471
+ rounds: external_exports.array(CreatorTemplateRoundSchema2.extend({ sample_url: external_exports.string().nullable().optional() })),
34310
34472
  budget: StudioBudgetSchema2
34311
34473
  });
34312
34474
  var NicheSubmitSchema2 = external_exports.object({
@@ -34316,6 +34478,7 @@ var NicheSubmitSchema2 = external_exports.object({
34316
34478
  hero_sample_index: external_exports.number().int().nonnegative()
34317
34479
  })
34318
34480
  });
34481
+ var VideoSubmitSchema2 = external_exports.object({ round: external_exports.number().int().positive() });
34319
34482
  var CreatorListingPatchSchema2 = CreatorTemplateListingSchema2.partial();
34320
34483
  var CreatorListingSchema2 = external_exports.object({
34321
34484
  object: external_exports.literal("creator_listing"),
@@ -34535,6 +34698,10 @@ var EventTypeSchema2 = external_exports.enum([
34535
34698
  "span.harness_build.end",
34536
34699
  "span.box_resume.start",
34537
34700
  "span.box_resume.end",
34701
+ "span.tools_resolve.start",
34702
+ "span.tools_resolve.end",
34703
+ "span.model_gate.start",
34704
+ "span.model_gate.end",
34538
34705
  /**
34539
34706
  * A delegated thread's lifecycle, on the **coordinator's** stream (§28). The child's own
34540
34707
  * `ses_…` rides inside `data.thread_id` — the event schema gains no field and `vetta.event` gains
@@ -36108,11 +36275,12 @@ var MusicGenerationSchema2 = external_exports.object({
36108
36275
  duration_seconds: Seconds22.nullable(),
36109
36276
  cost_micro_usd: MicroUsdField2
36110
36277
  });
36278
+ var EditModeSchema2 = external_exports.enum(["scene", "outfit_or_object", "person_swap", "recast"]);
36111
36279
  var EditRequestSchema2 = external_exports.object({
36112
36280
  video: external_exports.string().min(1),
36113
36281
  prompt: external_exports.string().min(1).max(1e3),
36114
36282
  references: external_exports.array(external_exports.string().min(1)).max(4).optional(),
36115
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).optional()
36283
+ mode: EditModeSchema2.optional()
36116
36284
  });
36117
36285
  var EditFailureCodeSchema2 = external_exports.enum(["bad_source", "refused", "timed_out", "provider_error", "cancelled"]);
36118
36286
  var EditJobSchema2 = external_exports.object({
@@ -36122,7 +36290,7 @@ var EditJobSchema2 = external_exports.object({
36122
36290
  video: external_exports.string(),
36123
36291
  prompt: external_exports.string(),
36124
36292
  references: external_exports.array(external_exports.string()),
36125
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).nullable(),
36293
+ mode: EditModeSchema2.nullable(),
36126
36294
  result: external_exports.object({ file_id: external_exports.string().startsWith("fil_") }).nullable(),
36127
36295
  error: external_exports.object({ code: EditFailureCodeSchema2, message: external_exports.string() }).nullable(),
36128
36296
  cost_micro_usd: MicroUsdField2.nullable(),
@@ -37096,6 +37264,11 @@ function tolerantPage(item) {
37096
37264
  });
37097
37265
  }
37098
37266
  var DOT_SEGMENT = /^(?:\.|%2e){1,2}$/i;
37267
+ function pathId(value, name6) {
37268
+ if (value !== void 0 && value !== null && String(value) !== "") return encodeURIComponent(value);
37269
+ const message4 = `${name6} is required`;
37270
+ throw new ApiError(400, { type: "invalid_request", code: "validation_failed", message: message4, param: name6, request_id: "" });
37271
+ }
37099
37272
  function url2(config2, call) {
37100
37273
  const segments = call.path.split("/");
37101
37274
  if (segments.some((segment) => DOT_SEGMENT.test(segment)) || segments.at(-1) === "") {
@@ -37924,77 +38097,77 @@ var domains = (config2) => ({
37924
38097
  delete: (id) => request(config2, DeletedSchema, { method: "DELETE", path: `/v1/domains/${encodeURIComponent(id)}` })
37925
38098
  });
37926
38099
  var emails = (config2) => ({
37927
- create: (identityId, body2) => request(config2, EmailInboxSchema2, {
38100
+ create: async (identityId, body2) => request(config2, EmailInboxSchema2, {
37928
38101
  method: "POST",
37929
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails`,
38102
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails`,
37930
38103
  body: body2
37931
38104
  }),
37932
- list: (identityId, query2 = {}) => request(config2, page(EmailInboxSchema2), {
38105
+ list: async (identityId, query2 = {}) => request(config2, page(EmailInboxSchema2), {
37933
38106
  method: "GET",
37934
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails`,
38107
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails`,
37935
38108
  query: query2
37936
38109
  }),
37937
38110
  /** Turn on or off whether mail to the inbox wakes its owner. An inbox from before the wake shipped is off. */
37938
- update: (identityId, inboxId, body2) => request(config2, EmailInboxSchema2, {
38111
+ update: async (identityId, inboxId, body2) => request(config2, EmailInboxSchema2, {
37939
38112
  method: "PATCH",
37940
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails/${encodeURIComponent(inboxId)}`,
38113
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}`,
37941
38114
  body: body2
37942
38115
  }),
37943
- delete: (identityId, inboxId) => request(config2, DeletedSchema, {
38116
+ delete: async (identityId, inboxId) => request(config2, DeletedSchema, {
37944
38117
  method: "DELETE",
37945
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails/${encodeURIComponent(inboxId)}`
38118
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}`
37946
38119
  }),
37947
38120
  /** Gated on the domain's `dns_status`; a premature send is a retryable `job_not_ready`. */
37948
- send: (identityId, inboxId, body2) => request(config2, EmailSendSchema, {
38121
+ send: async (identityId, inboxId, body2) => request(config2, EmailSendSchema, {
37949
38122
  method: "POST",
37950
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails/${encodeURIComponent(inboxId)}/send`,
38123
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}/send`,
37951
38124
  body: body2
37952
38125
  }),
37953
38126
  /** Everything that arrived for this persona, both channels unless one is named. */
37954
- messages: (identityId, query2 = {}) => request(config2, page(InboundMessageSchema2), {
38127
+ messages: async (identityId, query2 = {}) => request(config2, page(InboundMessageSchema2), {
37955
38128
  method: "GET",
37956
- path: `/v1/identities/${encodeURIComponent(identityId)}/messages`,
38129
+ path: `/v1/identities/${pathId(identityId, "identityId")}/messages`,
37957
38130
  query: query2
37958
38131
  }),
37959
38132
  /** Mark one arrived message read or unread; a message already read keeps its first time. */
37960
- markRead: (identityId, messageId, read) => request(config2, InboundMessageSchema2, {
38133
+ markRead: async (identityId, messageId, read) => request(config2, InboundMessageSchema2, {
37961
38134
  method: "POST",
37962
- path: `/v1/identities/${encodeURIComponent(identityId)}/messages/${encodeURIComponent(messageId)}/read`,
38135
+ path: `/v1/identities/${pathId(identityId, "identityId")}/messages/${encodeURIComponent(messageId)}/read`,
37963
38136
  body: { read }
37964
38137
  }),
37965
38138
  /** What the persona sent, newest first — through the API and through its agent alike. */
37966
- sent: (identityId, query2 = {}) => request(config2, page(OutboundMessageSchema2), {
38139
+ sent: async (identityId, query2 = {}) => request(config2, page(OutboundMessageSchema2), {
37967
38140
  method: "GET",
37968
- path: `/v1/identities/${encodeURIComponent(identityId)}/sent`,
38141
+ path: `/v1/identities/${pathId(identityId, "identityId")}/sent`,
37969
38142
  query: query2
37970
38143
  })
37971
38144
  });
37972
38145
  var phones = (config2) => ({
37973
38146
  /** 202, not 201: the number exists and can receive, but outbound waits on a carrier decision. */
37974
- provision: (identityId, body2) => request(config2, PhoneNumberSchema2, {
38147
+ provision: async (identityId, body2) => request(config2, PhoneNumberSchema2, {
37975
38148
  method: "POST",
37976
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones`,
38149
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones`,
37977
38150
  body: body2
37978
38151
  }),
37979
- list: (identityId, query2 = {}) => request(config2, page(PhoneNumberSchema2), {
38152
+ list: async (identityId, query2 = {}) => request(config2, page(PhoneNumberSchema2), {
37980
38153
  method: "GET",
37981
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones`,
38154
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones`,
37982
38155
  query: query2
37983
38156
  }),
37984
38157
  /** Set, or clear with `null`, the agent this number's inbound texts are for. */
37985
- update: (identityId, phoneId, body2) => request(config2, PhoneNumberSchema2, {
38158
+ update: async (identityId, phoneId, body2) => request(config2, PhoneNumberSchema2, {
37986
38159
  method: "PATCH",
37987
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones/${encodeURIComponent(phoneId)}`,
38160
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}`,
37988
38161
  body: body2
37989
38162
  }),
37990
- release: (identityId, phoneId) => request(config2, DeletedSchema, {
38163
+ release: async (identityId, phoneId) => request(config2, DeletedSchema, {
37991
38164
  method: "DELETE",
37992
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones/${encodeURIComponent(phoneId)}`
38165
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}`
37993
38166
  }),
37994
38167
  /** Refused with `compliance_pending` until the campaign is approved. That is a carrier rule. */
37995
- send: (identityId, phoneId, body2) => request(config2, SmsSendSchema, {
38168
+ send: async (identityId, phoneId, body2) => request(config2, SmsSendSchema, {
37996
38169
  method: "POST",
37997
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones/${encodeURIComponent(phoneId)}/send`,
38170
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}/send`,
37998
38171
  body: body2
37999
38172
  })
38000
38173
  });
@@ -38557,7 +38730,7 @@ var wallet = (config2) => {
38557
38730
  updatePolicy: (identity3, body2, select3 = {}) => request(config2, WalletSchema2, { method: "PATCH", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/policy`, body: body2, query: select3 }),
38558
38731
  freeze: (identity3, select3 = {}) => request(config2, WalletSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/freeze`, query: select3 }),
38559
38732
  unfreeze: (identity3, select3 = {}) => request(config2, WalletSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/unfreeze`, query: select3 }),
38560
- /** The three money moves take an `idempotencyKey` so a retry of one move reuses its key and moves the money once. */
38733
+ /** The money moves (and `pay`) take an `idempotencyKey` so a retry of one move reuses its key and moves the money once. */
38561
38734
  fund: (identity3, body2, select3 = {}, opts = {}) => request(config2, WalletTransactionSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/fund`, body: body2, query: select3, headers: keyed(opts) }),
38562
38735
  transfer: (identity3, body2, select3 = {}, opts = {}) => request(config2, WalletTransactionSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/transfer`, body: body2, query: select3, headers: keyed(opts) }),
38563
38736
  sweep: (identity3, body2 = {}, select3 = {}, opts = {}) => request(config2, WalletTransactionSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/sweep`, body: body2, query: select3, headers: keyed(opts) }),
@@ -38569,7 +38742,7 @@ var wallet = (config2) => {
38569
38742
  query: { ...query2, kind: "pay" }
38570
38743
  }),
38571
38744
  quote: (identity3, body2, select3 = {}) => request(config2, WalletQuoteSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/quote`, body: body2, query: select3 }),
38572
- pay: (identity3, body2, select3 = {}) => request(config2, WalletPaymentSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/pay`, body: body2, query: select3 })
38745
+ pay: (identity3, body2, select3 = {}, opts = {}) => request(config2, WalletPaymentSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/pay`, body: body2, query: select3, headers: keyed(opts) })
38573
38746
  };
38574
38747
  };
38575
38748
  var GrantSchema = external_exports.object({
@@ -38764,65 +38937,65 @@ var SocialWorkspaceSchema = external_exports.object({
38764
38937
  });
38765
38938
  var SocialPortalSchema = external_exports.object({ object: external_exports.literal("social_portal_link"), url: external_exports.url() });
38766
38939
  var setup = (config2) => ({
38767
- activate: (identity3) => request(config2, SocialWorkspaceSchema, {
38940
+ activate: async (identity3) => request(config2, SocialWorkspaceSchema, {
38768
38941
  method: "POST",
38769
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/activate`
38942
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/activate`
38770
38943
  }),
38771
- status: (identity3) => request(config2, SocialWorkspaceSchema, {
38944
+ status: async (identity3) => request(config2, SocialWorkspaceSchema, {
38772
38945
  method: "GET",
38773
- path: `/v1/identities/${encodeURIComponent(identity3)}/social`
38946
+ path: `/v1/identities/${pathId(identity3, "identity")}/social`
38774
38947
  }),
38775
- portal: (identity3, body2 = {}) => request(config2, SocialPortalSchema, {
38948
+ portal: async (identity3, body2 = {}) => request(config2, SocialPortalSchema, {
38776
38949
  method: "POST",
38777
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/portal`,
38950
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/portal`,
38778
38951
  body: body2
38779
38952
  }),
38780
- accounts: (identity3, query2 = {}) => request(config2, page(SocialAccountSchema2), {
38953
+ accounts: async (identity3, query2 = {}) => request(config2, page(SocialAccountSchema2), {
38781
38954
  method: "GET",
38782
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/accounts`,
38955
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/accounts`,
38783
38956
  query: query2
38784
38957
  }),
38785
- accountAnalytics: (identity3, account) => request(config2, SocialAnalyticsSchema2, {
38958
+ accountAnalytics: async (identity3, account) => request(config2, SocialAnalyticsSchema2, {
38786
38959
  method: "GET",
38787
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/accounts/${encodeURIComponent(account)}/analytics`
38960
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/accounts/${encodeURIComponent(account)}/analytics`
38788
38961
  }),
38789
- upload: (identity3, body2) => request(config2, SocialUploadSchema2, {
38962
+ upload: async (identity3, body2) => request(config2, SocialUploadSchema2, {
38790
38963
  method: "POST",
38791
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/uploads`,
38964
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/uploads`,
38792
38965
  body: body2
38793
38966
  })
38794
38967
  });
38795
38968
  var publishing = (config2) => ({
38796
- createPost: (identity3, body2) => request(config2, SocialPostSchema2, {
38969
+ createPost: async (identity3, body2) => request(config2, SocialPostSchema2, {
38797
38970
  method: "POST",
38798
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts`,
38971
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts`,
38799
38972
  body: body2
38800
38973
  }),
38801
- getPost: (identity3, post2) => request(config2, SocialPostSchema2, {
38974
+ getPost: async (identity3, post2) => request(config2, SocialPostSchema2, {
38802
38975
  method: "GET",
38803
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}`
38976
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}`
38804
38977
  }),
38805
- deletePost: (identity3, post2) => request(config2, DeletedSchema, {
38978
+ deletePost: async (identity3, post2) => request(config2, DeletedSchema, {
38806
38979
  method: "DELETE",
38807
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}`
38980
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}`
38808
38981
  }),
38809
- postAnalytics: (identity3, post2) => request(config2, SocialAnalyticsSchema2, {
38982
+ postAnalytics: async (identity3, post2) => request(config2, SocialAnalyticsSchema2, {
38810
38983
  method: "GET",
38811
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}/analytics`
38984
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}/analytics`
38812
38985
  }),
38813
38986
  /**
38814
38987
  * `GET /v1/posts` — every post the company files, across identities and sessions (§27.1): the
38815
38988
  * `social.post` calls waiting on a person (`pending`), and the ones sent, with their latest numbers.
38816
38989
  * `reconcile: false` lists what is stored without asking the provider about due posts first.
38817
38990
  */
38818
- listPosts: ({ reconcile, ...query2 } = {}) => request(config2, page(PostSchema2), {
38991
+ listPosts: async ({ reconcile, ...query2 } = {}) => request(config2, page(PostSchema2), {
38819
38992
  method: "GET",
38820
38993
  path: "/v1/posts",
38821
38994
  query: { ...query2, ...reconcile === void 0 ? {} : { reconcile: String(reconcile) } }
38822
38995
  }),
38823
- comments: (identity3, post2, query2 = {}) => request(config2, page(SocialCommentSchema2), {
38996
+ comments: async (identity3, post2, query2 = {}) => request(config2, page(SocialCommentSchema2), {
38824
38997
  method: "GET",
38825
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}/comments`,
38998
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}/comments`,
38826
38999
  query: query2
38827
39000
  })
38828
39001
  });
@@ -38981,10 +39154,10 @@ async function* streamFrames(config2, schema, call) {
38981
39154
  yield parsed.data;
38982
39155
  }
38983
39156
  }
38984
- function settled(session2, afterSeq, throughGrades) {
38985
- if (session2.status === "running" || session2.status === "queued") return false;
38986
- if (throughGrades && session2.stop_reason === "awaiting_delegation") return false;
38987
- return session2.last_seq <= afterSeq;
39157
+ function settledAt(session2, throughGrades) {
39158
+ if (session2.status === "running" || session2.status === "queued") return null;
39159
+ if (throughGrades && session2.stop_reason === "awaiting_delegation") return null;
39160
+ return session2.last_seq;
38988
39161
  }
38989
39162
  async function* streamEvents(config2, sessionId, options = {}) {
38990
39163
  const maxRetries = options.maxRetries ?? 5;
@@ -38993,7 +39166,8 @@ async function* streamEvents(config2, sessionId, options = {}) {
38993
39166
  let failures = 0;
38994
39167
  const grading = /* @__PURE__ */ new Set();
38995
39168
  let held = false;
38996
- if (lastSeq > 0 && settled(await sessions(config2).get(sessionId), lastSeq, throughGrades)) return;
39169
+ const endAt = lastSeq > 0 ? settledAt(await sessions(config2).get(sessionId), throughGrades) : null;
39170
+ if (endAt !== null && endAt <= lastSeq) return;
38997
39171
  for (; ; ) {
38998
39172
  try {
38999
39173
  const call = {
@@ -39011,6 +39185,7 @@ async function* streamEvents(config2, sessionId, options = {}) {
39011
39185
  if (event.type === "outcome.evaluation.started") grading.add(gradeKey(event));
39012
39186
  if (event.type === "outcome.evaluation.completed") grading.delete(gradeKey(event));
39013
39187
  yield event;
39188
+ if (endAt !== null && event.seq >= endAt) return;
39014
39189
  if (event.type === "session.idle") {
39015
39190
  held = throughGrades && grading.size > 0 && parkedOnGrade(event);
39016
39191
  if (!held) return;
@@ -39041,6 +39216,21 @@ var ExecResultSchema = external_exports.object({
39041
39216
  truncated: external_exports.boolean().optional()
39042
39217
  });
39043
39218
  var DirectorySchema = external_exports.object({ entries: external_exports.array(FileEntrySchema2) });
39219
+ async function* untilExit(path, frames2) {
39220
+ let exited = false;
39221
+ for await (const frame of frames2) {
39222
+ if ("exit" in frame) exited = true;
39223
+ yield frame;
39224
+ }
39225
+ if (!exited) {
39226
+ throw new ApiError(502, {
39227
+ type: "api_error",
39228
+ code: "internal_error",
39229
+ message: `POST ${path} ended without an exit frame; the command may have run \u2014 check GET \u2026/commands before re-running it`,
39230
+ request_id: ""
39231
+ });
39232
+ }
39233
+ }
39044
39234
  var workspace = (config2) => ({
39045
39235
  /** The name, and nothing else (§41.5). */
39046
39236
  update: (id, body2) => request(config2, ComputerSchema2, { method: "PATCH", path: `/v1/computers/${encodeURIComponent(id)}`, body: body2 }),
@@ -39050,11 +39240,14 @@ var workspace = (config2) => ({
39050
39240
  * The same run as `exec`, frame by frame (§41.2): `{stdout}`/`{stderr}` as they arrive, then one
39051
39241
  * `{exit}` naming the `computer_command` row it was recorded as. One connection, no resume.
39052
39242
  */
39053
- execStream: (id, command, opts = {}) => streamFrames(config2, ExecStreamFrameSchema2, {
39054
- method: "POST",
39055
- path: `/v1/computers/${encodeURIComponent(id)}/exec/stream`,
39056
- body: { command, ...opts.timeoutMs === void 0 ? {} : { timeout_ms: opts.timeoutMs } }
39057
- }),
39243
+ execStream: (id, command, opts = {}) => {
39244
+ const body2 = { command, ...opts.timeoutMs === void 0 ? {} : { timeout_ms: opts.timeoutMs } };
39245
+ return untilExit(`/v1/computers/${encodeURIComponent(id)}/exec/stream`, streamFrames(config2, ExecStreamFrameSchema2, {
39246
+ method: "POST",
39247
+ path: `/v1/computers/${encodeURIComponent(id)}/exec/stream`,
39248
+ body: body2
39249
+ }));
39250
+ },
39058
39251
  /** What has been run on the box, newest first (§41.3). */
39059
39252
  commands: (id, query2 = {}) => request(config2, page(ComputerCommandSchema2), {
39060
39253
  method: "GET",
@@ -39080,7 +39273,7 @@ var computers = (config2) => ({
39080
39273
  path: `/v1/computers/${encodeURIComponent(id)}/exec`,
39081
39274
  body: { command, ...timeoutMs === void 0 ? {} : { timeout_ms: timeoutMs } }
39082
39275
  }),
39083
- /** Paused bills storage only — the first efficiency lever (`memory/context.md`). */
39276
+ /** Paused bills nothing (disk is never metered) — the first efficiency lever (`memory/context.md`). */
39084
39277
  pause: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${encodeURIComponent(id)}/pause`, body: {} }),
39085
39278
  resume: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${encodeURIComponent(id)}/resume`, body: {} }),
39086
39279
  /** An agent's computer only (§41.8): a person holds it, and its sessions wait until it is handed back. */
@@ -41065,6 +41258,8 @@ var LedgerEntrySchema3 = external_exports.object({
41065
41258
  session_id: idOf3("ses").nullable(),
41066
41259
  agent_id: idOf3("agt").nullable(),
41067
41260
  deployment_id: idOf3("dep").nullable(),
41261
+ /** The computer (`cmp_`), browser (`brw_`) or phone (`mob_`) a debit bills; `null` for anything else, and from a server older than the field. */
41262
+ resource_id: external_exports.string().nullable().default(null),
41068
41263
  line_items: external_exports.array(external_exports.object({ tier: LineItemTierSchema3, amount_micro_usd: MicroUsdField3 })),
41069
41264
  created_at: Timestamp3
41070
41265
  });
@@ -42609,7 +42804,11 @@ var transposed3 = (a, b) => {
42609
42804
  };
42610
42805
  function toolNameProblem3(name6) {
42611
42806
  if (BUILTIN_TOOLS3.includes(name6) || name6 in FOLLOWS_TOOL3 || PLATFORM_TOOLS3.includes(name6)) return null;
42612
- if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) return `\`${name6}\` is not a tool: name a built-in, or a namespaced \`<namespace>.<tool>\``;
42807
+ if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) {
42808
+ const bare = [...BUILTIN_TOOLS3, ...Object.keys(FOLLOWS_TOOL3)].find((tool) => transposed3(tool, name6));
42809
+ const hint = bare === void 0 ? "name a built-in, or a namespaced `<namespace>.<tool>`" : `did you mean \`${bare}\`?`;
42810
+ return `\`${name6}\` is not a tool; ${hint}`;
42811
+ }
42613
42812
  const namespace = name6.slice(0, name6.indexOf("."));
42614
42813
  if (PLATFORM_NAMESPACES3.has(namespace)) {
42615
42814
  const known = [...PLATFORM_TOOLS3, ...Object.keys(FOLLOWS_TOOL3)].filter((tool) => tool.startsWith(`${namespace}.`));
@@ -42619,7 +42818,8 @@ function toolNameProblem3(name6) {
42619
42818
  return meant === void 0 ? null : `\`${name6}\` is not a tool; did you mean \`${meant}${name6.slice(namespace.length)}\`?`;
42620
42819
  }
42621
42820
  var ToolConfigSchema3 = external_exports.object({
42622
- enabled: external_exports.boolean(),
42821
+ /** Absent is enabled (ADR-1911): naming a tool to set its permission already says it is wanted. */
42822
+ enabled: external_exports.boolean().default(true),
42623
42823
  permission: ToolPermissionSchema3,
42624
42824
  config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
42625
42825
  });
@@ -42906,7 +43106,24 @@ var CREATOR_PROGRAM3 = {
42906
43106
  upload_token_minutes: 15,
42907
43107
  skill_max_bytes: 32 * 1024,
42908
43108
  /** The reviewer's install check (§42.5): the hard cap on its one session, never charged to the draft. */
42909
- review_check_budget_micro_usd: 5e6
43109
+ review_check_budget_micro_usd: 5e6,
43110
+ /** A `video` origin build (§42.14): one raw clip and its characters, recast by Mira. */
43111
+ video: {
43112
+ min_seconds: 3,
43113
+ max_seconds: 15,
43114
+ video_max_bytes: 95 * 1024 * 1024,
43115
+ image_max_bytes: 10 * 1024 * 1024,
43116
+ characters_min: 1,
43117
+ characters_max: 3,
43118
+ /** After the first render. A refused or failed render does not use one up. */
43119
+ revisions: 5,
43120
+ /** Per doomscroll account, until one of its templates is approved. */
43121
+ unapproved_templates: 2,
43122
+ /** Upload tickets a doomscroll account may ask for, per template. */
43123
+ upload_tickets: 20,
43124
+ /** A draft never submitted loses its source and character bytes this long after `updated_at`. */
43125
+ draft_retention_days: 30
43126
+ }
42910
43127
  }
42911
43128
  };
42912
43129
  var DOOMSCROLL_PROGRAM3 = {
@@ -42950,6 +43167,8 @@ var StudioStateSchema3 = external_exports.enum([
42950
43167
  "setup",
42951
43168
  "building",
42952
43169
  "ready",
43170
+ /** A `video` origin only: a version was submitted and its author is writing the skill. */
43171
+ "finalizing",
42953
43172
  "in_review",
42954
43173
  "live",
42955
43174
  "changes_requested"
@@ -43013,10 +43232,26 @@ var StudioSkillSchema3 = SavedSkillSchema3.extend({
43013
43232
  id: idOf3("skl").nullable(),
43014
43233
  version: external_exports.number().int().positive().nullable()
43015
43234
  });
43235
+ var StudioImageContentTypeSchema3 = external_exports.enum(["image/png", "image/jpeg", "image/webp"]);
43236
+ var StudioSourceVideoSchema3 = external_exports.object({
43237
+ file_id: external_exports.string().nullable(),
43238
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM3.studio.video.video_max_bytes),
43239
+ content_type: StudioUploadContentTypeSchema3,
43240
+ filename: external_exports.string().min(1).max(200),
43241
+ seconds: external_exports.number().nonnegative().nullable()
43242
+ });
43243
+ var CharacterPosition3 = external_exports.number().int().min(1).max(CREATOR_PROGRAM3.studio.video.characters_max);
43244
+ var StudioCharacterSchema3 = external_exports.object({
43245
+ position: CharacterPosition3,
43246
+ file_id: external_exports.string().nullable(),
43247
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM3.studio.video.image_max_bytes),
43248
+ content_type: StudioImageContentTypeSchema3,
43249
+ filename: external_exports.string().min(1).max(200)
43250
+ });
43016
43251
  var CreatorStudioSchema3 = external_exports.object({
43017
43252
  uploads: external_exports.array(StudioUploadSchema3).max(CREATOR_PROGRAM3.studio.uploads).default([]),
43018
- /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos. */
43019
- origin: external_exports.enum(["upload", "links"]).default("upload"),
43253
+ /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos; `video`: one raw clip recast by Mira (§42.14). */
43254
+ origin: external_exports.enum(["upload", "links", "video"]).default("upload"),
43020
43255
  imports: external_exports.array(StudioImportSchema3).max(CREATOR_PROGRAM3.studio.uploads).default([]),
43021
43256
  state: StudioStateSchema3.default("setup"),
43022
43257
  spend_micro_usd: MicroUsdField3.nonnegative().default(0),
@@ -43027,7 +43262,11 @@ var CreatorStudioSchema3 = external_exports.object({
43027
43262
  /** An org build's asked sample length (§57.2, ADR-1762); `null` is `sample_seconds`. */
43028
43263
  seconds: external_exports.number().int().min(10).max(60).nullable().default(null),
43029
43264
  /** An org build's own catalog text: its request's description when that fits a tagline; `null` lets the judge write one. */
43030
- tagline: external_exports.string().max(140).nullable().default(null)
43265
+ tagline: external_exports.string().max(140).nullable().default(null),
43266
+ /** A `video` origin's raw clip, its characters, and the round submitted (§42.14). */
43267
+ source_video: StudioSourceVideoSchema3.nullable().default(null),
43268
+ characters: external_exports.array(StudioCharacterSchema3).max(CREATOR_PROGRAM3.studio.video.characters_max).default([]),
43269
+ chosen_round: external_exports.number().int().positive().nullable().default(null)
43031
43270
  });
43032
43271
  var CreatorTemplateListingSchema3 = external_exports.object({
43033
43272
  listed: external_exports.boolean(),
@@ -43081,7 +43320,15 @@ var CreatorTemplateRoundSchema3 = external_exports.object({
43081
43320
  spend_micro_usd: MicroUsdField3.nonnegative(),
43082
43321
  error: external_exports.string().nullable(),
43083
43322
  created_at: Timestamp3,
43084
- finished_at: Timestamp3.nullable()
43323
+ finished_at: Timestamp3.nullable(),
43324
+ /** A `video` origin round's Mira edit and its result (migration 0172, §42.14). */
43325
+ edit_job_id: external_exports.string().nullable().default(null),
43326
+ sample_file_id: external_exports.string().nullable().default(null)
43327
+ });
43328
+ var StudioPlateSchema3 = external_exports.object({
43329
+ file: external_exports.string().min(1),
43330
+ kind: external_exports.enum(["video", "image"]),
43331
+ file_id: external_exports.string().min(1)
43085
43332
  });
43086
43333
  var NicheVersionStudioSchema3 = external_exports.object({
43087
43334
  round: external_exports.number().int().positive(),
@@ -43090,7 +43337,9 @@ var NicheVersionStudioSchema3 = external_exports.object({
43090
43337
  frames: external_exports.array(StudioFrameSchema3),
43091
43338
  samples: external_exports.array(StudioSampleSchema3),
43092
43339
  tagline: external_exports.string().max(140),
43093
- hero_sample_index: external_exports.number().int().nonnegative()
43340
+ hero_sample_index: external_exports.number().int().nonnegative(),
43341
+ /** A `video` origin's default clip and characters. */
43342
+ plates: external_exports.array(StudioPlateSchema3).optional()
43094
43343
  });
43095
43344
  var CreatorTemplateSchema3 = external_exports.object({
43096
43345
  id: idOf3("ctp"),
@@ -43187,13 +43436,26 @@ var CreatorAnalyticsSchema3 = external_exports.object({
43187
43436
  install_windows: external_exports.array(external_exports.object({ install_id: idOf3("bpi"), from: Day4, until: Day4 })).optional()
43188
43437
  });
43189
43438
  var CreatorTemplateCreateKindSchema3 = external_exports.object({
43190
- kind: CreatorTemplateKindSchema3.default("crew")
43439
+ kind: CreatorTemplateKindSchema3.default("crew"),
43440
+ /** `video` makes a draft built from one raw clip (§42.14); it needs `kind: niche`. */
43441
+ origin: external_exports.literal("video").optional()
43191
43442
  });
43192
43443
  var StudioUploadCreateSchema3 = external_exports.object({
43193
- position: UploadPosition3,
43444
+ purpose: external_exports.enum(["source", "character"]).optional(),
43445
+ position: UploadPosition3.optional(),
43194
43446
  filename: external_exports.string().min(1).max(200),
43195
- content_type: StudioUploadContentTypeSchema3,
43196
- bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM3.studio.upload_max_bytes)
43447
+ content_type: external_exports.union([StudioUploadContentTypeSchema3, StudioImageContentTypeSchema3]),
43448
+ bytes: external_exports.number().int().positive()
43449
+ }).superRefine((body2, ctx) => {
43450
+ const { video, upload_max_bytes } = CREATOR_PROGRAM3.studio;
43451
+ const character2 = body2.purpose === "character";
43452
+ const issue2 = (path, message32) => ctx.addIssue({ code: "custom", path: [path], message: message32 });
43453
+ if (body2.purpose !== "source" && body2.position === void 0) issue2("position", "position is required");
43454
+ if (character2 !== StudioImageContentTypeSchema3.safeParse(body2.content_type).success) {
43455
+ issue2("content_type", character2 ? "a character must be a PNG, JPEG or WebP image" : "this upload must be an MP4, MOV or WebM video");
43456
+ }
43457
+ const max = character2 ? video.image_max_bytes : body2.purpose === "source" ? video.video_max_bytes : upload_max_bytes;
43458
+ if (body2.bytes > max) issue2("bytes", `this upload may be at most ${max} bytes`);
43197
43459
  });
43198
43460
  var StudioUploadTicketSchema3 = external_exports.object({
43199
43461
  object: external_exports.literal("studio_upload_ticket"),
@@ -43207,6 +43469,12 @@ var StudioUploadResultSchema3 = external_exports.object({
43207
43469
  template_id: idOf3("ctp"),
43208
43470
  upload: StudioUploadSchema3
43209
43471
  });
43472
+ var StudioVideoUploadResultSchema3 = external_exports.object({
43473
+ object: external_exports.literal("studio_upload"),
43474
+ template_id: idOf3("ctp"),
43475
+ source_video: StudioSourceVideoSchema3.nullable(),
43476
+ characters: external_exports.array(StudioCharacterSchema3)
43477
+ });
43210
43478
  var StudioRoundCreateSchema3 = external_exports.object({
43211
43479
  feedback: external_exports.string().min(1).max(4e3).optional(),
43212
43480
  rights_attested: external_exports.boolean().optional()
@@ -43219,9 +43487,12 @@ var StudioBudgetSchema3 = external_exports.object({
43219
43487
  var CreatorStudioViewSchema3 = external_exports.object({
43220
43488
  object: external_exports.literal("creator_studio"),
43221
43489
  template_id: idOf3("ctp"),
43222
- studio: CreatorStudioSchema3,
43223
- /** Newest first. */
43224
- rounds: external_exports.array(CreatorTemplateRoundSchema3),
43490
+ /** A `video` origin's `source_video` also carries a signed `url` once its bytes landed. */
43491
+ studio: CreatorStudioSchema3.extend({
43492
+ source_video: StudioSourceVideoSchema3.extend({ url: external_exports.string().nullable().optional() }).nullable().default(null)
43493
+ }),
43494
+ /** Newest first. A `video` round also carries a signed `sample_url`. */
43495
+ rounds: external_exports.array(CreatorTemplateRoundSchema3.extend({ sample_url: external_exports.string().nullable().optional() })),
43225
43496
  budget: StudioBudgetSchema3
43226
43497
  });
43227
43498
  var NicheSubmitSchema3 = external_exports.object({
@@ -43231,6 +43502,7 @@ var NicheSubmitSchema3 = external_exports.object({
43231
43502
  hero_sample_index: external_exports.number().int().nonnegative()
43232
43503
  })
43233
43504
  });
43505
+ var VideoSubmitSchema3 = external_exports.object({ round: external_exports.number().int().positive() });
43234
43506
  var CreatorListingPatchSchema3 = CreatorTemplateListingSchema3.partial();
43235
43507
  var CreatorListingSchema3 = external_exports.object({
43236
43508
  object: external_exports.literal("creator_listing"),
@@ -43450,6 +43722,10 @@ var EventTypeSchema3 = external_exports.enum([
43450
43722
  "span.harness_build.end",
43451
43723
  "span.box_resume.start",
43452
43724
  "span.box_resume.end",
43725
+ "span.tools_resolve.start",
43726
+ "span.tools_resolve.end",
43727
+ "span.model_gate.start",
43728
+ "span.model_gate.end",
43453
43729
  /**
43454
43730
  * A delegated thread's lifecycle, on the **coordinator's** stream (§28). The child's own
43455
43731
  * `ses_…` rides inside `data.thread_id` — the event schema gains no field and `vetta.event` gains
@@ -45029,11 +45305,12 @@ var MusicGenerationSchema3 = external_exports.object({
45029
45305
  duration_seconds: Seconds23.nullable(),
45030
45306
  cost_micro_usd: MicroUsdField3
45031
45307
  });
45308
+ var EditModeSchema3 = external_exports.enum(["scene", "outfit_or_object", "person_swap", "recast"]);
45032
45309
  var EditRequestSchema3 = external_exports.object({
45033
45310
  video: external_exports.string().min(1),
45034
45311
  prompt: external_exports.string().min(1).max(1e3),
45035
45312
  references: external_exports.array(external_exports.string().min(1)).max(4).optional(),
45036
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).optional()
45313
+ mode: EditModeSchema3.optional()
45037
45314
  });
45038
45315
  var EditFailureCodeSchema3 = external_exports.enum(["bad_source", "refused", "timed_out", "provider_error", "cancelled"]);
45039
45316
  var EditJobSchema3 = external_exports.object({
@@ -45043,7 +45320,7 @@ var EditJobSchema3 = external_exports.object({
45043
45320
  video: external_exports.string(),
45044
45321
  prompt: external_exports.string(),
45045
45322
  references: external_exports.array(external_exports.string()),
45046
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).nullable(),
45323
+ mode: EditModeSchema3.nullable(),
45047
45324
  result: external_exports.object({ file_id: external_exports.string().startsWith("fil_") }).nullable(),
45048
45325
  error: external_exports.object({ code: EditFailureCodeSchema3, message: external_exports.string() }).nullable(),
45049
45326
  cost_micro_usd: MicroUsdField3.nullable(),
@@ -47858,7 +48135,7 @@ var auth2 = {
47858
48135
  } else if (apiKey === "" || cmd.config.apiKeyFromProfile) {
47859
48136
  const piped = cmd.readStdin()?.trim() ?? "";
47860
48137
  if (piped !== "") apiKey = piped;
47861
- if (apiKey === "") throw new UsageError("pipe the key on stdin, set VETTA_API_KEY, or pass --email and --password");
48138
+ if (apiKey === "") throw new UsageError("pipe the key on stdin, set NAIVE_API_KEY, or pass --email and --password");
47862
48139
  }
47863
48140
  const client = cmd.withApiKey(apiKey);
47864
48141
  const me = await client.auth.me();
@@ -48082,7 +48359,7 @@ function status2(args) {
48082
48359
  if (found === void 0) throw new UsageError(`--status must be ${CardStatusSchema.options.join("|")}`);
48083
48360
  return found;
48084
48361
  }
48085
- async function settled2(cmd, issued) {
48362
+ async function settled(cmd, issued) {
48086
48363
  let current = issued;
48087
48364
  for (let attempt2 = 0; SETTLING.has(current.status) && attempt2 < WAIT_ATTEMPTS; attempt2 += 1) {
48088
48365
  await new Promise((resolve5) => setTimeout(resolve5, WAIT_MS));
@@ -48110,7 +48387,7 @@ var cards2 = {
48110
48387
  label: args.need("label"),
48111
48388
  load_micro_usd: microFromUsdFlag("usd", args.need("usd"))
48112
48389
  });
48113
- return { out: args.bool("wait") ? await settled2(cmd, issued) : issued };
48390
+ return { out: args.bool("wait") ? await settled(cmd, issued) : issued };
48114
48391
  },
48115
48392
  show: async ({ client, args }) => ({ out: await client.identities.cards.get(ref(args), card(args)) }),
48116
48393
  reveal: async ({ client, args }) => {
@@ -48448,11 +48725,11 @@ var WAIT_MS2 = 5e3;
48448
48725
  var WAIT_ATTEMPTS2 = 1440;
48449
48726
  var STATES = ["setup", "building", "ready"];
48450
48727
  var newest = (build) => build.rounds[0];
48451
- var settled3 = (build) => newest(build)?.state === "ready" || newest(build)?.state === "failed";
48728
+ var settled2 = (build) => newest(build)?.state === "ready" || newest(build)?.state === "failed";
48452
48729
  async function finish(cmd, queued, wait) {
48453
48730
  if (!wait) return { out: queued };
48454
48731
  let build = queued;
48455
- for (let attempt2 = 0; attempt2 < WAIT_ATTEMPTS2 && !settled3(build); attempt2 += 1) {
48732
+ for (let attempt2 = 0; attempt2 < WAIT_ATTEMPTS2 && !settled2(build); attempt2 += 1) {
48456
48733
  await new Promise((resolve5) => setTimeout(resolve5, WAIT_MS2));
48457
48734
  build = await cmd.client.media.skills.get(queued.id);
48458
48735
  }
@@ -48699,8 +48976,8 @@ var media6 = {
48699
48976
  // §55: `naive media edit "<prompt>" --video <fil_|url>`. `--wait` follows the edit job.
48700
48977
  edit: async ({ client, args }) => {
48701
48978
  const mode = args.str("mode");
48702
- if (mode !== void 0 && mode !== "scene" && mode !== "outfit_or_object" && mode !== "person_swap") {
48703
- throw new UsageError("--mode must be scene, outfit_or_object or person_swap");
48979
+ if (mode !== void 0 && mode !== "scene" && mode !== "outfit_or_object" && mode !== "person_swap" && mode !== "recast") {
48980
+ throw new UsageError("--mode must be scene, outfit_or_object, person_swap or recast");
48704
48981
  }
48705
48982
  const references = args.list("reference");
48706
48983
  let job = await client.media.edits.create({
@@ -51616,7 +51893,7 @@ var ALIASES = {
51616
51893
  };
51617
51894
 
51618
51895
  // src/cli.ts
51619
- var VERSION = true ? "1.0.1" : "0.0.0-dev";
51896
+ var VERSION = true ? "1.0.3" : "0.0.0-dev";
51620
51897
  var GLOBAL_FLAGS_HELP = "global flags: --json (default) --human --profile <name> --api-key <key> --org <org_id> --api-base-url <url>";
51621
51898
  function usage() {
51622
51899
  const groups = [...Object.keys(GROUPS), ...Object.keys(ALIASES)].sort().join(", ");
@@ -51690,9 +51967,13 @@ function clients(deps2, baseUrl) {
51690
51967
  const fetch = namingHost(deps2.fetch, baseUrl);
51691
51968
  return (apiKey) => createClient({ baseUrl, apiKey, fetch, idempotencyKey: deps2.idempotencyKey });
51692
51969
  }
51970
+ function argvKeyWarning(flag) {
51971
+ return `warning: ${flag} leaves the key in shell history and, under npx, in ~/.npm/_logs; pipe it on stdin (read -rs KEY && printf '%s\\n' "$KEY" | naive login) or set NAIVE_API_KEY`;
51972
+ }
51693
51973
  async function run(argv, deps2) {
51694
51974
  const parsed = parseLine(argv);
51695
51975
  const first = parsed.words[0] ?? "";
51976
+ let argvKey;
51696
51977
  try {
51697
51978
  if (parsed.args(2).bool("version")) {
51698
51979
  deps2.io.out(`naive ${VERSION} (api ${API_VERSION})`);
@@ -51713,6 +51994,8 @@ async function run(argv, deps2) {
51713
51994
  const args = parsed.args(sub2 ? 3 : alias ? 1 : 2);
51714
51995
  rejectUnknownFlags(args.names(), group, command);
51715
51996
  const config2 = resolveConfig(args, deps2.env, deps2.readConfig, { login: group === "auth" && command === "login" });
51997
+ const claimKey = group === "naive" && command === "claim" && args.str("key") !== void 0;
51998
+ argvKey = args.str("api-key") !== void 0 ? "--api-key" : claimKey ? "--key" : void 0;
51716
51999
  if (config2.apiKey === "" && group !== "auth" && group !== "naive") throw new UsageError(NO_API_KEY);
51717
52000
  const withApiKey = clients(deps2, config2.baseUrl);
51718
52001
  const human2 = args.bool("human");
@@ -51729,6 +52012,8 @@ async function run(argv, deps2) {
51729
52012
  } catch (cause) {
51730
52013
  deps2.io.err(describeError(cause));
51731
52014
  return exitForError(cause);
52015
+ } finally {
52016
+ if (argvKey !== void 0) deps2.io.err(argvKeyWarning(argvKey));
51732
52017
  }
51733
52018
  }
51734
52019
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usenaive-sdk/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Naive Managed Agents command line — create agents, run sessions, watch events, see cost.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,8 +27,8 @@
27
27
  "esbuild": "0.28.2",
28
28
  "yaml": "^2.9.0",
29
29
  "@vetta/core": "0.0.0",
30
- "@usenaive-sdk/blueprints": "0.18.0",
31
- "@usenaive-sdk/managed-agents": "0.12.1"
30
+ "@usenaive-sdk/managed-agents": "0.12.3",
31
+ "@usenaive-sdk/blueprints": "0.18.0"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "node build.mjs",