@sequenceholdings/studio-cli 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -587,7 +587,7 @@ bundle; it never implicitly deletes agents.
587
587
  | `seq-studio agents validate [--dir <dir>] [--target <APP_ENV>] [--only <id1,id2>]` | Compile and validate locally, without API access |
588
588
  | `seq-studio agents plan [--dir <dir>] [--only <id1,id2>]` | Offline compile/hash plan |
589
589
  | `seq-studio agents plan [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>]` | Diff creates, updates, and unchanged definitions against an environment |
590
- | `seq-studio agents apply [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--yes]` | Apply creates and updates after showing the plan |
590
+ | `seq-studio agents apply [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--yes]` | Sequence-staff code-managed deploy: applies creates and updates after showing the plan |
591
591
  | `seq-studio agents list -e <env>` | List visible runtime agents |
592
592
  | `seq-studio agents show <id> -e <env>` | Show one runtime agent |
593
593
 
@@ -595,6 +595,21 @@ For `validate`, `plan`, and `apply`, `--only` accepts a comma-separated list of
595
595
  agent IDs after deployment-environment selection; every requested ID must be
596
596
  selected.
597
597
 
598
+ **Access is managed in Atlas, not in code.** `seq-studio deploy` deploys an
599
+ app's agents config-only, as you, with the same rules as an Agent Builder save:
600
+
601
+ - A new agent needs **Can create** on Agent Builder; you become its owner and
602
+ it starts unshared.
603
+ - An existing agent needs **editor** on it.
604
+ - The skills, MCP servers, Managed Functions and subagents it attaches must be
605
+ ones you may use, the same checks Agent Builder runs.
606
+ - The deploy never changes who can use the agent. Grant access in Agent Builder
607
+ or through the API. A definition that sets `permissions`, `isPublic` or
608
+ `publicOutputs` is refused.
609
+
610
+ `seq-studio agents apply` is the Sequence-staff path for Sequence's own
611
+ code-managed agents, whose definitions own their access as well.
612
+
598
613
  An optional `deploy-manifest.json` targets definitions by deployment identity:
599
614
 
600
615
  ```json
@@ -610,7 +625,7 @@ An optional `deploy-manifest.json` targets definitions by deployment identity:
610
625
  }
611
626
  ```
612
627
 
613
- Standalone workflow:
628
+ Sequence-managed standalone workflow (Sequence staff):
614
629
 
615
630
  ```bash
616
631
  pnpm dlx @sequenceholdings/studio-cli agents init support-agent
@@ -6,8 +6,12 @@ export interface ApplySummary {
6
6
  unchanged: number;
7
7
  }
8
8
  /** Each chunk is hashed over its own definitions — the apply route validates the body it received. */
9
- export declare function applyInChunks({ context, definitions, source, }: {
9
+ export declare function applyInChunks({ context, definitions, source, path, chunkSize, }: {
10
10
  context: CommandContext;
11
11
  definitions: AgentDefinition[];
12
12
  source: string;
13
+ /** The apply route: code-managed or config-only. */
14
+ path: string;
15
+ /** Definitions per request. */
16
+ chunkSize?: number;
13
17
  }): Promise<ApplySummary>;
@@ -5,10 +5,10 @@ const LOG = '[seq-studio]';
5
5
  // Chunked to stay inside the HTTP client's timeout; each agent commits independently anyway.
6
6
  const APPLY_CHUNK_SIZE = 20;
7
7
  /** Each chunk is hashed over its own definitions — the apply route validates the body it received. */
8
- export async function applyInChunks({ context, definitions, source, }) {
8
+ export async function applyInChunks({ context, definitions, source, path, chunkSize = APPLY_CHUNK_SIZE, }) {
9
9
  const chunks = [];
10
- for (let i = 0; i < definitions.length; i += APPLY_CHUNK_SIZE) {
11
- chunks.push(definitions.slice(i, i + APPLY_CHUNK_SIZE));
10
+ for (let i = 0; i < definitions.length; i += chunkSize) {
11
+ chunks.push(definitions.slice(i, i + chunkSize));
12
12
  }
13
13
  const total = { created: 0, updated: 0, unchanged: 0 };
14
14
  let applied = 0;
@@ -16,7 +16,7 @@ export async function applyInChunks({ context, definitions, source, }) {
16
16
  try {
17
17
  const result = await postJson({
18
18
  ...clientOptions(context),
19
- path: '/api/agents/deploy/apply',
19
+ path,
20
20
  body: {
21
21
  definitions: chunk,
22
22
  bundleHash: hashAgentBundle({ definitions: chunk }),
@@ -1,9 +1,18 @@
1
1
  import type { ParsedArgs } from '../process/commands.js';
2
2
  import { agentsInitCommand } from './scaffold.js';
3
3
  export { agentsInitCommand };
4
+ /**
5
+ * How a deploy treats an agent's access. `managed` is Sequence's code-managed
6
+ * path: the definition owns access, and only Sequence staff may use it.
7
+ * `config` deploys configuration only, as the caller, with the tiers Agent
8
+ * Builder uses; access stays whatever the UI or API set.
9
+ */
10
+ export type AgentDeployMode = 'managed' | 'config';
4
11
  export declare function agentsValidateCommand(args: ParsedArgs): Promise<number>;
5
12
  export declare function agentsPlanCommand(args: ParsedArgs): Promise<number>;
6
- export declare function agentsApplyCommand(args: ParsedArgs): Promise<number>;
13
+ export declare function agentsApplyCommand(args: ParsedArgs, { mode }?: {
14
+ mode?: AgentDeployMode;
15
+ }): Promise<number>;
7
16
  export declare function agentsListCommand(args: ParsedArgs): Promise<number>;
8
17
  export declare function agentsShowCommand(args: ParsedArgs): Promise<number>;
9
18
  export declare const AGENTS_USAGE = "usage:\n seq-studio agents init <dir> scaffold a typed agent\n seq-studio agents validate [--dir d] [--target app] [--only ids] offline compile + validation\n seq-studio agents plan [--dir d] [-e <env>] [--only ids] offline bundle plan or live diff\n seq-studio agents apply [--dir d] -e <env> [--only ids] [--yes] apply creates/updates; never deletes\n seq-studio agents list -e <env> list visible agents\n seq-studio agents show <id> -e <env> show one agent\n seq-studio agents voice help internal Voice authoring/publication\n\n Source: local --dir (default .), --repo agents/<name>, or --git-url <url>.\n Use --ref for remote sources. --target selects the deployment APP_ENV when it\n differs from the CLI environment alias (notably OpCo registrations). --only\n accepts a comma-separated list of agent IDs after environment selection.\n";
@@ -8,6 +8,10 @@ import { compileAgentSource as compileSource, materializeAgentSource as material
8
8
  import { agentsInitCommand } from './scaffold.js';
9
9
  export { agentsInitCommand };
10
10
  const LOG = '[seq-studio]';
11
+ const DEPLOY_ROUTES = {
12
+ managed: { plan: '/api/agents/deploy/plan', apply: '/api/agents/deploy/apply' },
13
+ config: { plan: '/api/agents/deploy/config/plan', apply: '/api/agents/deploy/config/apply' },
14
+ };
11
15
  function requestedAgentIds(args) {
12
16
  const only = args.flags.only;
13
17
  if (only === undefined)
@@ -128,7 +132,8 @@ export async function agentsPlanCommand(args) {
128
132
  await source.cleanup();
129
133
  }
130
134
  }
131
- export async function agentsApplyCommand(args) {
135
+ export async function agentsApplyCommand(args, { mode = 'managed' } = {}) {
136
+ const routes = DEPLOY_ROUTES[mode];
132
137
  const { source, context } = await materialize({
133
138
  args,
134
139
  requireEnvironment: true,
@@ -139,7 +144,7 @@ export async function agentsApplyCommand(args) {
139
144
  const bundle = await deploymentBundle({ args, source, context });
140
145
  const plan = await postJson({
141
146
  ...clientOptions(context),
142
- path: '/api/agents/deploy/plan',
147
+ path: routes.plan,
143
148
  body: {
144
149
  definitions: bundle.definitions,
145
150
  bundleHash: bundle.hash,
@@ -151,6 +156,7 @@ export async function agentsApplyCommand(args) {
151
156
  `${LOG} apply ${bundle.definitions.length} agent definitions to ${context.env.name}`,
152
157
  `${LOG} bundle ${bundle.hash}`,
153
158
  `${LOG} no agents will be deleted`,
159
+ ...(mode === 'config' ? [`${LOG} access is managed in the UI or API; this deploy leaves it unchanged`] : []),
154
160
  ];
155
161
  if (!(await confirmYes({ preview, confirmed: flagBool(args.flags, 'yes') }))) {
156
162
  return 1;
@@ -159,6 +165,10 @@ export async function agentsApplyCommand(args) {
159
165
  context,
160
166
  definitions: bundle.definitions,
161
167
  source: source.provenance.gitCommit ?? 'local',
168
+ path: routes.apply,
169
+ // The server checks a config deploy as one bundle (agents it creates may
170
+ // name each other), so it must arrive whole, as plan saw it.
171
+ ...(mode === 'config' ? { chunkSize: Math.max(bundle.definitions.length, 1) } : {}),
162
172
  });
163
173
  console.log(`${LOG} applied: ${summary.created} created, ${summary.updated} updated, ${summary.unchanged} unchanged`);
164
174
  return 0;
@@ -182,9 +182,11 @@ export async function createDefaultDeployers() {
182
182
  return functionsDeployCommand({ positional: [], flags: { dir: path, env, ...(yes ? { yes: true } : {}) } });
183
183
  },
184
184
  async agent(args) {
185
+ // An app's agents deploy their configuration only; access is managed in
186
+ // the UI or API, never overwritten from code.
185
187
  return agentsApplyCommand({ positional: [], flags: {
186
188
  dir: args.path, env: args.env, ...selectedFlags(args), ...(args.yes ? { yes: true } : {}),
187
- } });
189
+ } }, { mode: 'config' });
188
190
  },
189
191
  async process(args) {
190
192
  return applyCommand({ positional: [], flags: { dir: args.path, env: args.env, ...selectedFlags(args) } });
@@ -7,7 +7,7 @@
7
7
  import type { ParsedArgs } from '../process/commands.js';
8
8
  export declare const APP_INIT_USAGE: string;
9
9
  export declare const APP_ADD_USAGE: string;
10
- export declare const APP_DEPLOY_USAGE = "usage:\n seq-studio deploy -e <env> [options]\n\n Deploy the app declared in sequence.app.yml. Versions 2 and 3 use\n depends_on prerequisites; deploy.order optionally orders ready primitives.\n Runs each kind's existing command:\n orm \u2192 seq-studio orm apply <path> -e <env>\n function \u2192 seq-studio functions deploy --dir <path> -e <env> [--yes]\n agent \u2192 seq-studio agents apply --dir <path> -e <env> [--yes]\n process \u2192 seq-studio process apply --dir <path> -e <env>\n pipeline \u2192 seq-studio pipeline deploy --repo <repo> --ref <ref> -e <env>\n artifact \u2192 seq-studio artifact deploy <path> -e <env>\n\n Options:\n -e, --env <name> target environment (required)\n --dir <path> app root (default: cwd; must contain sequence.app.yml)\n --only <id1,id2> deploy these ids and their prerequisites (v2)\n --yes non-interactive (forwarded to primitive commands)\n --dry-run validate/compile selected sources without deploying (v2)\n --approved-by <sub> recorded caller approval for protected pipeline targets\n --wait-timeout <d> pipeline polling timeout, e.g. 10m or 2h\n\n Examples:\n seq-studio deploy -e staging --yes\n seq-studio deploy -e local --only get-pokemon --yes\n seq-studio deploy --dir ./pokedex -e staging --dry-run\n\n Run from the app root (directory with sequence.app.yml), or pass --dir.\n Version 1 manifests keep their existing ordering and exact --only behavior.\n Pipelines require repo and ref in their manifest entry.\n ORM namespaces require generated code and a reviewed migration ledger:\n seq-studio orm generate <path> && seq-studio orm diff <path>\n Commit generated migrations before the first deployment and schema changes.\n Pipeline preflight reads the remote source and pins its commit; dry-run\n therefore needs network/auth for pipelines. Version 1 dry-run only lists.\n A dry-run never opens a browser login: without a session it skips the\n workspace-binding check and says so. It warns, rather than fails, when the\n artifact source is not committed and clean on main.\n Version 2 writes the result to .sequence/deployments/<environment>.json.\n";
10
+ export declare const APP_DEPLOY_USAGE = "usage:\n seq-studio deploy -e <env> [options]\n\n Deploy the app declared in sequence.app.yml. Versions 2 and 3 use\n depends_on prerequisites; deploy.order optionally orders ready primitives.\n Runs each kind's existing command:\n orm \u2192 seq-studio orm apply <path> -e <env>\n function \u2192 seq-studio functions deploy --dir <path> -e <env> [--yes]\n agent \u2192 seq-studio agents apply --dir <path> -e <env> [--yes], config-only (access stays in Atlas)\n process \u2192 seq-studio process apply --dir <path> -e <env>\n pipeline \u2192 seq-studio pipeline deploy --repo <repo> --ref <ref> -e <env>\n artifact \u2192 seq-studio artifact deploy <path> -e <env>\n\n Options:\n -e, --env <name> target environment (required)\n --dir <path> app root (default: cwd; must contain sequence.app.yml)\n --only <id1,id2> deploy these ids and their prerequisites (v2)\n --yes non-interactive (forwarded to primitive commands)\n --dry-run validate/compile selected sources without deploying (v2)\n --approved-by <sub> recorded caller approval for protected pipeline targets\n --wait-timeout <d> pipeline polling timeout, e.g. 10m or 2h\n\n Examples:\n seq-studio deploy -e staging --yes\n seq-studio deploy -e local --only get-pokemon --yes\n seq-studio deploy --dir ./pokedex -e staging --dry-run\n\n Run from the app root (directory with sequence.app.yml), or pass --dir.\n Version 1 manifests keep their existing ordering and exact --only behavior.\n Pipelines require repo and ref in their manifest entry.\n ORM namespaces require generated code and a reviewed migration ledger:\n seq-studio orm generate <path> && seq-studio orm diff <path>\n Commit generated migrations before the first deployment and schema changes.\n Pipeline preflight reads the remote source and pins its commit; dry-run\n therefore needs network/auth for pipelines. Version 1 dry-run only lists.\n A dry-run never opens a browser login: without a session it skips the\n workspace-binding check and says so. It warns, rather than fails, when the\n artifact source is not committed and clean on main.\n Version 2 writes the result to .sequence/deployments/<environment>.json.\n";
11
11
  export declare function runAppInitCommand(args: ParsedArgs): Promise<number>;
12
12
  export declare function runAppAddCommand({ kindArg, args, }: {
13
13
  kindArg: string | undefined;
@@ -90,7 +90,7 @@ export const APP_DEPLOY_USAGE = `usage:
90
90
  Runs each kind's existing command:
91
91
  orm → seq-studio orm apply <path> -e <env>
92
92
  function → seq-studio functions deploy --dir <path> -e <env> [--yes]
93
- agent → seq-studio agents apply --dir <path> -e <env> [--yes]
93
+ agent → seq-studio agents apply --dir <path> -e <env> [--yes], config-only (access stays in Atlas)
94
94
  process → seq-studio process apply --dir <path> -e <env>
95
95
  pipeline → seq-studio pipeline deploy --repo <repo> --ref <ref> -e <env>
96
96
  artifact → seq-studio artifact deploy <path> -e <env>
package/dist/main.js CHANGED
@@ -56,6 +56,11 @@ const TOP_LEVEL_USAGE = `usage:
56
56
  Where supported, --json writes structured stdout; check exit status and pagination.
57
57
  Built-in env: local. Add your organization's deployment with
58
58
  \`seq-studio envs add <name> <url>\`; custom entries live in ~/.config/lattice/config.toml.
59
+ If this CLI cannot complete a documented step, read that environment's docs
60
+ before trying another tool. \`seq-studio envs list\` prints each environment URL.
61
+ Docs: <url>/docs. Feedback guide: <url>/docs/raw/seq-studio/feedback.md.
62
+ Sequence: https://sequence.seqholdings.com/docs
63
+ and https://sequence.seqholdings.com/docs/raw/seq-studio/feedback.md.
59
64
  `;
60
65
  const PROCESS_USAGE = `usage:
61
66
  seq-studio process init <dir>
@@ -1,26 +1,17 @@
1
- import {
2
- defineProcess,
3
- defineNativeAutomationNode,
4
- defineHumanNode,
5
- } from '@sequenceholdings/lattice'
6
-
7
- // Automation nodes run a function registered in the Atlas native-function
8
- // registry, referenced by id. `health-check` is the built-in reference handler;
9
- // swap in your own id once you register it under
10
- // atlas/src/server/lib/lattice/native-functions/functions/.
11
- const start = defineNativeAutomationNode({
12
- id: 'start',
13
- title: 'Start',
14
- outgoing_edges: [{ id: 'start-to-review', to: 'review' }] as const,
15
- function: 'health-check',
16
- })
1
+ import { defineProcess, defineHumanNode } from '@sequenceholdings/lattice'
17
2
 
3
+ // A starter process any author can publish: people-only steps, so it needs no
4
+ // service account. To automate a step, add a Managed Function or agent node
5
+ // (defineManagedFunctionNode / defineAgentNode) with
6
+ // `run_as: { service_account: '<account id>' }` — automation always runs as a
7
+ // service account you hold the Actor role on. `close` is the natural step to
8
+ // replace with a function that records the result.
18
9
  const review = defineHumanNode({
19
10
  id: 'review',
20
11
  title: 'Review',
21
12
  outgoing_edges: [
22
- { id: 'approve', to: 'done' },
23
- { id: 'reject', to: 'done' },
13
+ { id: 'approve', to: 'close' },
14
+ { id: 'reject', to: 'close' },
24
15
  ] as const,
25
16
  artifact_refs: [],
26
17
  metadata: {},
@@ -29,17 +20,20 @@ const review = defineHumanNode({
29
20
  on_timeout_edge_id: 'reject',
30
21
  })
31
22
 
32
- const done = defineNativeAutomationNode({
33
- id: 'done',
34
- title: 'Done',
23
+ // No outgoing edges: completing this step completes the run.
24
+ const close = defineHumanNode({
25
+ id: 'close',
26
+ title: 'Close',
35
27
  outgoing_edges: [] as const,
36
- function: 'health-check',
28
+ artifact_refs: [],
29
+ metadata: {},
30
+ completeLabel: 'Close',
37
31
  })
38
32
 
39
33
  export default defineProcess({
40
34
  id: '{{slug}}',
41
35
  name: '{{name}}',
42
36
  entity: { type: '{{slug}}' },
43
- start_node_id: 'start',
44
- nodes: [start, review, done],
37
+ start_node_id: 'review',
38
+ nodes: [review, close],
45
39
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/studio-cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth whoami`. Includes Auth0 browser login shared with seqapi.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -43,14 +43,14 @@
43
43
  "zod": "^4.1.13",
44
44
  "yaml": "^2.8.4",
45
45
  "@sequenceholdings/agent-spec": "0.1.3",
46
- "@sequenceholdings/artifact-studio": "0.7.1",
46
+ "@sequenceholdings/artifact-studio": "0.8.0",
47
47
  "@sequenceholdings/lattice": "0.1.5",
48
48
  "@sequenceholdings/managed-functions": "0.4.1",
49
49
  "@sequenceholdings/storage": "0.1.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@sequenceholdings/pipeline-spec": "0.2.5",
53
- "@sequenceholdings/orm": "2.6.1"
52
+ "@sequenceholdings/orm": "2.6.1",
53
+ "@sequenceholdings/pipeline-spec": "0.2.5"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@sequenceholdings/orm": {
@@ -1,26 +1,17 @@
1
- import {
2
- defineProcess,
3
- defineNativeAutomationNode,
4
- defineHumanNode,
5
- } from '@sequenceholdings/lattice'
6
-
7
- // Automation nodes run a function registered in the Atlas native-function
8
- // registry, referenced by id. `health-check` is the built-in reference handler;
9
- // swap in your own id once you register it under
10
- // atlas/src/server/lib/lattice/native-functions/functions/.
11
- const start = defineNativeAutomationNode({
12
- id: 'start',
13
- title: 'Start',
14
- outgoing_edges: [{ id: 'start-to-review', to: 'review' }] as const,
15
- function: 'health-check',
16
- })
1
+ import { defineProcess, defineHumanNode } from '@sequenceholdings/lattice'
17
2
 
3
+ // A starter process any author can publish: people-only steps, so it needs no
4
+ // service account. To automate a step, add a Managed Function or agent node
5
+ // (defineManagedFunctionNode / defineAgentNode) with
6
+ // `run_as: { service_account: '<account id>' }` — automation always runs as a
7
+ // service account you hold the Actor role on. `close` is the natural step to
8
+ // replace with a function that records the result.
18
9
  const review = defineHumanNode({
19
10
  id: 'review',
20
11
  title: 'Review',
21
12
  outgoing_edges: [
22
- { id: 'approve', to: 'done' },
23
- { id: 'reject', to: 'done' },
13
+ { id: 'approve', to: 'close' },
14
+ { id: 'reject', to: 'close' },
24
15
  ] as const,
25
16
  artifact_refs: [],
26
17
  metadata: {},
@@ -29,17 +20,20 @@ const review = defineHumanNode({
29
20
  on_timeout_edge_id: 'reject',
30
21
  })
31
22
 
32
- const done = defineNativeAutomationNode({
33
- id: 'done',
34
- title: 'Done',
23
+ // No outgoing edges: completing this step completes the run.
24
+ const close = defineHumanNode({
25
+ id: 'close',
26
+ title: 'Close',
35
27
  outgoing_edges: [] as const,
36
- function: 'health-check',
28
+ artifact_refs: [],
29
+ metadata: {},
30
+ completeLabel: 'Close',
37
31
  })
38
32
 
39
33
  export default defineProcess({
40
34
  id: '{{slug}}',
41
35
  name: '{{name}}',
42
36
  entity: { type: '{{slug}}' },
43
- start_node_id: 'start',
44
- nodes: [start, review, done],
37
+ start_node_id: 'review',
38
+ nodes: [review, close],
45
39
  })