@meistrari/tela-cli 0.8.0 → 1.1.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/docs/workflow-code/api-reference.md +286 -37
- package/dist/docs/workflow-code/cli.md +24 -1
- package/dist/docs/workflow-code/manifest.json +4 -4
- package/dist/docs/workflow-code/overview.md +2 -2
- package/dist/docs/workflow-code/quick-start.md +6 -4
- package/dist/index.js +20780 -1370
- package/package.json +1 -1
|
@@ -12,9 +12,14 @@ Import the authoring helpers from `@meistrari/workflow-code`.
|
|
|
12
12
|
import {
|
|
13
13
|
agent,
|
|
14
14
|
build,
|
|
15
|
+
canvas,
|
|
15
16
|
code,
|
|
17
|
+
crop,
|
|
16
18
|
input,
|
|
17
19
|
llm,
|
|
20
|
+
splitter,
|
|
21
|
+
vault,
|
|
22
|
+
remote,
|
|
18
23
|
workflow,
|
|
19
24
|
} from '@meistrari/workflow-code'
|
|
20
25
|
import type { WorkflowCodeConfig } from '@meistrari/workflow-code'
|
|
@@ -27,14 +32,20 @@ import type { WorkflowCodeConfig } from '@meistrari/workflow-code'
|
|
|
27
32
|
| [`input.text()`](#inputtextoptions) | Text input supplied by a user, API caller, or run payload. |
|
|
28
33
|
| [`input.file()`](#inputfileoptions) | File input supplied by upload or Vault reference. |
|
|
29
34
|
| [`llm()`](#llmoptions) | Single model-call transformation with optional structured output. |
|
|
30
|
-
| [`
|
|
35
|
+
| [`splitter()`](#splitteroptions) | Splitting file inputs, compatible prior outputs, or existing Vault files. |
|
|
36
|
+
| [`crop()`](#cropoptions) | Cropping selected PDF pages from compatible files or existing Vault files. |
|
|
37
|
+
| [`vault.asset()`](#vaultassetpath-options) | Declaring a local file that `sync` uploads and locks in Vault. |
|
|
38
|
+
| [`vault.ref()`](#vaultrefreference) | Declaring an inert reference to an existing `vault://...` file. |
|
|
39
|
+
| [`remote()`](#remote) | Generated catalog paths and explicit ID refs for inert remote authoring. |
|
|
40
|
+
| [`canvas()`](#canvasremoteref-options) | Executable Canvas or Workflow refs from the remote catalog. |
|
|
41
|
+
| [`agent(remoteRef, options)`](#agentremoteref-options) | Published-Agent calls from the remote catalog. |
|
|
31
42
|
| [`code()`](#codeoptions) | Sandboxed runtime JavaScript/TypeScript execution. |
|
|
32
43
|
| [`ref()` / `paths()` / `formats()`](#references-ref-paths-and-formats) | References to workflow inputs or prior node output in prompt callbacks and code handlers. |
|
|
33
44
|
|
|
34
45
|
A workflow file normally creates inputs, creates nodes, then default-exports `build(workflow(...), { inputs, nodes })`.
|
|
35
46
|
|
|
36
47
|
```ts
|
|
37
|
-
import { agent, build, input, llm, workflow } from '@meistrari/workflow-code'
|
|
48
|
+
import { agent, build, input, llm, remote, workflow } from '@meistrari/workflow-code'
|
|
38
49
|
|
|
39
50
|
const topic = input.text({ name: 'topic', required: true })
|
|
40
51
|
|
|
@@ -49,14 +60,16 @@ const outline = llm({
|
|
|
49
60
|
},
|
|
50
61
|
})
|
|
51
62
|
|
|
52
|
-
const
|
|
63
|
+
const reviewer = remote().agent().byId('published-agent-id')
|
|
64
|
+
|
|
65
|
+
const review = agent(reviewer, {
|
|
53
66
|
name: 'Review outline',
|
|
54
67
|
input: {
|
|
55
|
-
|
|
56
|
-
prompt: ({ ref, paths }) => [
|
|
68
|
+
message: ({ ref, paths }) => [
|
|
57
69
|
'Review this outline for a new Tela user.',
|
|
58
70
|
`Bullets: ${ref(outline, paths(outline).bullets).formats().format}`,
|
|
59
71
|
].join('\n'),
|
|
72
|
+
inputs: {},
|
|
60
73
|
},
|
|
61
74
|
})
|
|
62
75
|
|
|
@@ -74,6 +87,42 @@ Rules to keep in mind:
|
|
|
74
87
|
- References in node inputs may target workflow inputs or earlier nodes. Forward references are compile diagnostics.
|
|
75
88
|
|
|
76
89
|
|
|
90
|
+
### `remote()`
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { agent, build, canvas, input, remote, workflow } from '@meistrari/workflow-code'
|
|
94
|
+
|
|
95
|
+
const document = input.file({ name: 'document', required: true })
|
|
96
|
+
const extractInvoice = remote().canvas().Finance['Extract Invoice']
|
|
97
|
+
const triage = remote().agent().byId('published-agent-id')
|
|
98
|
+
|
|
99
|
+
const extract = canvas(extractInvoice, {
|
|
100
|
+
name: 'Extract invoice',
|
|
101
|
+
input: {
|
|
102
|
+
variables: ({ ref }) => ({ file: ref(document) }),
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const classify = agent(triage, {
|
|
107
|
+
name: 'Triage extraction',
|
|
108
|
+
input: {
|
|
109
|
+
message: ({ ref }) => `Classify ${ref(extract).formats().parser}`,
|
|
110
|
+
inputs: ({ ref }) => ({ document: ref(document) }),
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
export default build(workflow('remote-catalog-example'), {
|
|
115
|
+
inputs: [document],
|
|
116
|
+
nodes: [extract, classify],
|
|
117
|
+
})
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Run `tela workflow codegen` before typechecking to generate named paths. User workflow source still imports only from `@meistrari/workflow-code`; generated catalog declarations augment those public types and should not be imported from workflow files.
|
|
121
|
+
|
|
122
|
+
`remote()` values are inert path refs, not API calls or runtime resource objects. `remote().canvas()`, `.workflow()`, `.agent()`, and `.models()` expose generated namespaces. Use bracket access for names with spaces, punctuation, reserved words, or any other segment that is not a safe JavaScript identifier. `byId()` and model `raw()` are explicit escape hatches when a generated name is unavailable or an ID is clearer.
|
|
123
|
+
|
|
124
|
+
`compile` preserves remote refs symbolically and remains offline. `sync` refreshes the active catalog, validates and locks referenced resources, resolves the refs, then lowers them for remote mutation.
|
|
125
|
+
|
|
77
126
|
### References: `ref()`, `paths()`, and `formats()`
|
|
78
127
|
|
|
79
128
|
Workflow references connect node inputs to workflow inputs or earlier node outputs. Under the hood, Tela represents those links as URI references such as `input://customer_question` or `step://extract_invoice?path=total&format=...`. Workflow Code hides the URI string and exposes typed helpers instead.
|
|
@@ -102,7 +151,7 @@ const extractInvoice = llm({
|
|
|
102
151
|
},
|
|
103
152
|
})
|
|
104
153
|
|
|
105
|
-
const reviewInvoice =
|
|
154
|
+
const reviewInvoice = llm({
|
|
106
155
|
name: 'Review invoice extraction',
|
|
107
156
|
input: {
|
|
108
157
|
prompt: ({ ref, paths }) => [
|
|
@@ -296,58 +345,258 @@ const extractInvoice = llm({
|
|
|
296
345
|
})
|
|
297
346
|
```
|
|
298
347
|
|
|
299
|
-
### `
|
|
348
|
+
### `canvas(remoteRef, options)`
|
|
300
349
|
|
|
301
350
|
```ts
|
|
302
|
-
type
|
|
351
|
+
type RemoteCanvasOptions<Ref extends WorkflowCodeRemoteExecutableRef, Environment extends RemoteEnvironment<Ref> | undefined = undefined> = {
|
|
303
352
|
name: string
|
|
304
353
|
key?: string
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
function agent(options: AgentOptions): AgentNodeDeclaration
|
|
354
|
+
} & (Environment extends string
|
|
355
|
+
? { environment: Environment, input: { variables: RemoteReferenceRecordInput<RemoteInputObject<Ref, Environment>> } }
|
|
356
|
+
: RemoteDefaultOptions<Ref>)
|
|
357
|
+
|
|
358
|
+
function canvas<Ref extends WorkflowCodeRemoteExecutableRef, Environment extends RemoteEnvironment<Ref> | undefined = undefined>(
|
|
359
|
+
ref: Ref,
|
|
360
|
+
options: RemoteCanvasOptions<Ref, Environment>,
|
|
361
|
+
): CanvasNodeHandle<RemoteSelectedOutput<Ref, Environment>>
|
|
315
362
|
```
|
|
316
363
|
|
|
317
|
-
Declares an
|
|
364
|
+
Declares an executable remote Canvas or Workflow node. The `remoteRef` must come from `remote().canvas()` or `remote().workflow()`. Generated metadata supplies known input variables, output fields, and environment choices when the catalog exposes them.
|
|
318
365
|
|
|
319
366
|
| Option | Type | Required | Description |
|
|
320
367
|
| --- | --- | --- | --- |
|
|
321
368
|
| `name` | `string` | Yes | Display name and fallback node identity. Must be non-empty. |
|
|
322
369
|
| `key` | `string` | No | Stable identity when `name` may change. |
|
|
323
|
-
| `
|
|
324
|
-
| `input.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
| `schema` | `WorkflowCodeOutputSchema \| null` | No | Structured output fields for the agent result. Use field names mapped to JSON-schema-like field definitions; omit for default behavior or set `null` when intentionally no schema should be emitted. |
|
|
370
|
+
| `environment` | Generated literal union | Catalog-dependent | Environment name narrowed by the generated ref, such as `'production' \| 'staging'`. A generated ref with multiple non-production targets requires `environment`; generated refs with production metadata, no target metadata, or one selectable target may omit it. |
|
|
371
|
+
| `input.variables` | `Record<string, unknown> \| (context) => Record<string, unknown>` | Yes | Variables passed to the remote executable. Callback form enables `ref()` and typed variable refs. |
|
|
372
|
+
|
|
373
|
+
Generated declarations narrow `environment` to catalog literal names and conditionally make it required; it is not an arbitrary `string` escape hatch. The signature above uses the named `RemoteCanvasOptions` shape because the exact requiredness depends on the generated ref's target metadata rather than on a universal optional or required overload. Use `byId()` only for explicit ID binding, then rely on `sync` for authenticated environment validation when generated metadata is unavailable or stale.
|
|
328
374
|
|
|
329
|
-
|
|
375
|
+
After sync resolution, this becomes the existing Workflow V3 Canvas action with `canvasId`, optional `environmentName`, and resolved `variables`. Compile keeps the ref symbolic until orchestration supplies the active catalog and locks.
|
|
376
|
+
|
|
377
|
+
### `splitter(options)`
|
|
330
378
|
|
|
331
379
|
```ts
|
|
332
|
-
|
|
333
|
-
name:
|
|
334
|
-
key
|
|
380
|
+
type SplitterOptions = {
|
|
381
|
+
name: string
|
|
382
|
+
key?: string
|
|
335
383
|
input: {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
384
|
+
file: WorkflowCodeExclusiveFileSource
|
|
385
|
+
chunkSize?: number
|
|
386
|
+
type?: 'pdf' | 'csv'
|
|
387
|
+
mode?: 'single-pages' | 'smart-files'
|
|
388
|
+
customPrompt?: string
|
|
389
|
+
customPromptMode?: 'always' | 'fallback'
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function splitter(options: SplitterOptions): SplitterNodeHandle
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Declares the Workflow V3 `document-splitter` action. Its `input.file` is an exclusive reference field: it accepts a compatible workflow file input or previous-node output, one `vault.ref()` or `vault.asset()`, or an array containing one of those Vault declaration kinds. It does not accept arbitrary strings or text references.
|
|
397
|
+
|
|
398
|
+
| Option | Type | Required | Default | Description |
|
|
399
|
+
| --- | --- | --- | --- | --- |
|
|
400
|
+
| `name` | `string` | Yes | — | Display name and fallback node identity. |
|
|
401
|
+
| `key` | `string` | No | `name` | Stable identity when the display name may change. |
|
|
402
|
+
| `input.file` | `WorkflowCodeExclusiveFileSource` | Yes | — | File/File-array workflow reference, `vault.ref()`, or array of Vault refs. |
|
|
403
|
+
| `input.chunkSize` | `number` | No | `1` | Pages per PDF chunk or rows per CSV chunk. |
|
|
404
|
+
| `input.type` | `'pdf' \| 'csv'` | No | `'pdf'` | Splitter document type. |
|
|
405
|
+
| `input.mode` | `'single-pages' \| 'smart-files'` | No | `'single-pages'` | Fixed chunking or smart document-boundary detection. |
|
|
406
|
+
| `input.customPrompt` | `string` | No | — | Optional smart-files instruction, up to 2,000 characters. |
|
|
407
|
+
| `input.customPromptMode` | `'always' \| 'fallback'` | No | `'always'` | Whether the custom smart-files prompt is always used or only as fallback. |
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
const invoice = input.file({
|
|
411
|
+
name: 'invoice',
|
|
412
|
+
required: true,
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
const pages = splitter({
|
|
416
|
+
name: 'Split invoice',
|
|
417
|
+
input: {
|
|
418
|
+
file: ({ ref }) => ref(invoice),
|
|
419
|
+
chunkSize: 1,
|
|
420
|
+
type: 'pdf',
|
|
421
|
+
},
|
|
422
|
+
})
|
|
423
|
+
|
|
424
|
+
const splitFirstPageAgain = splitter({
|
|
425
|
+
name: 'Split first page again',
|
|
426
|
+
input: {
|
|
427
|
+
file: ({ ref, paths }) => ref(pages, paths(pages)[0].file),
|
|
342
428
|
},
|
|
429
|
+
})
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Structured `llm()` outputs and published Agent outputs from `agent(remoteRef, options)` are valid sources only when the selected output or path has a file-compatible schema. A file schema declares string-valued schemas for `name` and at least one locator property (`fileUrl`, `vaultReference`, or `base64`). Any other declared transport string field (`mimeType` or another locator) must also be string-valued. Arrays are compatible when their item schema is file-compatible. The `x-tela-kind: 'file'` marker is metadata only and does not bypass structural validation. Schema presence or matching property names alone is not sufficient: scalar, generic-object, missing, malformed, or otherwise incompatible paths produce `compiler.ref.incompatible`.
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
const generated = llm({
|
|
436
|
+
name: 'Generate document reference',
|
|
437
|
+
input: { prompt: 'Return the generated document reference.' },
|
|
343
438
|
schema: {
|
|
344
|
-
|
|
345
|
-
|
|
439
|
+
document: {
|
|
440
|
+
type: 'object',
|
|
441
|
+
properties: {
|
|
442
|
+
name: { type: 'string' },
|
|
443
|
+
fileUrl: { type: 'string' },
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
})
|
|
448
|
+
|
|
449
|
+
const generatedPages = splitter({
|
|
450
|
+
name: 'Split generated document',
|
|
451
|
+
input: {
|
|
452
|
+
file: ({ ref, paths }) => ref(generated, paths(generated).document),
|
|
346
453
|
},
|
|
347
454
|
})
|
|
348
455
|
```
|
|
349
456
|
|
|
350
|
-
|
|
457
|
+
`code()` outputs can also feed `splitter.input.file`. Compile statically infers the original handler return without calling it. Transport-file objects, nested paths, file arrays, pass-through file refs, and `File`/`Blob` values are supported. Scalar, malformed, `any`, `unknown`, and mixed file/non-file returns produce `compiler.ref.incompatible`.
|
|
458
|
+
|
|
459
|
+
```ts
|
|
460
|
+
const generatedByCode = code({
|
|
461
|
+
name: 'Generate document in code',
|
|
462
|
+
handler: () => new File(['document contents'], 'generated.pdf', {
|
|
463
|
+
type: 'application/pdf',
|
|
464
|
+
}),
|
|
465
|
+
})
|
|
466
|
+
|
|
467
|
+
const generatedCodePages = splitter({
|
|
468
|
+
name: 'Split code document',
|
|
469
|
+
input: {
|
|
470
|
+
file: ({ ref }) => ref(generatedByCode),
|
|
471
|
+
},
|
|
472
|
+
})
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
The referenced runtime value still needs to describe a real file. Declaring `fileUrl` or `vaultReference` in an LLM schema does not upload or create a Vault file.
|
|
476
|
+
|
|
477
|
+
### `crop(options)`
|
|
478
|
+
|
|
479
|
+
```ts
|
|
480
|
+
type CropOptions = {
|
|
481
|
+
name: string
|
|
482
|
+
key?: string
|
|
483
|
+
input: {
|
|
484
|
+
file: WorkflowCodeExclusiveFileSource
|
|
485
|
+
indexes: readonly (number | string)[]
|
|
486
|
+
type?: 'pdf'
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function crop(options: CropOptions): CropNodeHandle
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
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`.
|
|
494
|
+
|
|
495
|
+
| Option | Type | Required | Default | Description |
|
|
496
|
+
| --- | --- | --- | --- | --- |
|
|
497
|
+
| `name` | `string` | Yes | — | Display name and fallback node identity. |
|
|
498
|
+
| `key` | `string` | No | `name` | Stable identity when the display name may change. |
|
|
499
|
+
| `input.file` | `WorkflowCodeExclusiveFileSource` | Yes | — | File/File-array workflow reference, `vault.ref()`, `vault.asset()`, or an array of Vault declarations. |
|
|
500
|
+
| `input.indexes` | `readonly (number \| string)[]` | Yes | — | Integer page indexes or cropper-supported ranges such as `'3-5'`. |
|
|
501
|
+
| `input.type` | `'pdf'` | No | `'pdf'` | Cropper document type. |
|
|
502
|
+
|
|
503
|
+
```ts
|
|
504
|
+
const selectedPages = crop({
|
|
505
|
+
name: 'Crop selected invoice pages',
|
|
506
|
+
input: {
|
|
507
|
+
file: ({ ref }) => ref(invoice),
|
|
508
|
+
indexes: [1, '3-5'],
|
|
509
|
+
},
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
const cropAgain = crop({
|
|
513
|
+
name: 'Crop prior result',
|
|
514
|
+
input: {
|
|
515
|
+
file: ({ ref, paths }) => ref(selectedPages, paths(selectedPages)[0].file),
|
|
516
|
+
indexes: [2],
|
|
517
|
+
},
|
|
518
|
+
})
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
The result is a typed array whose items contain `indexes`, `originalFile`, and `file`. Compile validates file compatibility before lowering input and previous-node refs to Workflow V3 URIs; direct Vault refs lower to the cropper's transport-file shape. Source evaluation and offline compilation do not contact Vault or invoke prior nodes.
|
|
522
|
+
|
|
523
|
+
### `vault.asset(path, options?)`
|
|
524
|
+
|
|
525
|
+
```ts
|
|
526
|
+
const vault: {
|
|
527
|
+
asset: (
|
|
528
|
+
path: string,
|
|
529
|
+
options?: { name?: string, mimeType?: string },
|
|
530
|
+
) => WorkflowCodeVaultAsset
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
Creates an inert declaration for a local file that should be available to `splitter()` or `crop()`. Source evaluation and offline compile do not read the file, upload it, or require credentials. `sync` resolves the path relative to `workflow-code.config.ts`, rejects paths outside that project directory, hashes the content, and uploads it before the first workflow lifecycle mutation. A matching content hash in the active context lock reuses the existing Vault ref.
|
|
535
|
+
|
|
536
|
+
```ts
|
|
537
|
+
const localInvoice = vault.asset('./fixtures/invoice.pdf', {
|
|
538
|
+
name: 'invoice.pdf',
|
|
539
|
+
mimeType: 'application/pdf',
|
|
540
|
+
})
|
|
541
|
+
|
|
542
|
+
const selectedPages = crop({
|
|
543
|
+
name: 'Crop local invoice',
|
|
544
|
+
input: {
|
|
545
|
+
file: localInvoice,
|
|
546
|
+
indexes: [1, '3-5'],
|
|
547
|
+
},
|
|
548
|
+
})
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
`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.
|
|
552
|
+
|
|
553
|
+
### `vault.ref(reference)`
|
|
554
|
+
|
|
555
|
+
```ts
|
|
556
|
+
const vault: {
|
|
557
|
+
ref: <Reference extends `vault://${string}`>(
|
|
558
|
+
reference: Reference,
|
|
559
|
+
) => WorkflowCodeVaultRef<Reference>
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
Creates an inert declaration for a file that already exists in Vault. The reference must contain a UUID v4 or SHA-256 file id. Calling `vault.ref()` does not read credentials, contact Vault, download the file, or mutate local state during source evaluation.
|
|
564
|
+
|
|
565
|
+
```ts
|
|
566
|
+
const existingInvoice = vault.ref(
|
|
567
|
+
'vault://550e8400-e29b-41d4-a716-446655440000',
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
const existingPages = splitter({
|
|
571
|
+
name: 'Split existing invoice',
|
|
572
|
+
input: { file: existingInvoice },
|
|
573
|
+
})
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
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
|
+
|
|
578
|
+
### `agent(remoteRef, options)`
|
|
579
|
+
|
|
580
|
+
```ts
|
|
581
|
+
function agent<Ref extends WorkflowCodeRemoteAgentRef>(
|
|
582
|
+
ref: Ref,
|
|
583
|
+
options: {
|
|
584
|
+
name: string
|
|
585
|
+
key?: string
|
|
586
|
+
input: {
|
|
587
|
+
message: string | ((context: PromptFactoryContext) => string)
|
|
588
|
+
inputs: Record<string, unknown> | ((context: PromptFactoryContext) => Record<string, unknown>)
|
|
589
|
+
environmentVariables?: Record<string, string>
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
): AgentNodeHandle<RemoteAgentOutput<Ref>>
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
Declares a published Agent invocation. The `remoteRef` must come from `remote().agent()`. Generated metadata supplies known required inputs and output types when the catalog contains an authoritative published-Agent contract.
|
|
596
|
+
|
|
597
|
+
`input.message` is prompt-like, may use `ref()` callbacks, and must render to a non-empty string. `input.inputs` supplies the published Agent's named inputs and may contain workflow input or prior-node refs. Optional `environmentVariables` remain authored strings; they are not resolved through catalog metadata.
|
|
598
|
+
|
|
599
|
+
Lowering targets the existing Workflow V3 `agent-fcc` action fields `agentId`, `message`, `inputs`, and optional `environmentVariables` only. It does not emit output schema, revision, or catalog-hash fields in the node input.
|
|
351
600
|
|
|
352
601
|
### `code(options)`
|
|
353
602
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## CLI
|
|
2
2
|
|
|
3
|
-
The workflow command group documents implemented `init`, `compile`, `docs`, `sync`, and `publish` workflows. Current MVP behavior is local-first until you run explicit remote lifecycle commands such as `sync` or `publish`.
|
|
3
|
+
The workflow command group documents implemented `init`, `compile`, `docs`, `codegen`, `sync`, and `publish` workflows. Current MVP behavior is local-first until you run explicit remote lifecycle commands such as `sync` or `publish`.
|
|
4
4
|
|
|
5
5
|
### Command surface
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ The workflow command group documents implemented `init`, `compile`, `docs`, `syn
|
|
|
9
9
|
| `init [--directory <path>] [--config <path>] [--workflow <key>...] [--yes] [--init-git\|--no-init-git] [--install-deps\|--no-install-deps] [--package-manager bun\|pnpm\|npm\|yarn] [--json]` | Implemented | No | Create local Workflow Code scaffold. |
|
|
10
10
|
| `compile [target] [--config <path>] [--env <path>] [--json]` | Implemented | No | Compile selected source into Workflow V3 output. |
|
|
11
11
|
| `docs [page] [--json]` | Implemented | No | Read the version-matched Workflow Code documentation bundled with the installed CLI. |
|
|
12
|
+
| `codegen [--json]` | Implemented | No | Refresh or reuse the active-context remote catalog and generate remote() TypeScript metadata. |
|
|
12
13
|
| `sync [target] [--config <path>] [--env <path>] [--yes] [--json]` | Implemented | Yes | Synchronize local compiled workflow(s) with configured Tela prompt(s). |
|
|
13
14
|
| `publish [target] [--environment <name>] [--create-environment-if-missing] [--config <path>] [--env <path>] [--yes] [--json]` | Implemented | Yes | Publish local-matching workflow version(s) to the selected workflow environment. |
|
|
14
15
|
|
|
@@ -21,6 +22,7 @@ tela workflow compile
|
|
|
21
22
|
tela workflow compile invoice-processing
|
|
22
23
|
tela workflow compile invoice-processing --env .env.staging --json
|
|
23
24
|
tela workflow docs cli
|
|
25
|
+
tela workflow codegen --json
|
|
24
26
|
tela workflow sync
|
|
25
27
|
tela workflow sync invoice-processing --env .env.staging --json
|
|
26
28
|
tela workflow publish
|
|
@@ -105,6 +107,27 @@ tela workflow docs cli
|
|
|
105
107
|
tela workflow docs api-reference --json
|
|
106
108
|
```
|
|
107
109
|
|
|
110
|
+
### codegen
|
|
111
|
+
|
|
112
|
+
`codegen [--json]`
|
|
113
|
+
|
|
114
|
+
**Description.** `tela workflow codegen` resolves the active Tela Local context and workspace, refreshes the authenticated remote catalog, and writes TypeScript metadata for inert `remote()` authoring. It writes the generated augmentation at `.tela/workflow-code/generated/workflow-code.generated.d.ts` and the complete context/workspace snapshot at `.tela/workflow-code/catalogs/<workspaceId>/remote-catalog.snapshot.json`. The catalog includes canvases, workflows, templates, published agents, and models; only canvases, workflows, published agents, and models are projected by `remote()`.
|
|
115
|
+
|
|
116
|
+
Codegen fetches a fresh snapshot when possible. If refresh fails, it may reuse only a complete cached snapshot for the same active context and workspace, reports warning diagnostics, and repairs or skips artifacts deterministically. If neither refresh nor a matching snapshot is available, it fails without inventing catalog bindings. Generated files are non-secret typechecking and orchestration metadata; include the generated declaration path in TypeScript's `include` configuration when needed.
|
|
117
|
+
|
|
118
|
+
`compile` remains offline and preserves symbolic remote refs. `sync` refreshes and validates catalog references and locks before resolved lowering and remote mutation.
|
|
119
|
+
|
|
120
|
+
| Prop | Type | Required | Description |
|
|
121
|
+
|---|---|---:|---|
|
|
122
|
+
| `--json` | Flag | No | Emit command, active context/workspace, metadata source/hash/timestamps, written paths, skipped paths, and diagnostics as JSON. |
|
|
123
|
+
|
|
124
|
+
**Examples.**
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
tela workflow codegen
|
|
128
|
+
tela workflow codegen --json
|
|
129
|
+
```
|
|
130
|
+
|
|
108
131
|
### sync
|
|
109
132
|
|
|
110
133
|
**Description.** `tela workflow sync` compiles local source, resolves the active Tela Local context, selects the matching `projectId` and `promptId`, verifies remote content, and writes per-context lockfile state under `.tela/workflows/<workflowKey>/contexts/<context>/lock.json`.
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
"slug": "overview",
|
|
9
9
|
"title": "Documentation overview",
|
|
10
10
|
"file": "overview.md",
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "88c838262048260cee280cdd8d16e9987847bcf06b857ca6d2cf0b707c4b15fe"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"slug": "api-reference",
|
|
15
15
|
"title": "API Reference",
|
|
16
16
|
"file": "api-reference.md",
|
|
17
|
-
"sha256": "
|
|
17
|
+
"sha256": "fc121fd8c0e83e4f39ecef45b50d4fc9b0bc64888bd10d0590b3ca168af0a42d"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"slug": "cli",
|
|
21
21
|
"title": "CLI",
|
|
22
22
|
"file": "cli.md",
|
|
23
|
-
"sha256": "
|
|
23
|
+
"sha256": "759db330fd7b06859e55404f01feb0625a43bb579324fe011bc34cd92d517239"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"slug": "config",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"slug": "quick-start",
|
|
45
45
|
"title": "Quick start",
|
|
46
46
|
"file": "quick-start.md",
|
|
47
|
-
"sha256": "
|
|
47
|
+
"sha256": "15f4b45bd6292c4dd3f3ff5fc58f46e5e83e55f3a5e4ed9fee0df37fd12b2305"
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -9,6 +9,6 @@ Workflow Code documentation is organized as a set of focused pages. Read the pag
|
|
|
9
9
|
| [Quick start](/docs/quick-start) | You want the shortest path from `tela workflow init` to local compile and explicit sync. |
|
|
10
10
|
| [Installation](/docs/installation) | You need to verify Tela Dock, the `tela` CLI, or the `@meistrari/workflow-code` package. |
|
|
11
11
|
| [Config](/docs/config) | You are defining `workflow-code.config.ts`, dotenv files, target ids, or context-specific bindings. |
|
|
12
|
-
| [CLI](/docs/cli) | You need implemented init/compile/sync/publish behavior, target selection rules, or JSON diagnostics. |
|
|
13
|
-
| [API Reference](/docs/api-reference) | You are authoring `workflow()`, `build()`, `input`, `llm`, `agent`, `code`, and
|
|
12
|
+
| [CLI](/docs/cli) | You need implemented init/compile/docs/codegen/sync/publish behavior, target selection rules, generated catalog refresh, or JSON diagnostics. |
|
|
13
|
+
| [API Reference](/docs/api-reference) | You are authoring `workflow()`, `build()`, `input`, `llm`, `agent`, `code`, references, remote catalogs, and executable remote refs. |
|
|
14
14
|
| [Guides](/docs/guides) | You want repository layout, CI compile checks, and troubleshooting patterns. |
|
|
@@ -47,7 +47,7 @@ Keep the first config small: one target, one entrypoint, and environment-backed
|
|
|
47
47
|
### Author a workflow
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
|
-
import { agent, build, code, input, llm, workflow } from '@meistrari/workflow-code'
|
|
50
|
+
import { agent, build, code, input, llm, remote, workflow } from '@meistrari/workflow-code'
|
|
51
51
|
|
|
52
52
|
const topic = input.text({
|
|
53
53
|
name: 'topic',
|
|
@@ -77,15 +77,17 @@ const countBullets = code({
|
|
|
77
77
|
},
|
|
78
78
|
})
|
|
79
79
|
|
|
80
|
-
const
|
|
80
|
+
const reviewer = remote().agent().byId('published-agent-id')
|
|
81
|
+
|
|
82
|
+
const review = agent(reviewer, {
|
|
81
83
|
name: 'Review outline',
|
|
82
84
|
input: {
|
|
83
|
-
|
|
84
|
-
prompt: ({ ref, paths }) => [
|
|
85
|
+
message: ({ ref, paths }) => [
|
|
85
86
|
'Review this outline for a new Tela user.',
|
|
86
87
|
`Bullets: ${ref(outline, paths(outline).bullets).formats().json}`,
|
|
87
88
|
`Bullet count: ${ref(countBullets, paths(countBullets).count).formats().json}`,
|
|
88
89
|
].join('\n'),
|
|
90
|
+
inputs: {},
|
|
89
91
|
},
|
|
90
92
|
})
|
|
91
93
|
|