@plaintake/scenario 1.14.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
@@ -1036,7 +1061,14 @@ var RunCommandResultSchema = z7.object({
1036
1061
  narratedCount: z7.number().int().nonnegative(),
1037
1062
  diagnostics: z7.array(z7.object({ code: z7.string(), cueId: z7.string(), detail: z7.string() })),
1038
1063
  assertions: z7.array(AssertionSchema),
1039
- outputs: z7.array(ArtifactRefSchema)
1064
+ outputs: z7.array(ArtifactRefSchema),
1065
+ /**
1066
+ * The previous bundle this run replaced, archived as a `.<timestamp>` sibling rather
1067
+ * than deleted. Absent when nothing occupied the output directory — the common first
1068
+ * run — or when `--no-archive` asked for the old replace semantics. Optional and
1069
+ * additive, so every result written before archives existed still parses.
1070
+ */
1071
+ archivedPath: DISPLAY_PATH.optional()
1040
1072
  });
1041
1073
  var CheckAssertionSchema = AssertionSchema.extend({ message: z7.string().optional() });
1042
1074
  var CheckCommandResultSchema = z7.object({
@@ -1045,9 +1077,10 @@ var CheckCommandResultSchema = z7.object({
1045
1077
  status: StatusSchema,
1046
1078
  assertions: z7.array(CheckAssertionSchema),
1047
1079
  /**
1048
- * Handoff notes only. Cue, chapter, cursor and camera diagnostics are all derived from a
1049
- * render plan that `check` never builds — fabricating them would report on capabilities
1050
- * this command cannot see.
1080
+ * Handoff notes, plus a `speech.close` note when closing the narrator failed after
1081
+ * capture. Cue, chapter, cursor and camera diagnostics are all derived from a render plan
1082
+ * that `check` never builds — fabricating them would report on capabilities this command
1083
+ * cannot see.
1051
1084
  */
1052
1085
  diagnostics: z7.array(z7.object({ code: z7.string(), cueId: z7.string(), detail: z7.string() }))
1053
1086
  });
@@ -1082,6 +1115,17 @@ var DiffCommandResultSchema = z7.object({
1082
1115
  identical: z7.boolean(),
1083
1116
  differences: z7.array(z7.object({ category: DifferenceCategorySchema, detail: z7.string() }))
1084
1117
  });
1118
+ var CompareCommandResultSchema = z7.object({
1119
+ ...envelope("compare"),
1120
+ bundleA: DISPLAY_PATH,
1121
+ bundleB: DISPLAY_PATH,
1122
+ checks: z7.array(z7.object({ name: z7.string(), ok: z7.boolean(), detail: z7.string() }))
1123
+ });
1124
+ var InitResultSchema = z7.object({
1125
+ ...envelope("init"),
1126
+ files: z7.array(DISPLAY_PATH),
1127
+ validates: z7.boolean()
1128
+ });
1085
1129
  var PruneCandidateSchema = z7.object({
1086
1130
  path: DISPLAY_PATH,
1087
1131
  bytes: z7.number().int().nonnegative(),
@@ -1326,6 +1370,51 @@ var LicenceResultSchema = z7.discriminatedUnion("tier", [
1326
1370
  uses: z7.number().int().nonnegative()
1327
1371
  })
1328
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");
1329
1418
 
1330
1419
  // ../schema/src/zod-format.ts
1331
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;
@@ -47,6 +47,7 @@ export declare const RunCommandResultSchema: z.ZodObject<{
47
47
  sha256: z.ZodString;
48
48
  bytes: z.ZodNumber;
49
49
  }, z.core.$strip>>;
50
+ archivedPath: z.ZodOptional<z.ZodString>;
50
51
  schema: z.ZodLiteral<"agent-demo.result/v1">;
51
52
  kind: z.ZodLiteral<"run">;
52
53
  ok: z.ZodBoolean;
@@ -257,6 +258,49 @@ export declare const DiffCommandResultSchema: z.ZodObject<{
257
258
  ok: z.ZodBoolean;
258
259
  problems: z.ZodArray<z.ZodString>;
259
260
  }, z.core.$strip>;
261
+ /**
262
+ * `compare <bundleA> <bundleB>`'s result. Two `DISPLAY_PATH`s like `diff`, because it reads two
263
+ * bundles — but where `diff` is a *semantic* comparison of two different recordings and drift is
264
+ * never a fault, `compare` is a **render-determinism gate**: it re-hashes and re-decodes two
265
+ * renders that should be byte-for-byte identical, so a difference is a regression. `ok` therefore
266
+ * IS the verdict — the renders match — and a failing check names itself in `problems`, exactly the
267
+ * stance `verify` takes on a hash mismatch (unlike `diff`, whose `ok` is deliberately untied from
268
+ * its verdict). Exit 6, reusing `verify`'s and `diff`'s code, on drift or on a bundle whose
269
+ * rendered output could not be read back out. `checks` mirrors `compareRenders`'s own report so a
270
+ * caller sees every check, not only the failing ones. CLI-only: the MCP tool list is frozen at four.
271
+ */
272
+ export declare const CompareCommandResultSchema: z.ZodObject<{
273
+ bundleA: z.ZodString;
274
+ bundleB: z.ZodString;
275
+ checks: z.ZodArray<z.ZodObject<{
276
+ name: z.ZodString;
277
+ ok: z.ZodBoolean;
278
+ detail: z.ZodString;
279
+ }, z.core.$strip>>;
280
+ schema: z.ZodLiteral<"agent-demo.result/v1">;
281
+ kind: z.ZodLiteral<"compare">;
282
+ ok: z.ZodBoolean;
283
+ problems: z.ZodArray<z.ZodString>;
284
+ }, z.core.$strip>;
285
+ /**
286
+ * `init [<name>]`'s result. The scaffold is a starting point that must validate by
287
+ * construction — its template pins the deterministic video contract and uses no clock,
288
+ * randomness, network or absolute paths — but `validates` is still reported separately from
289
+ * `ok`, on the same pattern as `import`'s field of the same name, because the two answer
290
+ * different questions: `ok` says files were written; `validates` says the generated scenario
291
+ * passed the same `loadScenario` validate runs. A `false` there means the template drifted
292
+ * from the contract, not that the command failed. `files` names everything written, relative
293
+ * to the working directory: the scenario plus, only when none existed, a starter
294
+ * `plaintake.config.json` — an existing config is never touched, so it never appears here.
295
+ */
296
+ export declare const InitResultSchema: z.ZodObject<{
297
+ files: z.ZodArray<z.ZodString>;
298
+ validates: z.ZodBoolean;
299
+ schema: z.ZodLiteral<"agent-demo.result/v1">;
300
+ kind: z.ZodLiteral<"init">;
301
+ ok: z.ZodBoolean;
302
+ problems: z.ZodArray<z.ZodString>;
303
+ }, z.core.$strip>;
260
304
  /**
261
305
  * `prune`'s result. Selection never touches disk by itself — `dryRun: true` (the default,
262
306
  * absent `--yes`) means `candidates` names what *would* be removed and every one of them is
@@ -467,6 +511,46 @@ export declare const LicenceResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
467
511
  ok: z.ZodBoolean;
468
512
  problems: z.ZodArray<z.ZodString>;
469
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">;
470
554
  export type ArtifactRef = z.infer<typeof ArtifactRefSchema>;
471
555
  export type ValidationResult = z.infer<typeof ValidationResultSchema>;
472
556
  export type RunCommandResult = z.infer<typeof RunCommandResultSchema>;
@@ -475,13 +559,16 @@ export type RenderCommandResult = z.infer<typeof RenderCommandResultSchema>;
475
559
  export type VerificationReport = z.infer<typeof VerificationReportSchema>;
476
560
  export type WarmCommandResult = z.infer<typeof WarmCommandResultSchema>;
477
561
  export type DiffCommandResult = z.infer<typeof DiffCommandResultSchema>;
562
+ export type CompareCommandResult = z.infer<typeof CompareCommandResultSchema>;
563
+ export type InitResult = z.infer<typeof InitResultSchema>;
478
564
  export type PruneCommandResult = z.infer<typeof PruneCommandResultSchema>;
479
565
  export type ImportCommandResult = z.infer<typeof ImportCommandResultSchema>;
480
566
  export type InspectResult = z.infer<typeof InspectResultSchema>;
481
567
  export type DoctorResult = z.infer<typeof DoctorResultSchema>;
482
568
  export type ActivateResult = z.infer<typeof ActivateResultSchema>;
483
569
  export type LicenceResult = z.infer<typeof LicenceResultSchema>;
484
- export type DemoResult = ValidationResult | RunCommandResult | CheckCommandResult | RenderCommandResult | VerificationReport | WarmCommandResult | DiffCommandResult | 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;
485
572
  /**
486
573
  * Renders a filesystem location for display in a result, relative to `root` when it
487
574
  * lies inside it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaintake/scenario",
3
- "version": "1.14.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",