@plaintake/scenario 1.17.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -838,6 +838,31 @@ var RenderPlanSchema = z6.object({
838
838
  * older binary's own re-parse has stripped `theme` out of.
839
839
  */
840
840
  theme: ThemeSchema.optional(),
841
+ /**
842
+ * The one video this plan renders to, named for the scenario: `output/create-api-key.mp4`
843
+ * for `id: 'create-api-key'`. Frozen once, at record time, from the scenario's own id —
844
+ * `ScenarioMetaSchema`'s lowercase-kebab id rule is what the path regex above mirrors, so
845
+ * the two cannot drift apart silently.
846
+ *
847
+ * Optional and **never defaulted**, for the same reason as `theme`: a Zod `.default()`
848
+ * materialises on parse, and every parse-and-rewrite of an older plan (a `--aspect`
849
+ * re-cut re-freezes `render/render-plan.json`) would inject the field into bundles
850
+ * recorded before per-scenario names existed. Absent means exactly that — a plan frozen
851
+ * before 1.21, whose video is the historical `output/demo.mp4` the renderer's arg
852
+ * builders fall back to.
853
+ *
854
+ * Top-level — a sibling of `theme`, not a key inside `video` (which `recutPlan` rewrites
855
+ * wholesale) — so `recutPlan`'s `{...plan}` spread carries it through `--aspect` re-cuts
856
+ * unchanged.
857
+ *
858
+ * The frozen `ffmpeg` arrays remain the runtime source of truth: `renderBundle` replays
859
+ * them verbatim and `outputPathOf` reads the destination back out of them, which is what
860
+ * lets a bundle frozen under any earlier naming scheme render unchanged. This field
861
+ * exists for the *re*-freezes — `recutPlan` and the multi-actor splice rebuild their
862
+ * argument arrays from the plan, and read this field (via `outputOf`) so a re-cut writes
863
+ * the file the original recording wrote rather than the fallback name.
864
+ */
865
+ outputPath: z6.string().regex(/^output\/[a-z0-9][a-z0-9-]*\.mp4$/, "must be output/<scenario-id>.mp4, a kebab-case id").optional(),
841
866
  /**
842
867
  * The capture timeline cut into windows — of a genuine multi-actor cast, of an implicit
843
868
  * single actor pausing for explain cut-aways, or both at once. `segments` is the one
@@ -1345,6 +1370,51 @@ var LicenceResultSchema = z7.discriminatedUnion("tier", [
1345
1370
  uses: z7.number().int().nonnegative()
1346
1371
  })
1347
1372
  ]).refine(okMatchesProblems, "ok must be true iff problems is empty");
1373
+ var PublishReasonSchema = z7.enum([
1374
+ "no-endpoint",
1375
+ "no-key",
1376
+ "invalid-store",
1377
+ "not-a-bundle",
1378
+ "unauthorized",
1379
+ "unreachable",
1380
+ "hash-mismatch",
1381
+ "length-mismatch",
1382
+ "conflict",
1383
+ "unexpected-response"
1384
+ ]);
1385
+ var PublishResultSchema = z7.discriminatedUnion("ok", [
1386
+ z7.object({
1387
+ ...envelope("publish"),
1388
+ ok: z7.literal(false),
1389
+ reason: PublishReasonSchema
1390
+ }),
1391
+ z7.object({
1392
+ ...envelope("publish"),
1393
+ ok: z7.literal(true),
1394
+ videoId: z7.string().regex(/^[a-z2-7]{26}$/, "must be a 26-char base32 share id"),
1395
+ /** The page viewers open — the endpoint plus the id. */
1396
+ url: z7.string().regex(/^https?:\/\/\S+$/, "must be an http or https URL"),
1397
+ /** False when the video was already on the service — nothing was uploaded. */
1398
+ uploaded: z7.boolean(),
1399
+ /**
1400
+ * Present only when `--remember` was asked: true when the key was stored beside
1401
+ * license.json, false when the key file could not be written. The service's
1402
+ * proof of the key (an accepted PUT, or the identity check on an already-shared
1403
+ * run) is part of every success, so it is never the reason.
1404
+ */
1405
+ remembered: z7.boolean().optional(),
1406
+ /**
1407
+ * The ISO-8601 instant the share link now dies at — present only when an expiry
1408
+ * policy (`--expiry` or publish.json's `expiry`) was set. Absent means never
1409
+ * expires, exactly like a publish before the feature existed.
1410
+ */
1411
+ expiresAt: z7.string().min(1).optional(),
1412
+ captions: z7.boolean(),
1413
+ chapters: z7.boolean(),
1414
+ /** False is a state, not a fault: no FFmpeg on PATH means no poster frame. */
1415
+ poster: z7.boolean()
1416
+ })
1417
+ ]).refine(okMatchesProblems, "ok must be true iff problems is empty");
1348
1418
 
1349
1419
  // ../schema/src/zod-format.ts
1350
1420
  import { ZodError } from "zod";
@@ -737,6 +737,7 @@ export declare const RenderPlanSchema: z.ZodObject<{
737
737
  theme: z.ZodOptional<z.ZodObject<{
738
738
  accentColor: z.ZodString;
739
739
  }, z.core.$strip>>;
740
+ outputPath: z.ZodOptional<z.ZodString>;
740
741
  actors: z.ZodOptional<z.ZodArray<z.ZodObject<{
741
742
  id: z.ZodString;
742
743
  label: z.ZodString;
@@ -511,6 +511,46 @@ export declare const LicenceResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
511
511
  ok: z.ZodBoolean;
512
512
  problems: z.ZodArray<z.ZodString>;
513
513
  }, z.core.$strip>], "tier">;
514
+ /**
515
+ * A share that either landed or did not. Discriminated on `ok` because the two halves
516
+ * carry disjoint facts: a failure has a `reason` to switch on, a success has the link —
517
+ * and a caller reading one should never have to wonder whether the other is lying.
518
+ *
519
+ * The success `videoId` is the share service's content-derived id (first 16 bytes of the
520
+ * MP4's sha256, base32), not a plaintake id, so its shape is asserted here rather than
521
+ * borrowed from a bundle schema.
522
+ */
523
+ export declare const PublishResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
524
+ ok: z.ZodLiteral<false>;
525
+ reason: z.ZodEnum<{
526
+ "unexpected-response": "unexpected-response";
527
+ "no-endpoint": "no-endpoint";
528
+ "no-key": "no-key";
529
+ "invalid-store": "invalid-store";
530
+ "not-a-bundle": "not-a-bundle";
531
+ unauthorized: "unauthorized";
532
+ unreachable: "unreachable";
533
+ "hash-mismatch": "hash-mismatch";
534
+ "length-mismatch": "length-mismatch";
535
+ conflict: "conflict";
536
+ }>;
537
+ schema: z.ZodLiteral<"agent-demo.result/v1">;
538
+ kind: z.ZodLiteral<"publish">;
539
+ problems: z.ZodArray<z.ZodString>;
540
+ }, z.core.$strip>, z.ZodObject<{
541
+ ok: z.ZodLiteral<true>;
542
+ videoId: z.ZodString;
543
+ url: z.ZodString;
544
+ uploaded: z.ZodBoolean;
545
+ remembered: z.ZodOptional<z.ZodBoolean>;
546
+ expiresAt: z.ZodOptional<z.ZodString>;
547
+ captions: z.ZodBoolean;
548
+ chapters: z.ZodBoolean;
549
+ poster: z.ZodBoolean;
550
+ schema: z.ZodLiteral<"agent-demo.result/v1">;
551
+ kind: z.ZodLiteral<"publish">;
552
+ problems: z.ZodArray<z.ZodString>;
553
+ }, z.core.$strip>], "ok">;
514
554
  export type ArtifactRef = z.infer<typeof ArtifactRefSchema>;
515
555
  export type ValidationResult = z.infer<typeof ValidationResultSchema>;
516
556
  export type RunCommandResult = z.infer<typeof RunCommandResultSchema>;
@@ -527,7 +567,8 @@ export type InspectResult = z.infer<typeof InspectResultSchema>;
527
567
  export type DoctorResult = z.infer<typeof DoctorResultSchema>;
528
568
  export type ActivateResult = z.infer<typeof ActivateResultSchema>;
529
569
  export type LicenceResult = z.infer<typeof LicenceResultSchema>;
530
- export type DemoResult = ValidationResult | RunCommandResult | CheckCommandResult | RenderCommandResult | VerificationReport | WarmCommandResult | DiffCommandResult | CompareCommandResult | InitResult | PruneCommandResult | ImportCommandResult | InspectResult | DoctorResult | ActivateResult | LicenceResult;
570
+ export type PublishResult = z.infer<typeof PublishResultSchema>;
571
+ export type DemoResult = ValidationResult | RunCommandResult | CheckCommandResult | RenderCommandResult | VerificationReport | WarmCommandResult | DiffCommandResult | CompareCommandResult | InitResult | PruneCommandResult | ImportCommandResult | InspectResult | DoctorResult | ActivateResult | LicenceResult | PublishResult;
531
572
  /**
532
573
  * Renders a filesystem location for display in a result, relative to `root` when it
533
574
  * lies inside it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaintake/scenario",
3
- "version": "1.17.0",
3
+ "version": "1.23.0",
4
4
  "description": "Authoring SDK for PlainTake demo scenarios: defineDemo and the scenario DSL types. Install for editor autocomplete; the PlainTake binary ships a runtime fallback.",
5
5
  "license": "MIT",
6
6
  "type": "module",