@usenaive-sdk/cli 1.0.0 → 1.0.2

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 +399 -119
  2. package/package.json +2 -2
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) === "") {
@@ -37148,6 +37321,7 @@ var CODE_BY_STATUS = {
37148
37321
  var BLOCKED_AT_EDGE = "the request was blocked before it reached the API (HTTP 403); this can happen when a request body looks like SQL";
37149
37322
  function unreadableMessage(status4) {
37150
37323
  if (status4 === 403) return BLOCKED_AT_EDGE;
37324
+ if (status4 === 401) return "HTTP 401: the API key was rejected and the response had no readable details; check the API key and that baseUrl points at the API";
37151
37325
  return `HTTP ${status4}: the error response had no readable details`;
37152
37326
  }
37153
37327
  function apiErrorFrom(response, text32) {
@@ -37923,77 +38097,77 @@ var domains = (config2) => ({
37923
38097
  delete: (id) => request(config2, DeletedSchema, { method: "DELETE", path: `/v1/domains/${encodeURIComponent(id)}` })
37924
38098
  });
37925
38099
  var emails = (config2) => ({
37926
- create: (identityId, body2) => request(config2, EmailInboxSchema2, {
38100
+ create: async (identityId, body2) => request(config2, EmailInboxSchema2, {
37927
38101
  method: "POST",
37928
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails`,
38102
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails`,
37929
38103
  body: body2
37930
38104
  }),
37931
- list: (identityId, query2 = {}) => request(config2, page(EmailInboxSchema2), {
38105
+ list: async (identityId, query2 = {}) => request(config2, page(EmailInboxSchema2), {
37932
38106
  method: "GET",
37933
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails`,
38107
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails`,
37934
38108
  query: query2
37935
38109
  }),
37936
38110
  /** Turn on or off whether mail to the inbox wakes its owner. An inbox from before the wake shipped is off. */
37937
- update: (identityId, inboxId, body2) => request(config2, EmailInboxSchema2, {
38111
+ update: async (identityId, inboxId, body2) => request(config2, EmailInboxSchema2, {
37938
38112
  method: "PATCH",
37939
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails/${encodeURIComponent(inboxId)}`,
38113
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}`,
37940
38114
  body: body2
37941
38115
  }),
37942
- delete: (identityId, inboxId) => request(config2, DeletedSchema, {
38116
+ delete: async (identityId, inboxId) => request(config2, DeletedSchema, {
37943
38117
  method: "DELETE",
37944
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails/${encodeURIComponent(inboxId)}`
38118
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}`
37945
38119
  }),
37946
38120
  /** Gated on the domain's `dns_status`; a premature send is a retryable `job_not_ready`. */
37947
- send: (identityId, inboxId, body2) => request(config2, EmailSendSchema, {
38121
+ send: async (identityId, inboxId, body2) => request(config2, EmailSendSchema, {
37948
38122
  method: "POST",
37949
- path: `/v1/identities/${encodeURIComponent(identityId)}/emails/${encodeURIComponent(inboxId)}/send`,
38123
+ path: `/v1/identities/${pathId(identityId, "identityId")}/emails/${encodeURIComponent(inboxId)}/send`,
37950
38124
  body: body2
37951
38125
  }),
37952
38126
  /** Everything that arrived for this persona, both channels unless one is named. */
37953
- messages: (identityId, query2 = {}) => request(config2, page(InboundMessageSchema2), {
38127
+ messages: async (identityId, query2 = {}) => request(config2, page(InboundMessageSchema2), {
37954
38128
  method: "GET",
37955
- path: `/v1/identities/${encodeURIComponent(identityId)}/messages`,
38129
+ path: `/v1/identities/${pathId(identityId, "identityId")}/messages`,
37956
38130
  query: query2
37957
38131
  }),
37958
38132
  /** Mark one arrived message read or unread; a message already read keeps its first time. */
37959
- markRead: (identityId, messageId, read) => request(config2, InboundMessageSchema2, {
38133
+ markRead: async (identityId, messageId, read) => request(config2, InboundMessageSchema2, {
37960
38134
  method: "POST",
37961
- path: `/v1/identities/${encodeURIComponent(identityId)}/messages/${encodeURIComponent(messageId)}/read`,
38135
+ path: `/v1/identities/${pathId(identityId, "identityId")}/messages/${encodeURIComponent(messageId)}/read`,
37962
38136
  body: { read }
37963
38137
  }),
37964
38138
  /** What the persona sent, newest first — through the API and through its agent alike. */
37965
- sent: (identityId, query2 = {}) => request(config2, page(OutboundMessageSchema2), {
38139
+ sent: async (identityId, query2 = {}) => request(config2, page(OutboundMessageSchema2), {
37966
38140
  method: "GET",
37967
- path: `/v1/identities/${encodeURIComponent(identityId)}/sent`,
38141
+ path: `/v1/identities/${pathId(identityId, "identityId")}/sent`,
37968
38142
  query: query2
37969
38143
  })
37970
38144
  });
37971
38145
  var phones = (config2) => ({
37972
38146
  /** 202, not 201: the number exists and can receive, but outbound waits on a carrier decision. */
37973
- provision: (identityId, body2) => request(config2, PhoneNumberSchema2, {
38147
+ provision: async (identityId, body2) => request(config2, PhoneNumberSchema2, {
37974
38148
  method: "POST",
37975
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones`,
38149
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones`,
37976
38150
  body: body2
37977
38151
  }),
37978
- list: (identityId, query2 = {}) => request(config2, page(PhoneNumberSchema2), {
38152
+ list: async (identityId, query2 = {}) => request(config2, page(PhoneNumberSchema2), {
37979
38153
  method: "GET",
37980
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones`,
38154
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones`,
37981
38155
  query: query2
37982
38156
  }),
37983
38157
  /** Set, or clear with `null`, the agent this number's inbound texts are for. */
37984
- update: (identityId, phoneId, body2) => request(config2, PhoneNumberSchema2, {
38158
+ update: async (identityId, phoneId, body2) => request(config2, PhoneNumberSchema2, {
37985
38159
  method: "PATCH",
37986
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones/${encodeURIComponent(phoneId)}`,
38160
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}`,
37987
38161
  body: body2
37988
38162
  }),
37989
- release: (identityId, phoneId) => request(config2, DeletedSchema, {
38163
+ release: async (identityId, phoneId) => request(config2, DeletedSchema, {
37990
38164
  method: "DELETE",
37991
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones/${encodeURIComponent(phoneId)}`
38165
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}`
37992
38166
  }),
37993
38167
  /** Refused with `compliance_pending` until the campaign is approved. That is a carrier rule. */
37994
- send: (identityId, phoneId, body2) => request(config2, SmsSendSchema, {
38168
+ send: async (identityId, phoneId, body2) => request(config2, SmsSendSchema, {
37995
38169
  method: "POST",
37996
- path: `/v1/identities/${encodeURIComponent(identityId)}/phones/${encodeURIComponent(phoneId)}/send`,
38170
+ path: `/v1/identities/${pathId(identityId, "identityId")}/phones/${encodeURIComponent(phoneId)}/send`,
37997
38171
  body: body2
37998
38172
  })
37999
38173
  });
@@ -38556,7 +38730,7 @@ var wallet = (config2) => {
38556
38730
  updatePolicy: (identity3, body2, select3 = {}) => request(config2, WalletSchema2, { method: "PATCH", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/policy`, body: body2, query: select3 }),
38557
38731
  freeze: (identity3, select3 = {}) => request(config2, WalletSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/freeze`, query: select3 }),
38558
38732
  unfreeze: (identity3, select3 = {}) => request(config2, WalletSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/unfreeze`, query: select3 }),
38559
- /** 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. */
38560
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) }),
38561
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) }),
38562
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) }),
@@ -38568,7 +38742,7 @@ var wallet = (config2) => {
38568
38742
  query: { ...query2, kind: "pay" }
38569
38743
  }),
38570
38744
  quote: (identity3, body2, select3 = {}) => request(config2, WalletQuoteSchema2, { method: "POST", path: `/v1/identities/${encodeURIComponent(identity3)}/wallet/quote`, body: body2, query: select3 }),
38571
- 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) })
38572
38746
  };
38573
38747
  };
38574
38748
  var GrantSchema = external_exports.object({
@@ -38763,65 +38937,65 @@ var SocialWorkspaceSchema = external_exports.object({
38763
38937
  });
38764
38938
  var SocialPortalSchema = external_exports.object({ object: external_exports.literal("social_portal_link"), url: external_exports.url() });
38765
38939
  var setup = (config2) => ({
38766
- activate: (identity3) => request(config2, SocialWorkspaceSchema, {
38940
+ activate: async (identity3) => request(config2, SocialWorkspaceSchema, {
38767
38941
  method: "POST",
38768
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/activate`
38942
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/activate`
38769
38943
  }),
38770
- status: (identity3) => request(config2, SocialWorkspaceSchema, {
38944
+ status: async (identity3) => request(config2, SocialWorkspaceSchema, {
38771
38945
  method: "GET",
38772
- path: `/v1/identities/${encodeURIComponent(identity3)}/social`
38946
+ path: `/v1/identities/${pathId(identity3, "identity")}/social`
38773
38947
  }),
38774
- portal: (identity3, body2 = {}) => request(config2, SocialPortalSchema, {
38948
+ portal: async (identity3, body2 = {}) => request(config2, SocialPortalSchema, {
38775
38949
  method: "POST",
38776
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/portal`,
38950
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/portal`,
38777
38951
  body: body2
38778
38952
  }),
38779
- accounts: (identity3, query2 = {}) => request(config2, page(SocialAccountSchema2), {
38953
+ accounts: async (identity3, query2 = {}) => request(config2, page(SocialAccountSchema2), {
38780
38954
  method: "GET",
38781
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/accounts`,
38955
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/accounts`,
38782
38956
  query: query2
38783
38957
  }),
38784
- accountAnalytics: (identity3, account) => request(config2, SocialAnalyticsSchema2, {
38958
+ accountAnalytics: async (identity3, account) => request(config2, SocialAnalyticsSchema2, {
38785
38959
  method: "GET",
38786
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/accounts/${encodeURIComponent(account)}/analytics`
38960
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/accounts/${encodeURIComponent(account)}/analytics`
38787
38961
  }),
38788
- upload: (identity3, body2) => request(config2, SocialUploadSchema2, {
38962
+ upload: async (identity3, body2) => request(config2, SocialUploadSchema2, {
38789
38963
  method: "POST",
38790
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/uploads`,
38964
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/uploads`,
38791
38965
  body: body2
38792
38966
  })
38793
38967
  });
38794
38968
  var publishing = (config2) => ({
38795
- createPost: (identity3, body2) => request(config2, SocialPostSchema2, {
38969
+ createPost: async (identity3, body2) => request(config2, SocialPostSchema2, {
38796
38970
  method: "POST",
38797
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts`,
38971
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts`,
38798
38972
  body: body2
38799
38973
  }),
38800
- getPost: (identity3, post2) => request(config2, SocialPostSchema2, {
38974
+ getPost: async (identity3, post2) => request(config2, SocialPostSchema2, {
38801
38975
  method: "GET",
38802
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}`
38976
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}`
38803
38977
  }),
38804
- deletePost: (identity3, post2) => request(config2, DeletedSchema, {
38978
+ deletePost: async (identity3, post2) => request(config2, DeletedSchema, {
38805
38979
  method: "DELETE",
38806
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}`
38980
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}`
38807
38981
  }),
38808
- postAnalytics: (identity3, post2) => request(config2, SocialAnalyticsSchema2, {
38982
+ postAnalytics: async (identity3, post2) => request(config2, SocialAnalyticsSchema2, {
38809
38983
  method: "GET",
38810
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}/analytics`
38984
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}/analytics`
38811
38985
  }),
38812
38986
  /**
38813
38987
  * `GET /v1/posts` — every post the company files, across identities and sessions (§27.1): the
38814
38988
  * `social.post` calls waiting on a person (`pending`), and the ones sent, with their latest numbers.
38815
38989
  * `reconcile: false` lists what is stored without asking the provider about due posts first.
38816
38990
  */
38817
- listPosts: ({ reconcile, ...query2 } = {}) => request(config2, page(PostSchema2), {
38991
+ listPosts: async ({ reconcile, ...query2 } = {}) => request(config2, page(PostSchema2), {
38818
38992
  method: "GET",
38819
38993
  path: "/v1/posts",
38820
38994
  query: { ...query2, ...reconcile === void 0 ? {} : { reconcile: String(reconcile) } }
38821
38995
  }),
38822
- comments: (identity3, post2, query2 = {}) => request(config2, page(SocialCommentSchema2), {
38996
+ comments: async (identity3, post2, query2 = {}) => request(config2, page(SocialCommentSchema2), {
38823
38997
  method: "GET",
38824
- path: `/v1/identities/${encodeURIComponent(identity3)}/social/posts/${encodeURIComponent(post2)}/comments`,
38998
+ path: `/v1/identities/${pathId(identity3, "identity")}/social/posts/${encodeURIComponent(post2)}/comments`,
38825
38999
  query: query2
38826
39000
  })
38827
39001
  });
@@ -38980,10 +39154,10 @@ async function* streamFrames(config2, schema, call) {
38980
39154
  yield parsed.data;
38981
39155
  }
38982
39156
  }
38983
- function settled(session2, afterSeq, throughGrades) {
38984
- if (session2.status === "running" || session2.status === "queued") return false;
38985
- if (throughGrades && session2.stop_reason === "awaiting_delegation") return false;
38986
- 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;
38987
39161
  }
38988
39162
  async function* streamEvents(config2, sessionId, options = {}) {
38989
39163
  const maxRetries = options.maxRetries ?? 5;
@@ -38992,7 +39166,8 @@ async function* streamEvents(config2, sessionId, options = {}) {
38992
39166
  let failures = 0;
38993
39167
  const grading = /* @__PURE__ */ new Set();
38994
39168
  let held = false;
38995
- 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;
38996
39171
  for (; ; ) {
38997
39172
  try {
38998
39173
  const call = {
@@ -39010,6 +39185,7 @@ async function* streamEvents(config2, sessionId, options = {}) {
39010
39185
  if (event.type === "outcome.evaluation.started") grading.add(gradeKey(event));
39011
39186
  if (event.type === "outcome.evaluation.completed") grading.delete(gradeKey(event));
39012
39187
  yield event;
39188
+ if (endAt !== null && event.seq >= endAt) return;
39013
39189
  if (event.type === "session.idle") {
39014
39190
  held = throughGrades && grading.size > 0 && parkedOnGrade(event);
39015
39191
  if (!held) return;
@@ -39079,7 +39255,7 @@ var computers = (config2) => ({
39079
39255
  path: `/v1/computers/${encodeURIComponent(id)}/exec`,
39080
39256
  body: { command, ...timeoutMs === void 0 ? {} : { timeout_ms: timeoutMs } }
39081
39257
  }),
39082
- /** Paused bills storage only — the first efficiency lever (`memory/context.md`). */
39258
+ /** Paused bills nothing (disk is never metered) — the first efficiency lever (`memory/context.md`). */
39083
39259
  pause: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${encodeURIComponent(id)}/pause`, body: {} }),
39084
39260
  resume: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${encodeURIComponent(id)}/resume`, body: {} }),
39085
39261
  /** An agent's computer only (§41.8): a person holds it, and its sessions wait until it is handed back. */
@@ -39289,9 +39465,11 @@ function withTool(tools3, name6, settings) {
39289
39465
  }
39290
39466
  };
39291
39467
  }
39468
+ var DEFAULT_BASE_URL = "https://api.vetta.sh";
39292
39469
  function createClient(options) {
39293
39470
  const config2 = {
39294
39471
  ...options,
39472
+ baseUrl: (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "").replace(/\/v1$/, ""),
39295
39473
  fetch: options.fetch ?? ((input, init) => globalThis.fetch(input, init)),
39296
39474
  idempotencyKey: options.idempotencyKey ?? (() => crypto.randomUUID())
39297
39475
  };
@@ -41062,6 +41240,8 @@ var LedgerEntrySchema3 = external_exports.object({
41062
41240
  session_id: idOf3("ses").nullable(),
41063
41241
  agent_id: idOf3("agt").nullable(),
41064
41242
  deployment_id: idOf3("dep").nullable(),
41243
+ /** The computer (`cmp_`), browser (`brw_`) or phone (`mob_`) a debit bills; `null` for anything else, and from a server older than the field. */
41244
+ resource_id: external_exports.string().nullable().default(null),
41065
41245
  line_items: external_exports.array(external_exports.object({ tier: LineItemTierSchema3, amount_micro_usd: MicroUsdField3 })),
41066
41246
  created_at: Timestamp3
41067
41247
  });
@@ -42606,7 +42786,11 @@ var transposed3 = (a, b) => {
42606
42786
  };
42607
42787
  function toolNameProblem3(name6) {
42608
42788
  if (BUILTIN_TOOLS3.includes(name6) || name6 in FOLLOWS_TOOL3 || PLATFORM_TOOLS3.includes(name6)) return null;
42609
- 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>\``;
42789
+ if (!/^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name6)) {
42790
+ const bare = [...BUILTIN_TOOLS3, ...Object.keys(FOLLOWS_TOOL3)].find((tool) => transposed3(tool, name6));
42791
+ const hint = bare === void 0 ? "name a built-in, or a namespaced `<namespace>.<tool>`" : `did you mean \`${bare}\`?`;
42792
+ return `\`${name6}\` is not a tool; ${hint}`;
42793
+ }
42610
42794
  const namespace = name6.slice(0, name6.indexOf("."));
42611
42795
  if (PLATFORM_NAMESPACES3.has(namespace)) {
42612
42796
  const known = [...PLATFORM_TOOLS3, ...Object.keys(FOLLOWS_TOOL3)].filter((tool) => tool.startsWith(`${namespace}.`));
@@ -42616,7 +42800,8 @@ function toolNameProblem3(name6) {
42616
42800
  return meant === void 0 ? null : `\`${name6}\` is not a tool; did you mean \`${meant}${name6.slice(namespace.length)}\`?`;
42617
42801
  }
42618
42802
  var ToolConfigSchema3 = external_exports.object({
42619
- enabled: external_exports.boolean(),
42803
+ /** Absent is enabled (ADR-1911): naming a tool to set its permission already says it is wanted. */
42804
+ enabled: external_exports.boolean().default(true),
42620
42805
  permission: ToolPermissionSchema3,
42621
42806
  config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
42622
42807
  });
@@ -42903,7 +43088,24 @@ var CREATOR_PROGRAM3 = {
42903
43088
  upload_token_minutes: 15,
42904
43089
  skill_max_bytes: 32 * 1024,
42905
43090
  /** The reviewer's install check (§42.5): the hard cap on its one session, never charged to the draft. */
42906
- review_check_budget_micro_usd: 5e6
43091
+ review_check_budget_micro_usd: 5e6,
43092
+ /** A `video` origin build (§42.14): one raw clip and its characters, recast by Mira. */
43093
+ video: {
43094
+ min_seconds: 3,
43095
+ max_seconds: 15,
43096
+ video_max_bytes: 95 * 1024 * 1024,
43097
+ image_max_bytes: 10 * 1024 * 1024,
43098
+ characters_min: 1,
43099
+ characters_max: 3,
43100
+ /** After the first render. A refused or failed render does not use one up. */
43101
+ revisions: 5,
43102
+ /** Per doomscroll account, until one of its templates is approved. */
43103
+ unapproved_templates: 2,
43104
+ /** Upload tickets a doomscroll account may ask for, per template. */
43105
+ upload_tickets: 20,
43106
+ /** A draft never submitted loses its source and character bytes this long after `updated_at`. */
43107
+ draft_retention_days: 30
43108
+ }
42907
43109
  }
42908
43110
  };
42909
43111
  var DOOMSCROLL_PROGRAM3 = {
@@ -42947,6 +43149,8 @@ var StudioStateSchema3 = external_exports.enum([
42947
43149
  "setup",
42948
43150
  "building",
42949
43151
  "ready",
43152
+ /** A `video` origin only: a version was submitted and its author is writing the skill. */
43153
+ "finalizing",
42950
43154
  "in_review",
42951
43155
  "live",
42952
43156
  "changes_requested"
@@ -43010,10 +43214,26 @@ var StudioSkillSchema3 = SavedSkillSchema3.extend({
43010
43214
  id: idOf3("skl").nullable(),
43011
43215
  version: external_exports.number().int().positive().nullable()
43012
43216
  });
43217
+ var StudioImageContentTypeSchema3 = external_exports.enum(["image/png", "image/jpeg", "image/webp"]);
43218
+ var StudioSourceVideoSchema3 = external_exports.object({
43219
+ file_id: external_exports.string().nullable(),
43220
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM3.studio.video.video_max_bytes),
43221
+ content_type: StudioUploadContentTypeSchema3,
43222
+ filename: external_exports.string().min(1).max(200),
43223
+ seconds: external_exports.number().nonnegative().nullable()
43224
+ });
43225
+ var CharacterPosition3 = external_exports.number().int().min(1).max(CREATOR_PROGRAM3.studio.video.characters_max);
43226
+ var StudioCharacterSchema3 = external_exports.object({
43227
+ position: CharacterPosition3,
43228
+ file_id: external_exports.string().nullable(),
43229
+ bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM3.studio.video.image_max_bytes),
43230
+ content_type: StudioImageContentTypeSchema3,
43231
+ filename: external_exports.string().min(1).max(200)
43232
+ });
43013
43233
  var CreatorStudioSchema3 = external_exports.object({
43014
43234
  uploads: external_exports.array(StudioUploadSchema3).max(CREATOR_PROGRAM3.studio.uploads).default([]),
43015
- /** `links`: built from 1–3 reel links (`imports`), prompts optional; `upload`: the creator's three videos. */
43016
- origin: external_exports.enum(["upload", "links"]).default("upload"),
43235
+ /** `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). */
43236
+ origin: external_exports.enum(["upload", "links", "video"]).default("upload"),
43017
43237
  imports: external_exports.array(StudioImportSchema3).max(CREATOR_PROGRAM3.studio.uploads).default([]),
43018
43238
  state: StudioStateSchema3.default("setup"),
43019
43239
  spend_micro_usd: MicroUsdField3.nonnegative().default(0),
@@ -43024,7 +43244,11 @@ var CreatorStudioSchema3 = external_exports.object({
43024
43244
  /** An org build's asked sample length (§57.2, ADR-1762); `null` is `sample_seconds`. */
43025
43245
  seconds: external_exports.number().int().min(10).max(60).nullable().default(null),
43026
43246
  /** An org build's own catalog text: its request's description when that fits a tagline; `null` lets the judge write one. */
43027
- tagline: external_exports.string().max(140).nullable().default(null)
43247
+ tagline: external_exports.string().max(140).nullable().default(null),
43248
+ /** A `video` origin's raw clip, its characters, and the round submitted (§42.14). */
43249
+ source_video: StudioSourceVideoSchema3.nullable().default(null),
43250
+ characters: external_exports.array(StudioCharacterSchema3).max(CREATOR_PROGRAM3.studio.video.characters_max).default([]),
43251
+ chosen_round: external_exports.number().int().positive().nullable().default(null)
43028
43252
  });
43029
43253
  var CreatorTemplateListingSchema3 = external_exports.object({
43030
43254
  listed: external_exports.boolean(),
@@ -43078,7 +43302,15 @@ var CreatorTemplateRoundSchema3 = external_exports.object({
43078
43302
  spend_micro_usd: MicroUsdField3.nonnegative(),
43079
43303
  error: external_exports.string().nullable(),
43080
43304
  created_at: Timestamp3,
43081
- finished_at: Timestamp3.nullable()
43305
+ finished_at: Timestamp3.nullable(),
43306
+ /** A `video` origin round's Mira edit and its result (migration 0172, §42.14). */
43307
+ edit_job_id: external_exports.string().nullable().default(null),
43308
+ sample_file_id: external_exports.string().nullable().default(null)
43309
+ });
43310
+ var StudioPlateSchema3 = external_exports.object({
43311
+ file: external_exports.string().min(1),
43312
+ kind: external_exports.enum(["video", "image"]),
43313
+ file_id: external_exports.string().min(1)
43082
43314
  });
43083
43315
  var NicheVersionStudioSchema3 = external_exports.object({
43084
43316
  round: external_exports.number().int().positive(),
@@ -43087,7 +43319,9 @@ var NicheVersionStudioSchema3 = external_exports.object({
43087
43319
  frames: external_exports.array(StudioFrameSchema3),
43088
43320
  samples: external_exports.array(StudioSampleSchema3),
43089
43321
  tagline: external_exports.string().max(140),
43090
- hero_sample_index: external_exports.number().int().nonnegative()
43322
+ hero_sample_index: external_exports.number().int().nonnegative(),
43323
+ /** A `video` origin's default clip and characters. */
43324
+ plates: external_exports.array(StudioPlateSchema3).optional()
43091
43325
  });
43092
43326
  var CreatorTemplateSchema3 = external_exports.object({
43093
43327
  id: idOf3("ctp"),
@@ -43184,13 +43418,26 @@ var CreatorAnalyticsSchema3 = external_exports.object({
43184
43418
  install_windows: external_exports.array(external_exports.object({ install_id: idOf3("bpi"), from: Day4, until: Day4 })).optional()
43185
43419
  });
43186
43420
  var CreatorTemplateCreateKindSchema3 = external_exports.object({
43187
- kind: CreatorTemplateKindSchema3.default("crew")
43421
+ kind: CreatorTemplateKindSchema3.default("crew"),
43422
+ /** `video` makes a draft built from one raw clip (§42.14); it needs `kind: niche`. */
43423
+ origin: external_exports.literal("video").optional()
43188
43424
  });
43189
43425
  var StudioUploadCreateSchema3 = external_exports.object({
43190
- position: UploadPosition3,
43426
+ purpose: external_exports.enum(["source", "character"]).optional(),
43427
+ position: UploadPosition3.optional(),
43191
43428
  filename: external_exports.string().min(1).max(200),
43192
- content_type: StudioUploadContentTypeSchema3,
43193
- bytes: external_exports.number().int().positive().max(CREATOR_PROGRAM3.studio.upload_max_bytes)
43429
+ content_type: external_exports.union([StudioUploadContentTypeSchema3, StudioImageContentTypeSchema3]),
43430
+ bytes: external_exports.number().int().positive()
43431
+ }).superRefine((body2, ctx) => {
43432
+ const { video, upload_max_bytes } = CREATOR_PROGRAM3.studio;
43433
+ const character2 = body2.purpose === "character";
43434
+ const issue2 = (path, message32) => ctx.addIssue({ code: "custom", path: [path], message: message32 });
43435
+ if (body2.purpose !== "source" && body2.position === void 0) issue2("position", "position is required");
43436
+ if (character2 !== StudioImageContentTypeSchema3.safeParse(body2.content_type).success) {
43437
+ issue2("content_type", character2 ? "a character must be a PNG, JPEG or WebP image" : "this upload must be an MP4, MOV or WebM video");
43438
+ }
43439
+ const max = character2 ? video.image_max_bytes : body2.purpose === "source" ? video.video_max_bytes : upload_max_bytes;
43440
+ if (body2.bytes > max) issue2("bytes", `this upload may be at most ${max} bytes`);
43194
43441
  });
43195
43442
  var StudioUploadTicketSchema3 = external_exports.object({
43196
43443
  object: external_exports.literal("studio_upload_ticket"),
@@ -43204,6 +43451,12 @@ var StudioUploadResultSchema3 = external_exports.object({
43204
43451
  template_id: idOf3("ctp"),
43205
43452
  upload: StudioUploadSchema3
43206
43453
  });
43454
+ var StudioVideoUploadResultSchema3 = external_exports.object({
43455
+ object: external_exports.literal("studio_upload"),
43456
+ template_id: idOf3("ctp"),
43457
+ source_video: StudioSourceVideoSchema3.nullable(),
43458
+ characters: external_exports.array(StudioCharacterSchema3)
43459
+ });
43207
43460
  var StudioRoundCreateSchema3 = external_exports.object({
43208
43461
  feedback: external_exports.string().min(1).max(4e3).optional(),
43209
43462
  rights_attested: external_exports.boolean().optional()
@@ -43216,9 +43469,12 @@ var StudioBudgetSchema3 = external_exports.object({
43216
43469
  var CreatorStudioViewSchema3 = external_exports.object({
43217
43470
  object: external_exports.literal("creator_studio"),
43218
43471
  template_id: idOf3("ctp"),
43219
- studio: CreatorStudioSchema3,
43220
- /** Newest first. */
43221
- rounds: external_exports.array(CreatorTemplateRoundSchema3),
43472
+ /** A `video` origin's `source_video` also carries a signed `url` once its bytes landed. */
43473
+ studio: CreatorStudioSchema3.extend({
43474
+ source_video: StudioSourceVideoSchema3.extend({ url: external_exports.string().nullable().optional() }).nullable().default(null)
43475
+ }),
43476
+ /** Newest first. A `video` round also carries a signed `sample_url`. */
43477
+ rounds: external_exports.array(CreatorTemplateRoundSchema3.extend({ sample_url: external_exports.string().nullable().optional() })),
43222
43478
  budget: StudioBudgetSchema3
43223
43479
  });
43224
43480
  var NicheSubmitSchema3 = external_exports.object({
@@ -43228,6 +43484,7 @@ var NicheSubmitSchema3 = external_exports.object({
43228
43484
  hero_sample_index: external_exports.number().int().nonnegative()
43229
43485
  })
43230
43486
  });
43487
+ var VideoSubmitSchema3 = external_exports.object({ round: external_exports.number().int().positive() });
43231
43488
  var CreatorListingPatchSchema3 = CreatorTemplateListingSchema3.partial();
43232
43489
  var CreatorListingSchema3 = external_exports.object({
43233
43490
  object: external_exports.literal("creator_listing"),
@@ -43447,6 +43704,10 @@ var EventTypeSchema3 = external_exports.enum([
43447
43704
  "span.harness_build.end",
43448
43705
  "span.box_resume.start",
43449
43706
  "span.box_resume.end",
43707
+ "span.tools_resolve.start",
43708
+ "span.tools_resolve.end",
43709
+ "span.model_gate.start",
43710
+ "span.model_gate.end",
43450
43711
  /**
43451
43712
  * A delegated thread's lifecycle, on the **coordinator's** stream (§28). The child's own
43452
43713
  * `ses_…` rides inside `data.thread_id` — the event schema gains no field and `vetta.event` gains
@@ -45026,11 +45287,12 @@ var MusicGenerationSchema3 = external_exports.object({
45026
45287
  duration_seconds: Seconds23.nullable(),
45027
45288
  cost_micro_usd: MicroUsdField3
45028
45289
  });
45290
+ var EditModeSchema3 = external_exports.enum(["scene", "outfit_or_object", "person_swap", "recast"]);
45029
45291
  var EditRequestSchema3 = external_exports.object({
45030
45292
  video: external_exports.string().min(1),
45031
45293
  prompt: external_exports.string().min(1).max(1e3),
45032
45294
  references: external_exports.array(external_exports.string().min(1)).max(4).optional(),
45033
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).optional()
45295
+ mode: EditModeSchema3.optional()
45034
45296
  });
45035
45297
  var EditFailureCodeSchema3 = external_exports.enum(["bad_source", "refused", "timed_out", "provider_error", "cancelled"]);
45036
45298
  var EditJobSchema3 = external_exports.object({
@@ -45040,7 +45302,7 @@ var EditJobSchema3 = external_exports.object({
45040
45302
  video: external_exports.string(),
45041
45303
  prompt: external_exports.string(),
45042
45304
  references: external_exports.array(external_exports.string()),
45043
- mode: external_exports.enum(["scene", "outfit_or_object", "person_swap"]).nullable(),
45305
+ mode: EditModeSchema3.nullable(),
45044
45306
  result: external_exports.object({ file_id: external_exports.string().startsWith("fil_") }).nullable(),
45045
45307
  error: external_exports.object({ code: EditFailureCodeSchema3, message: external_exports.string() }).nullable(),
45046
45308
  cost_micro_usd: MicroUsdField3.nullable(),
@@ -47855,7 +48117,7 @@ var auth2 = {
47855
48117
  } else if (apiKey === "" || cmd.config.apiKeyFromProfile) {
47856
48118
  const piped = cmd.readStdin()?.trim() ?? "";
47857
48119
  if (piped !== "") apiKey = piped;
47858
- if (apiKey === "") throw new UsageError("pipe the key on stdin, set VETTA_API_KEY, or pass --email and --password");
48120
+ if (apiKey === "") throw new UsageError("pipe the key on stdin, set NAIVE_API_KEY, or pass --email and --password");
47859
48121
  }
47860
48122
  const client = cmd.withApiKey(apiKey);
47861
48123
  const me = await client.auth.me();
@@ -48079,7 +48341,7 @@ function status2(args) {
48079
48341
  if (found === void 0) throw new UsageError(`--status must be ${CardStatusSchema.options.join("|")}`);
48080
48342
  return found;
48081
48343
  }
48082
- async function settled2(cmd, issued) {
48344
+ async function settled(cmd, issued) {
48083
48345
  let current = issued;
48084
48346
  for (let attempt2 = 0; SETTLING.has(current.status) && attempt2 < WAIT_ATTEMPTS; attempt2 += 1) {
48085
48347
  await new Promise((resolve5) => setTimeout(resolve5, WAIT_MS));
@@ -48107,7 +48369,7 @@ var cards2 = {
48107
48369
  label: args.need("label"),
48108
48370
  load_micro_usd: microFromUsdFlag("usd", args.need("usd"))
48109
48371
  });
48110
- return { out: args.bool("wait") ? await settled2(cmd, issued) : issued };
48372
+ return { out: args.bool("wait") ? await settled(cmd, issued) : issued };
48111
48373
  },
48112
48374
  show: async ({ client, args }) => ({ out: await client.identities.cards.get(ref(args), card(args)) }),
48113
48375
  reveal: async ({ client, args }) => {
@@ -48445,11 +48707,11 @@ var WAIT_MS2 = 5e3;
48445
48707
  var WAIT_ATTEMPTS2 = 1440;
48446
48708
  var STATES = ["setup", "building", "ready"];
48447
48709
  var newest = (build) => build.rounds[0];
48448
- var settled3 = (build) => newest(build)?.state === "ready" || newest(build)?.state === "failed";
48710
+ var settled2 = (build) => newest(build)?.state === "ready" || newest(build)?.state === "failed";
48449
48711
  async function finish(cmd, queued, wait) {
48450
48712
  if (!wait) return { out: queued };
48451
48713
  let build = queued;
48452
- for (let attempt2 = 0; attempt2 < WAIT_ATTEMPTS2 && !settled3(build); attempt2 += 1) {
48714
+ for (let attempt2 = 0; attempt2 < WAIT_ATTEMPTS2 && !settled2(build); attempt2 += 1) {
48453
48715
  await new Promise((resolve5) => setTimeout(resolve5, WAIT_MS2));
48454
48716
  build = await cmd.client.media.skills.get(queued.id);
48455
48717
  }
@@ -48696,8 +48958,8 @@ var media6 = {
48696
48958
  // §55: `naive media edit "<prompt>" --video <fil_|url>`. `--wait` follows the edit job.
48697
48959
  edit: async ({ client, args }) => {
48698
48960
  const mode = args.str("mode");
48699
- if (mode !== void 0 && mode !== "scene" && mode !== "outfit_or_object" && mode !== "person_swap") {
48700
- throw new UsageError("--mode must be scene, outfit_or_object or person_swap");
48961
+ if (mode !== void 0 && mode !== "scene" && mode !== "outfit_or_object" && mode !== "person_swap" && mode !== "recast") {
48962
+ throw new UsageError("--mode must be scene, outfit_or_object, person_swap or recast");
48701
48963
  }
48702
48964
  const references = args.list("reference");
48703
48965
  let job = await client.media.edits.create({
@@ -49404,6 +49666,7 @@ export default defineProject({
49404
49666
  });
49405
49667
  `;
49406
49668
  var TEMPLATE_KEY = /(\btemplate:\s*)(["'])[^"']*\2/;
49669
+ var TEMPLATE_ENV = /process\.env\[["']NAIVE_TEMPLATE["']\](?!\s*\?\?)/;
49407
49670
  function setTemplate(cmd, dir, template6) {
49408
49671
  const path = `${dir}/naive.config.ts`;
49409
49672
  let text4;
@@ -49413,6 +49676,17 @@ function setTemplate(cmd, dir, template6) {
49413
49676
  throw new UsageError(`cloned ${dir}, but could not read ${path} to set the template: ${message3(error51)}`);
49414
49677
  }
49415
49678
  if (!TEMPLATE_KEY.test(text4)) {
49679
+ const index = `${dir}/templates/index.ts`;
49680
+ let picker;
49681
+ try {
49682
+ picker = cmd.readFile(index);
49683
+ } catch {
49684
+ picker = void 0;
49685
+ }
49686
+ if (picker !== void 0 && TEMPLATE_ENV.test(picker)) {
49687
+ cmd.writeFile(index, picker.replace(TEMPLATE_ENV, `(process.env["NAIVE_TEMPLATE"] ?? "${template6}")`));
49688
+ return;
49689
+ }
49416
49690
  throw new UsageError(`cloned ${dir}, but ${path} has no \`template:\` to set \u2014 this blueprint takes no template`);
49417
49691
  }
49418
49692
  cmd.writeFile(path, text4.replace(TEMPLATE_KEY, `$1"${template6}"`));
@@ -50250,7 +50524,8 @@ async function createBody4(cmd) {
50250
50524
  const outcome2 = args.str("outcome");
50251
50525
  return {
50252
50526
  agent_id: args.need("agent"),
50253
- message: args.str("message") ?? args.positionals[0] ?? "",
50527
+ // The API refuses an empty first message, so a missing one is a usage error here, not a 400.
50528
+ message: args.str("message") ?? args.positionals[0] ?? args.need("message"),
50254
50529
  // `naive session create --agent Concierge --identity ava-sales` (`docs/identity/personas.mdx`).
50255
50530
  ...identity3 === void 0 ? {} : { identity: identity3 },
50256
50531
  ...window === void 0 ? {} : { window: parseWindow(window) },
@@ -50265,10 +50540,14 @@ async function watch(cmd, sessionId, afterSeq) {
50265
50540
  let cursor = afterSeq;
50266
50541
  for (; ; ) {
50267
50542
  let parkedIdle = false;
50543
+ let idleOutput = null;
50268
50544
  for await (const event of cmd.client.stream(sessionId, { afterSeq: cursor })) {
50269
50545
  printEvent(cmd.io, event, cmd.human);
50270
50546
  cursor = event.seq;
50271
- if (event.type === "session.idle") parkedIdle = event.data["stop_reason"] === "awaiting_delegation";
50547
+ if (event.type === "session.idle") {
50548
+ parkedIdle = event.data["stop_reason"] === "awaiting_delegation";
50549
+ idleOutput = event.data["structured_output"] ?? null;
50550
+ }
50272
50551
  }
50273
50552
  let final = await cmd.client.sessions.get(sessionId);
50274
50553
  for (let attempt2 = 0; final.stop_reason === null && attempt2 < SETTLE_ATTEMPTS; attempt2 += 1) {
@@ -50276,6 +50555,7 @@ async function watch(cmd, sessionId, afterSeq) {
50276
50555
  final = await cmd.client.sessions.get(sessionId);
50277
50556
  }
50278
50557
  if (parkedIdle && gradeOut(final)) continue;
50558
+ if (final.structured_output == null && idleOutput !== null) final = { ...final, structured_output: idleOutput };
50279
50559
  return { out: final, code: exitForStopReason(final.stop_reason) };
50280
50560
  }
50281
50561
  }
@@ -51595,7 +51875,7 @@ var ALIASES = {
51595
51875
  };
51596
51876
 
51597
51877
  // src/cli.ts
51598
- var VERSION = true ? "1.0.0" : "0.0.0-dev";
51878
+ var VERSION = true ? "1.0.2" : "0.0.0-dev";
51599
51879
  var GLOBAL_FLAGS_HELP = "global flags: --json (default) --human --profile <name> --api-key <key> --org <org_id> --api-base-url <url>";
51600
51880
  function usage() {
51601
51881
  const groups = [...Object.keys(GROUPS), ...Object.keys(ALIASES)].sort().join(", ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usenaive-sdk/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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,7 +27,7 @@
27
27
  "esbuild": "0.28.2",
28
28
  "yaml": "^2.9.0",
29
29
  "@vetta/core": "0.0.0",
30
- "@usenaive-sdk/managed-agents": "0.12.0",
30
+ "@usenaive-sdk/managed-agents": "0.12.2",
31
31
  "@usenaive-sdk/blueprints": "0.18.0"
32
32
  },
33
33
  "scripts": {