@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.
- package/README.md +265 -81
- package/dist/app/adapters.d.ts +9 -0
- package/dist/app/adapters.js +176 -0
- package/dist/app/commands.d.ts +2 -2
- package/dist/app/commands.js +98 -22
- package/dist/app/deploy.d.ts +9 -10
- package/dist/app/deploy.js +83 -141
- package/dist/app/graph.d.ts +15 -0
- package/dist/app/graph.js +36 -0
- package/dist/app/manifest-validation.d.ts +16 -0
- package/dist/app/manifest-validation.js +99 -0
- package/dist/app/manifest.d.ts +27 -9
- package/dist/app/manifest.js +23 -107
- package/dist/app/paths.d.ts +14 -0
- package/dist/app/paths.js +77 -0
- package/dist/app/primitive-scaffold.d.ts +18 -0
- package/dist/app/primitive-scaffold.js +136 -0
- package/dist/app/readme.d.ts +4 -18
- package/dist/app/readme.js +107 -229
- package/dist/app/run-deployment.d.ts +8 -0
- package/dist/app/run-deployment.js +50 -0
- package/dist/app/scaffold-files.d.ts +13 -0
- package/dist/app/scaffold-files.js +68 -0
- package/dist/app/scaffold.d.ts +11 -3
- package/dist/app/scaffold.js +77 -245
- package/dist/app/workspace-compile.d.ts +18 -0
- package/dist/app/workspace-compile.js +143 -0
- package/dist/app/workspace-model.d.ts +70 -0
- package/dist/app/workspace-model.js +159 -0
- package/dist/app/workspace-scaffold.d.ts +27 -0
- package/dist/app/workspace-scaffold.js +126 -0
- package/dist/app/workspace.d.ts +14 -0
- package/dist/app/workspace.js +147 -0
- package/dist/atlas-client.js +28 -6
- package/dist/auth-cmds/commands.d.ts +1 -1
- package/dist/auth-cmds/commands.js +5 -2
- package/dist/functions/commands.js +7 -1
- package/dist/functions/manifest.d.ts +18 -0
- package/dist/functions/manifest.js +29 -4
- package/dist/main.js +9 -4
- package/dist/orm/delegate.js +30 -23
- package/dist/pat-hints.js +1 -0
- package/dist/pipeline/commands.js +27 -9
- package/dist/pipeline/lifecycle.d.ts +2 -0
- package/dist/pipeline/lifecycle.js +91 -11
- package/dist/process/build.js +59 -43
- package/dist/process/codegen.d.ts +3 -2
- package/dist/process/codegen.js +143 -27
- package/dist/process/commands.d.ts +2 -0
- package/dist/process/commands.js +63 -18
- package/dist/process/discover.d.ts +6 -3
- package/dist/process/discover.js +11 -3
- package/dist/process/lint.d.ts +14 -0
- package/dist/process/lint.js +143 -5
- package/dist/process/plan-diff.d.ts +8 -0
- package/dist/process/plan-diff.js +61 -4
- package/dist/process/safety-baseline.d.ts +154 -0
- package/dist/process/safety-baseline.js +387 -0
- package/dist/process/simulate.js +64 -22
- package/dist/repos/commands.d.ts +1 -1
- package/dist/repos/commands.js +29 -3
- package/package.json +8 -7
package/dist/process/simulate.js
CHANGED
|
@@ -10,10 +10,21 @@
|
|
|
10
10
|
* - Stubs automation runner identically — native handlers live in the
|
|
11
11
|
* Atlas image and can't execute here
|
|
12
12
|
*/
|
|
13
|
-
import { DEFAULT_MAX_FANOUT_WIDTH, isJoinUndecided, } from '@sequenceholdings/lattice/define';
|
|
13
|
+
import { DEFAULT_MAX_FANOUT_WIDTH, isJoinUndecided, isJsonataExpr, MAX_PROCESS_ITERATIONS_CEILING, MAX_PROCESS_REVISITS_CEILING, } from '@sequenceholdings/lattice/define';
|
|
14
14
|
import { extractOutputState, mergeRunState } from '@sequenceholdings/lattice';
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import { evaluateJsonata } from '@sequenceholdings/lattice/jsonata-runtime';
|
|
16
|
+
function recordDispatch({ budget, nodeId, }) {
|
|
17
|
+
budget.iterations += 1;
|
|
18
|
+
if (budget.iterations > budget.maxIterations) {
|
|
19
|
+
throw new Error(`iteration cap (${budget.maxIterations}) exceeded`);
|
|
20
|
+
}
|
|
21
|
+
const visitsForNode = (budget.visitsByNodeId.get(nodeId) ?? 0) + 1;
|
|
22
|
+
budget.visitsByNodeId.set(nodeId, visitsForNode);
|
|
23
|
+
if (visitsForNode > budget.maxRevisits) {
|
|
24
|
+
throw new Error(`revisit cap (${budget.maxRevisits}) exceeded for node "${nodeId}"`);
|
|
25
|
+
}
|
|
26
|
+
return budget.iterations;
|
|
27
|
+
}
|
|
17
28
|
export async function simulateProcess(opts) {
|
|
18
29
|
const proc = opts.process;
|
|
19
30
|
const startId = opts.startNodeId ?? proc.start_node_id;
|
|
@@ -25,27 +36,23 @@ export async function simulateProcess(opts) {
|
|
|
25
36
|
error: `start_node_id "${startId}" not found in process "${proc.id}"`,
|
|
26
37
|
};
|
|
27
38
|
}
|
|
28
|
-
const maxIterations = opts.maxIterations ??
|
|
29
|
-
const maxRevisits = opts.maxRevisits ??
|
|
30
|
-
const
|
|
39
|
+
const maxIterations = opts.maxIterations ?? proc.max_iterations ?? MAX_PROCESS_ITERATIONS_CEILING;
|
|
40
|
+
const maxRevisits = opts.maxRevisits ?? proc.max_revisits ?? MAX_PROCESS_REVISITS_CEILING;
|
|
41
|
+
const budget = {
|
|
42
|
+
iterations: 0,
|
|
43
|
+
visitsByNodeId: new Map(),
|
|
44
|
+
maxIterations,
|
|
45
|
+
maxRevisits,
|
|
46
|
+
};
|
|
31
47
|
const steps = [];
|
|
32
48
|
const upstream = {};
|
|
33
49
|
let runState = opts.state ?? {};
|
|
34
50
|
const processesById = opts.processesById ??
|
|
35
51
|
new Map([[proc.id, proc]]);
|
|
36
52
|
let current = startNode;
|
|
37
|
-
let iteration = 0;
|
|
38
53
|
try {
|
|
39
54
|
for (;;) {
|
|
40
|
-
iteration
|
|
41
|
-
if (iteration > maxIterations) {
|
|
42
|
-
throw new Error(`iteration cap (${maxIterations}) exceeded`);
|
|
43
|
-
}
|
|
44
|
-
const visitsForNode = (visits.get(current.id) ?? 0) + 1;
|
|
45
|
-
visits.set(current.id, visitsForNode);
|
|
46
|
-
if (visitsForNode > maxRevisits) {
|
|
47
|
-
throw new Error(`revisit cap (${maxRevisits}) exceeded for node "${current.id}"`);
|
|
48
|
-
}
|
|
55
|
+
const iteration = recordDispatch({ budget, nodeId: current.id });
|
|
49
56
|
const ctx = {
|
|
50
57
|
entity: opts.entity ? { type: opts.entity.type, id: opts.entity.id } : null,
|
|
51
58
|
upstream: upstream,
|
|
@@ -67,6 +74,7 @@ export async function simulateProcess(opts) {
|
|
|
67
74
|
humanDecisions: opts.humanDecisions ?? {},
|
|
68
75
|
iteration,
|
|
69
76
|
processesById,
|
|
77
|
+
budget,
|
|
70
78
|
record: (step) => steps.push(step),
|
|
71
79
|
});
|
|
72
80
|
const statePatch = extractOutputState(output);
|
|
@@ -131,6 +139,13 @@ export async function simulateProcess(opts) {
|
|
|
131
139
|
}
|
|
132
140
|
async function runInputMapperIfAny(node, ctx) {
|
|
133
141
|
const mapper = node.input;
|
|
142
|
+
if (isJsonataExpr(mapper)) {
|
|
143
|
+
return evaluateJsonata({
|
|
144
|
+
label: `node:${node.id} input`,
|
|
145
|
+
expr: mapper.expr,
|
|
146
|
+
input: ctx,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
134
149
|
if (typeof mapper !== 'function')
|
|
135
150
|
return ctx;
|
|
136
151
|
return Promise.resolve(mapper(ctx));
|
|
@@ -204,7 +219,16 @@ async function simulateParallel(args, node) {
|
|
|
204
219
|
node.branches.forEach((b, i) => branches.push({ branchId: b.branch_id, index: i, item: null, sub: b.node }));
|
|
205
220
|
}
|
|
206
221
|
else {
|
|
207
|
-
const items = node.fan_out
|
|
222
|
+
const items = isJsonataExpr(node.fan_out)
|
|
223
|
+
? await evaluateJsonata({
|
|
224
|
+
label: `node:${node.id} fan_out`,
|
|
225
|
+
expr: node.fan_out.expr,
|
|
226
|
+
input: args.ctx,
|
|
227
|
+
})
|
|
228
|
+
: node.fan_out(args.ctx);
|
|
229
|
+
if (!Array.isArray(items)) {
|
|
230
|
+
throw new Error(`parallel node "${node.id}" fan_out must return an array; got ${typeof items}`);
|
|
231
|
+
}
|
|
208
232
|
const cap = node.max_fanout ?? DEFAULT_MAX_FANOUT_WIDTH;
|
|
209
233
|
if (items.length > cap) {
|
|
210
234
|
throw new Error(`parallel node "${node.id}" fan_out produced ${items.length} items; ` +
|
|
@@ -214,6 +238,7 @@ async function simulateParallel(args, node) {
|
|
|
214
238
|
}
|
|
215
239
|
const results = [];
|
|
216
240
|
for (const br of branches) {
|
|
241
|
+
const iteration = recordDispatch({ budget: args.budget, nodeId: br.sub.id });
|
|
217
242
|
const branchCtx = {
|
|
218
243
|
...args.ctx,
|
|
219
244
|
branch: { id: br.branchId, index: br.index, item: br.item },
|
|
@@ -224,12 +249,13 @@ async function simulateParallel(args, node) {
|
|
|
224
249
|
input: subInput,
|
|
225
250
|
ctx: branchCtx,
|
|
226
251
|
humanDecisions: args.humanDecisions,
|
|
227
|
-
iteration
|
|
252
|
+
iteration,
|
|
228
253
|
processesById: args.processesById,
|
|
254
|
+
budget: args.budget,
|
|
229
255
|
record: args.record,
|
|
230
256
|
});
|
|
231
257
|
args.record({
|
|
232
|
-
iteration
|
|
258
|
+
iteration,
|
|
233
259
|
node_id: br.sub.id,
|
|
234
260
|
kind: br.sub.kind,
|
|
235
261
|
input: subInput,
|
|
@@ -251,7 +277,14 @@ async function simulateParallel(args, node) {
|
|
|
251
277
|
// simulate verifies topology/routing, not settlement timing). In that case
|
|
252
278
|
// the eager contract requires a decision; surface a sentinel return as the
|
|
253
279
|
// same clear error the runtime raises instead of a confusing edge failure.
|
|
254
|
-
const joinOutput = node.join
|
|
280
|
+
const joinOutput = isJsonataExpr(node.join)
|
|
281
|
+
? (await evaluateJsonata({
|
|
282
|
+
label: `node:${node.id} join`,
|
|
283
|
+
expr: node.join.expr,
|
|
284
|
+
input: args.ctx,
|
|
285
|
+
bindings: { branches: results },
|
|
286
|
+
}))
|
|
287
|
+
: node.join(results, args.ctx);
|
|
255
288
|
if (isJoinUndecided(joinOutput)) {
|
|
256
289
|
throw new Error(node.join_mode === 'eager'
|
|
257
290
|
? `parallel node "${node.id}": eager join returned {undecided: true} with ` +
|
|
@@ -313,14 +346,23 @@ async function simulateSubprocess(args, node) {
|
|
|
313
346
|
throw new Error(childResult.error ?? `child process "${node.process}" simulation failed`);
|
|
314
347
|
}
|
|
315
348
|
const childOutput = childResult.steps.at(-1)?.output;
|
|
316
|
-
|
|
349
|
+
const childRun = {
|
|
317
350
|
run_id: 'sim-child',
|
|
318
351
|
process_id: node.process,
|
|
319
352
|
version: node.version ?? 'simulate',
|
|
320
353
|
status: childFailed ? 'failed' : 'completed',
|
|
321
354
|
output: childOutput,
|
|
322
355
|
...(childResult.error ? { error: childResult.error } : {}),
|
|
323
|
-
}
|
|
356
|
+
};
|
|
357
|
+
if (isJsonataExpr(node.output)) {
|
|
358
|
+
return evaluateJsonata({
|
|
359
|
+
label: `node:${node.id} output`,
|
|
360
|
+
expr: node.output.expr,
|
|
361
|
+
input: args.ctx,
|
|
362
|
+
bindings: { child: childRun },
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return node.output(childRun, args.ctx);
|
|
324
366
|
}
|
|
325
367
|
export function formatSimulateResult(result) {
|
|
326
368
|
const lines = [];
|
package/dist/repos/commands.d.ts
CHANGED
|
@@ -96,6 +96,6 @@ export declare function reposCiRequireCommand(args: ParsedArgs): Promise<number>
|
|
|
96
96
|
export declare function reposCiImportCommand(args: ParsedArgs): Promise<number>;
|
|
97
97
|
export declare function reposCiCommand(args: ParsedArgs): Promise<number>;
|
|
98
98
|
export declare function reposDeleteCommand(args: ParsedArgs): Promise<number>;
|
|
99
|
-
export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] create a repo
|
|
99
|
+
export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend gcs_isomorphic|walgit]\n create a repo (GCS default, seed README;\n walgit starts empty on main; needs namespace write)\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--out dir]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--out dir]\n smart-HTTP when ATLAS_GIT_PAT is set;\n otherwise JSON materialize (<ns>/<name>)\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview discovered CI checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> reserved (refuses write until sandboxed runner)\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] reserved (refuses write until sandboxed runner)\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone prefers real git clone (PAT via askpass \u2014 never written into the remote\n URL). Without ATLAS_GIT_PAT, <ns>/<name> falls back to the JSON API and prints\n how to get a PAT (seq-studio or Atlas UI /settings/tokens).\n PAT without Auth0 login: use --url from Repositories \u2192 Clone (or --id <uuid>).\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 clone then checkout).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings \u2192 Tokens)\n";
|
|
100
100
|
export declare function runReposCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
101
101
|
export {};
|
package/dist/repos/commands.js
CHANGED
|
@@ -234,6 +234,9 @@ export async function reposShowCommand(args) {
|
|
|
234
234
|
console.log(` path: ${namespace}/${name}`);
|
|
235
235
|
console.log(` id: ${repo.id}`);
|
|
236
236
|
console.log(` default branch: ${repo.defaultBranch}`);
|
|
237
|
+
if (repo.gitBackend) {
|
|
238
|
+
console.log(` git backend: ${repo.gitBackend}`);
|
|
239
|
+
}
|
|
237
240
|
console.log(` created: ${shortDate(repo.createdAt)} by ${repo.createdBy}`);
|
|
238
241
|
console.log(` updated: ${shortDate(repo.updatedAt)}`);
|
|
239
242
|
console.log(` clone (PAT as basic-auth password): ${cloneUrl(ctx, repo.id)}`);
|
|
@@ -262,16 +265,37 @@ export async function reposShowCommand(args) {
|
|
|
262
265
|
}
|
|
263
266
|
return 0;
|
|
264
267
|
}
|
|
268
|
+
const GIT_BACKEND_KINDS = ['gcs_isomorphic', 'walgit'];
|
|
269
|
+
const GIT_BACKEND_KIND_SET = new Set(GIT_BACKEND_KINDS);
|
|
270
|
+
function parseGitBackendFlag(args) {
|
|
271
|
+
const gitBackend = stringFlag(args.flags, 'git-backend');
|
|
272
|
+
if (gitBackend === undefined)
|
|
273
|
+
return undefined;
|
|
274
|
+
if (!GIT_BACKEND_KIND_SET.has(gitBackend)) {
|
|
275
|
+
throw new Error(`--git-backend must be ${GIT_BACKEND_KINDS.join(' or ')} (got "${gitBackend}").`);
|
|
276
|
+
}
|
|
277
|
+
return gitBackend;
|
|
278
|
+
}
|
|
265
279
|
export async function reposCreateCommand(args) {
|
|
266
280
|
const { namespace, name } = parseRepoPath(args.positional[0]);
|
|
267
281
|
const ctx = await reposContext(args);
|
|
268
282
|
const defaultBranch = stringFlag(args.flags, 'default-branch');
|
|
283
|
+
const gitBackend = parseGitBackendFlag(args);
|
|
284
|
+
if (gitBackend === 'walgit' && defaultBranch !== undefined && defaultBranch !== 'main') {
|
|
285
|
+
throw new Error('walgit create does not set HEAD from --default-branch; omit it or use main.');
|
|
286
|
+
}
|
|
269
287
|
const repo = await postJson({
|
|
270
288
|
...clientOptions(ctx),
|
|
271
289
|
path: '/api/git-service/repos',
|
|
272
|
-
body: {
|
|
290
|
+
body: {
|
|
291
|
+
namespaceSlug: namespace,
|
|
292
|
+
name,
|
|
293
|
+
...(defaultBranch ? { defaultBranch } : {}),
|
|
294
|
+
...(gitBackend ? { gitBackend } : {}),
|
|
295
|
+
},
|
|
273
296
|
});
|
|
274
|
-
|
|
297
|
+
const backend = repo.gitBackend ?? gitBackend;
|
|
298
|
+
console.log(`${LOG} created ${namespace}/${name} (id=${repo.id}, default branch ${repo.defaultBranch}${backend ? `, gitBackend=${backend}` : ''}) on ${ctx.env.name}`);
|
|
275
299
|
return 0;
|
|
276
300
|
}
|
|
277
301
|
async function materializeTree({ ctx, namespace, name, destDir, ref, verb, }) {
|
|
@@ -748,7 +772,9 @@ export const REPOS_USAGE = `usage:
|
|
|
748
772
|
seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment
|
|
749
773
|
seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces
|
|
750
774
|
seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)
|
|
751
|
-
seq-studio repos create <ns>/<name> -e <env> [--default-branch b]
|
|
775
|
+
seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend gcs_isomorphic|walgit]
|
|
776
|
+
create a repo (GCS default, seed README;
|
|
777
|
+
walgit starts empty on main; needs namespace write)
|
|
752
778
|
seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--out dir] [--force]
|
|
753
779
|
seq-studio repos clone --url <https://…/repos/<id>/git> -e <env> [--ref r] [--out dir]
|
|
754
780
|
seq-studio repos clone --id <uuid> -e <env> [--ref r] [--out dir]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
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 pat`. Includes Auth0 browser login shared with seqapi.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"esbuild": "^0.25.0",
|
|
40
|
+
"js-yaml": "^4.3.2",
|
|
41
|
+
"smol-toml": "^1.7.1",
|
|
41
42
|
"tsx": "^4.20.3",
|
|
42
43
|
"zod": "^4.1.13",
|
|
43
44
|
"@sequenceholdings/agent-spec": "0.1.2",
|
|
44
|
-
"@sequenceholdings/artifact-studio": "0.2.
|
|
45
|
+
"@sequenceholdings/artifact-studio": "0.2.3",
|
|
45
46
|
"@sequenceholdings/lattice": "0.1.2"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"@sequenceholdings/orm": "0.
|
|
49
|
+
"@sequenceholdings/orm": "2.0.0",
|
|
49
50
|
"@sequenceholdings/pipeline-spec": "0.1.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependenciesMeta": {
|
|
@@ -60,8 +61,8 @@
|
|
|
60
61
|
"@types/js-yaml": "^4.0.9",
|
|
61
62
|
"@types/node": "^22.0.0",
|
|
62
63
|
"typescript": "^5.6.0",
|
|
63
|
-
"vitest": "^4.1.
|
|
64
|
-
"@sequenceholdings/orm": "0.
|
|
64
|
+
"vitest": "^4.1.11",
|
|
65
|
+
"@sequenceholdings/orm": "2.0.0",
|
|
65
66
|
"@sequenceholdings/pipeline-spec": "0.1.0"
|
|
66
67
|
},
|
|
67
68
|
"engines": {
|