@mortar-ai/skill 0.6.0 → 0.7.0

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
@@ -34,8 +34,11 @@ experience.
34
34
  The skill teaches Claude:
35
35
 
36
36
  - **Core contract** — Fabric-owned client/config files, schema-first workflow,
37
- one migration operation per call, supported migration kinds, access-policy
38
- invariants, version boundaries, and completion checks.
37
+ real versioned SQL plan/apply, supported DDL, access-policy invariants,
38
+ OpenAPI-driven application code, version boundaries, and completion checks.
39
+ - **OpenAPI reference** — the canonical Mortar REST contract is mirrored from
40
+ `mortar/docs/public/openapi.yaml` for on-demand operation/schema lookup; the
41
+ AI Turn writes project-language request and response code through Harness.
39
42
  - **Database reference** — CRUD, filters, atomic row mutations, trusted
40
43
  cross-table transactions, and ACID boundaries.
41
44
  - **Auth reference** — email/password, phone OTP, sessions, password reset, and
@@ -69,9 +72,11 @@ Idempotent — overwrites in place.
69
72
 
70
73
  ## Maintainer release
71
74
 
72
- `SKILL.md` and `references/` are the hand-edited instruction sources. Keep the
73
- core short and move capability detail into a routed reference. Regenerate the
74
- manifest and Harness copy before testing or publishing:
75
+ `SKILL.md` and the Markdown files in `references/` are the hand-edited
76
+ instruction sources. `references/openapi.yaml` is generated from the canonical
77
+ `mortar/docs/public/openapi.yaml`; never edit the mirror directly. Keep the core
78
+ short and move capability detail into a routed reference. Regenerate the
79
+ manifest, OpenAPI mirror, and Harness copy before testing or publishing:
75
80
 
76
81
  ```bash
77
82
  npm run sync
package/SKILL.md CHANGED
@@ -28,9 +28,10 @@ itself does not run on Mortar. Do not infer its setup from another BaaS.
28
28
  import { mortar } from '../../utils/mortar/client';
29
29
  ```
30
30
 
31
- - `src/integrations/mortar/client.ts`, its `types.ts`, and the WeChat equivalents
32
- under `utils/mortar/` are platform-owned. Never create, overwrite, or replace
33
- them.
31
+ - `src/integrations/mortar/client.ts`, its compatibility `types.ts`, and the
32
+ WeChat equivalents under `utils/mortar/` are platform-owned wiring. Never
33
+ create, overwrite, or replace them. Generate application-owned request,
34
+ response, and domain types in ordinary project paths for the current runtime.
34
35
  - Never add `VITE_MORTAR_*`, `MORTAR_URL`, or client-side API-key environment
35
36
  variables. Never hand-write `createClient(...)`, `src/lib/mortar.ts`, or a
36
37
  second wrapper/client in a Fabric project.
@@ -63,19 +64,24 @@ below; if platform provisioning fails, report that platform failure.
63
64
  writes the approved artifact before reconciling the live resource.
64
65
  4. These source directories are platform-protected because direct edits would
65
66
  bypass plan/apply. Submit the exact source through the matching tool; do not
66
- edit or create `mortar.config.json`. Do not edit generated
67
- `integrations/mortar/types.ts`; Fabric regenerates it from the post-apply live
68
- schema. The same schema can generate TypeScript, Swift, Kotlin, and Dart app
69
- data types; those outputs are derived and never drive migration execution.
70
- 5. Install or update `@mortar-ai/client` with npm when needed and let npm own the
67
+ edit or create `mortar.config.json`. Mortar returns contracts and live state,
68
+ never generated project files. The AI Turn owns runtime-specific app models
69
+ and request/response code through Harness; do not call or invent a Mortar
70
+ source-code-generation endpoint.
71
+ 5. Before writing application request/response code, locate the relevant
72
+ `operationId` in `references/openapi.yaml`, read its request, response, error,
73
+ security, and `x-mortar-trust-surface` fields, and combine that contract with
74
+ `mortar_schema` plus the project's language and conventions. Never expose an
75
+ operation marked `x-mortar-project-code: forbidden` in an app bundle.
76
+ 6. Install or update `@mortar-ai/client` with npm when needed and let npm own the
71
77
  lockfile. Atomic batches, server-side filtered mutations, and
72
78
  `DatabaseTransactions` require version 0.8.0 or newer. Do not rewrite
73
79
  unrelated dependencies.
74
- 6. Before a multi-step mutation, choose the real consistency boundary. A
80
+ 7. Before a multi-step mutation, choose the real consistency boundary. A
75
81
  one-table batch or filtered mutation may use the public singleton;
76
82
  cross-table row + queue transactions require trusted server code; object
77
83
  storage and external services never join a PostgreSQL transaction.
78
- 7. Type-check and build. Handle every `{ data, error }` SDK result in UI code.
84
+ 8. Type-check and build. Handle every `{ data, error }` SDK result in UI code.
79
85
 
80
86
  Supported database DDL is `CREATE TABLE`, `DROP TABLE`, `ALTER TABLE … ADD/DROP
81
87
  COLUMN`, `ALTER TABLE … SET ACCESS`, and `CREATE INDEX`. Put
@@ -84,7 +90,15 @@ COLUMN`, `ALTER TABLE … SET ACCESS`, and `CREATE INDEX`. Put
84
90
  `set_bucket_access`, `deploy_function`, `delete_function`, `upsert_cron`, and
85
91
  `delete_cron`; they belong to `mortar_resource`, never SQL. Destructive and
86
92
  backend-changing operations respect the workspace approval gate. Arbitrary
87
- PostgreSQL, data backfills, PL/pgSQL, transactions, and triggers are not inputs.
93
+ PostgreSQL, `DEFAULT`, `UNIQUE`, `CHECK`, foreign keys, data backfills, PL/pgSQL,
94
+ transactions, and triggers are not inputs.
95
+
96
+ Every row already has server-owned `id`, `created_at`, and `updated_at`
97
+ metadata. Do not declare those names as application columns or send them in
98
+ ordinary insert/update payloads; only pass `id` as row identity through the
99
+ documented upsert contract. They are flattened into SDK results and may be used
100
+ for ordering or indexes. Today, `NOT NULL` enforces payload presence; logical
101
+ type names guide application types but do not runtime-validate payload values.
88
102
 
89
103
  ## Access and safety invariants
90
104
 
@@ -98,6 +112,11 @@ PostgreSQL, data backfills, PL/pgSQL, transactions, and triggers are not inputs.
98
112
  - Generate an unguessable logical object key for each public upload.
99
113
  - Client-side filters are UX, not authorization. Choose a server-enforced access
100
114
  policy for private or owner-scoped rows.
115
+ - Client validation and an in-flight submit guard are UX, not server validation
116
+ or retry-safe idempotency. Public row insert has no idempotency key or durable
117
+ uniqueness constraint. Never claim direct insert is exactly-once; when the
118
+ product requires durable deduplication, use a reviewed server-side contract
119
+ that actually implements it or state the limitation.
101
120
  - Never put `app` or `admin` keys, `DatabaseTransactions`, operator clients, or
102
121
  other privileged capabilities in Web, Desktop renderer, Keel/React Native, or
103
122
  WeChat bundles.
@@ -113,9 +132,12 @@ Agent Skills hosts resolve the same paths relative to this `SKILL.md`.
113
132
 
114
133
  - Database CRUD, atomic row mutations, trusted cross-table transactions, and
115
134
  exact ACID boundaries: `references/database.md`
116
- - Versioned SQL syntax, checksums/revisions, resource artifact layout, type
117
- generation, legacy migrations, and the complete capability-to-source matrix:
135
+ - Versioned SQL syntax, checksums/revisions, resource artifact layout, AI-owned
136
+ application types, legacy migrations, and the complete capability-to-source matrix:
118
137
  `references/schema-migrations.md`
138
+ - The authoritative Mortar REST contract used to generate project-language
139
+ request/response code: `references/openapi.yaml`. Search by `operationId` and
140
+ read only the selected operation plus its referenced component schemas.
119
141
  - App-user signup/signin, OTP, session lifecycle, and private-user modeling:
120
142
  `references/auth.md`
121
143
  - Upload/download/list/signed URLs, immutable object versions, CORS, and
@@ -152,6 +174,15 @@ sed -n '1,240p' /tmp/skills/mortar/references/storage.md
152
174
  - Every database schema change used reviewed exact SQL through `mortar_migrate`;
153
175
  every function/bucket/cron change used `mortar_resource`.
154
176
  - Application code imports only the platform-owned singleton.
177
+ - Application request/response and domain types were written by the AI in
178
+ ordinary project source after consulting the relevant OpenAPI operations and
179
+ live schema; Mortar did not return generated source files. Model real
180
+ boundaries (for example form input versus persisted data) and reuse
181
+ SDK-inferred response types when sufficient instead of adding ceremonial
182
+ duplicate aliases.
183
+ - Application payloads do not redeclare or send server-owned row metadata, and
184
+ the UI does not overclaim client validation or duplicate suppression as a
185
+ durable backend guarantee.
155
186
  - No secret/admin client or hand-written fallback configuration entered the
156
187
  client bundle.
157
188
  - Every SDK error path is handled.
package/manifest.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "id": "mortar",
4
- "version": "0.6.0",
5
- "content_sha256": "sha256:f3cf01640a48dca83ccfe49a744c33355a5009567a1706d5c59528d6ddd3ee92",
4
+ "version": "0.7.0",
5
+ "content_sha256": "sha256:ec235e0f2e9c38e64ab906c8daca2daa98482313a4004fd1a73bc30f17671487",
6
6
  "source_repo": "liamxujia/appunvs",
7
7
  "source_path": "mortar/skill",
8
8
  "distributions": [
@@ -11,6 +11,6 @@
11
11
  ],
12
12
  "npm": {
13
13
  "package": "@mortar-ai/skill",
14
- "version": "0.6.0"
14
+ "version": "0.7.0"
15
15
  }
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mortar-ai/skill",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Agent skill package for building Fabric applications on Mortar (BaaS), with compact core guidance and on-demand references.",
5
5
  "main": "index.js",
6
6
  "files": ["SKILL.md", "references", "manifest.json", "index.js", "README.md"],
@@ -89,7 +89,7 @@ deployment edge after Mortar verifies ownership.
89
89
  - **Trusted project/operator**: app/admin project keys in server, CI, CLI, MCP,
90
90
  or platform provisioning. Never ship these credentials or clients to a Web,
91
91
  Desktop renderer, Keel/React Native, or WeChat bundle.
92
- - **Account control plane**: account JWT or `mtr_pat_*` PAT against the apex
92
+ - **Account control plane**: Account session JWT or `mtr_pat_*` PAT against the apex
93
93
  `_accounts` routes. These credentials manage projects and ownership; they are
94
94
  not interchangeable with project or app-user credentials.
95
95
 
@@ -3,7 +3,7 @@
3
3
  Read this reference for Mortar accounts, projects, API keys, PATs, custom
4
4
  domains, plans, top-up, auto-top-up, capacity, or enterprise placement.
5
5
 
6
- The control plane uses the apex host and an account JWT or `mtr_pat_*` personal
6
+ The control plane uses the apex host and an Account session JWT or `mtr_pat_*` personal
7
7
  access token. It manages account identity, project lifecycle, project API keys,
8
8
  PATs, project usage, domain claims, plan/top-up settings, and enterprise intent.
9
9
  These credentials are not app-user sessions and cannot be substituted for a
@@ -29,6 +29,37 @@ Updates and deletes use the same filter chain. Useful operators include `eq`,
29
29
  `neq`, ranges, `like/ilike`, `in`, `is`, `order`, `limit`, `single`, and
30
30
  `maybeSingle`.
31
31
 
32
+ ## System row metadata versus application payload
33
+
34
+ Every stored row has server-owned `id`, `created_at`, and `updated_at` metadata.
35
+ The SDK flattens that `RowMeta` beside the application payload when returning a
36
+ row. Do not declare those names as logical application columns and do not send
37
+ them in ordinary insert/update payloads. The documented upsert contract is the
38
+ exception: it accepts `id` as row identity and removes system metadata from the
39
+ stored application payload. Use the server-generated `created_at` for ordering,
40
+ filters, and indexes instead of creating a second timestamp column.
41
+
42
+ Mortar's current logical schema enforces required-field presence through `NOT
43
+ NULL`. Type spellings drive the language-neutral schema and application types,
44
+ but the row API does not yet runtime-validate every value against those type
45
+ names. `DEFAULT`, `UNIQUE`, `CHECK`, and foreign-key constraints are not
46
+ supported logical DDL. Client-side format, range, and length checks remain UX;
47
+ do not describe them as database enforcement.
48
+
49
+ ## Duplicate suppression is not durable idempotency
50
+
51
+ Disabling a submit button while a request is in flight prevents rapid duplicate
52
+ clicks in that mounted client. It does not make a row insert retry-safe. The
53
+ public insert API has no idempotency-key contract or durable uniqueness
54
+ constraint, and the SDK intentionally does not automatically retry this
55
+ non-idempotent POST. A client-side select-then-insert check is still racy and is
56
+ often unavailable under `public_insert` because anonymous reads are denied.
57
+
58
+ If the product requires exactly-once submission or durable deduplication, do
59
+ not claim direct public insert satisfies it. Use a reviewed supported
60
+ server-side contract that really performs atomic deduplication, or state that
61
+ the guarantee is not currently available for that client path.
62
+
32
63
  ## Atomic row mutations
33
64
 
34
65
  Pass an array when every insert or upsert must succeed or fail together. Mortar