@meistrari/tela-cli 1.2.1 → 1.4.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.
@@ -15,6 +15,7 @@ import {
15
15
  canvas,
16
16
  code,
17
17
  crop,
18
+ docTemplate,
18
19
  input,
19
20
  llm,
20
21
  splitter,
@@ -35,7 +36,9 @@ import type { WorkflowCodeConfig } from '@meistrari/workflow-code'
35
36
  | [`splitter()`](#splitteroptions) | Splitting file inputs, compatible prior outputs, or existing Vault files. |
36
37
  | [`crop()`](#cropoptions) | Cropping selected PDF pages from compatible files or existing Vault files. |
37
38
  | [`vault.asset()`](#vaultassetpath-options) | Declaring a local file that `sync` uploads and locks in Vault. |
39
+ | [`docTemplate()`](#doctemplateoptions) | Rendering a `.docx` Vault template with keyed placeholders. |
38
40
  | [`vault.ref()`](#vaultrefreference) | Declaring an inert reference to an existing `vault://...` file. |
41
+ | [`vault.asset()`](#vaultassetpath-options) | Declaring a local file dependency uploaded and locked by `sync`. |
39
42
  | [`remote()`](#remote) | Generated catalog paths and explicit ID refs for inert remote authoring. |
40
43
  | [`canvas()`](#canvasremoteref-options) | Executable Canvas or Workflow refs from the remote catalog. |
41
44
  | [`agent(remoteRef, options)`](#agentremoteref-options) | Published-Agent calls from the remote catalog. |
@@ -491,6 +494,29 @@ function crop(options: CropOptions): CropNodeHandle
491
494
  ```
492
495
 
493
496
  Declares Workflow V3's existing `document-cropper` action. Its exclusive `input.file` supports the same compatible workflow input, prior-node output, `vault.ref()`, `vault.asset()`, and Vault-array forms as `splitter.input.file`.
497
+ ### `docTemplate(options)`
498
+
499
+ ```ts
500
+ type DocTemplateOptions = {
501
+ name: string
502
+ key?: string
503
+ input: {
504
+ template: WorkflowCodeVaultSource
505
+ | ((context: ExclusiveRefFactoryContext) => WorkflowCodeExclusiveRef<string>)
506
+ placeholders?: Record<string, string | WorkflowCodeVaultSource>
507
+ | ((context: PromptFactoryContext) => Record<string, string | WorkflowCodeVaultSource | PromptRefValue>)
508
+ outputFilename: string
509
+ mustache?: boolean
510
+ createPermalink?: boolean
511
+ templateFilename?: string
512
+ templateFileSize?: number
513
+ }
514
+ }
515
+
516
+ function docTemplate(options: DocTemplateOptions): DocTemplateNodeHandle
517
+ ```
518
+
519
+ Declares the Workflow V3 `document-templater` action. `input.template` may be a `.docx` file declared with `vault.ref()` or `vault.asset()`, or a callback reference to a text workflow input/string-compatible field from an earlier node. Placeholders are authored as a keyed object; literal strings remain literal, and compatible workflow/Vault references lower to the reference strings consumed by the runtime action.
494
520
 
495
521
  | Option | Type | Required | Default | Description |
496
522
  | --- | --- | --- | --- | --- |
@@ -549,6 +575,44 @@ const selectedPages = crop({
549
575
  ```
550
576
 
551
577
  `path`, `name`, and `mimeType` must be non-empty strings when present. Offline compile without a matching explicit asset snapshot reports `vault.asset.missing_lock`; it never falls back to reading the local file. If the file changes, the next `sync` uploads the new content and updates the lock.
578
+ | `input.template` | `WorkflowCodeVaultSource` | Yes | — | Existing `vault.ref()` or local `vault.asset()` `.docx` template. |
579
+ | `input.template` | `WorkflowCodeVaultSource` or callback | Yes | — | Existing `vault.ref()`, local `vault.asset()`, text input ref, or string-compatible earlier-node ref containing the template Vault URL. |
580
+ | `input.placeholders` | Record or callback | No | `{}` | Literal strings, Vault sources, text inputs, or string-compatible earlier-node fields keyed by template placeholder. |
581
+ | `input.outputFilename` | `string` | Yes | — | Filename for the generated document. |
582
+ | `input.mustache` | `boolean` | No | `false` | Enables the runtime action's Mustache mode. |
583
+ | `input.createPermalink` | `boolean` | No | `false` | Requests a permalink for the rendered document. |
584
+ | `input.templateFilename` | `string` | No | Known Vault name | Explicit `.docx` template name, validated against known metadata. |
585
+ | `input.templateFileSize` | `number` | No | Known Vault size | Explicit byte size, validated against known metadata. |
586
+
587
+ ```ts
588
+ const template = vault.asset('./templates/invoice.docx', {
589
+ name: 'invoice.docx',
590
+ mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
591
+ })
592
+
593
+ const renderInvoice = docTemplate({
594
+ name: 'Render invoice',
595
+ input: {
596
+ template,
597
+ outputFilename: 'rendered-invoice.docx',
598
+ placeholders: ({ ref, paths }) => ({
599
+ customer: ref(customerName),
600
+ total: ref(extractInvoice, paths(extractInvoice).total),
601
+ footer: 'Generated by Tela',
602
+ }),
603
+ },
604
+ })
605
+
606
+ const renderSelectedTemplate = docTemplate({
607
+ name: 'Render selected template',
608
+ input: {
609
+ template: ({ ref, paths }) => ref(selectTemplate, paths(selectTemplate).vaultUrl),
610
+ outputFilename: 'selected-template.docx',
611
+ },
612
+ })
613
+ ```
614
+
615
+ The returned handle exposes typed `generatedDocument`, `generatedAt`, and optional permalink fields. Before workflow mutation, `sync` uploads changed local assets, reuses matching locks, validates access to every directly used Vault ref, checks known filename/size metadata, and rejects known non-`.docx` templates. Dynamic template refs are validated for scope and string compatibility, but their runtime Vault value cannot be inspected during sync. File inputs and non-string node fields are incompatible template or placeholder references.
552
616
 
553
617
  ### `vault.ref(reference)`
554
618
 
@@ -575,6 +639,26 @@ const existingPages = splitter({
575
639
 
576
640
  During compile, a direct Vault ref used by `splitter.input.file` or `crop.input.file` lowers to a transport-file object containing both `fileUrl` and `vaultReference`. Compile remains offline. Before remote workflow mutation, sync and publish validate access to every compiled Vault ref in the active Tela context.
577
641
 
642
+ ### `vault.asset(path, options)`
643
+
644
+ ```ts
645
+ const vault: {
646
+ asset: (
647
+ path: string,
648
+ options?: { name?: string, mimeType?: string },
649
+ ) => WorkflowCodeVaultAsset
650
+ }
651
+ ```
652
+
653
+ Creates an inert local file declaration. Source evaluation does not read, hash, or upload the path. `sync` resolves it inside the Workflow Code project, uploads new or changed content, and persists the returned `vault://...` ref with its content hash and known metadata in the target lockfile. An unchanged asset reuses that lock.
654
+
655
+ ```ts
656
+ const template = vault.asset('./templates/invoice.docx', {
657
+ name: 'invoice.docx',
658
+ mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
659
+ })
660
+ ```
661
+
578
662
  ### `agent(remoteRef, options)`
579
663
 
580
664
  ```ts
@@ -14,7 +14,7 @@
14
14
  "slug": "api-reference",
15
15
  "title": "API Reference",
16
16
  "file": "api-reference.md",
17
- "sha256": "fc121fd8c0e83e4f39ecef45b50d4fc9b0bc64888bd10d0590b3ca168af0a42d"
17
+ "sha256": "380cf0c8543400f6fd311936f1b4fb984f12d27b0472213b8a2b431405f0755e"
18
18
  },
19
19
  {
20
20
  "slug": "cli",