@norskvideo/ctl-product-template-schema 0.1.31 → 0.1.33

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 (3) hide show
  1. package/index.d.ts +20 -0
  2. package/index.js +34 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -55,6 +55,14 @@ export declare const ProductTemplateSideloadSchema: z.ZodObject<{
55
55
  llmVenv: z.ZodOptional<z.ZodBoolean>;
56
56
  }, z.core.$strip>;
57
57
  export type ProductTemplateSideload = z.infer<typeof ProductTemplateSideloadSchema>;
58
+ export declare const ProductTemplateHostTlsSchema: z.ZodObject<{
59
+ services: z.ZodArray<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ export type ProductTemplateHostTls = z.infer<typeof ProductTemplateHostTlsSchema>;
62
+ export declare const ProductTemplateWorkdirSchema: z.ZodObject<{
63
+ services: z.ZodArray<z.ZodString>;
64
+ }, z.core.$strip>;
65
+ export type ProductTemplateWorkdir = z.infer<typeof ProductTemplateWorkdirSchema>;
58
66
  export declare const ProductTemplateAcceleratorSchema: z.ZodEnum<{
59
67
  none: "none";
60
68
  nvidia: "nvidia";
@@ -316,6 +324,12 @@ export declare const ProductTemplateManifestSchema: z.ZodObject<{
316
324
  configPath: z.ZodString;
317
325
  }, z.core.$strict>]>>;
318
326
  }, z.core.$strict>>>;
327
+ workdir: z.ZodOptional<z.ZodObject<{
328
+ services: z.ZodArray<z.ZodString>;
329
+ }, z.core.$strip>>;
330
+ hostTls: z.ZodOptional<z.ZodObject<{
331
+ services: z.ZodArray<z.ZodString>;
332
+ }, z.core.$strip>>;
319
333
  migration: z.ZodOptional<z.ZodObject<{
320
334
  strategy: z.ZodEnum<{
321
335
  overlap: "overlap";
@@ -551,6 +565,12 @@ export declare const ProductTemplateMaterialsSchema: z.ZodObject<{
551
565
  configPath: z.ZodString;
552
566
  }, z.core.$strict>]>>;
553
567
  }, z.core.$strict>>>;
568
+ workdir: z.ZodOptional<z.ZodObject<{
569
+ services: z.ZodArray<z.ZodString>;
570
+ }, z.core.$strip>>;
571
+ hostTls: z.ZodOptional<z.ZodObject<{
572
+ services: z.ZodArray<z.ZodString>;
573
+ }, z.core.$strip>>;
554
574
  migration: z.ZodOptional<z.ZodObject<{
555
575
  strategy: z.ZodEnum<{
556
576
  overlap: "overlap";
package/index.js CHANGED
@@ -191,6 +191,34 @@ export const ProductTemplateSideloadSchema = z
191
191
  }),
192
192
  })
193
193
  .meta({ id: "ProductTemplateSideload", outputId: "ProductTemplateSideload" });
194
+ // The host's own TLS certificate, handed to a product's containers. WHY THIS
195
+ // EXISTS: norsk-ctl already holds the certificate the host is reached by, and a
196
+ // product that serves TLS itself (relays in a cluster talk HTTPS to each other,
197
+ // and later run QUIC listeners) needs the same identity rather than minting a
198
+ // self-signed one nobody trusts. Additive: an older runner ignoring the field
199
+ // still launches the product, which then simply has no certificate mounted.
200
+ export const ProductTemplateHostTlsSchema = z
201
+ .object({
202
+ services: z.array(z.string().min(1)).min(1).meta({
203
+ description: "Compose services that get the host certificate. Each must be a service in the template's own compose.yml. The runner mounts the certificate and key read-only at /etc/norsk-host-tls (cert.pem, key.pem) and sets NORSK_HOST_TLS_DIR=/etc/norsk-host-tls and NORSK_HOST_TLS_TRUSTED=true|false (true when the certificate is a real, browser-trusted one; false when the host's is self-signed). A host with no certificate mounts nothing and sets neither variable; the launch still goes ahead.",
204
+ }),
205
+ })
206
+ .meta({ id: "ProductTemplateHostTls", outputId: "ProductTemplateHostTls" });
207
+ // The instance working directory, handed to a product's own services. WHY THIS
208
+ // EXISTS: it is the one per-instance store that survives a relaunch (a named
209
+ // volume does not: relaunch tears down with `down -v`), and the runner mounts
210
+ // it at /data only into media and studio. A product whose own service keeps
211
+ // state -- a relay's state file and site key -- or writes files the engine must
212
+ // read (assets, recordings) needs the same directory at the same path. A
213
+ // product relying on it declares the runner capability `service-workdir`,
214
+ // since an older runner would ignore the field and lose the state.
215
+ export const ProductTemplateWorkdirSchema = z
216
+ .object({
217
+ services: z.array(z.string().min(1)).min(1).meta({
218
+ description: "Compose services that get the instance working directory, read-write at /data -- the same directory, at the same path, that media and studio have -- with NORSK_WORKDIR=/data. Each must be a service in the template's own compose.yml. It survives relaunch, restart and runner upgrade; only `instance delete --purge` removes it.",
219
+ }),
220
+ })
221
+ .meta({ id: "ProductTemplateWorkdir", outputId: "ProductTemplateWorkdir" });
194
222
  // Placement requirements guidance (requirements-authoring.md). Each dimension
195
223
  // the placer reasons over — capacity (vCPUs), cores, GPU, capabilities, host
196
224
  // ports — is optionally declared with a `mode`:
@@ -337,6 +365,12 @@ export const ProductTemplateManifestSchema = z
337
365
  description: "Host-port bindings whose value rides a product-template parameter. Opt-in per launch via the param value: absent = closed, 'auto' = allocate a free port from `preferred`, number = use it. When opened the port is published as a managed host binding and surfaced to the containers via compose interpolation. Alongside the per-param scalars the runner sets NORSK_ALLOCATED_PORTS: a JSON object keyed by param, each value {port, protocol, service?}, describing every opened port ('{}' when none opted in; unset when nothing is declared) — so a product needing the allocation as data maps one var instead of folding scalars into JSON via interpolation.",
338
366
  }),
339
367
  logs: ProductTemplateLogsSchema.optional(),
368
+ workdir: ProductTemplateWorkdirSchema.optional().meta({
369
+ description: "Mount the instance working directory at /data into the named compose services, as media and studio always have it -- for a product's own service that keeps state across relaunch or shares files with the engine. Absent = not mounted. Declare the runner capability `service-workdir` alongside it.",
370
+ }),
371
+ hostTls: ProductTemplateHostTlsSchema.optional().meta({
372
+ description: "Mount the host's TLS certificate and key, read-only, into the named compose services — for a product that serves TLS itself. Copied per launch, so a rotated certificate is picked up on relaunch. Absent = nothing mounted.",
373
+ }),
340
374
  migration: ProductTemplateMigrationSchema.optional().meta({
341
375
  description: "How a running instance may be moved between nodes. `strategy` is the strongest promise the product keeps: `overlap` (target started, then source stopped — both may produce briefly), `stopThenStart` (the default when absent — target prepared but not started, source stopped, target started), or `handover` (the job speaks the worker's migration socket and hands over at an exact position). A migrate request may down-grade to a safer strategy but never up-grade past the declaration. Only the manager reads this; the worker never does.",
342
376
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-product-template-schema",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {