Developer Guide 2 — Recipes: how do I…?
Sibling guides: dev-1-getting-started.md · dev-3-services-directory.md · dev-4-api-and-mcp.md · dev-5-flows-connections-expressions.md · dev-6-refusals-troubleshooting.md.
D2.0 How to read a recipe#
Every control in the Workbench is a typed tool call to the Kernel. Each recipe gives the UI path first, then the tool call that path makes, so you can script it or hand it to an agent.
- A tool call that edits takes
compositionId/compositionTitleas optional extras. Open a composition withveda_begin_compositionand pass its uuid back, and the edits undo as one step (D2.14).compositionIdmust be a Kernel-generated uuid: "compositionId must be a uuid, got …". - Ids are prefixed (
entity:,flow:,conn:,policy:,decision:,glossary:,process:,workspace:,app:). Most tools accept the app id with or withoutapp:. - The model is not the database and not the running app. Most recipes end with "regenerate and deploy" (Generate on the app's project page, then the Deployment Center: Part 7). The tool results say so, for example: "the model changed; a database already migrated is not altered — regenerate the app and the DDL, and migrate".
- Writes need the verb the control asks for. The Workbench dims a control unless the signed-in builder holds it, even when the Kernel's bindings are open (
CLAUDE.md, Workbench UI). The dimmed control prints "Needs …" and names the verb.
| Recipe | Goal |
|---|---|
| D2.1 | Add a field to an Entity and read the migration verdict |
| D2.2 | Rename or retype a field safely |
| D2.3 | Add a row policy |
| D2.4 | Give an app a database |
| D2.5 | Call a REST service from a Flow |
| D2.6 | Expose a Flow as an authenticated endpoint |
| D2.7 | Call a Flow from a Process service task |
| D2.8 | Add a Decision and bind a Glossary term |
| D2.9 | Start a case from the Work Portal and from code |
| D2.10 | Change an Environment's app address |
| D2.11 | Rotate an API key |
| D2.12 | Import an existing HTML page |
| D2.13 | Export and import an app |
| D2.14 | Undo a Veda or tool composition |
| D2.15 | Read a Flow run and replay it |
D2.1 Add a field to an Entity and read the migration verdict#
- UI: open the Data model designer on the Entity. In the right panel under Add a field (or + Add field under the table) set Name, Type, optional Required, Unique, Default value, Comment, then Add field (Training Day 1, Lab 3).
- Tool:
{ "tool": "entity_add_field",
"args": { "entityId": "entity:customer",
"field": { "name": "income", "type": "decimal", "precision": 18, "scale": 2,
"description": "Monthly income, THB" } } }Field types are string, text, integer, decimal, boolean, date, datetime, time, binary, json, uuid, vector (entity.schema.json). A field's properties are name, type, length, precision, scale, required, unique, default, description, dimensions, sensitive, version, autoNumber plus the ones the tools write for you.
- Preview the migration before touching a database. Tool
data_migration_plan(workspaceId,environment,entityRef, optionalfield, plusappReforconnectionRef) returns the database's recorded version, each change withsafe / unsafe / blocked, and the exact SQL. It reads Data Studio's reader login and no rows. Dev only:data_apply_migration(workspaceId,environment,entityRef,toSeq, plusappRef/connectionRef) runs a complete, safe migration in one transaction. Anything that can lose data goes through a release. - Offline alternative:
cd kernel-poc && node src/generate-migration.js --entity entity:customer --from-seq 3 [--dialect postgres] [--out <dir>]. It diffs two versions from the event log and writes SQL; it never connects to a database.--allow-destructiveexists, but blocked migrations are never emitted even with it (Part 2 "Refuse rather than guess"). - DDL for a whole app:
node src/generate-ddl.js --app loan-onboarding --dialect oracle --out ../generated/ddl(seven dialects).
D2.2 Rename or retype a field safely#
Change a column's type, length, nullability, default or comment, or its name, without delete-and-re-add.
Know that a rename is never inferred: it is a separate, explicit argument. A primary-key column cannot be renamed or retyped here.
- UI: select the field, press Edit. Type, length or digits, Default value, Required, Unique and Comment sit behind one Save; a verdict box ("safe — Safe for a table that already has rows. Checked for postgres.") appears before you save. Rename is a separate confirmed action in the field's own panel and does not go through the Save bar (
designer-data-model/src/plugin.tsx). - Dry run first (writes nothing):
{ "tool": "entity_set_field",
"args": { "entityId": "entity:customer", "field": "fullName",
"renameTo": "displayName", "dryRun": true } }- Real call: the same arguments without
dryRun. Edits go inchanges(type, length, precision, scale, dimensions, required, unique, default, description;nullremoves a property). Other arguments:dialects,acknowledgeDependents,allowBlocked. - Rename records the old name on the field (
renamedFrom), so the migration is a realRENAME COLUMN(on SQL Serversp_rename), not drop + add, and the data survives. In the same composition it moves what is structured: this entity's indexes, relation joins andwriteColumns, other entities' foreign keys that join to the column, and the widgets and grid columns of Forms bound to the entity. - Places that hold the old name only as text (row filters, formulas, Content, flow SQL, expressions, page bindings, other apps) are not rewritten. The call is refused and lists them. Fix them, or pass exactly that list as
acknowledgeDependents. - Migrate this entity before the entities that relate to it, then regenerate the app.
data_migration_plan shows a rename, not a column drop. The result's note says "renamed in the model, and everything structured that named it moved with it".
Real messages from entity-field-edit.js:
<field> is part of the primary key — changing its … rewrites every table that references it: plan it as a data migration<field> is an end of … — a foreign key's two columns must keep the same type, so it cannot be changed from one side"<to>" is not a column name — letters, digits and _, starting with a letter, up to 63 characters"<to>" differs from "<field>" only by case — most databases would call that the same column- A blocked type change (for example text to number on Postgres) is refused with the engine's reason; the designer says "add a new field, copy the data across and remove the old one".
allowBlocked: truesaves the model change anyway without migrating the database. - A stale edit is refused (optimistic concurrency).
allowBlocked: true saves the model change anyway without migrating the database.
D2.3 Add a row policy#
Limit which rows a role sees and which columns it may change.
The Entity must not serve public reads: a public read has no session for a filter to apply to, and the two are refused against each other in either order. Roles are named as they appear in the token. The filter reads the entity's own columns and claims.<name> from the verified session; claim values are always bound parameters, never interpolated.
- UI: Data model designer, section Add a row policy (existing ones show as
Policy · <role>). Fill Role and Filter, press Save policy for. The header shows a badge such as "1 row policy". - Tool:
{ "tool": "entity_set_row_policy",
"args": { "entityId": "entity:loan-application", "role": "agent",
"filter": "assignedTo == claims.sub",
"writeColumns": ["status", "notes"] } }writeColumns is the only set of columns the role may change on the rows its filter admits; [] makes it read-only. A role with writeColumns cannot create or delete rows. Omitting writeColumns on a later call keeps the earlier restriction; allColumns: true is the one way to lift it.
3. Regenerate the app. The result says it plainly: "enforced by the generated API, NOT by the DDL — regenerate the app for it to take effect".
4. Remove with entity_remove_row_policy (entityId, role, optional allowUnfiltered). Removing a role's filter while others remain makes that role see no rows (narrowing). Removing the last filter would let every signed-in user see every row, so it needs allowUnfiltered: true; the designer asks first and says that access widens.
row filter for role '<role>' is not usable: unknown column '<x>'writeColumns for role '<role>' names '<c>', which is not a field of this entity; also "names the primary key" and "names the version column" (the server bumps it).writeColumns and allColumns: true contradict — name the columns, or lift the restriction, not both- Public reads on: refused, designer text "Can't be made public while 1 row policy exists".
Removing the last filter would let every signed-in user see every row, so it needs allowUnfiltered: true; the designer asks first and says that access widens.
D2.4 Give an app a database#
A Postgres database (schema, tables, Data Studio logins) for an app in an environment.
The app must be in a workspace (app_set_workspace places it; app_add_database will not place it for you). The environment needs a database server: one that some Connection of the workspace is already bound to with an owner login. If the environment has none yet, you name the first one (below).
- UI: Data Studio, Set up a database. The owner login is pasted write-only there (Part 7 §7.5). The Kernel never holds it.
- Plan (read-only):
{ "tool": "app_database_plan",
"args": { "appId": "app:car-loan", "workspaceId": "workspace:default", "environment": "Dev" } } It lists the servers found, the Connection, schema and host reference it would use, and how many entities would get a table.
3. Make the model half. app_add_database (appId, workspaceId, environment, optional schema, service, database, hostRef) creates conn:<app>-db, binds it in that one environment and declares it the app's database: connection_create, workspace_bind_connection and app_set_database in one composition. It is resumable. The default schema is the app key as a plain name (car-loan becomes car_loan); the default host reference is <APP>_DB_URL. For the first server of an environment pass service (one of its host:port services) and database; the result's ownerSecretKey names the vault key to fill.
4. Make the database half. Either queue it: app_database_setup (workspaceId, environment, appRef), then follow the run with deploy_status / deploy_logs (bundleId = the workspace id). Or run the script: cd kernel-poc && npm run app:db:setup -- --connection conn:car-loan-db --workspace workspace:default --env Dev [--writer] [--revealer] [--skip-logins] [--dry]. It makes the schema and each missing table as the owner, then the reader (and writer/revealer if asked) login. It is re-runnable. A Deploy also runs this step first ("Set up app databases").
Data Studio opens the app and lists its tables. app_database_plan now reports has-database.
Plan/add codes are not-placed, has-database, no-environment, no-server. Real texts:
<app> already declares <conn> as its database<env> has no database server to put it on: nothing of <ws>'s is bound to a Postgres database with an owner login there yet.app_database_setup:<app> declares no database of its own — Data Studio's "Set up a database" (app_add_database) makes one first;… knows Postgres only so far; and"<env>" requires approval from …, so its database changes through a release.
Dialects other than Postgres: setup from here is Postgres only (not verified beyond the refusal text).
The setup script from kernel-poc, previewing first with --dry:
npm run app:db:setup -- --connection conn:car-loan-db --workspace workspace:default --env Dev --dry
npm run app:db:setup -- --connection conn:car-loan-db --workspace workspace:default --env DevD2.5 Call a REST service from a Flow#
A Flow step that calls an external HTTP API with a base URL per environment and a credential kept in the vault.
A Flow exists (trigger required at creation; a Flow created from the UI gets runtime.engine: "node"). The app is in a workspace with an environment whose services are declared (workspace_set_environment_network, D2.10). Concepts: dev-5-flows-connections-expressions.md.
- Create the Connection. UI: app project page, Artifacts, + New, Kind Connection (it opens in the Integration designer). Tool:
{ "tool": "connection_create",
"args": { "appId": "credit-app", "name": "credit-bureau", "kind": "http",
"http": { "baseUrlRef": "CREDIT_BUREAU_URL",
"auth": { "type": "apiKey", "apiKeyHeader": "X-Api-Key",
"secretRef": "vault:bureau/key" } } } } http.auth.type is one of none, basic, apiKey, bearer, oauth2ClientCredentials, signature. Any type other than none needs a secretRef: credentials never live in the artifact. baseUrlRef is an env-var name, not a URL. Connection kind is one of database, http, soap, amqp, kafka, smtp, objectStore, sftp, vector, custom.
2. Bind the Connection to a service per environment (the base URL for Dev, UAT and Prod is bound separately):
{ "tool": "workspace_bind_connection",
"args": { "workspaceId": "workspace:default", "name": "Dev",
"connectionRef": "conn:credit-bureau", "service": "credit-bureau-api",
"basePath": "/v2" } } An http Connection needs a service that declares a scheme; basePath is only for http, objectStore and soap. Each runtime then gets its own resolved value from this binding (connection-env.js names the variables, hub-config.js derives them). Never type a Connection value into a worker's compose file.
3. Set the secret. UI: the Integration designer's Connection editor has a write-only field per secret and environment ("Paste the value"); it shows "set" or "not set" with the vault version. Tool: secret_status (artifactId, optional environment) lists what is needed; secret_set (artifactId, environment, key, value) writes kv/oneweb/<workspace>/<environment>/<KEY>. value is write-only and never returned, logged or stored in the Kernel.
4. Add the step (UI: Add step, the picker entry Call a REST API). Tool:
{ "tool": "flow_add_step",
"args": { "flowId": "flow:score", "step": { "id": "s-bureau", "type": "rest", "name": "Ask the bureau",
"rest": { "connectionRef": "conn:credit-bureau", "url": "/score", "method": "GET" } } } } url is relative to the Connection's base. Declare the variables the step reads with flow_add_variable (flowId, name, type, optional isInput, isOutput, sensitive). Mark personal or secret data sensitive: true, or a declared scalar is recorded in run history.
5. Step headers (rest.headers) cannot carry credentials; use the Connection's auth. Details and the full refused list are in Part 5 §5.1.
Generate the app (or hub_deploy then npm run hub:apply for a Hub runtime) and call the flow. verify:hub-config checks every runtime's derived env against the Environment. Run history shows the step (D2.15).
connection "<name>": kind "http" needs a "http" config block…http.auth: auth.type "apiKey" needs a secretRef — credentials never live in the artifact itselfflow "<id>" step "<id>": connectionRef <id> is kind "<k>" — a "rest" step needs a "http"-kind connectionconn:… is http, addressed by URL — service "<s>" needs a scheme (http/https)<Env> declares no service "<s>" — … set its topology with workspace_set_environment_network firstsecret_setfrom an agent: "… may not set a secret: a value a model holds has already been through its context." A person sets it in the Workbench; an administrator can usenpm run vault:import.
D2.6 Expose a Flow as an authenticated endpoint#
An HTTP route for a Flow, protected by an API key.
An HTTP entry point is always expose (path, method, policy). The trigger kind is webhook or invoke; the deprecated inline trigger.webhook block is refused.
- Create the Policy. UI: + New, Kind API policy. Tool:
{ "tool": "policy_create",
"args": { "appId": "credit-app", "name": "partner-key", "auth": { "type": "apiKey" } } } Auth types are none, apiKey, oauth2ClientCredentials, mtls (plus the mtls flag, tokenTtl, scopes). Change later with policy_set_auth.
2. Publish the Flow. UI: the Flow's Callable as section: Method, Path, Protected by, Save endpoint (Stop exposing… removes it). Tool:
{ "tool": "flow_set_expose",
"args": { "flowId": "flow:score", "expose": { "path": "/hooks/score", "method": "POST",
"policyRef": "policy:partner-key" } } } expose is replaced wholesale. A save that omits subFlowCallers drops it, which breaks callers that run this flow in-process. Re-send the whole object.
3. Mint the key. UI: the Policy editor, Generate key per environment (shows "set · vault vN", never the value). Tool: policy_generate_key (policyId, environment). It writes POLICY_<ID>_API_KEY to the vault and returns only the name and version.
4. Make the app read it: cd kernel-poc && npm run generate:app-env -- --env Dev, then restart the app (it reads env at boot). Regenerate the app so the route exists.
5. Callers send header x-api-key. The generated route enforces it. An unset variable answers 503, never an open door.
Without the header the route refuses; with it the flow runs. secret_status on the policy shows the key set.
policyRef policy:… does not existpolicy_generate_key: "<id>is auth.type … not apiKey — there is no key to generate"; "<KEY>is already set in(vault vN) — … Replace it with an overlap instead" (use D2.11); and "a rotation of … is in progress". secret_seton a Policy: "<id>'s key is ONEWEB's own — policy_generate_key mints it so no person ever sees it, and key:rotate replaces one in use".
Source disagreement: policy_create's tool description still says "Not enforced — no gateway exists yet", but gen-flow.js enforces apiKey (x-api-key) in the generated route and CLAUDE.md says so. Scopes and tokenTtl are not enforced by the app route. Trust the generator.
D2.7 Call a Flow from a Process service task#
A BPM service task that runs a Flow and receives its outputs.
The Flow must be exposed (path and method). The BPM engine's service task can present only an API key, or nothing. A Flow behind oauth2 or mTLS needs an engine-facing door.
- UI: Process designer, select the service task. What runs holds the Flow picker; the Call section shows what the deploy would resolve; Inputs & outputs maps variables. Save the picked flow before the Call section shows it.
- Tool, add the node:
{ "tool": "process_add_service_task",
"args": { "processId": "process:loan-renewal", "id": "n-credit", "name": "Check credit",
"flowRef": "flow:pl-credit-check" } }- Map variables where names differ (replaces the whole service block, so pass every field):
{ "tool": "process_set_service",
"args": { "processId": "process:loan-renewal", "nodeId": "n-credit", "flowRef": "flow:pl-credit-check",
"inputs": [ { "flow": "applicantId", "process": "customerId" } ],
"outputs": [ { "flow": "creditScore", "process": "creditScoreText" } ] } }- Read the resolution without deploying:
process_flow_call(processId,nodeId, read-only). It gives the endpoint, what the engine must present (the key's variable name, never its value), and every problem the deploy would refuse. The deploy compiler throws the same first problem word for word (flow-call.js). - For a flow under oauth2 or mTLS,
flow_create_engine_doorbuilds a<flow>-engineflow that runs the target as a subFlow under its own apiKey policy (arguments: see its schema intools/flow.js; not reproduced here, not verified live). - Deploy through the Deployment Center (processes deploy after identity; Part 7 §7.2).
process_flow_call returns problems: []. A started case moves past the task and the output variable holds the value.
Real texts from flow-call.js:
node '<n>': <flow> has no expose.path/method — it must be a published Flow to be called from a processnode '<n>': <flow> input '<v>' is mapped from process variable '<p>', which the process does not declarenode '<n>': <flow> declares output '<v>', but the process declares no variable named '<v>' to receive it… which is declared type "<t>" — an RSTask output can only ever deliver a String … so this variable must be declared type "string"… declares output '<o>', but none of its steps sets '<o>', so its reply never carries it …(a decision's or REST step's result is the flow'sresp; only a Map step copies it into a variable)… is exposed under <policy> (<type>), which the engine's service task cannot meet … Expose the flow under a policy the engine can meet (apiKey …)- A warning, not a refusal:
<flow>'s endpoint has no policy — anyone who can reach the app can run it.
D2.8 Add a Decision and bind a Glossary term#
A rules table whose columns read in the business's words.
An app. A Glossary is optional; the designer can create one.
- UI: + New, Kind Decision, then the Decision designer. For vocabulary, the Glossary designer (port 3019 per
CLAUDE.md) defines terms; or use a column's Business term section, which also offers to create a term from the column (glossary, term and binding in one undo step). - Create the Decision:
{ "tool": "decision_create",
"args": { "appId": "lending", "name": "risk-route",
"inputs": [ { "name": "amount", "type": "number" } ],
"outputs": [ { "name": "route", "type": "enum", "allowedValues": ["auto", "manual"] } ],
"logic": { "kind": "table", "table": { "hitPolicy": "first", "rules": [
{ "id": "r1", "when": { "amount": "<= 500000" }, "then": { "route": "auto" } },
{ "id": "r2", "when": { "amount": "-" }, "then": { "route": "manual" } } ] } },
"tests": [ { "name": "small", "given": { "amount": 100000 }, "expect": { "route": "auto" } } ] } } Types are string, number, boolean, date, enum. Hit policies are first, unique, any, priority, collect. Cell tests are FEEL unary tests (> 2000000, "TH","SG", [50..70], -). Under first, a rule added after a catch-all never fires; use decision_add_rule with before. The expression parser is FEEL, a separate grammar from the platform's CEL-style one.
3. Create the vocabulary: glossary_create (appId, name), then glossary_set_term (glossaryId, term) with a term { id, label, type, unit?, values?, definition?, synonyms? }. A term id is lower-case kebab (^[a-z][a-z0-9-]{0,62}$) and never renamed. There is also glossary_import_terms for CSV.
4. Bind:
{ "tool": "decision_bind_term",
"args": { "decisionId": "decision:risk-route", "name": "amount", "side": "input",
"term": { "glossaryRef": "glossary:lending", "id": "loan-amount" } } } term: null unbinds. Binding changes how the column reads, never what the rules compare.
5. Test without writing: decision_run_tests (decisionId) and decision_evaluate (decisionId, inputs, optional asOf).
decision_run_tests returns failing: 0. decision_evaluate with { "amount": 100000 } gives route: auto.
cannot bind "<col>" to "<label>":followed by the contradictions (a term of another type, a value the term does not define).<glossary> has no term "<id>" — it has …;"<n>" is both an input and an output — say which (side).- Editing a bound term:
term "<id>" refused:with each affected decision. rule "<id>" tests unknown input "<k>" — declared: …- A bound column cannot be changed against its term: "is bound to the business term … Change the term (glossary_set_term), or unbind the column first".
- A Decision with a failing embedded test is refused at create.
Under first, a rule added after a catch-all never fires; use decision_add_rule with before.
D2.9 Start a case: Work Portal versus code#
A running process instance with its correlated data row.
The process is deployed (D2.7 end; Part 7). Its entry Form's data model has the correlation field bpmInstanceId (text 120); the Process designer offers "Add the correlation field" if it is missing. Writes to the engine need OW_ENGINE_CLIENT_ID/SECRET in the app's env; without them every portal write fails closed.
- Work Portal: sign in to the generated app, + Start a case, fill the entry fields, Start application. The confirmation names the case, then the first task if you hold or may claim it.
- From code, the portal's own route:
POST /api/portal/start/<processKey>with a JSON body of the entry fields (column names). The route creates the engine instance and inserts the correlated row in one step, and answers{ "started": "<instanceId>", "display": … }.
curl -X POST http://localhost:3111/api/portal/start/credit-approval \
-H "content-type: application/json" -H "Cookie: ow_session=<session cookie>" \
-d '{ "applicantName": "Somchai", "amount": 250000 }' Auth: the route needs a signed-in session (getSession). The auth module says data routes accept the cookie or Authorization: Bearer; whether the portal start route accepts a bearer token was not confirmed (not verified). The cookie name ow_session is the generator's default.
3. If the process names a work party for starting, only its members may start. The app address (port) is the one the environment declares (D2.10).
4. Do not start cases on the demo personal-loan apps: they are parked unsubmitted on purpose (use-cases.md note). Use a training app.
The response has started. The Work Portal inbox shows the task; Operations shows the case.
Statuses and texts from the generated route:
- 503
authorization not configured; 401unauthorized. - 403
you are not a member of the work party that starts this process. - 400
invalid JSON body. - 502 with the engine's error text if the engine call fails.
- No start route at all: the portal says "authored, but process:
has no start route in this app — it may be hidden from the Work Portal, or have no user task with a bound form".
Do not start cases on the demo personal-loan apps: they are parked unsubmitted on purpose (use-cases.md note). Use a training app.
D2.10 Change an Environment's app address#
Move where an app answers in one environment (for example Dev from :3101 to :3111).
Sign-in only accepts redirects to the declared address; any other port fails at the identity provider with "Invalid parameter: redirect_uri" (Training Day 2, seen 2026-11-06). Change the address in the Environment, not the identity client.
- UI: the app's Environments tab, App addresses, edit, Save address. It is dimmed with a reason unless you hold
manageConnections. - Tool:
workspace_set_environment_networkreplaces the whole topology (omittingidentity,appBindingsorobservabilityclears them). Read the current workspace first (kernel_get_artifact), change one address, send everything back:
{ "tool": "workspace_set_environment_network",
"args": { "workspaceId": "workspace:default", "name": "Dev",
"networkViews": ["host", "compose"],
"services": [ { "name": "loan-app-dev", "scheme": "http",
"addresses": { "host": "localhost:3111", "compose": "host.docker.internal:3111" } } ],
"appBindings": [ { "appRef": "app:loan-onboarding", "service": "loan-app-dev" } ] } } (Service names and the compose address are illustrative; (not verified) for any real workspace. identity and observability must be re-sent if they were set.)
3. A separate field, app_set_base_url (appId, baseUrl), sets the app's Work Portal origin (an origin only: no path, query or fragment; null removes it). It is per app and declared, not derived. It is not the environment's binding.
4. Re-derive the app's env (npm run generate:app-env -- --env Dev) and restart the app. Redeploy so identity redirect URIs follow the address.
env_runtime_plan (workspaceId, environment, read-only) lists what is still unset, in the deploy's own words. Sign-in returns to the new port.
Real texts:
service "<s>" has no address for view(s) <v> — every service needs one per declared view;… gives an address for undeclared view(s) …;service "<s>" is declared twice.<env> is a production environment and refuses these addresses:(loopback, link-local and the unspecified address in Prod;address-guard.js).removing service(s) … would strand …(a Connection binding or Hub runtime still uses it; unbind first).- A new app binding is refused if the app's data may not reside in this environment's region (
residency.js).
workspace_set_environment_network replaces the whole topology (omitting identity, appBindings or observability clears them). Read the current workspace first, change one address, send everything back.
D2.11 Rotate an API key#
Replace an apiKey Policy's key with no window of 401s.
This is a CLI procedure (key-rotate.js), not a button. Your shell must not set POLICY_<ID>_API_KEY itself: a deployer's env beats the vault. Rotation reaches only the local engine of one environment (KERNEL_ENGINE_ENV, default Dev). Memory notes record that a real Dev rotation had not been run when this was written (not verified live).
cd kernel-poc, then, in order:
npm run key:rotate -- status --policy policy:pl-credit-check --env Devshows what is where, by name and version, never values.npm run key:rotate -- start --policy … --env Devmoves the current key toPOLICY_<ID>_API_KEY_PREVIOUSand writes a new one. Add--dry-runfirst.- For each app it names:
npm run generate:app-env -- --env Dev --app <dir>, then restart the app. The app now accepts both keys. npm run key:rotate -- deploy --policy … --env Dev --apps-restartedredeploys each calling process. The Kernel head compiled with the previous key must equal the deployed bytes, so only the key ships. It then migrates the running cases on the replaced definition, and only those.npm run key:rotate -- finish --policy … --env Devretires the previous key (a soft delete in the vault), thengenerate:app-envand a restart retire it from the apps.abortundoes astartbefore any deploy.
status shows no previous key. Calls with the new key succeed. verify:hub-config names an app block still holding an older vault version.
Real reasons from key-rotate.js:
<VAR> is not in the vault — there is no key to rotate (vault:import it first)a Hub runtime serves a flow under <policy> (…) — the Hub's route accepts ONE key …(a Hub-served policy cannot be rotated this way)app:<x>'s routes do not read <VAR>_PREVIOUS — regenerate it with gen-flow.js's two-key check first, or it would 401 every old definition<VAR> is set in this process's env, and a deploy prefers the env to the vault — unset ita rotation is already in progress (previous vN) — deploy, then finish (or abort)pass --apps-restarted once every app above has been restarted …finishis refused while a running case still sends the previous key (named, with counts).
Do not use policy_generate_key for this: it refuses a key that is already set.
D2.12 Import an existing HTML page#
Turn existing markup into a Page artifact whose elements become design-system components.
A Design system artifact whose component contracts match the markup's classes (for example designsystem:centerx). Without one every element imports as html:*; the tool refuses an unknown design system rather than silently downgrading.
- UI: not located in the sources read for this guide (not verified). Use the tool or the CLI.
- Tool:
{ "tool": "page_import_html",
"args": { "appId": "support-desk", "slug": "queue", "html": "<body>…</body>",
"designSystemRef": "designsystem:centerx", "title": "Queue" } } A whole document is fine; <head> is ignored. The id is page:<slug> unless id is given.
3. CLI: node src/import-html.js --src <file.html> --app <appId> --slug <slug> [--ds designsystem:centerx] [--dry] (or npm run import:html).
4. Read the result: components, rootType, parserWarnings and notImported: unexplained classes, inline styles, scripts and CSS that did not come across. Fix those with the ordinary page tools (page_add_component, page_set_component_styles, …) in one composition.
5. A static imported mock has no data actions; add them (a rest action can carry an entityRef so impact analysis sees the page read an entity).
The result has created: "page:<slug>" and a component count; notImported is the review list. Vendor class names live in the design system, not the importer.
page:<slug> already exists — pick a different slug, pass an explicit id, or edit it with page_add_component(an import never overwrites).unknown design system <ref> — without it every element imports as html:*, so this is refused rather than silently downgraded
An import never overwrites: pick a different slug, pass an explicit id, or edit the existing page.
D2.13 Export and import an app#
Copy a whole app (or one artifact) into another workspace or Kernel as new artifacts.
Read ARTIFACT-TRANSFER.md. A copy is always new, with fresh ids; nothing is overwritten. Rows, uploads and run history are never exported.
- UI, whole app: the project page's Export app (download); on Home, Import app… beside + New app. One artifact: the version chip's ⋯ menu in a designer: Export… and Import a copy into this app….
- Tools:
app_export(appId) returns the envelope ("format": "oneweb-app"). Import with dry run first:
{ "tool": "app_import",
"args": { "envelope": { "…": "the file's content" }, "workspaceId": "workspace:default",
"newAppId": "loan-copy", "dryRun": true } } Then without dryRun. For one artifact: artifact_export (artifactId) and artifact_import (envelope, appId, optional name, tableName, schema, dryRun). A single copy may reference only its own app, plus Groups and Workspaces.
3. What does not travel: owners, role bindings, first admins and members, the environment address and publication state; secret values (refused); API keys (generate the new one, D2.6); a database Connection's reader/writer/revealer logins (the copy gets its own schema and host reference; run D2.4's setup).
4. app_import is manageMembers (placing an app). The whole app is written in one composition with the App last, so a failure leaves no App behind and the copy is one undo (D2.14).
The dry run returns ok, problems, warnings, notes and the creates list. After the real import, open the new app and check its artifacts.
Real texts:
<id> holds a secret value at <paths>. A secret never travels in a file — remove it and export again.No app <id> in this Kernel;No artifact <id> in this Kernel.not-transferablefor an App (useapp_export), a Bundle, a Workspace, the Work Portal's settings or an identity group.- Import plan problems: a name already used in the target app, an entity table already used, an invalid spec, a reference outside the allowed set. The dry run names each.
A secret value is refused on export and on import. A vault: reference is only a name and is kept, so the copy reads the same vault secret; an API key policy gets no key and a database Connection gets no logins in the copy, so set those up for it.
D2.14 Undo a Veda or tool composition#
Revert a group of changes, however many artifacts they touched, as one step.
Only edits that carried a compositionId (or were made in one transaction by the tool itself, like a field rename that updates Forms) undo as a unit. Veda's changes and the Workbench's Save bars are compositions.
- UI: the shell's Undo and Redo buttons undo the last composition; every designer reloads (
reload()). In the Data model designer, Undo removes a just-saved comment. - Tool: open, edit, close, undo.
{ "tool": "veda_begin_composition", "args": { "title": "Add income and rename name" } } Pass the returned uuid as compositionId on each edit, then veda_end_composition (compositionId). To revert: veda_undo_composition (compositionId) returns { reverted }. To restore: veda_redo_composition (compositionId) returns { reapplied }.
3. Redo is a different operation, not undo called twice: undo recomputes the state before the composition's first event, so a second undo does nothing. Always use veda_redo_composition.
4. Provenance: AI edits are recorded with ai: true and shown for approval and undo (Part 4 §4.10); kernel_audit_trail and kernel_diff read the history (read-only; arguments not listed here).
Re-read the artifact with kernel_get_artifact (or reopen the designer): the fields are gone.
unknown composition <id>(nothing was recorded under that uuid).compositionId must be a uuid, got "…". It is generated by the Kernel when a composition is opened — pass that value back, and use compositionTitle for a human-readable name.- Undo does not touch the database, a deployed app or the vault. A migration already run stays run.
Redo is a different operation, not undo called twice: undo recomputes the state before the composition's first event, so a second undo does nothing. Always use veda_redo_composition.
D2.15 Read a Flow run and replay it#
See what a run did, step by step, and re-run it against what is deployed now.
The environment needs an observability binding (OTLP in, query out; Jaeger in Dev). A run is one OpenTelemetry trace found by oneweb.flow.* attributes. A store that does not answer is refused, never reported as "no runs".
- UI: the Operations console, Flow runs tab (read-only except the confirmed Replay). Select a run for its steps, timing, attempts, error and the variables it changed.
- Tools (read-only):
flow_runs(workspaceId,environment; optionalflowRef,statusok|error,sinceISO,limitup to 200), thenflow_run(workspaceId,environment,runId), whererunIdis the trace idflow_runslists. - Values: a variable declared
sensitive, or an undeclared one, reads***. Error text is recorded as the runtime wrote it; the reader scrubs credentials on display. - Plan the replay:
flow_replay_plan(workspaceId,environment,runId, optionalruntimecamel-quarkus|nextjs). It lists the inputs the recording could not keep and the steps whose effect would happen again (mail, file write, non-GET call, non-SELECT statement, subFlow). - Replay:
{ "tool": "flow_replay",
"args": { "workspaceId": "workspace:default", "environment": "Dev", "runId": "<trace id>",
"inputs": { "idNumber": "…" }, "acknowledgeEffects": ["s-send"] } } acknowledgeEffects must be exactly the step ids the plan lists. The replay is a NEW run from the first step of the flow as deployed now; it is never a resume. It needs runOps and the environment's approval rule. The UI form reads the plan first and asks for each hidden value and acknowledgement.
6. Fresh run with no recording: hub_run_plan / hub_run (arguments in tools/hub.js; not reproduced here).
The result names the new run; flow_runs lists it, tagged with the original (oneweb.replay.of).
flow_replay lists every reason at once. Real texts from replay-run.js:
<flow> declares no input "<n>" — a replay takes only the flow's declared inputs<n> input(s) of run <id> were not recorded and must be supplied in \inputs`:( )` - a missing effect acknowledgement (named by step id)
the identity provider did not answer (…) — no token, no replay<where> did not answer at <url> (…) — recorded as an unreachable replayno run <id> in the <env> trace store (<base>) — it may be older than the store's retention- A cron flow cannot be replayed (no caller), and a file run cannot: move the file from
failed/back to the inbox (Part 5 §5.6). A freshhub_runof a flow with noexposesays "has no caller … A schedule/file/queue trigger has no manual door here". - Failed queue messages and files are a different tool family:
failed_items,failed_item_replay,failed_item_delete.
The replay is a NEW run from the first step of the flow as deployed now; it is never a resume, so each effect must be acknowledged.
D2.16 Not verified, and where to go next#
- No recipe was executed. Tool names and arguments were read from
inputSchemainkernel-poc/src/tools/*.js; JSON examples use illustrative ids. Error strings are copied from source and may differ on a Kernel started before a source change. - Not located or confirmed: the Page import's UI location, the portal start route's bearer support, a real
key:rotaterun, and the arguments offlow_create_engine_doorandhub_run.
Next: dev-6-refusals-troubleshooting.md, dev-4-api-and-mcp.md, dev-5-flows-connections-expressions.md, dev-3-services-directory.md.