@sequenceholdings/artifact-studio 0.4.0 → 0.6.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.
- package/README.md +35 -1
- package/VERSION-PIN.md +29 -0
- package/dist/active-deploy-policy.d.ts +9 -3
- package/dist/active-deploy-policy.js +20 -8
- package/dist/artifact-env-bindings.d.ts +9 -0
- package/dist/artifact-env-bindings.js +32 -0
- package/dist/build.js +6 -0
- package/dist/cli.js +62 -13
- package/dist/deployment-validation.d.ts +2 -0
- package/dist/deployment-validation.js +2 -0
- package/dist/dev-link.js +28 -2
- package/dist/env-binding-scan.d.ts +10 -0
- package/dist/env-binding-scan.js +179 -0
- package/dist/env-bindings.d.ts +52 -0
- package/dist/env-bindings.js +180 -0
- package/dist/gateway/control.d.ts +33 -0
- package/dist/gateway/control.js +29 -0
- package/dist/gateway/hosted-proxy.d.ts +5 -0
- package/dist/gateway/hosted-proxy.js +4 -1
- package/dist/gateway/lattice-invoke.d.ts +48 -0
- package/dist/gateway/lattice-invoke.js +245 -0
- package/dist/gateway/lattice-upstream.d.ts +38 -0
- package/dist/gateway/lattice-upstream.js +136 -0
- package/dist/gateway/server.js +2 -3
- package/dist/gateway/session.d.ts +3 -1
- package/dist/gateway/session.js +10 -3
- package/dist/manifest-next.d.ts +55 -0
- package/dist/manifest-next.js +35 -2
- package/dist/manifest-static.d.ts +35 -0
- package/dist/manifest-static.js +12 -0
- package/dist/manifest.d.ts +48 -0
- package/dist/next-build.d.ts +2 -1
- package/dist/next-build.js +12 -7
- package/dist/offline/cache.d.ts +4 -0
- package/dist/offline/cache.js +7 -0
- package/dist/offline/connector.d.ts +28 -0
- package/dist/offline/connector.js +122 -0
- package/dist/offline/crypto.d.ts +5 -0
- package/dist/offline/crypto.js +24 -0
- package/dist/offline/index.d.ts +8 -0
- package/dist/offline/index.js +7 -0
- package/dist/offline/indexed-db.d.ts +10 -0
- package/dist/offline/indexed-db.js +104 -0
- package/dist/offline/management-types.d.ts +25 -0
- package/dist/offline/management-types.js +1 -0
- package/dist/offline/outbox.d.ts +7 -0
- package/dist/offline/outbox.js +46 -0
- package/dist/offline/replay.d.ts +25 -0
- package/dist/offline/replay.js +192 -0
- package/dist/offline/secure-store.d.ts +6 -0
- package/dist/offline/secure-store.js +51 -0
- package/dist/offline/types.d.ts +162 -0
- package/dist/offline/types.js +1 -0
- package/dist/orm-json-scalars.d.ts +21 -0
- package/dist/orm-json-scalars.js +21 -0
- package/dist/runtime-contracts.d.ts +7 -7
- package/dist/runtime-contracts.js +1 -1
- package/dist/sdk-orm.d.ts +7 -1
- package/dist/sdk-orm.js +12 -5
- package/dist/sdk.d.ts +134 -1
- package/dist/server/api-client.d.ts +26 -0
- package/dist/server/api-client.js +38 -0
- package/dist/server/broker-contract.d.ts +191 -5
- package/dist/server/broker-contract.js +142 -1
- package/dist/server/client.d.ts +82 -47
- package/dist/server/client.js +138 -59
- package/dist/server/connection-retry.d.ts +12 -0
- package/dist/server/connection-retry.js +40 -0
- package/dist/server/errors.d.ts +61 -0
- package/dist/server/errors.js +89 -0
- package/dist/server/external-context.d.ts +21 -0
- package/dist/server/external-context.js +19 -0
- package/dist/server/internal/signed-token.d.ts +15 -0
- package/dist/server/internal/signed-token.js +67 -0
- package/dist/server/internal/v1-context.d.ts +18 -0
- package/dist/server/internal/v1-context.js +26 -0
- package/dist/server/internal/verify-any.d.ts +22 -0
- package/dist/server/internal/verify-any.js +53 -0
- package/dist/server/logger.d.ts +1 -1
- package/dist/server/managed-server-path.d.ts +6 -0
- package/dist/server/managed-server-path.js +14 -0
- package/dist/server/principal.d.ts +48 -0
- package/dist/server/principal.js +39 -0
- package/dist/server/processes.d.ts +290 -0
- package/dist/server/processes.js +56 -0
- package/dist/server/request-context.d.ts +121 -3
- package/dist/server/request-context.js +111 -33
- package/dist/server/testing.d.ts +40 -0
- package/dist/server/testing.js +86 -0
- package/dist/server.d.ts +13 -4
- package/dist/server.js +6 -2
- package/dist/source-resolver.d.ts +9 -2
- package/dist/source-resolver.js +55 -8
- package/dist/templates/nextjs/AGENTS.md +10 -0
- package/dist/templates/nextjs/CLAUDE.md +1 -0
- package/dist/templates/nextjs/README.md +88 -0
- package/dist/templates/nextjs/package.json +3 -1
- package/dist/templates/nextjs/tests/server.test.mjs +25 -0
- package/dist/templates/react-vite/AGENTS.md +8 -88
- package/dist/templates/react-vite/CLAUDE.md +0 -6
- package/dist/templates/react-vite/package.json +1 -1
- package/dist/templates/react-vite/src/App.tsx +37 -14
- package/dist/templates/react-vite/src/styles.css +10 -0
- package/package.json +15 -3
- package/templates/nextjs/AGENTS.md +10 -0
- package/templates/nextjs/CLAUDE.md +1 -0
- package/templates/nextjs/README.md +88 -0
- package/templates/nextjs/package.json +3 -1
- package/templates/nextjs/tests/server.test.mjs +25 -0
- package/templates/react-vite/AGENTS.md +8 -88
- package/templates/react-vite/CLAUDE.md +0 -6
- package/templates/react-vite/package.json +1 -1
- package/templates/react-vite/src/App.tsx +37 -14
- package/templates/react-vite/src/styles.css +10 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
1
2
|
import { seq } from '@sequenceholdings/artifact-studio'
|
|
2
3
|
import {
|
|
3
4
|
Button,
|
|
@@ -15,23 +16,36 @@ const CARDS = [
|
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
export default function App() {
|
|
19
|
+
const [status, setStatus] = useState<'idle' | 'pending' | 'ok' | 'error'>('idle')
|
|
20
|
+
|
|
18
21
|
async function pingAtlas() {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
setStatus('pending')
|
|
23
|
+
try {
|
|
24
|
+
await seq.api.get<{ ok?: boolean }>('/api/health')
|
|
25
|
+
setStatus('ok')
|
|
26
|
+
} catch {
|
|
27
|
+
setStatus('error')
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
return (
|
|
24
|
-
<main className="min-h-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
<main className="min-h-full bg-background p-roomy text-foreground sm:p-10">
|
|
33
|
+
<div>
|
|
34
|
+
<p className="mb-2 text-xs font-extrabold uppercase tracking-widest text-primary">
|
|
35
|
+
Artifact Studio
|
|
36
|
+
</p>
|
|
37
|
+
<h1 className="text-lg font-bold tracking-tight">Build on Atlas</h1>
|
|
38
|
+
</div>
|
|
39
|
+
<p className="mt-2 max-w-2xl leading-relaxed text-muted-foreground">
|
|
40
|
+
This app uses Atlas's shared UI component library. Import any component
|
|
41
|
+
from{' '}
|
|
42
|
+
<code className="font-mono text-sm">
|
|
43
|
+
@sequenceholdings/atlas-ui
|
|
44
|
+
</code>
|
|
45
|
+
.
|
|
32
46
|
</p>
|
|
33
47
|
|
|
34
|
-
<div className="grid
|
|
48
|
+
<div className="mt-7 grid max-w-3xl grid-cols-1 gap-inline-loose sm:grid-cols-3">
|
|
35
49
|
{CARDS.map((card) => (
|
|
36
50
|
<Card key={card.label}>
|
|
37
51
|
<CardHeader>
|
|
@@ -46,9 +60,18 @@ export default function App() {
|
|
|
46
60
|
))}
|
|
47
61
|
</div>
|
|
48
62
|
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
<div className="mt-6 flex flex-wrap items-center gap-inline">
|
|
64
|
+
<Button
|
|
65
|
+
size="lg"
|
|
66
|
+
className="min-h-11"
|
|
67
|
+
disabled={status === 'pending'}
|
|
68
|
+
onClick={() => void pingAtlas()}
|
|
69
|
+
>
|
|
70
|
+
{status === 'pending' ? 'Testing…' : 'Test Atlas API bridge'}
|
|
71
|
+
</Button>
|
|
72
|
+
{status === 'ok' ? <Badge variant="secondary">Atlas responded</Badge> : null}
|
|
73
|
+
{status === 'error' ? <Badge variant="destructive">Request failed</Badge> : null}
|
|
74
|
+
</div>
|
|
52
75
|
</main>
|
|
53
76
|
)
|
|
54
77
|
}
|
|
@@ -10,3 +10,13 @@
|
|
|
10
10
|
build-time injection. At DES-227 cutover, tokens.css becomes v2 — drop the
|
|
11
11
|
explicit tokens.v2 / theme.v2 imports (and the CLI stops injecting them). */
|
|
12
12
|
@source "../node_modules/@sequenceholdings/atlas-ui/dist";
|
|
13
|
+
|
|
14
|
+
html,
|
|
15
|
+
body,
|
|
16
|
+
#root {
|
|
17
|
+
min-height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.6.1",
|
|
13
13
|
"description": "SDK types and CLI library for building Artifact Studio apps. Driven via `seq-studio artifact <sub>` (@sequenceholdings/studio-cli), which runs the `./cli` runCli export.",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"types": "./dist/sdk.d.ts",
|
|
18
18
|
"default": "./dist/sdk.js"
|
|
19
19
|
},
|
|
20
|
+
"./offline": {
|
|
21
|
+
"types": "./dist/offline/index.d.ts",
|
|
22
|
+
"default": "./dist/offline/index.js"
|
|
23
|
+
},
|
|
20
24
|
"./cli": {
|
|
21
25
|
"types": "./dist/cli.d.ts",
|
|
22
26
|
"default": "./dist/cli.js"
|
|
@@ -101,6 +105,10 @@
|
|
|
101
105
|
"types": "./dist/server/release-forms.d.ts",
|
|
102
106
|
"default": "./dist/server/release-forms.js"
|
|
103
107
|
},
|
|
108
|
+
"./server/testing": {
|
|
109
|
+
"types": "./dist/server/testing.d.ts",
|
|
110
|
+
"default": "./dist/server/testing.js"
|
|
111
|
+
},
|
|
104
112
|
"./next": {
|
|
105
113
|
"types": "./dist/next.d.ts",
|
|
106
114
|
"default": "./dist/next.js"
|
|
@@ -120,6 +128,10 @@
|
|
|
120
128
|
"./tunnel": {
|
|
121
129
|
"types": "./dist/tunnel/index.d.ts",
|
|
122
130
|
"default": "./dist/tunnel/index.js"
|
|
131
|
+
},
|
|
132
|
+
"./offline-management": {
|
|
133
|
+
"types": "./dist/offline/management-types.d.ts",
|
|
134
|
+
"default": "./dist/offline/management-types.js"
|
|
123
135
|
}
|
|
124
136
|
},
|
|
125
137
|
"files": [
|
|
@@ -146,9 +158,9 @@
|
|
|
146
158
|
"google-auth-library": "^10.5.0",
|
|
147
159
|
"server-only": "0.0.1",
|
|
148
160
|
"parse5": "7.3.0",
|
|
149
|
-
"@sequenceholdings/lattice-form-renderer": "0.
|
|
161
|
+
"@sequenceholdings/lattice-form-renderer": "0.2.0",
|
|
150
162
|
"@sequenceholdings/storage": "0.1.0",
|
|
151
|
-
"@sequenceholdings/orm": "2.
|
|
163
|
+
"@sequenceholdings/orm": "2.3.0"
|
|
152
164
|
},
|
|
153
165
|
"devDependencies": {
|
|
154
166
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Sequence development
|
|
2
|
+
|
|
3
|
+
Before every development task, read the live documentation for this project's
|
|
4
|
+
target environment. Find the environment's URL with `seq-studio envs list`
|
|
5
|
+
(or the project configuration), then open `<environment-url>/docs`.
|
|
6
|
+
|
|
7
|
+
Start with that site's `/docs/llms.txt` index and follow the relevant pages as
|
|
8
|
+
needed. The hosted docs are the single source of truth for platform usage;
|
|
9
|
+
do not duplicate their instructions in this file. If docs access is blocked,
|
|
10
|
+
open the same URL in the signed-in browser.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -77,6 +77,94 @@ platform-user relations also read `<namespace>/platformUsers`). Under
|
|
|
77
77
|
`data.write`, use `<namespace>/ops/<Operation>` for each persisted mutation the
|
|
78
78
|
app runs, or `<namespace>/<table>` for table-level coverage.
|
|
79
79
|
|
|
80
|
+
To start a Lattice process, list its id under `processes.start` and call
|
|
81
|
+
`processes.start({ process, runId, title, entity, metadata, assignments })`
|
|
82
|
+
from a server action or route handler. The run starts as the signed-in user (or
|
|
83
|
+
the attached service account, through `asService()`) and needs that identity's
|
|
84
|
+
Invoker grant on the process. `runId` is an idempotency key: starting the same
|
|
85
|
+
id again returns the existing run. `metadata` is the run's input
|
|
86
|
+
(`ctx.run.metadata`). `assignments` names who works each human node
|
|
87
|
+
(`{ execute: { groups: ['<group id>'] } }`), as `POST /api/lattice/runs` takes
|
|
88
|
+
it; Atlas refuses principals it has tombstoned. The start node and version stay
|
|
89
|
+
with the process.
|
|
90
|
+
|
|
91
|
+
To read a process's runs, list its id under `processes.read` and call
|
|
92
|
+
`processes.listRuns({ process, status, entity, limit, archived })` or
|
|
93
|
+
`processes.getRun(runId)`. Both answer as `GET /api/lattice/runs` and
|
|
94
|
+
`GET /api/lattice/runs/[runId]` would for the signed-in user: the list holds
|
|
95
|
+
only runs that user may view, `getRun` needs Viewer on the run and returns
|
|
96
|
+
`{ run, steps, states, event_cursor }`, and `run.metadata` is blank on read for
|
|
97
|
+
every viewer — keep the data your pages need in your own ORM namespace. Reads
|
|
98
|
+
work from pages and GET route handlers; starting a run does not.
|
|
99
|
+
|
|
100
|
+
The same `processes.read` declaration lets you render the process itself.
|
|
101
|
+
`processes.describe({ process, version })` returns the applied template a run
|
|
102
|
+
is filled in from — `{ id, name, version, new_runs_disabled, start_node_id,
|
|
103
|
+
input_schema, nodes }` — for the active version, or for a run's
|
|
104
|
+
`processVersion` to show the template that run started from. Every node lists
|
|
105
|
+
its `id`, `kind`, `title`, `description` and `outgoing_edges`; a `human` node
|
|
106
|
+
also carries what a person working it is shown: `advance_edges`,
|
|
107
|
+
`complete_label`, the author's `metadata` bag (form fields, surface hints) and
|
|
108
|
+
`comments_enabled`. Automation, agent and function internals are the process's
|
|
109
|
+
own and never appear. It needs Viewer on the process, which anyone who may
|
|
110
|
+
start it has. `processes.listTasks({ processes, view, limit })` lists the
|
|
111
|
+
signed-in user's own human steps across your declared processes (a subset, or
|
|
112
|
+
all of them) — `view: 'active'` (default) for steps waiting on them,
|
|
113
|
+
`'completed'` for ones they finished — each with its run and node identity plus
|
|
114
|
+
the node's `title`, interpolated `description`, `advance_edges`,
|
|
115
|
+
`complete_label` and `metadata`. It is always the caller's queue: there is no
|
|
116
|
+
way to ask for someone else's, and nothing in a task lets you advance it
|
|
117
|
+
without the user's own Lattice authority.
|
|
118
|
+
|
|
119
|
+
To work those steps, list the process id under `processes.act` as well and
|
|
120
|
+
call, from a server action or a non-GET route handler:
|
|
121
|
+
`processes.advance({ runId, stepId, edgeId, payload })` completes one of the
|
|
122
|
+
signed-in user's parked steps — `edgeId` is one of the node's `advance_edges`
|
|
123
|
+
(omit it on a terminal node), `payload` is the step's output, and `stepId`
|
|
124
|
+
disambiguates when a parallel block has several human branches parked. It
|
|
125
|
+
needs the user's own `advancer` grant on that step: the application cannot
|
|
126
|
+
complete a step as someone else. `processes.assign({ runId, stepId, users,
|
|
127
|
+
groups })` reassigns a parked step (its advancers become exactly those
|
|
128
|
+
principals) and `processes.grantViewers` / `processes.revokeViewers({ runId,
|
|
129
|
+
users, groups })` share a run or take a share back; all three need the user to
|
|
130
|
+
own the run, and `processes.listViewers(runId)` shows the run's stored shares.
|
|
131
|
+
Users are Auth0 subs and groups are chat-group ids — take them from
|
|
132
|
+
`processes.searchPrincipals({ q, types, limit })`, which finds people in the
|
|
133
|
+
user's own tenant and groups they can see, as the Lattice picker does. The
|
|
134
|
+
same applies through `asService()`: the attached service account acts under its
|
|
135
|
+
own grants, with no elevation.
|
|
136
|
+
|
|
137
|
+
A refused process call rejects with an `ArtifactServerError` whose `status` is
|
|
138
|
+
Atlas's and whose `atlas` field keeps what Atlas said: `atlas.detail` is the
|
|
139
|
+
reason, `atlas.code` the route's machine code when it has one — an advance
|
|
140
|
+
answers `RUN_TERMINAL` (410) once the run has finished, `WORKFLOW_NOT_RUNNING`
|
|
141
|
+
(409) while a fresh run's workflow is still being dispatched (retry shortly),
|
|
142
|
+
`NO_PARKED_STEP` and `EDGE_ID_MISMATCH` (409) when the step moved on or was
|
|
143
|
+
completed another way. Branch on `atlas.code`, not on the message text.
|
|
144
|
+
|
|
145
|
+
Lattice calls this server only at paths listed under `server.lattice.accept`.
|
|
146
|
+
Each entry is an exact origin-relative path (`/api/hooks/lattice`), with no
|
|
147
|
+
wildcards. A process node names that path; the caller needs `end_user` on this
|
|
148
|
+
app. The signed request context includes the Lattice run, node, step, and
|
|
149
|
+
process ids.
|
|
150
|
+
|
|
151
|
+
Feature flags need no declaration. `flags.isEnabled(name)` (or
|
|
152
|
+
`flags.evaluate(names)` for up to 32 at once) asks Atlas, which evaluates them
|
|
153
|
+
for the signed-in user as its own routes do, from any route, page or action. A
|
|
154
|
+
refused call rejects, so treat a failure as off where a flag gates a change.
|
|
155
|
+
|
|
156
|
+
To keep an audit trail of what users do in the application, declare
|
|
157
|
+
`audit: { service: artifact_studio }` under `server.capabilities` and call
|
|
158
|
+
`audit.record({ action, detail, resources, metadata })` from the server, for
|
|
159
|
+
example `{ action: 'view', detail: 'invoices.view', resources: [{ type:
|
|
160
|
+
'invoice', id }] }`. Atlas records it for the signed-in user, adds where it
|
|
161
|
+
came from (project, deployment, request) and resolves once the audit log has it.
|
|
162
|
+
Reads may record from GET handlers and pages. An application that replaces a
|
|
163
|
+
product's Atlas routes can record under that product's audit service once
|
|
164
|
+
Atlas registers the project for it. `metadata` takes scalars that say what
|
|
165
|
+
happened, such as counts, outcomes and what was searched for. Never put request
|
|
166
|
+
bodies, document contents or secrets in it.
|
|
167
|
+
|
|
80
168
|
Managed secrets stay in hosted runtimes. For local integration tests, use your
|
|
81
169
|
own test credentials, mocks or an existing governed function. Use a hosted
|
|
82
170
|
preview for application code that needs a managed secret. Never put secrets in
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"dev": "next dev --webpack --hostname 127.0.0.1",
|
|
11
11
|
"build": "next build",
|
|
12
12
|
"start": "next start --hostname 127.0.0.1",
|
|
13
|
-
"
|
|
13
|
+
"lint": "next typegen && tsc --noEmit --noUnusedLocals --noUnusedParameters --noFallthroughCasesInSwitch",
|
|
14
|
+
"type-check": "next typegen && tsc --noEmit",
|
|
15
|
+
"test": "node --test tests/*.test.mjs"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
16
18
|
"@sequenceholdings/artifact-studio": "{{artifactStudioVersion}}",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { test } from 'node:test'
|
|
3
|
+
import { greet } from '../app/actions.ts'
|
|
4
|
+
import { GET } from '../app/api/health/route.ts'
|
|
5
|
+
|
|
6
|
+
test('greeting validates input and returns the server action result', async () => {
|
|
7
|
+
const data = new FormData()
|
|
8
|
+
data.set('name', ' Atlas ')
|
|
9
|
+
assert.deepEqual(await greet({ message: '', error: null }, data), {
|
|
10
|
+
message: 'Hello, Atlas. Your server action ran successfully.', error: null,
|
|
11
|
+
})
|
|
12
|
+
for (const name of ['', ' '.repeat(3), 'a'.repeat(81)]) {
|
|
13
|
+
data.set('name', name)
|
|
14
|
+
const result = await greet({ message: '', error: null }, data)
|
|
15
|
+
assert.equal(result.message, '')
|
|
16
|
+
assert.equal(result.error, 'Enter a name between 1 and 80 characters.')
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('health route returns uncached JSON without any runtime bindings', async () => {
|
|
21
|
+
const response = GET()
|
|
22
|
+
assert.equal(response.status, 200)
|
|
23
|
+
assert.equal(response.headers.get('cache-control'), 'no-store')
|
|
24
|
+
assert.deepEqual(await response.json(), { ok: true, framework: 'nextjs' })
|
|
25
|
+
})
|
|
@@ -1,90 +1,10 @@
|
|
|
1
|
-
# Sequence
|
|
1
|
+
# Sequence development
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Before every development task, read the live documentation for this project's
|
|
4
|
+
target environment. Find the environment's URL with `seq-studio envs list`
|
|
5
|
+
(or the project configuration), then open `<environment-url>/docs`.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { unwrap, seq } from './lib/api'
|
|
10
|
-
const customer = await unwrap<Customer>(seq.api.get(`/api/crm/customers/${id}`))
|
|
11
|
-
```
|
|
12
|
-
For endpoints with extra envelope fields (pagination `meta`, warnings), drop to `seq.api.fetch` and read `res.body` directly.
|
|
13
|
-
|
|
14
|
-
2. **FormData blocker.** `seq.api.fetch` `JSON.stringify`s any non-string `body` value, which silently turns `FormData` into `"{}"`. For multipart uploads, use `seq.api.upload(path, file, fields?, options?)`; the bridge constructs `FormData` in the trusted host and returns the usual `{ ok, status, body }` envelope.
|
|
15
|
-
|
|
16
|
-
3. **Capability matcher: exact paths, `/*` prefix wildcards, and single-segment `*` patterns.** `{id}` template forms do **not** match. List both the bare path and the prefix wildcard for broad resources, or use a least-privilege segment pattern for dynamic routes:
|
|
17
|
-
```yaml
|
|
18
|
-
- /api/crm/customers
|
|
19
|
-
- /api/crm/customers/*
|
|
20
|
-
- /api/lattice/runs/*/advance
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Prerequisite
|
|
24
|
-
|
|
25
|
-
None — `seq-studio artifact init <dir>` works from any directory; no monorepo checkout is required. The template lists `@sequenceholdings/artifact-studio` and `@sequenceholdings/atlas-ui` in **devDependencies** for local editor/type-check tooling only. `seq-studio artifact build|deploy` bundles against the CLI's own pinned copies of `react`, `react-dom`, `@tanstack/react-query`, `react-router-dom`, `sonner`, and `@sequenceholdings/atlas-ui`, and resolves `@sequenceholdings/artifact-studio` to the CLI-pinned SDK, whose `seq` export uses the host-injected `window.seq`. The SDK also provides `createArtifactOrmExecutor({ namespace, manifest })` for persisted ORM operations; declare `/api/data/v2/<namespace>` under `capabilities.api.write`, including queries (execution uses POST). The helper handles the ORM envelope; do not pass its result to the CRM `unwrap()` helper. Remote deploys (`--repo` / `--git-url`) run `pnpm install --prod` for **app-specific** `dependencies` only (e.g. `recharts`, `reactflow`) from the artifact lockfile.
|
|
26
|
-
|
|
27
|
-
## Package manager
|
|
28
|
-
|
|
29
|
-
Use **pnpm** for artifacts you will deploy from git — `seq-studio artifact build|deploy --repo/--git-url` runs `pnpm install --frozen-lockfile --prod` when `package.json` is present, so commit `pnpm-lock.yaml`. Local editor-only installs can use another package manager, but pnpm keeps Sequence's `minimumReleaseAge` supply-chain quarantine in effect (see the studio-cli README). If you have a stale checkout from the old `file:`-link era, `rm -rf node_modules` and reinstall.
|
|
30
|
-
|
|
31
|
-
## Key files
|
|
32
|
-
|
|
33
|
-
| File | Role |
|
|
34
|
-
|---|---|
|
|
35
|
-
| `artifact.bundle.yml` | Capability manifest — every API path the artifact calls: exact paths, `/*` prefix wildcards, or single-segment `*` patterns |
|
|
36
|
-
| `src/main.tsx` | Providers: `QueryClientProvider` → `PortalContainerProvider` → `App` |
|
|
37
|
-
| `src/App.tsx` | Entrypoint UI |
|
|
38
|
-
| `src/lib/api.ts` | `unwrap<T>` envelope helper + re-export of `seq` |
|
|
39
|
-
| `src/styles.css` | Tailwind v4 + canonical `@sequenceholdings/atlas-ui/tokens.css` |
|
|
40
|
-
| `vite.config.ts` | Vite + React + Tailwind v4 plugin |
|
|
41
|
-
|
|
42
|
-
## Defaults
|
|
43
|
-
|
|
44
|
-
- UI: prefer `@sequenceholdings/atlas-ui` primitives (`Button`, `Card`, `Input`, `Dialog`, `Select`, `Checkbox`, `DropdownMenu`, `KpiTile`, `Switch`, …) over raw Tailwind. The design-system cutover made `Select`, `Checkbox`, `DropdownMenu`, `Command`, `Calendar`, `ScrollArea`, `Table`, and the Task family first-class exports — use them directly; fall back to `Popover` compositions or native controls only when a component is genuinely missing.
|
|
45
|
-
- Routing: `HashRouter`. Mount routes at `/`, not at the Atlas app prefix.
|
|
46
|
-
- Data: React Query is wired in `src/main.tsx`. Use `useQuery` / `useMutation` against `unwrap(seq.api.*)`.
|
|
47
|
-
- Icons: do **not** add third-party deps like `@tabler/icons-react`. Deploys from git (`--repo` / `--git-url`) build a bare tree — `seq-studio` runs `pnpm install --prod` from your lockfile, then aliases platform peers (`react`, `react-dom`, `@tanstack/react-query`, `react-router-dom`, `sonner`, `@sequenceholdings/atlas-ui`). List only app-specific imports (e.g. `recharts`) in `dependencies`; do not add file/workspace `@sequenceholdings/*` specs in git-service repos, because remote installs only accept registry semver specs. Inline SVG components in `src/icons.tsx`.
|
|
48
|
-
|
|
49
|
-
## Tokens — colour comes from semantic roles, never a raw ramp
|
|
50
|
-
|
|
51
|
-
This app bundles `@sequenceholdings/atlas-ui/tokens.css` and re-themes per tenant for free. Reach for a **semantic role** and colour follows the host brand and light/dark automatically.
|
|
52
|
-
|
|
53
|
-
**Never** use the numbered `black-*` / `white-*` opacity scales (`text-black-40`, `bg-black-6`, `border-black-10`), raw Tailwind neutrals (`gray|slate|zinc|neutral|stone-N`), arbitrary hex in class strings (`bg-[#1f2937]`), or `var(--black-*)` / `var(--color-black-*)`. These are **retired** — post-cutover they resolve to nothing or to a fixed ink that won't flip in dark. Bare `text-white` / `bg-black` and opacity modifiers like `bg-foreground/10` stay legal; only the numbered steps and raw palettes are banned. There is no old→new lookup table on purpose — pick by *what the element is and what it sits on*.
|
|
54
|
-
|
|
55
|
-
| Situation | Role |
|
|
56
|
-
|---|---|
|
|
57
|
-
| The page surface | `bg-background` — the page only, never a panel |
|
|
58
|
-
| Bordered/rounded panel, card, list | `bg-card` — a border is not a surface; every bordered container needs an explicit surface |
|
|
59
|
-
| Inset well inside a card (code block, read-only value) | `bg-muted` |
|
|
60
|
-
| Form field (input, textarea, select trigger) | `bg-field` |
|
|
61
|
-
| Interactive / hover fill | `bg-accent` / `bg-surface-hover` |
|
|
62
|
-
| Selected / active / focus state fill | `bg-foreground/8`–`bg-foreground/15` overlay |
|
|
63
|
-
| Modal scrim behind a dialog | `bg-overlay` — never `bg-foreground/N` (washes lighter in dark) |
|
|
64
|
-
| Primary text | `text-foreground` |
|
|
65
|
-
| Resting nav items, meta rows | `text-foreground-secondary` |
|
|
66
|
-
| Section labels, captions | `text-muted-foreground` |
|
|
67
|
-
| Standard border | `border-border` (form controls: `border-input`) |
|
|
68
|
-
|
|
69
|
-
Surfaces **nest** — never repeat a rung (`bg-card` inside `bg-card` is invisible): `bg-background` (page) → `bg-card` (panel, + border + `shadow-xs` to lift) → `bg-muted` (inset well).
|
|
70
|
-
|
|
71
|
-
**Dual-runtime.** Inside Atlas the artifact runs in its own iframe and inherits nothing — the runtime posts the host's resolved brand in as inline custom properties (theme channel + `data-tokens`). Standalone `vite dev` has no host, so the artifact must still render on the base semantic roles. **Do not** bundle `tokens.v2.tenants.css`, hardcode an opco's brand, or add `[data-theme]` selectors — that pins the artifact to one tenant.
|
|
72
|
-
|
|
73
|
-
## Bridge methods
|
|
74
|
-
|
|
75
|
-
Two primitives on `seq.api`:
|
|
76
|
-
|
|
77
|
-
- `seq.api.fetch(path, options?)` returns `{ ok, status, body }` — does not throw on non-2xx. Use when you need the status (e.g. handle 409) or the raw envelope with extra fields like `meta`.
|
|
78
|
-
- `seq.api.request(method, path, body?)` throws on non-2xx and returns parsed JSON. Sugar wrappers `seq.api.get / .post / .patch / .delete` are thin shells around `request`, so they also throw.
|
|
79
|
-
|
|
80
|
-
Wrap reads/writes that should auto-throw through `unwrap()` in `src/lib/api.ts`. Drop to `seq.api.fetch` when you need pagination `meta` or status inspection.
|
|
81
|
-
|
|
82
|
-
## Lattice embed context
|
|
83
|
-
|
|
84
|
-
When the artifact is served from a Lattice human node (the **Tasks/Inbox** task surface, or the builder Artifacts tab), `seq.lattice.context()` tells you which run/node/step you're rendering for:
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
const { runId, nodeId, stepId, processId } = seq.lattice.context()
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
It's **synchronous** (the host injects this into the sandbox up front — no bridge round trip) and each field is `null` when unavailable. The Inbox provides all four; the builder Artifacts tab has no live `stepId`; a standalone open has no context at all. Use it instead of hand-parsing `window.location` — that's the sanctioned, stable accessor, and you don't need to declare anything in `artifact.bundle.yml` for it. To read step-scoped data, pass `runId`/`stepId` to the relevant Atlas endpoint (which still authorizes the caller server-side).
|
|
7
|
+
Start with that site's `/docs/llms.txt` index and follow the relevant pages as
|
|
8
|
+
needed. The hosted docs are the single source of truth for platform usage;
|
|
9
|
+
do not duplicate their instructions in this file. If docs access is blocked,
|
|
10
|
+
open the same URL in the signed-in browser.
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
# Sequence Artifact Studio app
|
|
2
|
-
|
|
3
|
-
Agent instructions for this artifact live in `AGENTS.md` — one file every coding agent reads
|
|
4
|
-
(Cursor and Codex load `AGENTS.md` natively; the import below pulls it in for Claude Code).
|
|
5
|
-
Add or edit guidance in `AGENTS.md`, not here.
|
|
6
|
-
|
|
7
1
|
@AGENTS.md
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@sequenceholdings/artifact-studio": "^0.
|
|
12
|
+
"@sequenceholdings/artifact-studio": "^0.6.0",
|
|
13
13
|
"@sequenceholdings/atlas-ui": "^3.1.1",
|
|
14
14
|
"@tailwindcss/postcss": "^4.2.2",
|
|
15
15
|
"@tailwindcss/vite": "^4.2.2",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
1
2
|
import { seq } from '@sequenceholdings/artifact-studio'
|
|
2
3
|
import {
|
|
3
4
|
Button,
|
|
@@ -15,23 +16,36 @@ const CARDS = [
|
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
export default function App() {
|
|
19
|
+
const [status, setStatus] = useState<'idle' | 'pending' | 'ok' | 'error'>('idle')
|
|
20
|
+
|
|
18
21
|
async function pingAtlas() {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
setStatus('pending')
|
|
23
|
+
try {
|
|
24
|
+
await seq.api.get<{ ok?: boolean }>('/api/health')
|
|
25
|
+
setStatus('ok')
|
|
26
|
+
} catch {
|
|
27
|
+
setStatus('error')
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
return (
|
|
24
|
-
<main className="min-h-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
<main className="min-h-full bg-background p-roomy text-foreground sm:p-10">
|
|
33
|
+
<div>
|
|
34
|
+
<p className="mb-2 text-xs font-extrabold uppercase tracking-widest text-primary">
|
|
35
|
+
Artifact Studio
|
|
36
|
+
</p>
|
|
37
|
+
<h1 className="text-lg font-bold tracking-tight">Build on Atlas</h1>
|
|
38
|
+
</div>
|
|
39
|
+
<p className="mt-2 max-w-2xl leading-relaxed text-muted-foreground">
|
|
40
|
+
This app uses Atlas's shared UI component library. Import any component
|
|
41
|
+
from{' '}
|
|
42
|
+
<code className="font-mono text-sm">
|
|
43
|
+
@sequenceholdings/atlas-ui
|
|
44
|
+
</code>
|
|
45
|
+
.
|
|
32
46
|
</p>
|
|
33
47
|
|
|
34
|
-
<div className="grid
|
|
48
|
+
<div className="mt-7 grid max-w-3xl grid-cols-1 gap-inline-loose sm:grid-cols-3">
|
|
35
49
|
{CARDS.map((card) => (
|
|
36
50
|
<Card key={card.label}>
|
|
37
51
|
<CardHeader>
|
|
@@ -46,9 +60,18 @@ export default function App() {
|
|
|
46
60
|
))}
|
|
47
61
|
</div>
|
|
48
62
|
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
<div className="mt-6 flex flex-wrap items-center gap-inline">
|
|
64
|
+
<Button
|
|
65
|
+
size="lg"
|
|
66
|
+
className="min-h-11"
|
|
67
|
+
disabled={status === 'pending'}
|
|
68
|
+
onClick={() => void pingAtlas()}
|
|
69
|
+
>
|
|
70
|
+
{status === 'pending' ? 'Testing…' : 'Test Atlas API bridge'}
|
|
71
|
+
</Button>
|
|
72
|
+
{status === 'ok' ? <Badge variant="secondary">Atlas responded</Badge> : null}
|
|
73
|
+
{status === 'error' ? <Badge variant="destructive">Request failed</Badge> : null}
|
|
74
|
+
</div>
|
|
52
75
|
</main>
|
|
53
76
|
)
|
|
54
77
|
}
|
|
@@ -10,3 +10,13 @@
|
|
|
10
10
|
build-time injection. At DES-227 cutover, tokens.css becomes v2 — drop the
|
|
11
11
|
explicit tokens.v2 / theme.v2 imports (and the CLI stops injecting them). */
|
|
12
12
|
@source "../node_modules/@sequenceholdings/atlas-ui/dist";
|
|
13
|
+
|
|
14
|
+
html,
|
|
15
|
+
body,
|
|
16
|
+
#root {
|
|
17
|
+
min-height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|