@sequenceholdings/studio-cli 0.7.2 → 0.9.1

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 (89) hide show
  1. package/README.md +414 -55
  2. package/dist/access/commands.d.ts +1 -1
  3. package/dist/access/commands.js +102 -55
  4. package/dist/access/custom-role-hosts.d.ts +3 -0
  5. package/dist/access/custom-role-hosts.js +88 -0
  6. package/dist/access/group-rosters.d.ts +6 -0
  7. package/dist/access/group-rosters.js +33 -0
  8. package/dist/access/host-contract.d.ts +55 -0
  9. package/dist/access/host-contract.js +33 -0
  10. package/dist/access/hosts.d.ts +4 -0
  11. package/dist/access/hosts.js +60 -0
  12. package/dist/access/principal.d.ts +16 -0
  13. package/dist/access/principal.js +36 -0
  14. package/dist/access/roles.d.ts +18 -0
  15. package/dist/access/roles.js +89 -0
  16. package/dist/access/tier-hosts.d.ts +12 -0
  17. package/dist/access/tier-hosts.js +206 -0
  18. package/dist/agents/commands.d.ts +1 -1
  19. package/dist/agents/commands.js +76 -16
  20. package/dist/agents/scaffold.js +8 -3
  21. package/dist/app/commands.js +37 -12
  22. package/dist/app/manifest.d.ts +2 -2
  23. package/dist/app/official-source.d.ts +4 -2
  24. package/dist/app/official-source.js +6 -4
  25. package/dist/app/readme.js +2 -2
  26. package/dist/app/repository-index.d.ts +6 -0
  27. package/dist/app/repository-index.js +2 -2
  28. package/dist/app/workspace-model.js +4 -0
  29. package/dist/app/workspace-scaffold.js +5 -3
  30. package/dist/app/workspace.d.ts +2 -0
  31. package/dist/app/workspace.js +1 -1
  32. package/dist/artifact/delegate.js +26 -3
  33. package/dist/artifact/sandbox.js +2 -1
  34. package/dist/atlas-client.d.ts +15 -8
  35. package/dist/atlas-client.js +140 -64
  36. package/dist/bin.js +9 -1
  37. package/dist/cli-errors.js +4 -0
  38. package/dist/command-contract.d.ts +8 -2
  39. package/dist/command-contract.js +3 -2
  40. package/dist/command-help.d.ts +8 -6
  41. package/dist/command-help.js +65 -14
  42. package/dist/env-flags.d.ts +7 -0
  43. package/dist/env-flags.js +23 -0
  44. package/dist/functions/commands.js +66 -11
  45. package/dist/functions/manifest.d.ts +5 -0
  46. package/dist/functions/manifest.js +44 -23
  47. package/dist/functions/service-account-guidance.d.ts +21 -0
  48. package/dist/functions/service-account-guidance.js +62 -0
  49. package/dist/functions/workspace.d.ts +11 -0
  50. package/dist/functions/workspace.js +52 -0
  51. package/dist/machine-output.d.ts +7 -0
  52. package/dist/machine-output.js +56 -0
  53. package/dist/main.d.ts +2 -1
  54. package/dist/main.js +32 -4
  55. package/dist/orm/delegate.js +49 -6
  56. package/dist/orm/execute.js +11 -5
  57. package/dist/orm/failures.d.ts +32 -0
  58. package/dist/orm/failures.js +75 -0
  59. package/dist/orm/read.js +3 -3
  60. package/dist/orm/version-guard.d.ts +3 -0
  61. package/dist/orm/version-guard.js +63 -0
  62. package/dist/pipeline/commands.js +4 -1
  63. package/dist/principals/commands.d.ts +3 -0
  64. package/dist/principals/commands.js +124 -0
  65. package/dist/process/commands.js +9 -3
  66. package/dist/process/human-input-probe.d.ts +23 -0
  67. package/dist/process/human-input-probe.js +118 -0
  68. package/dist/process/lint.d.ts +2 -0
  69. package/dist/process/lint.js +10 -0
  70. package/dist/process/run-steps.d.ts +112 -0
  71. package/dist/process/run-steps.js +123 -0
  72. package/dist/process/runs.d.ts +4 -3
  73. package/dist/process/runs.js +69 -21
  74. package/dist/release-age.d.ts +1 -1
  75. package/dist/release-age.js +1 -0
  76. package/dist/repos/commands.d.ts +57 -0
  77. package/dist/repos/commands.js +83 -15
  78. package/dist/repos/init-repo.d.ts +45 -0
  79. package/dist/repos/init-repo.js +257 -0
  80. package/dist/repos/primitive-declaration.d.ts +43 -0
  81. package/dist/repos/primitive-declaration.js +212 -0
  82. package/dist/sandbox-unpushed-warning.d.ts +23 -0
  83. package/dist/sandbox-unpushed-warning.js +86 -0
  84. package/dist/service-accounts/commands.js +15 -3
  85. package/dist/templates/commands.d.ts +14 -2
  86. package/dist/templates/commands.js +70 -16
  87. package/dist/templates/process/pnpm-workspace.yaml +1 -0
  88. package/package.json +15 -12
  89. package/templates/process/pnpm-workspace.yaml +1 -0
package/README.md CHANGED
@@ -28,7 +28,7 @@ verifies and copies the selected release into a new or empty directory.
28
28
 
29
29
  > **Note:** all network commands require a Sequence platform account with the
30
30
  > appropriate permissions. Without one, only the offline commands
31
- > (`init` without `--template`, `lint`, `simulate`, `build`, `bundle inspect`, `agents init`,
31
+ > (`init` without `--template` or `--repo`, `lint`, `simulate`, `build`, `bundle inspect`, `agents init`,
32
32
  > `agents validate`, offline `agents plan`, `pipeline init`, `pipeline validate`) work.
33
33
  > Repo and function command help is also available without an account; for
34
34
  > example, `seq-studio repos create --help` and `seq-studio functions invoke --help`.
@@ -43,7 +43,10 @@ that the underlying platform HTTP routes are public contracts.
43
43
 
44
44
  ### Piped output
45
45
 
46
- Commands with `--json` write their structured result to stdout. The executable
46
+ Commands with `--json` (or `--jsonl`) write only their structured result to
47
+ stdout, so `seq-studio … --json | jq` parses: while either flag is set, every
48
+ human status, progress, or hint line goes to stderr, including lines from the
49
+ delegated ORM and Artifact Studio commands. The executable
47
50
  allows stdout and stderr to drain before normal exit, including for large
48
51
  responses and nonzero command statuses. Check the exit status before using a
49
52
  result; an interrupted process or a closed downstream pipe can still leave
@@ -68,10 +71,12 @@ equivalent and would happily install a freshly-published malicious
68
71
  version of any transitive dep. **External process repos scaffolded by
69
72
  `seq-studio process init` ship a `pnpm-workspace.yaml` with the same
70
73
  guard.** Stick with pnpm so the policy actually applies.
71
- (The seq-studio publish chain — `agent-spec`, `atlas-ui`, `lattice-form-renderer`,
72
- `artifact-studio`, `lattice`, `studio-cli` — is excluded from the quarantine;
73
- those come from the Studio repo's own publish pipeline, so new `seq-studio`
74
- releases install immediately.)
74
+ The scaffold's first-party quarantine exemptions are `agent-spec`,
75
+ `artifact-studio`, `atlas-ui`, `custom-roles-manifest`, `lattice`,
76
+ `lattice-form-renderer`, `managed-functions`, `orm`, `pipeline-spec`, `platform`,
77
+ `storage`, and `studio-cli`, all under `@sequenceholdings/`. These packages come
78
+ from the Studio repo's own publish pipelines, so new `seq-studio` releases
79
+ install immediately. Third-party dependencies retain the seven-day quarantine.
75
80
 
76
81
  All initializers include a short `AGENTS.md` pointing to the target environment's
77
82
  live `/docs` and `/docs/llms.txt`, plus a `CLAUDE.md` importing it. Use these paths
@@ -165,15 +170,22 @@ git config --global credential."$SEQ_STUDIO_BASE_URL".useHttpPath true
165
170
  Repository sources for `--repo` builds are materialized through the JSON API,
166
171
  like other headless callers; public `--git-url` sources are refused.
167
172
 
173
+ The sandbox is temporary: Atlas resets it after inactivity and its files can be
174
+ lost. Keep real work in a git-service repository and push often. Scaffold
175
+ straight into one with `--repo <ns>/<name>` on any init command (see
176
+ [Scaffold into a repository](#scaffold-into-a-repository---repo)). After every
177
+ command, `seq-studio` prints one line to stderr when the current directory's
178
+ checkout has uncommitted changes or commits that are not pushed. The check is
179
+ skipped outside sandbox token mode, never changes the exit code or stdout, and
180
+ gives up silently on any Git error.
181
+
168
182
  Artifact Studio apps deploy from a Git Service repository. The sandbox has no
169
183
  package registry, so nothing is installed or built from a local directory:
170
184
 
171
185
  ```bash
172
- seq-studio repos create acme/portal
173
- seq-studio repos clone acme/portal # clones into ./portal
174
- cd portal
175
- seq-studio artifact init . # keep dependencies and optionalDependencies empty
176
- git add -A && git commit -m "Portal" && git push
186
+ seq-studio artifact init portal --repo acme/portal # creates acme/portal if missing, clones it into ./portal
187
+ # keep package.json dependencies and optionalDependencies empty
188
+ git -C portal add -A && git -C portal commit -m "Portal" && git -C portal push -u origin HEAD
177
189
  seq-studio artifact deploy --repo acme/portal
178
190
  ```
179
191
 
@@ -245,7 +257,7 @@ locations, dependencies, and deployment selection.
245
257
 
246
258
  | Command | What it does |
247
259
  |---------|--------------|
248
- | `seq-studio init <dir> [--with <kinds>] [--skip-install]` | Scaffold a version 3 app, root pnpm workspace, shared package, README, and selected primitives; by default creates ORM, function, process, and artifact primitives, installs dependencies, and authors the first ORM migration |
260
+ | `seq-studio init <dir> [--with <kinds>] [--skip-install] [--repo <ns>/<name>]` | Scaffold a version 3 app, root pnpm workspace, shared package, README, and selected primitives; by default creates ORM, function, process, and artifact primitives, installs dependencies, and authors the first ORM migration |
249
261
  | `seq-studio add <kind> <name> [--depends-on <ids>] [--template <t>]` | Add any primitive, including additional ORM namespaces and UIs |
250
262
  | `seq-studio add package <name>` | Add a shared TypeScript package to the manifest and pnpm workspace |
251
263
  | `seq-studio validate [--dir <path>] [--json]` | Offline check of the app manifest, dependency graph, contained primitive directories, and resolved member refs |
@@ -320,9 +332,11 @@ packages, preserves the seven-day dependency age gate, and explicitly controls
320
332
  build scripts. Generated nested install configuration is consolidated at the
321
333
  root. CI should use `pnpm install --frozen-lockfile`.
322
334
 
323
- Every new app includes `packages/shared`, named `@<app-id>/shared`. Artifacts and
324
- processes receive ordinary `workspace:*` dependencies; functions do not, because
325
- their deployed bundles cannot resolve workspace links. Export common types,
335
+ Every new app includes `packages/shared`, named `@<app-id>/shared`. Processes
336
+ receive ordinary `workspace:*` dependencies. Functions and artifacts do not:
337
+ a function's deployed bundle cannot resolve workspace links, and an artifact
338
+ deployed on its own (`seq-studio artifact deploy --repo`) builds from its
339
+ directory alone. Add the link to an artifact or function that imports it. Export common types,
326
340
  validation, and helpers from `src/index.ts`. Additional packages are registered
327
341
  with `seq-studio add package <name>`; add them to consumers with:
328
342
 
@@ -653,12 +667,12 @@ bundle; it never implicitly deletes agents.
653
667
 
654
668
  | Command | What it does |
655
669
  |---------|--------------|
656
- | `seq-studio agents init <dir>` | Scaffold a standalone typed agent repository |
670
+ | `seq-studio agents init <dir> [--repo <ns>/<name>]` | Scaffold a standalone typed agent repository on the recommended model (`RECOMMENDED_AGENT_MODEL` from `@sequenceholdings/agent-spec`); `--repo` scaffolds into a git-service repo ([Scaffold into a repository](#scaffold-into-a-repository---repo)) |
657
671
  | `seq-studio agents validate [--dir <dir>] [--target <APP_ENV>] [--only <id1,id2>]` | Compile and validate locally, without API access |
658
672
  | `seq-studio agents bundle --out <file> [--dir <dir>] [--target <APP_ENV>] [--only <id1,id2>]` | Write the config deploy body, `{ definitions, bundleHash }`, offline; repository CI's agent build |
659
673
  | `seq-studio agents plan [--dir <dir>] [--only <id1,id2>]` | Offline compile/hash plan |
660
- | `seq-studio agents plan [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--managed]` | Diff creates, updates, and unchanged definitions against an environment |
661
- | `seq-studio agents apply [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--yes] [--managed]` | Deploy agent configuration after showing the plan |
674
+ | `seq-studio agents plan [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--managed] [--check-execution]` | Diff creates, updates, and unchanged definitions against an environment |
675
+ | `seq-studio agents apply [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--yes] [--managed] [--check-execution]` | Deploy agent configuration after showing the plan |
662
676
  | `seq-studio agents list -e <env>` | List visible runtime agents |
663
677
  | `seq-studio agents show <id> -e <env>` | Show one runtime agent |
664
678
 
@@ -686,6 +700,44 @@ A merge deploys an agent the same way, as the person who merged, when its
686
700
  `--managed` selects the Sequence-staff path for Sequence's own code-managed
687
701
  agents, whose definitions own their access as well.
688
702
 
703
+ Studio CLI 0.8.0 adds `--check-execution` to CONFIG `agents plan` and `agents
704
+ apply`. Confirm matching backend support before using this release candidate:
705
+
706
+ ```bash
707
+ seq-studio agents plan --dir . -e <env> --check-execution
708
+ seq-studio agents apply --dir . -e <env> --check-execution
709
+ ```
710
+
711
+ This opt-in accepts at most **20 existing agents in one whole bundle** and
712
+ requires your actual interactive login, editor access and current invocation
713
+ rights. Create a new agent through ordinary CONFIG deployment first. Checked
714
+ plan evaluates the proposed configurations together with their current,
715
+ authorized dependencies; checked apply repeats every readiness check before
716
+ its first write. Access remains managed through the UI or API. Offline and
717
+ `--managed` use are refused, and an unavailable checked endpoint or missing
718
+ acknowledgement never falls back to an unchecked deployment or smaller chunks.
719
+
720
+ Readiness is a point-in-time eligibility check, not a reservation, an execution
721
+ identity, a new permission, or proof that a model/tool run succeeded. Apply
722
+ still uses the existing per-agent writes. Obtain the actual current execution
723
+ identity after applying, and use the ordinary admission precondition when
724
+ starting a pinned run; source and access can change after a successful check.
725
+
726
+ Where the runtime has enabled pinned private context, references in an agent's
727
+ `systemPrompt` and recursive string values of `structuredOutput.schema` can be
728
+ captured for the actual execution owner. Captures contain reference IDs, owner
729
+ IDs and fragment versions only, never decrypted values or hashes of those
730
+ values. Any edit (including label/purpose), deletion, owner mismatch or disabled
731
+ private-capture support invalidates the pin at the next checked boundary.
732
+ Private configuration anywhere in the declared closure redacts input/output
733
+ telemetry and leaves private-dependent runtime evidence explicitly incomplete.
734
+ Other private placements, mounted per-agent credentials, unsupported runtimes
735
+ and completion hooks keep their existing capture refusals. New message-private
736
+ references cannot introduce an uncaptured source; references already admitted
737
+ by the configuration use the exact captured version. Ordinary saves and
738
+ existing unpinned owner-only resolution keep their current behavior.
739
+
740
+
689
741
  An optional `deploy-manifest.json` targets definitions by deployment identity:
690
742
 
691
743
  ```json
@@ -847,13 +899,13 @@ compiled to canonical SQL before registration.
847
899
 
848
900
  | Command | What it does |
849
901
  |---------|--------------|
850
- | `seq-studio orm init <dir>` | Scaffold one v2 namespace package (`sequence.config.ts`, `schema/*.ts`, `graphql/**`, and codegen config). |
902
+ | `seq-studio orm init <dir> [--repo <ns>/<name>]` | Scaffold one v2 namespace package (`sequence.config.ts`, `schema/*.ts`, `graphql/**`, and codegen config). `--repo` scaffolds into a git-service repo ([Scaffold into a repository](#scaffold-into-a-repository---repo)). |
851
903
  | `seq-studio orm generate [dir]` | Generate `schema.graphql`, `operations.manifest.json`, `typePolicies.gen.ts`, `namespace.contract.json`, `sql-operations.gen.ts`, and consumer codegen when `codegen.ts` is present. |
852
904
  | `seq-studio orm generate [dir] --migration-export [--check]` | Export `orm.migration.json` after validating the committed ORM migration. Pipeline migration planning recompiles these declarative inputs. `--check` compares against the current source and operations without writing; use it in CI. |
853
905
  | `seq-studio orm validate [dir]` | Parse and compile the namespace, then verify its committed migration chain is current. |
854
906
  | `seq-studio orm plan [dir] -e <env>` | Compare the compiled namespace with registry state without applying database changes. |
855
907
  | `seq-studio orm diff [dir] [--check]` | Author the next committed migration, or verify the migration/snapshot chain offline for CI. |
856
- | `seq-studio orm apply [dir] -e <env>` | Author a migration if needed, register/apply the namespace, activate its operation set, publish roles/capabilities, and refresh generated outputs. |
908
+ | `seq-studio orm apply [dir] -e <env> [--timeout <duration>] [--no-wait]` | Author a migration if needed, register/apply the namespace, activate its operation set, publish its declared capabilities, and refresh generated outputs. Waits until the new version is live (prints `live:`; default up to 20m); `--no-wait` returns once queued. |
857
909
  | `seq-studio orm execute <namespace> <operation> -e <env> [--variables-file <file>] [--var <name>=<value>]...` | Execute the deployed version's persisted operation by name, as the signed-in caller. Needs no checkout. |
858
910
  | `seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>` | Execute one named persisted operation as hashed in this checkout's `operations.manifest.json`, with variables from a JSON object file, as the signed-in caller. |
859
911
  | `seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]` | List the namespaces you can read. |
@@ -864,6 +916,13 @@ compiled to canonical SQL before registration.
864
916
  | `seq-studio orm migrate-from-yaml <dir>` | Convert a legacy YAML namespace to TypeScript authoring while preserving its committed migrations. |
865
917
  | `seq-studio orm import [dir] --spec <file>` | Plan a batched copy from an existing Postgres relation (a synced warehouse table) into an owned ORM table. Writes a SQL script; it does not connect or apply row policies. |
866
918
 
919
+ For v2 schema commands (`generate`, `validate`, `plan`, `diff`, and `apply`),
920
+ `seq-studio` checks the ORM version it loads against the namespace's declared
921
+ `@sequenceholdings/orm` range in `package.json` before compiling. If they do
922
+ not match, install the namespace's dependencies and run its local CLI, or
923
+ upgrade the CLI and ORM together. A missing `package.json` has no declared
924
+ range to check; use a package manifest for versioned namespace builds.
925
+
867
926
  Run ORM commands with the CLI installed in the package that owns the
868
927
  namespace. A new namespace package lists both `@sequenceholdings/studio-cli` and
869
928
  `@sequenceholdings/orm`, so after `pnpm install` everything runs through
@@ -886,6 +945,23 @@ Global ORM commands require a CLI release that declares `drizzle-orm` directly.
886
945
  Older releases can fail during module loading because `drizzle-kit` imports
887
946
  `drizzle-orm` without declaring it. Update the global CLI if you see that error.
888
947
 
948
+ `apply` waits until the new version is live and serving, then prints a `live:`
949
+ line: every operation of the new version, by hash or by name, can run from that
950
+ point, so `apply` followed by `execute` needs no sleep. `--timeout` bounds the
951
+ wait (`90s`, `15m`, `1h`; a bare number is seconds) and `--no-wait` returns once
952
+ the apply is queued. A timed-out wait leaves the apply running on the server;
953
+ re-run the same command to keep waiting.
954
+
955
+ The scaffold's sample operations include create, get, update, and delete by
956
+ primary key, each governed by the table's write policy. Optional variables
957
+ follow GraphQL input rules: an omitted variable omits its field (the column
958
+ default applies on insert; an update leaves the column alone), and an explicit
959
+ `null` writes NULL.
960
+
961
+ A refused data-plane request prints the server's message, error code, and the
962
+ variable, column, constraint, or capability at fault (schema names only, never
963
+ values), followed by a next step.
964
+
889
965
  `apply --dry-run` rehearses a migration against a disposable branch copy of
890
966
  the target environment's data. `apply --no-create` is the CI guard that refuses
891
967
  to provision a missing namespace. Destructive DDL requires explicit
@@ -1044,8 +1120,8 @@ datasets before adopting this path for latency-sensitive reads.
1044
1120
  | Command | What it does |
1045
1121
  |---------|--------------|
1046
1122
  | `seq-studio process init <dir>` | Scaffold a process repo: `package.json`, sample `process.ts`, `tsconfig.json` |
1047
- | `seq-studio process lint [--dir <path>] [--offline]` | Static checks (graph, return contracts, agent schema, timeouts, and JSONata syntax); `--offline` skips live agent-schema lookup |
1048
- | `seq-studio process plan [--dir <path>] -e <env>` | Build bundle, diff against currently-active version |
1123
+ | `seq-studio process lint [--dir <path>] [--offline]` | Static checks (graph, return contracts, agent schema, timeouts, JSONata syntax, and human `input` projections); `--offline` skips live agent-schema lookup |
1124
+ | `seq-studio process plan [--dir <path>] -e <env>` | Build bundle, run the same lint `apply` enforces (CLI **0.9.1**+), diff against currently-active version |
1049
1125
  | `seq-studio process apply [--dir <path>] -e <env> [--only <id1,id2>]` | Build → register bundle → promote each process. `--only` promotes just the named process ids (the bundle still contains the whole root — registration is inert) |
1050
1126
  | `seq-studio process apply --repo <namespace>/<name> [--ref <r>] -e <env> [--only <id1,id2>]` | Same as above, but materializes the source from a platform git-service repo in `processes`, `apps`, or your own namespace. Pinned commit SHA is injected as bundle provenance. Uses your `seq-studio login` (or the target realm's M2M JSON source path for CI) |
1051
1127
  | `seq-studio process test [--dir <path>] -e <env> [--offline]` | CI wrapper: lint + plan, non-zero exit on errors or BREAKING diffs; see the offline limitation below |
@@ -1055,9 +1131,10 @@ datasets before adopting this path for latency-sensitive reads.
1055
1131
  | `seq-studio process bundle inspect <bundle.json>` | Show a saved bundle's summary |
1056
1132
  | `seq-studio process bundle list [-e <env>] [--limit N] [--cursor <hash>]` | List registered bundles (paginated; CLI auto-fetches all pages) |
1057
1133
  | `seq-studio process bundle publish <hash or bundle.json> [-e <env>]` | Register a local bundle (no promote) |
1058
- | `seq-studio process runs start <process-id> -e <env> [--version <v>] [--run-id <id>] [--metadata-file <file>]` | Start a run as you (needs `invoker` on the process) |
1134
+ | `seq-studio process runs start <process-id> -e <env> [--version <v>] [--run-id <id>] [--metadata-file <file>]` | Start a run as you (needs `invoker` on the process); prints the new run id |
1135
+ | `seq-studio process runs retry <run-id> -e <env> [--run-id <new-id>]` | Start a failed, cancelled, or timed-out run again with the same inputs, linked to the original (needs `invoker` on the process; CLI **0.9.0**+) |
1059
1136
  | `seq-studio process runs list -e <env> [--process <id>] [--status <s>] [--limit N]` | List runs you can view, newest first |
1060
- | `seq-studio process runs show <run-id> -e <env> [--wait]` | Show a run's status and steps; `--wait` polls until it finishes |
1137
+ | `seq-studio process runs show <run-id> -e <env> [--wait] [--steps [--node <id>] [--full]]` | Show a run's status, error, and steps; `--wait` polls until it finishes; `--steps` (CLI **0.9.1**+) adds each step's edge, error, input, and output |
1061
1138
  | `seq-studio process runs cancel <run-id> -e <env>` | Cancel a run (needs `invoker` on the process) |
1062
1139
 
1063
1140
  Use `lint --offline` for checks without live registry lookups. `test --offline`
@@ -1068,23 +1145,57 @@ subprocess versions when needed. It is not a guarantee of network-free execution
1068
1145
  ### Runs
1069
1146
 
1070
1147
  ```bash
1071
- seq-studio process runs start credit-memo -e <env> \
1072
- --run-id memo-loan-1042 --metadata-file run.json --json
1073
- seq-studio process runs show memo-loan-1042 -e <env> --wait --json
1148
+ seq-studio process runs start credit-memo -e <env> --metadata-file run.json
1149
+ # prints: Run: <run-id> | Process: credit-memo@3 | Status: pending
1150
+ seq-studio process runs show <run-id> -e <env> --wait --json
1151
+ seq-studio process runs show <run-id> -e <env> --steps # each step's edge, error, input, output
1152
+ seq-studio process runs retry <run-id> -e <env> # after it failed
1074
1153
  seq-studio process runs list -e <env> --process credit-memo --status failed --limit 20
1075
1154
  ```
1076
1155
 
1156
+ `start` prints the new run's id. Without `--run-id`, every `start` gets a fresh
1157
+ id, so leave it off unless you need idempotency. `--run-id` names exactly one
1158
+ run: repeating it for the same process returns that run whatever its status
1159
+ (`idempotent_replay: true`, with `existing_status`) and never starts another,
1160
+ and reusing it for a different process is refused. Use it when a caller might
1161
+ send the same start twice, such as `--run-id memo-loan-1042` for one loan.
1162
+
1163
+ `retry` (CLI **0.9.0** or later, which may not be published yet) runs a
1164
+ `failed`, `cancelled`, or `timed_out` run again: a new run of the same process
1165
+ version, from the start node, with the original's metadata, entity, and title.
1166
+ The original is unchanged, and the new run is linked to it in the run's lineage
1167
+ (a `replay`, shown in the Lattice run view). Atlas refuses other statuses
1168
+ (`RUN_NOT_RETRYABLE`). A retry is a new start: it needs the same `invoker`
1169
+ grant on the process as starting it, plus permission to view the original run,
1170
+ and while the process is at its concurrent-run limit it waits queued
1171
+ (`outcome: queued`) exactly as a start does. `--run-id` on `retry`
1172
+ names the new run, so repeating that retry returns it instead of starting a
1173
+ third. To change the inputs or run a newer version, use `start`.
1174
+
1077
1175
  `--version` pins a published version; without it the active version runs.
1078
- `--run-id` makes `start` idempotent: repeating it for the same process returns
1079
- the existing run (`idempotent_replay: true`) rather than starting another, and
1080
- reusing it for a different process is refused. `--metadata-file` must hold a
1081
- JSON object. `list` filters by `--process`, `--status` (`pending`, `running`,
1176
+ `--metadata-file` must hold a JSON object. `list` filters by `--process`, `--status` (`pending`, `running`,
1082
1177
  `completed`, `failed`, `cancelled`, `timed_out`), `--entity-type`/`--entity-id`,
1083
1178
  and `--archived`; it returns the newest runs up to `--limit` (default 50,
1084
1179
  maximum 500). The run API has no cursor, so narrow the filters to reach older
1085
1180
  runs. `show --wait` stops waiting after `--timeout` seconds (default 600); the
1086
1181
  run itself continues. `--json` prints the API response on every command.
1087
1182
 
1183
+ `show` prints the run's `error` when it failed. `show --steps` (CLI **0.9.1**
1184
+ or later) prints each step's status, edge taken, error, input, and output, read
1185
+ from the same run response and permission (`viewer` on the run) as `show`.
1186
+ Inputs, outputs, and errors longer than 2,000 characters are cut to a preview
1187
+ that says their full length; `--full` prints them whole, and `--node <id>`
1188
+ narrows to one node. `--steps --json` returns `{ run, steps }` with the same
1189
+ bounds: a cut field holds its first 2,000 characters as a string, and the step's
1190
+ (or run's) `truncated` map names it with its full length, for example
1191
+ `"truncated": { "output": { "chars": 5012 } }`.
1192
+ A node whose input mapper fails never starts a step, so that failure shows only
1193
+ as the run's error.
1194
+
1195
+ ```bash
1196
+ seq-studio process runs show <run-id> -e <env> --steps --node review --full --json
1197
+ ```
1198
+
1088
1199
  ### JSONata mapper contracts
1089
1200
 
1090
1201
  `jsonata('…')` expressions are serialized as `*_expr` data and run in a
@@ -1094,7 +1205,7 @@ and returns an ISO-8601 string.
1094
1205
 
1095
1206
  | Mapper slot | `$` input | Named bindings | Expected result |
1096
1207
  |-------------|-----------|----------------|-----------------|
1097
- | `input` / human context projection | Context snapshot | — | Runner input; human projections return a context snapshot |
1208
+ | `input` / human context projection | Context snapshot | — | Runner input; human projections return `{ entity, run, upstream }` |
1098
1209
  | `artifact_refs` | Context snapshot | — | Artifact-reference array |
1099
1210
  | `dueDate` | Context snapshot | — | ISO date, epoch milliseconds, or `null` |
1100
1211
  | `emailNotification` template/reminder | Context snapshot | `$info` | `{ subject, body }` |
@@ -1176,7 +1287,7 @@ functions cannot opt in retroactively. The default remains mutable. See the
1176
1287
 
1177
1288
  | Command | What it does |
1178
1289
  |---------|--------------|
1179
- | `seq-studio functions init <dir>` | Scaffold one standalone TypeScript managed function |
1290
+ | `seq-studio functions init <dir> [--repo <ns>/<name>]` | Scaffold one standalone TypeScript managed function; `--repo` scaffolds into a git-service repo ([Scaffold into a repository](#scaffold-into-a-repository---repo)) |
1180
1291
  | `seq-studio functions dev [--dir <dir>] [--port <port>]` | Run a local HTTP server with Managed Function cache context |
1181
1292
  | `seq-studio functions build [--dir <dir>]` | Validate a local manifest, bundle, lockfile, and size |
1182
1293
  | `seq-studio functions register [--dir <dir>] -e <env>` | Register an undeployed shell and its initial secret names/mappings without uploading or activating code |
@@ -1191,6 +1302,17 @@ functions cannot opt in retroactively. The default remains mutable. See the
1191
1302
  that function. Versions named by repository CI, such as `ci-abc`, do not reset
1192
1303
  the sequence. A function with no numbered versions starts at `v1`.
1193
1304
 
1305
+ For a local `--dir` deployment, the preview's `(repository dirty)` label and
1306
+ recorded `gitDirty` check the entire containing Git checkout: tracked changes
1307
+ and unignored files outside the function directory count too. This differs from
1308
+ local Artifact Studio active deploys, which check only the artifact source
1309
+ directory. A CLI-created `.artifact-studio/config.json` outside the function
1310
+ can therefore mark an unchanged function dirty. Run `git status --short` at
1311
+ the repository root before deploying. If that config is only local setup, add
1312
+ `.artifact-studio/` to the checkout's `.git/info/exclude` or a reviewed
1313
+ `.gitignore`; keep function source edits visible. Remote `--repo` and
1314
+ `--git-url` deploys record a pinned commit with `gitDirty=false`.
1315
+
1194
1316
  After an upload is accepted, `functions show --fn <slug> -e <env> --json` returns
1195
1317
  the server's `activeVersionId`, `immutableRelease`, exact active version, and
1196
1318
  version history with status, Git revision and dirty bit, and source digest.
@@ -1263,11 +1385,28 @@ seq-studio functions deploy --repo managed-functions/encompass \
1263
1385
  --path functions/get-loan -e staging
1264
1386
  ```
1265
1387
 
1266
- Each selected directory is a self-contained function package. Functions in the
1388
+ Each selected directory is a function package. Functions in the
1267
1389
  same repo share Git review and commit provenance, but keep separate manifests,
1268
1390
  versions, runtime resources, secrets, and permissions. `--path` accepts only a
1269
1391
  canonical relative directory inside a remote repo; use `--dir` for local source.
1270
1392
 
1393
+ When the selected package uses `workspace:` dependencies, build/deploy discovers
1394
+ the containing `sequence.app.yml` within that repository and uses its declared
1395
+ `packages` to compile the selected function's dependency closure. The manifest
1396
+ must declare the selected function. This does **not** deploy sibling primitives,
1397
+ deployment prerequisites, or register/update the Application bundle. Standalone
1398
+ packages without workspace dependencies retain their existing build behavior.
1399
+
1400
+ Shared Node packages may set `"seqStudio": { "source": "src/index.ts" }` in
1401
+ `package.json` to use a root source entry instead of a missing or stale `dist`
1402
+ export on a clean clone. Browser and subpath exports keep their normal resolution.
1403
+ No package build scripts are executed. Compiled bundles retain the original Git
1404
+ provenance, registry dependencies and projected lockfile validation; workspace
1405
+ source paths must stay inside the declared package roots. Local `.env` and
1406
+ relative `--from-env-file` paths still resolve from the original selected function,
1407
+ never the temporary compilation directory. Remote committed `.env` files are
1408
+ never used, and dotenv files are not copied into the compiled staging directory.
1409
+
1271
1410
  ### Scoped group-member directory reads
1272
1411
 
1273
1412
  A function may opt in to resolving selected members of existing Atlas groups:
@@ -1519,9 +1658,20 @@ reads its author. Do not substitute a physical directory table name. This is
1519
1658
  an explicit read scope only; namespace access, operation requirements and row
1520
1659
  policies still apply. Ordinary namespace table names remain lowercase identifiers.
1521
1660
 
1522
- A function that reaches a namespace must attach a top-level `service_account`
1523
- provided by its administrator. Caller-mode execution remains on behalf of the
1524
- invoking user; attaching the account does not select service mode.
1661
+ A function that reads or writes a namespace on behalf of its caller needs no
1662
+ service account. To also act as the function itself (service mode:
1663
+ `createFunctionServiceOrmExecutor`, Lattice runs), name a top-level
1664
+ `service_account` you hold the actor role on. With a `service_account` named, the account acts in every declared namespace,
1665
+ unless you mark specific namespaces with `service: true` (which requires an
1666
+ account): then only those. The account's token and namespace floor cover only
1667
+ those service-mode namespaces.
1668
+ Capabilities the function exercises as itself, such as storage, process,
1669
+ agent, workflow and monitoring access, always need one. A deploy that
1670
+ needs an account and names none is refused with the capabilities that need it,
1671
+ whether you can create one (`seq-studio service-accounts create <slug> --display-name "<name>"` (needs Can create on Service Accounts)), and the accounts you can
1672
+ already attach. Caller-mode execution (`createFunctionOrmExecutor`) remains on
1673
+ behalf of the invoking user; code chooses service mode explicitly with
1674
+ `createFunctionServiceOrmExecutor`.
1525
1675
 
1526
1676
  A successful direct `seq-studio orm execute` call does not test a function's
1527
1677
  delegated scope. If the same read fails through the function with a 403, check
@@ -1602,11 +1752,12 @@ successfully. Help does not initialize files, authenticate, or deploy.
1602
1752
 
1603
1753
  | Command | Underlying `runCli` verb |
1604
1754
  |---------|--------------------------|
1605
- | `seq-studio artifact init <dir> [--template react-vite\|nextjs]` | `init <dir>` — defaults to the existing React/Vite scaffold |
1755
+ | `seq-studio artifact init <dir> [--template react-vite\|nextjs] [--repo <ns>/<name>]` | `init <dir>` — defaults to the existing React/Vite scaffold; `--repo` first prepares a git-service checkout ([Scaffold into a repository](#scaffold-into-a-repository---repo)) |
1606
1756
  | `seq-studio artifact link [dir] -e <env> [--project <id>]` | `link [dir] --env <env>` |
1607
1757
  | `seq-studio artifact build [dir] [-e <env>]` | React/HTML: local bundle. Next.js: asynchronous hosted preview build on Atlas; use `pnpm build` for local compilation. |
1608
1758
  | `seq-studio artifact plan [dir] -e <env>` | `plan [dir] --env <env>` |
1609
1759
  | `seq-studio artifact deploy [dir] -e <env> [--skip-unchanged] [--no-create] [--project <id>]` | `deploy [dir] --env <env>` — `--skip-unchanged` no-ops (before building) when the remote active deployment's `sourceHash` **and** CLI/atlas-ui peer versions already match; `--no-create` errors instead of creating a missing project; `--project <id>` targets a project directly when duplicate slugs make the lookup ambiguous (slug must still match the manifest) |
1760
+ | `seq-studio artifact deploy --repo <ns>/<name> --ref <branch> --preview [--key <key>] -e <env>` | Builds any branch, tag, or commit as a preview and prints its link; see "Previews" below. Works for React/HTML and Next.js (`--key` is React/HTML only), and from an agent sandbox |
1610
1761
  | `seq-studio artifact dev [dir] -e <env> [--link <pkgDir>[,<pkgDir>]] [--port <port>]` | React/HTML: rebuild preview on changes. Next.js: local development server and owner-only Atlas tunnel; `--port` selects its loopback port. |
1611
1762
  | `seq-studio artifact pull <project-id> -e <env> [--out <dir>]` | `pull <project-id> --env <env> [--out <dir>]` |
1612
1763
  | `seq-studio artifact list -e <env> [--json]` | `list --env <env>` — projects visible on the environment (slug, id, active version, visibility); `--json` emits the response object |
@@ -1638,7 +1789,28 @@ targeting `local` may use any branch, including dirty working trees. Feature
1638
1789
  branches, dirty artifact source trees, non-git sources, and detached checkouts
1639
1790
  that cannot be attributed to an allowed branch are preview-only for deployed environments
1640
1791
  (`seq-studio artifact dev` / preview channel); promotion applies the same
1641
- provenance check.
1792
+ provenance check. Atlas decides whether the target is a staging environment
1793
+ from its own configuration, not from the name you pass to `-e`, so a
1794
+ `staging`-branch deploy works under any environment name, including an agent
1795
+ sandbox's `sandbox`.
1796
+
1797
+ ### Previews
1798
+
1799
+ A preview is a private test copy of your app. It runs the code from a branch
1800
+ inside Atlas, under its own link, for people who can edit the project. The live
1801
+ app and its users see nothing. Use one to try a branch before you merge it:
1802
+
1803
+ ```bash
1804
+ seq-studio artifact deploy --repo <namespace>/<repository> --ref <branch> --preview -e <env>
1805
+ ```
1806
+
1807
+ The command prints the preview link. For a React/HTML app, each `--key` keeps
1808
+ one preview; by default the key is the branch name, so every branch keeps its
1809
+ own and a later deploy of that branch replaces it. Each Next.js preview is its
1810
+ own immutable build with its own link, so `--key` does not apply to it. A preview can't be promoted to the live app. To go
1811
+ live, merge the branch and deploy `main` (or `staging` on a staging
1812
+ deployment). An official deploy of any other branch is refused with the
1813
+ `--preview` command to run instead.
1642
1814
 
1643
1815
  **React/HTML CLI atlas-ui stamp (DES-254):** builds force-alias `@sequenceholdings/atlas-ui`
1644
1816
  to the CLI's copy — not the artifact's declared semver. Deployments record
@@ -1931,6 +2103,74 @@ a human identity or extend a human login's expiry.
1931
2103
  Add `--help` to a repo command to read its usage offline, without an
1932
2104
  environment or credentials.
1933
2105
 
2106
+ ### Scaffold into a repository (`--repo`)
2107
+
2108
+ Source you build belongs in a platform git-service repository, not only on one
2109
+ machine. Every init command takes `--repo <namespace>/<name>` to start there:
2110
+ `seq-studio init`, `orm init`, `functions init`, `artifact init`, and
2111
+ `agents init`.
2112
+
2113
+ ```bash
2114
+ seq-studio functions init get-loan --repo lending/get-loan -e <env>
2115
+ git -C get-loan add -A && git -C get-loan commit -m 'Scaffold get-loan' && git -C get-loan push -u origin HEAD
2116
+ ```
2117
+
2118
+ - The repository is created when it does not exist, with the same name rules
2119
+ and permission (namespace write) as `repos create`; an existing one is reused.
2120
+ - When `<dir>` is not inside a Git checkout, the repository is cloned into it
2121
+ (it must be new or empty) and the scaffold lands in the clone, next to the
2122
+ starter README and `.seq/identity.json`.
2123
+ - When `<dir>` is inside a Git checkout, the repository becomes that checkout's
2124
+ `origin` (created empty, so your history can be pushed into it). A checkout
2125
+ whose `origin` already points elsewhere is refused before anything is created.
2126
+ For a newly created repository, install its identity receipt with
2127
+ `seq-studio repos identity <ns>/<name> -e <env> --write --dir <root>`.
2128
+ - `seq-studio init --template <name>@<version> --repo …` fills the fresh clone:
2129
+ the template's README replaces the seed README, and the clone keeps its own
2130
+ `.seq/identity.json` (the receipt for this repository, not the template's).
2131
+ A checkout with any other content is refused.
2132
+ - Nothing is committed or pushed. The command prints the exact `git add`,
2133
+ `git commit`, and `git push` to run; pushes use the same credential helper as
2134
+ `repos clone`.
2135
+ - It needs `-e <env>` and a user login, or an agent sandbox.
2136
+
2137
+ #### Repository CI inventory for standalone primitives
2138
+
2139
+ Repository CI checks and deploys only what `.seq/repository.yml` (or a root
2140
+ `sequence.app.yml`) declares, and fails `undeclared-manifest` on any other
2141
+ `artifact.bundle.yml`, `managed-function.yml`, or `sequence.config.ts`. So in a
2142
+ git-service checkout (its `origin` is a git-service clone URL, or it already has
2143
+ `.seq/repository.yml`), `orm init`, `functions init`, and `artifact init` add
2144
+ the scaffold under `resources`, with or without `--repo`:
2145
+
2146
+ ```yaml
2147
+ # Repository CI checks every application and resource listed here and deploys it when changes merge to main.
2148
+ schema_version: 1
2149
+ resources:
2150
+ - id: maint-orm
2151
+ kind: orm
2152
+ path: orm/maint
2153
+ namespace: maint
2154
+ - id: notify
2155
+ kind: function
2156
+ path: functions/notify
2157
+ slug: notify
2158
+ - id: app-ui
2159
+ kind: artifact
2160
+ path: app
2161
+ project_id: app
2162
+ ```
2163
+
2164
+ The identity comes from the scaffold itself (`sequence.config.ts` namespace,
2165
+ `managed-function.yml` `function.id`, `artifact.bundle.yml`
2166
+ `artifact.project_id`), and existing comments and entries are kept. A scaffold
2167
+ inside a declared application is left out, with a note to add it to that app
2168
+ with `seq-studio add`; a path that overlaps a declared resource or an `ignore`
2169
+ entry, or that would deploy the same namespace, function, or project id as a
2170
+ declared resource (CI rejects duplicate identities), is left out with the
2171
+ reason on stderr. Other repositories are not touched.
2172
+ Commit `.seq/repository.yml` with the scaffold.
2173
+
1934
2174
  ### Repository identity
1935
2175
 
1936
2176
  New repositories created on identity-capable Atlas releases contain a committed
@@ -2043,7 +2283,7 @@ JSON API — the same repos `--repo <ns>/<name>` sources build from.
2043
2283
  | `seq-studio repos namespaces [create <slug>] -e <env>` | list namespaces, or create one (creator becomes owner) |
2044
2284
  | `seq-studio repos show <ns>/<name> -e <env>` | detail: id, branches, clone URL; artifact project id when slug matches |
2045
2285
  | `seq-studio repos identity <ns>/<name> -e <env> [--write --dir .]` | inspect the server-issued identity; `--write` restores its receipt at the matching clone's Git worktree root; admin-only `--adopt --write --yes` binds a legacy repository once |
2046
- | `seq-studio repos create <ns>/<name> -e <env> [--default-branch <b>] [--git-backend walgit]` | create a repo, seeded with a README on `main`. The server picks the backend (walgit wherever it is configured). `--git-backend walgit` creates it empty, for pushing existing history. Needs namespace write. |
2286
+ | `seq-studio repos create <ns>/<name> -e <env> [--default-branch <b>] [--git-backend walgit]` | create a repo, seeded with a README on `main`. The server picks the backend (walgit wherever it is configured). `--git-backend walgit` creates it empty, for pushing existing history. Needs namespace write. Returns once the repo resolves by name (the lookup `clone`, `show`, and `pull` use), so `repos clone` can follow at once. |
2047
2287
  | `seq-studio repos clone <ns>/<name> \| --url <clone-url> \| --id <uuid> -e <env> [--ref <r>] [--output <dir>] [--force] [--full] [--transport auto\|git\|json]` | smart-HTTP `git clone --depth 1` using login (`--full` fetches history; a commit SHA stays full). Configures login for subsequent Git commands. Use files-only `--transport json` for `<ns>/<name>`. `--out` remains an alias for `--output`. |
2048
2288
  | `seq-studio repos pull <ns>/<name> -e <env> [--ref <r>] [--out <dir>] [--force]` | always materialize via JSON API (no `.git` dir); refuses a non-empty destination unless `--force` |
2049
2289
  | `seq-studio repos delete <ns>/<name> -e <env> [--yes]` | delete a repo — interactive confirm unless `--yes` |
@@ -2189,6 +2429,23 @@ relative to the package root. Validation, planning, deployment, migrations,
2189
2429
  and ORM repinning share the same loader. `pipeline init` scaffolds into the
2190
2430
  first listed stage directory; without config it keeps using the package root.
2191
2431
 
2432
+ To package a pipeline from a larger application repository without changing its
2433
+ release identity, add `source_paths: [src, lookup-data, requirements.txt]` to
2434
+ `pipeline.config.yml`. Entries are literal package-relative files or complete
2435
+ directories, not globs. Include all runtime imports, data and dependency files.
2436
+ Configured stages and pipeline metadata (schemas, documentation, migrations,
2437
+ workflow, external assets, ORM contracts and extra resources) are always retained.
2438
+ Validation rejects missing declared entrypoints/decoders and extra-job local
2439
+ files. Omit `source_paths` to retain full-root capture. This requires a server and
2440
+ SDK release with source-package support; older releases reject the field.
2441
+
2442
+ Run `seq-studio pipeline validate .` in the standalone checkout, review and
2443
+ commit the config and source together, then use the usual `pipeline plan --repo
2444
+ <namespace>/<slug> --ref <sha> --source-env <source-env> -e <target-env>`. Selection
2445
+ is resolved from that pinned commit before snapshot size checks; the existing
2446
+ limits and repository authorization still apply. It does not change the repo,
2447
+ root, stage identities, deployment admission or rollback provenance.
2448
+
2192
2449
  | Command | What it does |
2193
2450
  |---------|--------------|
2194
2451
  | `seq-studio pipeline list -e <env> [--limit <count>] [--offset <count>] [--json]` | List available pipelines and their source repositories; default 50 results, maximum 200, with the next offset shown when more exist |
@@ -2640,7 +2897,7 @@ retires stages removed from the repo. This operation does not retain or restore
2640
2897
  the deleted Databricks object; verify backups and cutover readiness before
2641
2898
  authorizing a DLT pipeline deletion because its managed tables can be dropped.
2642
2899
 
2643
- The `{env}-MP-…` scheme itself is a one-shot break from the unprefixed names (`silverlake-core`, `pipelines-<domain>-<env>`). We do not migrate DAB bundle state or DLT resource identity: the first deploy after this change creates a new bundle and new jobs/pipelines, and can cascade-drop DLT-managed tables on the deleted resource. Operators should pause or delete leftover unprefixed jobs once the new ones are healthy. Each enabled OpCo deployment advertises and owns its own target profile.
2900
+ The `{env}-MP-…` scheme itself is a one-shot break from the earlier unprefixed names (`pipelines-<domain>-<env>`). We do not migrate DAB bundle state or DLT resource identity: the first deploy after this change creates a new bundle and new jobs/pipelines, and can cascade-drop DLT-managed tables on the deleted resource. Operators should pause or delete leftover unprefixed jobs once the new ones are healthy. Each enabled OpCo deployment advertises and owns its own target profile.
2644
2901
 
2645
2902
  `validate` is offline — no network or database. `--assets` supplies a
2646
2903
  registry **asset export** (JSON) so inputs referencing other Pipelines'
@@ -2797,22 +3054,112 @@ require an explicit environment; help is offline, including `doctor --help`.
2797
3054
 
2798
3055
  ### Runtime access
2799
3056
 
3057
+ `seq-studio access` manages grants on every Atlas primitive with the same verbs.
3058
+ Atlas applies the rules the Permissions UI uses; the CLI adds no authority.
3059
+
2800
3060
  ```bash
2801
- seq-studio access definitions orm <namespace> -e <env>
3061
+ seq-studio principals search "maintenance" -e <env> # find grant-ready ids
3062
+ seq-studio access definitions process <process-id> -e <env>
3063
+ seq-studio access list process <process-id> --floor -e <env>
3064
+ seq-studio access grant process <process-id> --floor --principal-type service-account --principal-id <account-id> -e <env>
3065
+ seq-studio access grant orm <namespace> --key <role> --principal-type group --principal-id <group-id> -e <env>
3066
+ seq-studio access revoke orm <namespace> --key <role> --principal-type group --principal-id <group-id> -e <env>
2802
3067
  seq-studio access resolve orm <namespace> -e <env>
2803
- seq-studio access list orm <namespace> --floor -e <env>
2804
- seq-studio access grant orm <namespace> --floor --principal-type user --principal-id <subject> -e <env>
2805
- seq-studio access grant orm <namespace> --key <role> --principal-type user --principal-id <subject> -e <env>
2806
- seq-studio access revoke orm <namespace> --key <role> --principal-type user --principal-id <subject> -e <env>
2807
3068
  ```
2808
3069
 
2809
- Resource types are `artifact`, `function`, and `orm`; their IDs are project UUID,
2810
- Function UUID, and namespace name respectively. The runtime floor means `end_user`
2811
- for Artifact/ORM and `invoker` for Function. `list` defaults to direct role/capability
2812
- grants; `resolve` evaluates only the signed-in caller. Grant/revoke require existing
2813
- grant-management authority. Roles and pins do not assign users; `capabilities.uses`
2814
- must declare every capability consumed. Fresh previews do not register new role keys;
2815
- activate a release before granting them. Authoring/collaborator permissions remain separate.
3070
+ | Type | Resource ID | `--floor` | `--key` |
3071
+ | --- | --- | --- | --- |
3072
+ | `artifact` | project UUID | `end_user` | declared roles/capabilities |
3073
+ | `function` | Function UUID | `invoker` | declared roles/capabilities |
3074
+ | `orm` | namespace name | `end_user` | declared roles/capabilities |
3075
+ | `application` | Application id | none | Application roles; `--kind runtime\|collaborator` |
3076
+ | `process` | Lattice process id | `invoker` | `owner`, `editor`, `invoker`, `viewer` |
3077
+ | `agent` | Agent Builder agent id | `invoker` | `owner`, `editor`, `invoker`, `outputs_viewer` |
3078
+ | `pipeline` | release unit `<namespace>/<name>` | none | `admin`, `editor`, `operator`, `viewer` |
3079
+ | `service-account` | account id | none | `admin`, `actor` |
3080
+ | `secret` | secret UUID | `user` | `user`, `editor`, `admin` |
3081
+ | `repo` | `<namespace>/<name>` or repo id | none | `reader`, `writer`, `merger`, `admin` |
3082
+ | `namespace` | git namespace slug | none | `reader`, `writer`, `merger`, `admin` |
3083
+ | `workspace` | Workspaces V2 workspace id | none | `viewer`, `editor`, `admin` |
3084
+
3085
+ Principal types are `user` (authenticated subject), `group` (directory group id),
3086
+ `organization` (tenant slug), and `service-account` (`<account-id>` or
3087
+ `service-account|<account-id>`); never an email or display name. `definitions`
3088
+ lists a type's floor and tiers (declared roles for artifact/function/orm/application).
3089
+ `list` shows direct grants; `--floor`/`--key` narrow it. `resolve` evaluates only the
3090
+ signed-in caller and exists for the declared-capability types.
3091
+
3092
+ On every type except artifact, function, orm, and application, a principal holds
3093
+ one tier. `grant` is a no-op when it already holds that tier and refuses to change a
3094
+ different one unless you pass `--replace`; `revoke` removes only the named tier.
3095
+ Grants require grant-management authority on the resource (process editors manage
3096
+ Editor/Viewer, process owners every role). Service accounts additionally need you to
3097
+ hold `actor` on the account, and take only runtime tiers (`invoker`/`viewer` on a
3098
+ process, `invoker` on an agent). You can grant only groups you belong to unless you
3099
+ are a platform admin. Service-account grants are Sequence-operator only; managed
3100
+ secrets refuse agent sandbox tokens. Roles and pins do not assign users;
3101
+ `capabilities.uses` must declare every capability consumed. Fresh previews do not
3102
+ register new role keys; activate a release before granting them.
3103
+
3104
+ ### Finding principals
3105
+
3106
+ ```bash
3107
+ seq-studio principals search <query> -e <env> [--types user,group,service-account,organization] [--limit <n>]
3108
+ seq-studio principals users search <query> -e <env>
3109
+ seq-studio principals groups list -e <env> [--search <query>] [--limit <n>] [--page <n>]
3110
+ seq-studio principals groups show <group-id> -e <env> [--limit <n>] [--offset <n>]
3111
+ ```
3112
+
3113
+ Results are JSON, and each principal carries
3114
+ `"grant": { "principalType", "principalId" }` ready for `access grant`. You see
3115
+ exactly what the Atlas pickers show you, through the same server code: active users
3116
+ in your organization (Sequence operators: both tenants), groups you belong to
3117
+ (platform admins: every group) and never deleted ones, service accounts you hold
3118
+ `actor` on, and your own organization. `groups show` pages a visible group's active
3119
+ members (50 per page) and reports a group you can't see as not found. An agent sandbox
3120
+ token sees exactly its caller's view. Requires CLI 0.8.0+ and an Atlas release with
3121
+ the caller mode of `/api/authz/principals/search`.
3122
+
3123
+ **Capabilities are code, roles are data.** A resource's source declares the
3124
+ capabilities its code checks; the roles that bundle them are created and edited
3125
+ in Atlas:
3126
+
3127
+ ```bash
3128
+ seq-studio access roles list orm <namespace> -e <env>
3129
+ seq-studio access roles create orm <namespace> technician --grants equipment-read,work-orders-write -e <env>
3130
+ seq-studio access roles update orm <namespace> technician --grants equipment-read -e <env>
3131
+ seq-studio access roles delete orm <namespace> technician -e <env>
3132
+ ```
3133
+
3134
+ `--grants` and `--inherits` replace the role's whole list on update. Editing
3135
+ roles requires capability-admin authority on the resource. Role `definitions`
3136
+ in source are a deprecated one-time seed that later deploys never update.
3137
+
3138
+ #### Service-account group roster Reader
3139
+
3140
+ Prepared in CLI **0.8.2**, paired with Platform SDK **0.1.0** and Managed Functions **0.5.1**; all await
3141
+ separate publication. Deploy the matching host/model before provisioning.
3142
+
3143
+ ```bash
3144
+ seq-studio access grant group <group-id> --key roster-reader --principal-type user --principal-id 'service-account|<account-id>' -e <env>
3145
+ seq-studio access revoke group <group-id> --key roster-reader --principal-type user --principal-id 'service-account|<account-id>' -e <env>
3146
+ ```
3147
+
3148
+ This uses the shared Platform SDK's typed operator client and the current CLI login.
3149
+ The shared transport owns redirect refusal, origin validation, deadline and response
3150
+ bounds; the CLI supplies session rotation and host-scoped edge headers. Grants
3151
+ require a verified human group owner or platform operator plus Actor on the
3152
+ service account. The independent Reader relation enables bounded roster reads without
3153
+ joining the group or inheriting member permissions. Tenant Directory Reader and
3154
+ the function's declared roster allowlist are still mandatory. Revocation does
3155
+ not require Actor; unavailable or unauthorized groups fail closed.
3156
+
3157
+ Only `grant` and `revoke`, key `roster-reader`, and an explicit service-account
3158
+ subject are supported for groups. Group floor grants, human subjects and other
3159
+ keys are rejected before authentication. An unavailable route or denied group fails closed; confirm the host version,
3160
+ IDs and governance access rather than granting
3161
+ ordinary group membership. Neither the SDK nor CLI grants access automatically
3162
+ on deployment. These operations do not issue credentials.
2816
3163
 
2817
3164
  ### Repository Pulls
2818
3165
 
@@ -2866,6 +3213,18 @@ contract and retry guidance. Agents only see this guidance when their instructio
2866
3213
  load the page or the installed feedback skill.
2867
3214
 
2868
3215
 
2869
- ### Planned verified service policy support
3216
+ ### Verified service policy support
3217
+
3218
+ Namespace policies using `servicePrincipal()` (ORM 2.7.1 and later) require the matching deployed IR v6 runtime. Before registration, `orm apply` checks authenticated target protocol support and refuses an unavailable or older runtime. Package versions alone do not prove rollout.
3219
+
3220
+ ## Shared Platform SDK runtime
2870
3221
 
2871
- The unpublished Studio CLI 0.7.0 release chain carries ORM 2.7.1. Namespace policies using `servicePrincipal()` require the matching deployed IR v6 runtime. Before registration, `orm apply` checks authenticated target protocol support and refuses an unavailable or older runtime. Artifact Studio 0.10.1, Managed Functions 0.4.5 and Pipeline Spec 0.3.0 remain awaiting publication in this same chain; package versions alone do not prove rollout. The existing `workspace:*` consumer dependencies resolve to ORM 2.7.1 when the reviewed chain is packed.
3222
+ All Atlas HTTP helpers now use the shared bounded transport while retaining CLI
3223
+ registered-origin checks, rotating sandbox sessions, host-scoped edge headers,
3224
+ structured Atlas errors, source authorization and raw invocation metadata. Only
3225
+ recognized pre-execution warming receipts retain the existing retry behavior.
3226
+ Typed operator provisioning clients live at `platform.controlPlane`; the CLI's
3227
+ service-account and roster workflows consume them. The coordinated Platform,
3228
+ Storage and primitive SDK release remains prepared and unpublished. See
3229
+ [consumer coverage](../../../docs/platform/sdk-consumer-coverage.md) for exact
3230
+ operations and application-owned compatibility routes.