@runtypelabs/cli 2.37.0 → 2.40.2

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/README.md +180 -8
  2. package/dist/index.js +6698 -4980
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -643,8 +643,93 @@ Manage agents.
643
643
  | `agents create -n <name>` | Create a new agent |
644
644
  | `agents execute <id> -m <message>` | Execute an agent with a message |
645
645
  | `agents task <agent> -g <goal>` | Run a multi-session task (see Marathon section) |
646
+ | `agents ensure <file>` | Converge a definition from a file |
646
647
  | `agents delete <id>` | Delete an agent |
647
648
 
649
+ `agents execute` and `dispatch --agent` take `--alias <name>` or `--version-id <id>`
650
+ to run a specific version. Supply at most one; omit both to run the agent's saved
651
+ configuration.
652
+
653
+ #### Release aliases
654
+
655
+ An agent runs an immutable **version**. A **release alias** is a named, mutable
656
+ pointer that selects which version runs: `live` is built in and never expires, and
657
+ any name matching `^[a-z0-9][a-z0-9-]{0,62}$` is a preview pointer. Every activation
658
+ appends an append-only **deployment receipt**.
659
+
660
+ | Subcommand | Description |
661
+ | ------------------------------------------------------------------------------ | ---------------------------------- |
662
+ | `agents aliases list <agentId> [--include-archived]` | List the pointers, live first |
663
+ | `agents aliases get <agentId> <alias>` | Read one pointer and its revision |
664
+ | `agents aliases activate <agentId> <alias> --version-id <id> [--revision <n>]` | Aim a pointer at one exact version |
665
+ | `agents aliases archive <agentId> <alias> [--revision <n>] [--dry-run]` | Stop a preview pointer resolving |
666
+ | `agents aliases archive <alias> --all [--dry-run]` | Archive that name on every agent |
667
+ | `agents aliases rollback <agentId> <alias> [--steps <n>] [--revision <n>]` | Re-aim at the previous version |
668
+ | `agents deployments list <agentId> [--alias <name>]` | Read the deployment history |
669
+
670
+ Moving an existing `live` pointer requires the revision you read, sent as `If-Match`:
671
+
672
+ ```bash
673
+ runtype agents aliases get agent_abc live --json
674
+ runtype agents aliases activate agent_abc live --version-id agentver_9 --revision 12 \
675
+ --idempotency-key deploy-2026-09-06-1
676
+ ```
677
+
678
+ `agents ensure <file> --deploy <alias>` saves and activates in one step;
679
+ `--release publish|none` is the older spelling of the same thing, and supplying both
680
+ is refused. A non-live deploy leaves live unchanged.
681
+
682
+ ##### Cleaning up a pull request's preview
683
+
684
+ A preview pointer expires 14 days after the last converge that touched it, and a
685
+ sweep archives it then. Archiving on PR close is the primary cleanup; the TTL is
686
+ only the backstop. `--all` archives the name on every agent the pull request
687
+ touched, each under the revision it just read, and reports a stale revision
688
+ without stopping. It is idempotent: a second run finds nothing active.
689
+
690
+ ```yaml
691
+ on:
692
+ pull_request:
693
+ types: [closed]
694
+
695
+ jobs:
696
+ archive-preview:
697
+ runs-on: ubuntu-latest
698
+ steps:
699
+ - run: npx @runtypelabs/cli agents aliases archive "pr-${{ github.event.number }}" --all
700
+ env:
701
+ RUNTYPE_API_KEY: ${{ secrets.RUNTYPE_API_KEY }}
702
+ ```
703
+
704
+ An organization holds at most 50 active preview aliases and one agent at most 10.
705
+ Creating one past either limit is refused with `PREVIEW_ALIAS_LIMIT`; archiving one
706
+ frees the quota immediately.
707
+
708
+ #### Promoting between organizations
709
+
710
+ `runtype agents promote` moves an agent from one organization to another with two
711
+ credentials. Neither key is ever a command-line argument: name the environment
712
+ variable that holds it.
713
+
714
+ | Subcommand | Description |
715
+ | --------------------------------------------------- | ------------------------------------------------------- |
716
+ | `agents promote prepare <name> --alias <candidate>` | Stage the definition at a preview pointer in the target |
717
+ | `agents promote validate <manifest>` | Re-plan and report unresolved references (exit 1) |
718
+ | `agents promote evaluate <manifest> --suite <id>` | Run a suite against the staged version |
719
+ | `agents promote activate <manifest> [--alias live]` | Deploy that exact staged version |
720
+
721
+ ```bash
722
+ export RUNTYPE_SOURCE_API_KEY=... RUNTYPE_TARGET_API_KEY=...
723
+ runtype agents promote prepare "Pricing Assistant" --alias promote-482
724
+ runtype agents promote validate promotion.json
725
+ runtype agents promote evaluate promotion.json --suite evalsuite_1
726
+ runtype agents promote activate promotion.json
727
+ ```
728
+
729
+ Credentials never cross organizations, secrets stay `{{secret:NAME}}` references
730
+ resolved by the target, and the manifest carries only ids and hashes. `evaluate`
731
+ reports its result and nothing gates activation on it.
732
+
648
733
  ### `runtype persona`
649
734
 
650
735
  Set up the [Persona](https://github.com/runtypelabs/persona) chat widget against Runtype: create an agent, create a client token, and output an embed snippet.
@@ -673,6 +758,39 @@ runtype dispatch --flow <id> --variable key=value --variable key2=value2
673
758
  runtype dispatch --flow <id> --no-stream --json
674
759
  ```
675
760
 
761
+ #### Execution inputs and machine-readable results
762
+
763
+ `dispatch`, `flows run`, and `agents execute` accept `--inputs <json>` or
764
+ `--inputs-file <file|->` for typed input variables. Use `-` to read a JSON object
765
+ from stdin. `--variable key=value` remains a repeatable **string** input; use JSON
766
+ for numbers, booleans, arrays, objects, and null. Conflicting input sources and
767
+ duplicate keys are rejected rather than silently overwritten.
768
+
769
+ ```bash
770
+ runtype flows run flow_example --inputs '{"limit":5,"enabled":true}' --json
771
+ printf '%s' '{"customer":{"name":"Alyss"}}' | runtype dispatch --flow flow_example --inputs-file - --json
772
+ runtype agents execute agent_example --message "Summarize these items" --inputs '{"items":[1,2,3]}' --json
773
+ runtype dispatch --flow flow_example --messages-file conversation.json --jsonl
774
+ ```
775
+
776
+ `--messages-file <file|->` supplies a JSON array of messages instead of `--message`.
777
+ Only one source may consume stdin. Input-bearing `agents execute` requests use
778
+ the dispatch API so variables reach the runtime; requests without input variables
779
+ retain the agent execution endpoint.
780
+
781
+ For these execution commands, `--json` writes one final JSON value to stdout,
782
+ without progress prose or text deltas. `--jsonl` writes structured events one per
783
+ line followed by an `execution_summary` event (also used for buffered results or
784
+ errors). The two formats are mutually exclusive. Diagnostics go to stderr.
785
+ Exit codes are **0** for completion, **1** for failed execution, invalid input,
786
+ authentication errors, or incomplete streams, and **2** when awaiting input or
787
+ approval. Awaiting results do not claim `success: true`. A paused execution is
788
+ not automatically approved or restarted.
789
+
790
+ CRUD commands that accept a JSON-object `--from-file` through the shared file
791
+ reader also accept `--from-file -`. This does not change commands whose input
792
+ files have a different format, such as batch record-ID arrays.
793
+
676
794
  ### `runtype prompts`
677
795
 
678
796
  Manage prompts.
@@ -706,6 +824,17 @@ Manage batch operations.
706
824
  | `batch status <id>` | Check batch job status (`--watch`) |
707
825
  | `batch cancel <id>` | Cancel a batch job |
708
826
 
827
+ `batch status --watch` polls in both terminal and nonterminal environments. Use
828
+ `--timeout <ms>` (default `300000`) and `--interval <ms>` (default `2000`) to bound
829
+ the local wait; these options require `--watch`. With `--json`, stdout contains
830
+ one final result, while progress is sent to stderr. Failed or cancelled batches,
831
+ completed batches with failed records, and local timeouts exit nonzero. Timing out
832
+ stops watching only: it does not cancel or resubmit the server batch.
833
+
834
+ ```bash
835
+ runtype batch status batch_example --watch --timeout 600000 --interval 2000 --json
836
+ ```
837
+
709
838
  ### `runtype eval`
710
839
 
711
840
  Manage evaluations.
@@ -855,16 +984,59 @@ runtype config path
855
984
 
856
985
  Valid config keys: `apiUrl`, `defaultModel`, `defaultTemperature`, `outputFormat`, `streamResponses`
857
986
 
858
- ### Global Options
987
+ ### Effective target and headless safeguards
988
+
989
+ ```bash
990
+ # Inspect the resolved endpoint and credential source without exposing the key
991
+ runtype config context --json
992
+
993
+ # Fail closed if the target or authenticated organization differs
994
+ runtype --no-input --expect-api-url https://api.runtype.com --expect-org org_example \
995
+ flows run flow_example --inputs '{"limit":5}' --json
996
+
997
+ # Headless mode is not consent: destructive commands also require --yes
998
+ runtype --no-input records delete record_example --yes
999
+ ```
859
1000
 
860
- All commands support these flags:
1001
+ API URL precedence is **`--api-url` > `RUNTYPE_API_URL` > saved `apiUrl` config >
1002
+ stored credential endpoint > production**. Saved URL configuration now affects
1003
+ ordinary API commands, not just configuration display. If an old saved value is
1004
+ stale, reset it or explicitly select your intended endpoint before upgrading
1005
+ automation. Conflicting explicit API URL flags are rejected.
1006
+
1007
+ `config context` is an offline, redacted inspection; its stored organization hint
1008
+ is not proof of current server identity (`orgVerified: false`). `--expect-org`
1009
+ checks the authenticated identity against the server before API actions. With
1010
+ either expected-target guard, an invalid environment credential does not silently
1011
+ fall back to a different stored credential.
1012
+
1013
+ Claim/verify tokens remain bound to their issuing server; the expected-URL guard
1014
+ also checks that actual endpoint. Anonymous registration and claim/verify reject
1015
+ `--expect-org`, since that ceremony cannot prove the resulting organization.
1016
+
1017
+ Implicit login never prompts when stdin is not a terminal. `--no-input` also
1018
+ disables interactive startup and prompts in terminal sessions; delete, bulk-delete,
1019
+ revoke, and reset commands require explicit `--yes` in this mode. Marathon and
1020
+ `agents task` reject `--no-input`; use their documented headless JSON mode instead.
1021
+
1022
+ ### Global Options
861
1023
 
862
- | Flag | Description |
863
- | -------------------- | ------------------------ |
864
- | `--json` | Output in JSON format |
865
- | `--tty` / `--no-tty` | Force TTY / non-TTY mode |
866
- | `-v, --verbose` | Enable verbose output |
867
- | `--api-url <url>` | Override API URL |
1024
+ Root flags are forwarded to subcommands; output support depends on the command:
1025
+
1026
+ | Flag | Description |
1027
+ | ------------------------ | --------------------------------------- |
1028
+ | `--json` | Output in JSON format |
1029
+ | `--tty` / `--no-tty` | Force TTY / non-TTY mode |
1030
+ | `-v, --verbose` | Enable verbose output |
1031
+ | `--api-url <url>` | Override API URL |
1032
+ | `--expect-api-url <url>` | Assert effective API endpoint |
1033
+ | `--expect-org <id>` | Assert authenticated organization |
1034
+ | `--no-input` | Disable prompts; does not imply consent |
1035
+ | `-y, --yes` | Explicit destructive-action consent |
1036
+
1037
+ `--tty` / `--no-tty` are available on commands with terminal rendering. The strict
1038
+ single-result JSON contract above applies to the three execution commands and
1039
+ `batch status --watch`, not every legacy command.
868
1040
 
869
1041
  ## Development
870
1042