@sequenceholdings/studio-cli 0.1.26 → 0.1.28

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 (62) hide show
  1. package/README.md +265 -81
  2. package/dist/app/adapters.d.ts +9 -0
  3. package/dist/app/adapters.js +176 -0
  4. package/dist/app/commands.d.ts +2 -2
  5. package/dist/app/commands.js +98 -22
  6. package/dist/app/deploy.d.ts +9 -10
  7. package/dist/app/deploy.js +83 -141
  8. package/dist/app/graph.d.ts +15 -0
  9. package/dist/app/graph.js +36 -0
  10. package/dist/app/manifest-validation.d.ts +16 -0
  11. package/dist/app/manifest-validation.js +99 -0
  12. package/dist/app/manifest.d.ts +27 -9
  13. package/dist/app/manifest.js +23 -107
  14. package/dist/app/paths.d.ts +14 -0
  15. package/dist/app/paths.js +77 -0
  16. package/dist/app/primitive-scaffold.d.ts +18 -0
  17. package/dist/app/primitive-scaffold.js +136 -0
  18. package/dist/app/readme.d.ts +4 -18
  19. package/dist/app/readme.js +107 -229
  20. package/dist/app/run-deployment.d.ts +8 -0
  21. package/dist/app/run-deployment.js +50 -0
  22. package/dist/app/scaffold-files.d.ts +13 -0
  23. package/dist/app/scaffold-files.js +68 -0
  24. package/dist/app/scaffold.d.ts +11 -3
  25. package/dist/app/scaffold.js +77 -245
  26. package/dist/app/workspace-compile.d.ts +18 -0
  27. package/dist/app/workspace-compile.js +143 -0
  28. package/dist/app/workspace-model.d.ts +70 -0
  29. package/dist/app/workspace-model.js +159 -0
  30. package/dist/app/workspace-scaffold.d.ts +27 -0
  31. package/dist/app/workspace-scaffold.js +126 -0
  32. package/dist/app/workspace.d.ts +14 -0
  33. package/dist/app/workspace.js +147 -0
  34. package/dist/atlas-client.js +28 -6
  35. package/dist/auth-cmds/commands.d.ts +1 -1
  36. package/dist/auth-cmds/commands.js +5 -2
  37. package/dist/functions/commands.js +7 -1
  38. package/dist/functions/manifest.d.ts +18 -0
  39. package/dist/functions/manifest.js +29 -4
  40. package/dist/main.js +9 -4
  41. package/dist/orm/delegate.js +30 -23
  42. package/dist/pat-hints.js +1 -0
  43. package/dist/pipeline/commands.js +27 -9
  44. package/dist/pipeline/lifecycle.d.ts +2 -0
  45. package/dist/pipeline/lifecycle.js +91 -11
  46. package/dist/process/build.js +59 -43
  47. package/dist/process/codegen.d.ts +3 -2
  48. package/dist/process/codegen.js +143 -27
  49. package/dist/process/commands.d.ts +2 -0
  50. package/dist/process/commands.js +63 -18
  51. package/dist/process/discover.d.ts +6 -3
  52. package/dist/process/discover.js +11 -3
  53. package/dist/process/lint.d.ts +14 -0
  54. package/dist/process/lint.js +143 -5
  55. package/dist/process/plan-diff.d.ts +8 -0
  56. package/dist/process/plan-diff.js +61 -4
  57. package/dist/process/safety-baseline.d.ts +154 -0
  58. package/dist/process/safety-baseline.js +387 -0
  59. package/dist/process/simulate.js +64 -22
  60. package/dist/repos/commands.d.ts +1 -1
  61. package/dist/repos/commands.js +29 -3
  62. package/package.json +8 -7
package/README.md CHANGED
@@ -136,58 +136,168 @@ Pass `--env <name>` (or `-e <name>`) on commands that talk to the platform.
136
136
  the artifact folder's `.artifact-studio/config.json` `defaultEnv` (set by
137
137
  `artifact link` / `artifact env use`).
138
138
 
139
- ## App monorepo commands
139
+ ## App bundle commands
140
140
 
141
- One app repo can contain ORM, managed functions, and an Artifact Studio UI.
142
- The root `sequence.app.yml` manifest declares the structure — required for
143
- scaffolding and for the eventual Applications UI. Do not hand-author apps
144
- without it.
141
+ A single `sequence.app.yml` defines the deployable contents of an app: ORM
142
+ namespaces, managed functions, typed agents, Lattice processes, Data Pipelines,
143
+ and Artifact Studio UIs. Shared packages are declared separately as build inputs.
144
+ Each primitive keeps its own runtime definition; the app manifest controls source
145
+ locations, dependencies, and deployment selection.
145
146
 
146
- > **Availability:** This is currently an internal orchestration workflow.
147
- > Generated ORM apps depend on unpublished `@sequenceholdings/orm`, so
148
- > standalone external installs and the function-to-ORM runtime path are not
149
- > supported yet.
147
+ > **Availability:** App orchestration remains an internal workflow. Standalone
148
+ > primitives retain their documented public/Preview availability. This change
149
+ > does not make function-to-ORM service-account access a public runtime contract.
150
150
 
151
151
  | Command | What it does |
152
152
  |---------|--------------|
153
- | `seq-studio init <dir> --with <kinds>` | Scaffold an app monorepo + `sequence.app.yml` + a Sequence app `README.md` + selected primitive subfolders |
154
- | `seq-studio add function&#124;artifact <name>` | Add a function or Artifact Studio UI to the current app (updates the manifest) |
155
- | `seq-studio deploy -e <env> [--yes] [--only id1,id2] [--dry-run]` | Deploy every primitive in `deploy.order` (orm → functions → artifact) |
156
-
157
- `init` supports v0 kinds `orm`, `function`, and `artifact`; pass them as a
158
- comma-list (`--with orm,function,artifact`) or boolean flags (`--orm`). `add`
159
- currently supports functions and one Artifact Studio UI; ORM is created only by
160
- `init`. Creating a platform git-service repo (`seq-studio repos create` or the
161
- Repositories UI) writes the same class of README into the initial commit, so a
162
- fresh clone already has the primitives / [docs.seqholdings.com](https://docs.seqholdings.com/)
163
- guide. `seq-studio init .` is allowed in a clone whose README contains the
164
- seq-studio seed marker; it merges Sequence ignores into an existing
165
- `.gitignore` and will not overwrite an ordinary docs-only README.
153
+ | `seq-studio init <dir> --with <kinds>` | Scaffold a version 2 app, root pnpm workspace, shared package, README, and selected primitives |
154
+ | `seq-studio add <kind> <name> [--depends-on <ids>]` | Add any primitive, including additional ORM namespaces and UIs |
155
+ | `seq-studio add package <name>` | Add a shared TypeScript package to the manifest and pnpm workspace |
156
+ | `seq-studio deploy -e <env> [--yes] [--only id1,id2] [--dry-run]` | Validate and deploy the selected app graph, including prerequisites |
157
+
158
+ `init` accepts `orm`, `function`, `agent`, `process`, `pipeline`, and `artifact` as
159
+ a comma-separated `--with` list or boolean flags (`--agent --process`). The first
160
+ function defaults to `hello` (`--function-name` changes it). Agent, process, and
161
+ pipeline folders use the app name. Pipelines default to transformation stages;
162
+ `--pipeline-type ingestion|transformation|serving` selects another template.
166
163
 
167
164
  ```bash
168
- # Full-stack toy (ORM + function + artifact) — workspace / internal CLI only
169
- seq-studio init pokedex --with orm,function,artifact --function-name get-pokemon
170
- cd pokedex
171
- (cd orm/pokedex && pnpm install)
172
- (cd functions/get-pokemon && pnpm install)
173
- (cd artifact && pnpm install)
174
-
175
- seq-studio login
176
- seq-studio deploy -e local --yes
177
-
178
- # Day-2: add a second function without re-init
179
- seq-studio add function list-types
180
- (cd functions/list-types && pnpm install)
181
- seq-studio deploy -e local --only list-types --yes
165
+ seq-studio init loan-tools --with orm,function,agent,process,artifact
166
+ cd loan-tools
167
+ pnpm install
168
+ seq-studio orm generate orm/loan_tools
169
+ seq-studio orm diff orm/loan_tools
170
+ # Review and commit the generated migrations before deployment.
171
+ seq-studio login -e <env>
172
+ seq-studio deploy -e <env> --dry-run
173
+ seq-studio deploy -e <env> --yes
174
+
175
+ seq-studio add agent reviewer
176
+ seq-studio add process approvals --depends-on reviewer-agent
177
+ seq-studio add orm audit
178
+ pnpm install
179
+ seq-studio orm generate orm/audit
180
+ seq-studio orm diff orm/audit
181
+ # Review and commit orm/audit/migrations/.
182
+ seq-studio add artifact admin
183
+ seq-studio add package contracts
184
+ pnpm install
185
+ seq-studio deploy -e <env> --only approvals-process --yes
182
186
  ```
183
187
 
184
- Each primitive keeps its own `package.json` / lockfile. `deploy` fans out to
185
- the existing per-primitive commands (`orm apply`, `functions deploy`,
186
- `artifact deploy`). Pass `--yes` for non-interactive function deploys.
188
+ Creating a default GCS-backed platform git-service repo (`seq-studio repos create`
189
+ without `--git-backend walgit`, or the Repositories UI) seeds it with a Sequence
190
+ app README. A fresh clone with that seed README is a valid `init .` target. Init
191
+ preserves its git remote and existing ignores, replaces the seed README, and
192
+ refuses ordinary non-empty repositories. The initial UI stays at `artifact/`;
193
+ additional UIs live under `artifacts/<name>/`.
194
+
195
+ ### One workspace, shared packages
196
+
197
+ Install once from the root and commit the generated `pnpm-lock.yaml`. The root
198
+ `pnpm-workspace.yaml` lists the manifest's JavaScript primitives and shared
199
+ packages, preserves the seven-day dependency age gate, and explicitly controls
200
+ build scripts. Generated nested install configuration is consolidated at the
201
+ root. CI should use `pnpm install --frozen-lockfile`.
187
202
 
188
- `deploy.on_error` defaults to `stop`. Set it to `continue` to deploy independent
189
- primitives after a failure; any primitive whose `depends_on` prerequisite failed
190
- or was skipped is skipped as well.
203
+ Every new app includes `packages/shared`, named `@<app-id>/shared`, with ordinary
204
+ `workspace:*` dependencies from its JavaScript primitives. Export common types,
205
+ validation, and helpers from `src/index.ts`. Additional packages are registered
206
+ with `seq-studio add package <name>`; add them to consumers with:
207
+
208
+ ```bash
209
+ pnpm --filter @loan-tools/primitive-hello add '@loan-tools/contracts@workspace:*'
210
+ ```
211
+
212
+ The app deployment prepares self-contained function and artifact sources from
213
+ their declared workspace dependencies. Shared packages are not independently
214
+ deployed resources. Shared source packages support JavaScript, TypeScript, and
215
+ JSON; keep browser assets in the artifact and keep shared packages independent
216
+ of primitive source directories. Shared registry dependency ranges must agree
217
+ with their consumers. Custom function builds must provide their built `main`
218
+ entry or set `package.json` `seqStudio.source` to an explicit source entry.
219
+ File-relative runtime constructs whose meaning would change during function
220
+ bundling fail preflight; use explicit file imports for bundled data.
221
+
222
+ Agent definitions compile to declarative data; imported helpers do not run at
223
+ runtime. Lattice mapper closures cannot capture arbitrary shared executable
224
+ code. Put shared runtime business logic in a managed function and reference
225
+ that primitive from the workflow. For reuse between app repositories, publish
226
+ versioned packages and depend on registry versions.
227
+
228
+ Workspace deployments outside `local` require the root lockfile. Staging keeps
229
+ its registry resolutions and overrides; the existing Managed Functions registry
230
+ policy still applies. A lockfile from an unsupported registry is reported and
231
+ resolved again by the function service, just as in standalone function deploys.
232
+
233
+ ### Manifest and deployment behavior
234
+
235
+ ```yaml
236
+ schema_version: 2
237
+ app:
238
+ id: loan-tools
239
+ title: Loan Tools
240
+ studio:
241
+ created_with: 0.1.27
242
+ min_cli: 0.1.27
243
+ packages:
244
+ - name: '@loan-tools/shared'
245
+ path: packages/shared
246
+ primitives:
247
+ - id: reviewer-agent
248
+ kind: agent
249
+ path: agents/reviewer
250
+ - id: approvals-process
251
+ kind: process
252
+ path: processes/approvals
253
+ depends_on: [reviewer-agent]
254
+ - id: admin-ui
255
+ kind: artifact
256
+ path: artifacts/admin
257
+ project_id: admin
258
+ depends_on: [approvals-process]
259
+ deploy:
260
+ on_error: stop
261
+ ```
262
+
263
+ Version 2 topologically orders `depends_on` prerequisites. Optional `deploy.order`
264
+ is a preference among ready primitives. `--only` includes the selected primitives'
265
+ transitive prerequisites; use app primitive IDs, not agent/process runtime IDs.
266
+ Agent and process entries may set `only` to select definitions from their source
267
+ folder. Agent and pipeline entries may set `target` to select a deployment identity.
268
+
269
+ Before the first ORM deployment, and after changing its schema, run
270
+ `seq-studio orm generate <namespace-path>` followed by
271
+ `seq-studio orm diff <namespace-path>`. Review and commit the generated migration
272
+ ledger. Init creates the namespace source; it does not create this reviewed
273
+ baseline automatically. A namespace without migrations fails deployment
274
+ preflight with instructions to run `orm diff`.
275
+
276
+ Before any deployment, version 2 validates and compiles the selected sources.
277
+ `--dry-run` performs this preflight without deploying. Pipeline preflight reads
278
+ the remote repository, validates its source, and pins the resolved commit, so a
279
+ pipeline dry run needs network access and authentication. Other local primitive
280
+ checks do not deploy resources. Official artifact deployments require the full app
281
+ checkout to be clean on `main`, including shared packages and the app manifest;
282
+ local deployments retain the local development path.
283
+
284
+ Pipeline entries require `repo: pipelines/<name>` and `ref`; they may specify
285
+ `target`; their `path` is the local authoring directory. Commit and push pipeline
286
+ source to the declared platform git-service release unit before deploying. The
287
+ app reuses the existing pipeline release workflow and waits for completion.
288
+ Use `--approved-by <caller-sub>` when the target requires recorded approval and
289
+ `--wait-timeout 2h` to control polling. Pipeline deployment plants jobs; it does
290
+ not run them. Removing a manifest entry never implicitly deletes a resource.
291
+
292
+ `deploy.on_error` defaults to `stop`. `continue` deploys independent primitives
293
+ and skips dependents of failed/skipped prerequisites. The operation is not atomic:
294
+ successful deployments remain if a later primitive fails. Version 2 records the
295
+ plan and outcomes in `.sequence/deployments/<encoded-env>.json`, ignored by Git.
296
+
297
+ Existing version 1 manifests retain their explicit/kind ordering, exact `--only`
298
+ selection, and plan-only dry run. Change `schema_version` to `2` to opt into the
299
+ new dependency/preflight semantics, then declare shared packages and configure a
300
+ root pnpm workspace if you want shared builds. Adding an agent, process, or pipeline to a version 1 app upgrades the manifest to version 2 and raises its minimum CLI version; it preserves existing package files and deployment-order preferences. Existing function/artifact/ORM additions retain version 1. There is no automatic migration of existing dependency files or lockfiles.
191
301
 
192
302
  ## Agent commands
193
303
 
@@ -259,8 +369,15 @@ compiled to canonical SQL before registration.
259
369
  | `seq-studio orm plan [dir] -e <env>` | Compare the compiled namespace with registry state without applying database changes. |
260
370
  | `seq-studio orm diff [dir] [--check]` | Author the next committed migration, or verify the migration/snapshot chain offline for CI. |
261
371
  | `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. |
372
+ | `seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>` | Execute one named persisted operation from `operations.manifest.json` with variables from a JSON object file, as the signed-in caller. |
262
373
  | `seq-studio orm migrate-from-yaml <dir>` | Convert a legacy YAML namespace to TypeScript authoring while preserving its committed migrations. |
263
374
 
375
+ Install the CLI and ORM package together:
376
+
377
+ ```bash
378
+ pnpm add -g @sequenceholdings/studio-cli@0.1.27 @sequenceholdings/orm@2.0.0
379
+ ```
380
+
264
381
  The everyday loop is:
265
382
 
266
383
  ```bash
@@ -280,33 +397,57 @@ the target environment's data. `apply --no-create` is the CI guard that refuses
280
397
  to provision a missing namespace. Destructive DDL requires explicit
281
398
  `--allow-destructive` consent.
282
399
 
283
- > **ORM v2 branch status:** the scaffold currently depends on
284
- > `@sequenceholdings/orm@^2.0.0`, which is not published yet; the registry's
285
- > latest release is the v1 `0.1.1` package. A clean standalone scaffold cannot
286
- > complete `pnpm install` until the v2 ORM dependency chain is released. Do not
287
- > use monorepo workspace links as evidence that the external workflow is ready.
288
- > Sequence contributors should see
289
- > [`docs/platform/orm-v2.md`](../../../docs/platform/orm-v2.md) for the branch
290
- > architecture, internal verification workflow, demo, and remaining rollout
291
- > gates.
400
+ > **Preview:** ORM v2 is a Preview workflow. The generated namespace package
401
+ > depends on `@sequenceholdings/orm@^2.0.0`; use the matching published major
402
+ > version and keep generated manifests and migrations committed with source.
292
403
 
293
404
  ## Process commands
294
405
 
295
406
  | Command | What it does |
296
407
  |---------|--------------|
297
408
  | `seq-studio process init <dir>` | Scaffold a process repo: `package.json`, sample `process.ts`, `tsconfig.json` |
298
- | `seq-studio process lint` | Static checks (graph, return contracts, agent schema, timeouts) |
299
- | `seq-studio process plan -e <env>` | Build bundle, diff against currently-active version |
300
- | `seq-studio process apply -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) |
409
+ | `seq-studio process lint [--dir <path>] [--offline]` | Static checks (graph, return contracts, agent schema, timeouts, and JSONata syntax); `--offline` skips live agent-schema lookup |
410
+ | `seq-studio process plan [--dir <path>] -e <env>` | Build bundle, diff against currently-active version |
411
+ | `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) |
301
412
  | `seq-studio process apply --repo processes/<name> [--ref <r>] -e <env> [--only <id1,id2>]` | Same as above, but materializes the source from a platform git-service repo. Pinned commit SHA is injected as bundle provenance. Requires `ATLAS_GIT_PAT` (or the target realm's M2M secret for CI) |
302
- | `seq-studio process test -e <env>` | CI wrapper: lint + plan, non-zero exit on errors or BREAKING diffs |
303
- | `seq-studio process simulate <id>` | Isolated child-process walk with stubbed runners (offline) |
304
- | `seq-studio process bundle build [-o file.json]` | Build a bundle locally |
413
+ | `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 |
414
+ | `seq-studio process simulate <id> [--dir <path>]` | Isolated child-process walk with stubbed runners and hardened JSONata data-flow mapper evaluation (offline) |
415
+ | `seq-studio process bundle build [--dir <path>] [-o file.json]` | Build a bundle locally |
305
416
  | `seq-studio process bundle pull <hash> [-e <env>] [-o file.json]` | Fetch a stored bundle |
306
417
  | `seq-studio process bundle inspect <bundle.json>` | Show a saved bundle's summary |
307
418
  | `seq-studio process bundle list [-e <env>] [--limit N] [--cursor <hash>]` | List registered bundles (paginated; CLI auto-fetches all pages) |
308
419
  | `seq-studio process bundle publish <hash or bundle.json> [-e <env>]` | Register a local bundle (no promote) |
309
420
 
421
+ Use `lint --offline` for checks without live registry lookups. `test --offline`
422
+ also skips agent-schema lookup and permits skipping the active-version diff when
423
+ environment/auth is unavailable, but it still attempts that live diff and resolves
424
+ subprocess versions when needed. It is not a guarantee of network-free execution.
425
+
426
+ ### JSONata mapper contracts
427
+
428
+ `jsonata('…')` expressions are serialized as `*_expr` data and run in a
429
+ memory-bounded worker with a five-second deadline. `$eval` is disabled.
430
+ `$addBusinessHours(isoString, seconds)` is the only registered host function
431
+ and returns an ISO-8601 string.
432
+
433
+ | Mapper slot | `$` input | Named bindings | Expected result |
434
+ |-------------|-----------|----------------|-----------------|
435
+ | `input` / human context projection | Context snapshot | — | Runner input; human projections return a context snapshot |
436
+ | `artifact_refs` | Context snapshot | — | Artifact-reference array |
437
+ | `dueDate` | Context snapshot | — | ISO date, epoch milliseconds, or `null` |
438
+ | `emailNotification` template/reminder | Context snapshot | `$info` | `{ subject, body }` |
439
+ | `advance_allowed` | Context snapshot | — | Advance-allowed ACL; OpCo authoring is rejected pending dynamic-ACL hardening |
440
+ | parallel `fan_out` | Context snapshot | — | Branch-item array |
441
+ | parallel `join` | Context snapshot | `$branches` | Node output |
442
+ | subprocess `output` | Context snapshot | `$child` | Node output |
443
+ | node or supervisor retry predicate | `{ name, message }` | — | `true` to retry |
444
+
445
+ `process lint` parse-checks all of these slots. `process simulate` evaluates
446
+ the data-flow slots used by its topology walk (`input`, `fan_out`, `join`, and
447
+ subprocess `output`). It intentionally keeps runners stubbed and therefore
448
+ does not send email or execute due-date, ACL, artifact-reference, or retry
449
+ behavior.
450
+
310
451
  ### Remote source for `apply`
311
452
 
312
453
  `apply` can deploy a process from the platform git service instead of a local
@@ -337,10 +478,11 @@ unrelated credentials when the source is not trusted.
337
478
 
338
479
  ### Process discovery
339
480
 
340
- `seq-studio` walks the current working directory for any subfolder
341
- containing a `process.ts` file. Each `process.ts` must
342
- `export default defineProcess(...)`. Set `LATTICE_PROCESSES_ROOT` to
343
- point at a different folder.
481
+ Local process commands scan `<id>/process.ts` under the root selected by
482
+ `--dir`, then `LATTICE_PROCESSES_ROOT`, then the current working directory, in
483
+ that precedence order. Relative paths resolve from the current working directory.
484
+ Each `process.ts` must `export default defineProcess(...)`. `apply --repo`
485
+ selects a remote source and cannot be combined with `--dir`.
344
486
 
345
487
  ```
346
488
  my-processes/
@@ -351,8 +493,7 @@ my-processes/
351
493
  ```
352
494
 
353
495
  ```bash
354
- cd my-processes
355
- seq-studio process lint # finds both processes
496
+ seq-studio process lint --dir my-processes --offline # finds both processes
356
497
  ```
357
498
 
358
499
  ## Managed Function commands
@@ -398,8 +539,9 @@ canonical relative directory inside a remote repo; use `--dir` for local source.
398
539
 
399
540
  ### Scaling
400
541
 
401
- Managed functions scale to zero by default. Set a bounded warm pool in
402
- `managed-function.yml` when first-request latency matters:
542
+ Managed functions keep one warm instance by default. Set `min_instances: 0`
543
+ in `managed-function.yml` to scale to zero, or raise the floor when first-request
544
+ latency matters:
403
545
 
404
546
  ```yaml
405
547
  limits:
@@ -407,7 +549,7 @@ limits:
407
549
  max_instances: 3
408
550
  ```
409
551
 
410
- `min_instances` defaults to `0`, cannot exceed `max_instances`, and incurs
552
+ `min_instances` defaults to `1`, cannot exceed `max_instances`, and incurs
411
553
  Cloud Run idle-instance charges while warm.
412
554
 
413
555
  ### Invocation IP allowlist
@@ -450,6 +592,21 @@ function whose required adapter is missing. The manifest declares only the
450
592
  server-owned adapter; authors cannot configure its runtime resource selection
451
593
  or policy.
452
594
 
595
+ Protected Encompass reads use closed, function-specific contracts:
596
+
597
+ - loan point/search and eFolder adapters authorize the human caller against
598
+ Atlas's current loan policy, then bind the returned loan or child resource to
599
+ that decision;
600
+ - `encompass.loan-read-full` and `encompass.loan-fields-read` preserve approved
601
+ full-loan access while rejecting wrong-loan and unsolicited-field responses;
602
+ - `encompass.global-metadata-read` covers the registered field-schema and
603
+ Encompass-settings reads with bounded, projected outputs and no loan lookup.
604
+
605
+ These adapters also require a clean, full Git commit on the active function
606
+ version. Rollout flags are platform kill switches; FGA function or suite
607
+ `invoker` remains the runtime access grant. Download and write functions are
608
+ not members of these read adapters.
609
+
453
610
  ### ORM data access
454
611
 
455
612
  A function declares its ORM Data API reach in `capabilities.data`, grouped by
@@ -512,10 +669,14 @@ routed through `~/.config/lattice/config.toml` and the shared seqapi token.
512
669
  directory's `.artifact-studio/config.json` — run them from the linked artifact
513
670
  folder (or run `seq-studio artifact link` first).
514
671
 
515
- **Active (official) deploys require a clean `main` checkout with a resolved
516
- git commit** for both Git Service (`--repo`) and local sources. Feature
517
- branches, dirty trees, non-git sources, and detached checkouts that cannot be
518
- attributed to `main` are preview-only
672
+ **Active (official) deploys to deployed environments require `main` with a
673
+ resolved git commit and a clean artifact source directory** for both Git
674
+ Service (`--repo`) and local sources. When a local source is nested in a larger
675
+ checkout, dirty files outside that source directory are ignored with a warning.
676
+ Deployments targeting `local` may use any branch, including dirty working
677
+ trees. Feature branches, dirty artifact source trees, non-git sources, and
678
+ detached checkouts that cannot be attributed to `main` are preview-only for
679
+ deployed environments
519
680
  (`seq-studio artifact dev` / preview channel); promotion applies the same
520
681
  provenance check.
521
682
 
@@ -536,9 +697,12 @@ of the pipeline (build → upload) is identical regardless of origin:
536
697
  | `--git-url <url>` | a public, credential-free HTTPS git URL (cloned to a temp dir) |
537
698
 
538
699
  `--ref <branch\|tag\|commit>` selects the revision for `build` and `plan`
539
- (default: the repo's default branch). Active `deploy` requires `main`; other
540
- refs are preview-only. A remote source is materialized to a temp dir, built,
541
- and torn down;
700
+ (default: the repo's default branch). Active deploys to deployed environments
701
+ require `main`; local active deploys scope dirty-file checks to the source
702
+ directory and warn about unrelated changes elsewhere in the checkout.
703
+ `--env local` accepts any local source ref. Other refs are preview-only for
704
+ deployed environments. A remote source is materialized to a
705
+ temp dir, built, and torn down;
542
706
  the target project is resolved from the source's `artifact.bundle.yml`
543
707
  `project_id`. The deployment records the resolved commit as its `git_commit`
544
708
  provenance. `--repo` needs `-e <env>` + a platform login. M2M/CI builds accept
@@ -577,6 +741,7 @@ any username, PAT as password). **You do not need `seqapi`.**
577
741
  (`<your-atlas-url>/settings/tokens` — run `seq-studio envs list` for the
578
742
  URLs visible to your identity)
579
743
  2. **New token** → scopes `repo:read` (add `repo:write` for push) → copy once
744
+ Merge is a repository grant (Merge / Admin), not a PAT scope.
580
745
  3. Export and clone:
581
746
 
582
747
  ```bash
@@ -595,7 +760,7 @@ Requires Auth0 login. Same identity as the UI:
595
760
  ```bash
596
761
  seq-studio login # add --env <registered-opco-env> for a tenant realm
597
762
  seq-studio auth pat create --name laptop --scopes repo:read,repo:write -e <env>
598
- # optional: --expires 7d|30d|90d|1y|never (default 30d)
763
+ # optional: --expires 1d|7d|30d|90d|1y|never (default 30d)
599
764
  # optional: --store-credentials # git credential approve for the env host
600
765
 
601
766
  seq-studio auth pat list -e <env>
@@ -614,7 +779,7 @@ JSON API — the same repos `--repo <ns>/<name>` sources build from.
614
779
  | `seq-studio repos list -e <env> [--namespace <slug>] [--mine]` | repos visible on the environment (permission-filtered) |
615
780
  | `seq-studio repos namespaces [create <slug>] -e <env>` | list namespaces, or create one (creator becomes owner) |
616
781
  | `seq-studio repos show <ns>/<name> -e <env>` | detail: id, branches, clone URL; artifact project id when slug matches |
617
- | `seq-studio repos create <ns>/<name> -e <env> [--default-branch <b>]` | create a repo seeded with a Sequence app README (needs namespace write) |
782
+ | `seq-studio repos create <ns>/<name> -e <env> [--default-branch <b>] [--git-backend gcs_isomorphic\|walgit]` | create a repo (GCS default + seed README; `walgit` starts empty on `main`; needs namespace write) |
618
783
  | `seq-studio repos clone <ns>/<name> \| --url <clone-url> \| --id <uuid> -e <env> [--ref <r>] [--out <dir>] [--force]` | smart-HTTP `git clone` when `ATLAS_GIT_PAT` is set (`--url`/`--id` need no seqapi); otherwise JSON materialize + PAT hint |
619
784
  | `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` |
620
785
  | `seq-studio repos delete <ns>/<name> -e <env> [--yes]` | delete a repo — interactive confirm unless `--yes` |
@@ -659,12 +824,13 @@ install it alongside the CLI to use this family.
659
824
  | `seq-studio pipeline init --type ingestion\|transformation\|serving <name> [--dir <dir>]` | Scaffold `<name>.stage.yml` (commented per-kind template) plus a `src/` Databricks-notebook entrypoint stub (begins with `# Databricks notebook source`; serving stages are declarative — no stub). Refuses to overwrite an existing spec |
660
825
  | `seq-studio pipeline validate [dir] [--assets <file\|url>] [--orm-contracts <file\|url>] [--json]` | Run the full offline spec gate: envelope + body validation, `schema_ref` resolution, and repo-level graph validation (reference resolution, single-writer, cycles, column subsets, serving projection checks). Auto-loads `orm-contracts.json` from the pipeline dir when present. Exit 0/1 |
661
826
  | `seq-studio pipeline plan --repo pipelines/<slug> --ref <sha\|branch> -e <env> [--target <id>] [--json]` | Enqueue and poll a durable Pipeline plan (materialize → SDK/`validateSpecGraph` → compile → live-diff → provision findings). Fails closed listing **every** missing target binding (alert channels, workspace, Databricks `source.credential`) plus Data Sync edge-worker machine/operation/`credEnvFamilies` mismatches before registry writes. Does **not** run Databricks `bundle validate` (that is a Trigger deploy-path hard gate). Exit 1 on destructive findings (CI-safe). `--json` emits the completed stable plan envelope |
662
- | `seq-studio pipeline deploy --repo pipelines/<slug> --ref <sha\|branch> -e <env> [--target <id>] [--approved-by <sub>] [--run-now] [--no-wait]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. Default is plant-only (jobs are created, not run). `--run-now` runs in-unit producer roots after bundle deploy and waits before serving sync create. Polls to terminal unless `--no-wait`. Targets that require approval need `--approved-by` naming the authenticated caller. |
827
+ | `seq-studio pipeline deploy --repo pipelines/<slug> --ref <sha\|branch> -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. Default is plant-only (jobs are created, not run). `--run-now` runs in-unit producer roots after bundle deploy; serving refresh provisioning completes before producer trigger.after tasks can run. If a producer fails, the terminal status includes the remote Databricks task/event error when available. `--allow-destructive` is repeatable and must exactly name every deletion/recreation finding in the immutable plan; only authenticated `@seqholdings.com` users may authorize it; permission, ownership, schedule-drift, and provisioning blockers cannot be overridden. Polls to terminal unless `--no-wait`. Targets that require approval need `--approved-by` naming the authenticated caller. |
828
+ | `seq-studio pipeline status --deployment-id <id> -e <env> [--json]` | Fetch the current remote deployment status without changing it. Use this public command to continue monitoring after local polling stops |
663
829
  | `seq-studio pipeline adopt --stage <slug> --ref <sha\|branch> -e <env> [--target <id>] --native-id <id> --approved-by <you> [--resource-key <key>] [--kind job\|dlt_pipeline] [--old-source-removal-pr <url>] [--repo pipelines/<slug>]` | Bind a live Databricks job/pipeline into the stage without recreation (`bundle deployment bind` on Trigger). Always requires `--approved-by` naming the caller. When the key is still in the monorepo DAB, pass `--old-source-removal-pr` and follow the returned cutover checklist: unbind the old bundle state without deleting the remote, then remove its DAB declaration and add the target-specific adopted-resource entry in the same PR before redeploying. |
664
830
  | `seq-studio pipeline unbind --stage <slug> --ref <sha\|branch> -e <env> [--target <id>] --approved-by <you> [--resource-key <key>] [--repo pipelines/<slug>]` | Release an adopted binding on Trigger; the remote object stays live (never deleted) |
665
831
  | `seq-studio pipeline run-now --stage <slug> -e <env> [--target <id>] [--repo pipelines/<slug>] [--json]` | Run the stage's active job or DLT pipeline immediately and print its Databricks run URL |
666
- | `seq-studio pipeline promote --stage <slug> --version <v> -e <env> [--target <id>] [--repo pipelines/<slug>] [--approved-by <you>] [--no-wait]` | Promote a validated version to another target. Targets that require approval need `--approved-by`; `--repo` disambiguates a slug that exists in multiple Pipelines |
667
- | `seq-studio pipeline rollback --stage <slug> -e <env> [--target <id>] [--repo pipelines/<slug>] [--approved-by <you>] [--no-wait]` | Redeploy the previously retired deployment's version. Targets that require approval need `--approved-by`. |
832
+ | `seq-studio pipeline promote --stage <slug> --version <v> -e <env> [--target <id>] [--repo pipelines/<slug>] [--approved-by <you>] [--wait-timeout <duration>] [--no-wait]` | Promote a validated version to another target. Targets that require approval need `--approved-by`; `--repo` disambiguates a slug that exists in multiple Pipelines |
833
+ | `seq-studio pipeline rollback --stage <slug> -e <env> [--target <id>] [--repo pipelines/<slug>] [--approved-by <you>] [--wait-timeout <duration>] [--no-wait]` | Redeploy the previously retired deployment's version. Targets that require approval need `--approved-by`. |
668
834
 
669
835
  `-e/--env` selects the Atlas connection. `--target` selects the logical
670
836
  pipeline target advertised by that endpoint. It is optional when the alias
@@ -672,9 +838,14 @@ matches a target id or when the endpoint has exactly one target.
672
838
 
673
839
  Unless `--no-wait` is set, `plan`, `deploy`, `promote`, and `rollback` report status or
674
840
  status-detail changes while waiting, then emit a 20-second progress heartbeat.
675
- Terminal output includes the deployment ID and elapsed time; failures include
676
- the status detail, and any available Trigger run ID is shown. `--json` output
677
- is unchanged.
841
+ Deploy, promote, and rollback wait up to 2 hours by default; pass
842
+ `--wait-timeout <duration>` with a positive value such as `10m` or `2h` to
843
+ override that local polling window. `--no-wait` only stops local polling—the
844
+ remote deployment continues. If the wait window expires, output includes the
845
+ deployment ID and an exact `seq-studio pipeline status` command for continued
846
+ monitoring. Internal operators also receive the equivalent `seqapi` command;
847
+ failures include the status detail, and any available Trigger run ID is shown.
848
+ `--json` output is unchanged.
678
849
 
679
850
  ### Managed Pipelines asset identity
680
851
 
@@ -682,6 +853,19 @@ Compiled Databricks assets use stable, environment-qualified identities: display
682
853
 
683
854
  Changing a DAB resource key is a delete-and-create operation. Treat these identities as the existing-resource contract when planning, adopting, unbinding, or inspecting a Managed Pipeline; Unity Catalog catalogs, volumes, tables, and synced tables are not renamed by this convention.
684
855
 
856
+ Deletion and recreation remain blocked by default. For an intentional,
857
+ reviewed migration, repeat `--allow-destructive <resource-key>` for every
858
+ eligible finding printed by the plan. Only authenticated `@seqholdings.com`
859
+ users may authorize destructive deploys. The authorization is stored against
860
+ the exact plan hash and authenticated caller, so a changed plan requires new
861
+ consent. Immediately before apply, the worker generates a direct-engine DAB
862
+ plan, verifies that it contains no additional destructive resources and still
863
+ maps each deletion key to the reviewed native ID, then applies those exact plan
864
+ bytes. A successful DAB prune releases the corresponding registry bindings and
865
+ retires stages removed from the repo. This operation does not retain or restore
866
+ the deleted Databricks object; verify backups and cutover readiness before
867
+ authorizing a DLT pipeline deletion because its managed tables can be dropped.
868
+
685
869
  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.
686
870
 
687
871
  `validate` is offline — no network or database. `--assets` supplies a
@@ -0,0 +1,9 @@
1
+ import type { DeployPrimitiveArgs, PrimitiveDeployers } from './deploy.js';
2
+ import type { PrimitiveEntry } from './manifest.js';
3
+ /**
4
+ * Validate every selected source before any deployer runs. Pipeline source is
5
+ * materialized read-only from git and pinned. Live runtime reference checks
6
+ * remain inside apply, after dependencies deploy.
7
+ */
8
+ export declare function validateAppPrimitive(args: DeployPrimitiveArgs): Promise<PrimitiveEntry | void>;
9
+ export declare function createDefaultDeployers(): Promise<PrimitiveDeployers>;