minutework 0.1.52 → 0.1.54

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
@@ -147,7 +147,7 @@ minutework deploy --preview
147
147
 
148
148
  Combined **tenant-app + sidecar** workspaces keep sidecar setup explicit. Root `pnpm install` stays Node-only and does not run `poetry install` for you. If you need the sidecar, run `pnpm run install:sidecar` from the workspace root or `cd sidecar && poetry install` yourself before `minutework dev` or `minutework test`. Sidecar-only scaffolds have no root `package.json`; install Python deps once inside `sidecar/` before running local sidecar workflows.
149
149
 
150
- For direct third-party web hosts such as Vercel, deploy `tenant-app` only. In Vercel, point the project Root Directory at `tenant-app`; the optional sidecar remains a separate Poetry-managed surface. To keep `@minutework/web-auth` same-origin on a bring-your-own host, set `MW_GATEWAY_BASE_URL` to the platform gateway base URL — the template's `next.config.mjs` then proxies `/_mw/*` to the gateway — and run `minutework deploy --live --host <your-domain>` so the gateway recognizes that host as your tenant's live canonical customer-web origin.
150
+ For direct third-party web hosts such as Vercel, deploy `tenant-app` only. In Vercel, point the project Root Directory at `tenant-app`; the optional sidecar remains a separate Poetry-managed surface. To keep `@minutework/web-auth` same-origin on a bring-your-own host, set `MW_GATEWAY_BASE_URL` to the canonical live customer-web host returned by `minutework deploy --live` — the template's `next.config.mjs` then proxies `/_mw/*` to the gateway — and run `minutework deploy --live --host <your-domain>` so the gateway recognizes that host as your tenant's live canonical customer-web origin. For local auth against dev, target `https://dev.minutework.ai`, deploy live there, then set `MW_GATEWAY_BASE_URL` to the returned `https://<label>.customers.dev.minutework.ai` host, not bare `https://dev.minutework.ai`.
151
151
 
152
152
  `link` provisions or resolves the default published-site property for the active tenant and stores that property key in repo-local state. The SDK-based `tenant-app/.env.example` contains only the app metadata contract used by the template: `NEXT_PUBLIC_MW_APP_ID`, `MW_TEMPLATE_APP_NAME`, and optional `MW_PUBLIC_BASE_URL`. Browser auth and manifest calls use same-origin `/_mw` routes through `@minutework/web-auth`; do not add platform content tokens or public-site property vars to the tenant app.
153
153
 
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: ontology-authoring
3
+ description: "Promoting a local fact to shared, URN-anchored truth: declaring ontology mappings, URN anchors, and promotion rules, then staging reviewable promotion candidates."
4
+ ---
5
+
6
+ # Ontology Authoring
7
+
8
+ Use this skill when a local app object should become — or resolve to — a
9
+ **shared, Core-owned, URN-anchored** entity that other tenants' runtimes can
10
+ recognize. This is the authoring half of the promotion loop; the
11
+ principles-only companion is `ontology-mapping/SKILL.md`.
12
+
13
+ The review law is the point of this lane:
14
+ **Core is the sole `urn:mw:<kind>:<uuid>` minter; a runtime never mints, and
15
+ every promotion is reviewable.** You stage a candidate locally and the
16
+ bridge-owned sweep submits it; an operator (or the conservative auto-accept)
17
+ decides. Nothing you author activates a shared URN by itself.
18
+
19
+ ## 1. Classify: shared WHO/WHERE/WHAT vs tenant-local
20
+
21
+ Decide, per object, whether it is genuinely shared identity or just tenant
22
+ data:
23
+
24
+ - `entity` — a shared **WHAT/WHO-org** (a company, vendor, carrier, account).
25
+ - `person` — a shared **WHO** (PII-bearing; always operator-reviewed).
26
+ - `location` — a shared **WHERE** (always operator-reviewed).
27
+ - Everything high-variance or tenant-specific stays **runtime-local** — do not
28
+ promote it. Overlay it instead (step 2).
29
+
30
+ Map the object's stable identifiers to namespaced identifier types
31
+ (`EntityIdentifier.id_type` for entities, `PersonIdentifier.id_type` for
32
+ persons). A good shared identifier is namespaced and externally meaningful
33
+ (e.g. a government registry number). FleetRun is illustrative only: a carrier's
34
+ DOT number is an `entity` identifier; the carrier's internal nickname is not.
35
+
36
+ ## 2. Declare mappings, anchors, and overlays (schema DSL)
37
+
38
+ In `schemas/schema.ts` (or `schema.mw`), declare `ontologyMappings`:
39
+
40
+ ```ts
41
+ ontologyMapping("vendor", "entity", {
42
+ anchors: [anchor("entity_ref", "entity")],
43
+ promotionRules: [
44
+ promotionRule("entity_ref", "entity", {
45
+ mode: "candidate_match",
46
+ idType: "registry_id",
47
+ minConfidence: 0.95,
48
+ }),
49
+ ],
50
+ overlays: [overlay("entity_ref", "vendor_terms", ["payment_terms", "rep"])],
51
+ })
52
+ ```
53
+
54
+ - `anchor(field, target_kind)` — the local field that carries the shared URN
55
+ once resolved. Compiles into a `URNAnchor` target.
56
+ - `overlay(target_urn_field, overlay_kind, payload_fields)` — hang
57
+ tenant-specific fields off a shared entity **without** mutating the shared
58
+ baseline. Keep high-variance fields here, not in the shared object.
59
+ - These compile to `ontologyMappingManifests`, which the runtime materializes
60
+ as `LocalOntologyMapping` rows on install — that is what makes this runtime's
61
+ objects of the kind promotion-eligible and what `ontology.resolve_local`
62
+ falls back to.
63
+
64
+ ## 3. Declare promotion rules (`prom_v1`)
65
+
66
+ For a promotable fact, declare a `promotionRule` with:
67
+
68
+ - `mode`: `candidate_match` (resolve to an existing shared entity) or
69
+ `candidate_create` (propose a new one).
70
+ - `id_type`: the namespaced identifier the match keys on.
71
+ - `min_confidence` (optional): the floor for the conservative entity
72
+ auto-accept. **Auto-accept fires only for `entity`, only on an exactly-one
73
+ unique-identifier match at confidence ≥ threshold, and only as an echo of the
74
+ existing URN — no mint, no create, no merge.** Person, location, zero/multi
75
+ matches, and any create/merge always go to operator review.
76
+
77
+ ## 4. Stage a candidate at runtime (staging only)
78
+
79
+ Staging is a runtime act, separate from submission. Cite the exact tools (both
80
+ are outside the default read ring — grant per agent via `enable_agent_tools`):
81
+
82
+ - `ontology.resolve_local` — read, live. Returns the `URNAnchor` for a local
83
+ object (the shared `core_urn`) or the active mapping candidates as fallback.
84
+ - `ontology.propose_candidate` — effectful, **staging only**. Records a PENDING
85
+ `PromotionCandidate`; it does **not** push to Core. The bridge-owned sweep
86
+ (`MW_ONTOLOGY_PROMOTION_REPORTING_ENABLED`) submits, and Core decides.
87
+
88
+ Provenance is mandatory and you never supply a URN:
89
+
90
+ - Put namespaced identifiers in `evidence.identifiers`
91
+ (`[{ id_type, value }]`), the local anchor target in `evidence.anchor`
92
+ (`{ local_object_kind, local_object_id, field_name }`), and the supporting
93
+ signal as plain `evidence` keys.
94
+ - Pass a calibrated `confidence` and an opaque `source_ref` (a
95
+ `runtime:<id>:<kind>:<id>` reference) — never a `urn:mw:` value, and never a
96
+ `core_urn`. Only Core mints URNs.
97
+
98
+ ## Cross-runtime anchoring
99
+
100
+ A runtime learns a shared `core_urn` **only for facts it itself staged**. There
101
+ is no open "does identifier X exist in Core" lookup. When a second runtime has
102
+ the same mapping installed and stages its own candidate for the same fact, the
103
+ sweep re-POSTs it, Core's `(origin_runtime, origin_ref, candidate_kind)` unique
104
+ constraint dedupes against the already-decided request and returns the **same**
105
+ `core_urn`, and that runtime writes its own `URNAnchor`. Same shared truth, no
106
+ new trust surface.
107
+
108
+ ## Cross-references
109
+
110
+ - `runtime_ontology_contract.md` — runtime-local anchors, mappings, candidates.
111
+ - `core_ontology_and_runtime_overlays.md` — Core ownership and overlays.
112
+ - `schema-engine/SKILL.md` — declaring the schema the mappings hang off.
113
+ - `app-pack-authoring/SKILL.md` — packaging the mappings into an installable app.
114
+ - `ontology-mapping/SKILL.md` — the principles companion.
@@ -8,6 +8,10 @@ description: "Local app data needs shared identifiers, shared meaning, or mappin
8
8
  Use ontology mappings when local app data needs shared identifiers or shared
9
9
  meaning.
10
10
 
11
+ For the concrete authoring procedure (declaring mappings, URN anchors, and
12
+ promotion rules, then staging reviewable promotion candidates), see the sibling
13
+ `ontology-authoring/SKILL.md`.
14
+
11
15
  - Prefer stable shared references and URNs over duplicating shared entities.
12
16
  - Runtime should remain ontology-aware, not ontology-authoritative.
13
17
  - Keep local app schema ownership clear even when mapping into shared ontology
@@ -142,6 +142,12 @@ generated Builder workspace.
142
142
  - `ontology.resolve_local` -- Read-only native tool over
143
143
  URNAnchor/LocalOntologyMapping; not in the default READ_RING, granted per agent via
144
144
  enable_agent_tools.
145
+ - `ontology.propose_candidate` -- Stages a PENDING PromotionCandidate locally
146
+ (idempotent on origin_ref+candidate_kind). The bridge-owned submission sweep then
147
+ carries it cross-plane (PENDING -> SUBMITTED -> resolved with a Core-minted
148
+ core_urn) under MW_ONTOLOGY_PROMOTION_REPORTING_ENABLED; Core stays the sole URN
149
+ minter and its ingress fails closed independently. Effectful; outside the default
150
+ READ_RING, granted per agent via enable_agent_tools.
145
151
  - `command_exec.run_template` -- Operator/platform-dispatch surface; not an
146
152
  agent-callable tool.
147
153
  - `voice.hangup_call` -- VoiceSession finalization is live; the provider-side hangup
@@ -152,12 +158,6 @@ generated Builder workspace.
152
158
  leg as unavailable):
153
159
  - `scheduling.book_appointment` -- Capability is registered but the direct booking
154
160
  executor is MVP-deferred; preflight truthfully reports provider_unavailable.
155
- - `ontology.propose_candidate` -- Staging leg only: records a PENDING
156
- PromotionCandidate locally (idempotent on origin_ref+candidate_kind). The
157
- cross-plane submission to Core (PENDING -> SUBMITTED -> resolved with a minted
158
- core_urn) is a deferred, bridge-owned leg; the promotion service stays
159
- platform-owned. Effectful; outside the default READ_RING, granted per agent via
160
- enable_agent_tools.
161
161
  - `voice.initiate_call` -- Pre-dial stack is live (consent + TCPA preflight, approval
162
162
  parking, VoiceSession lifecycle); the Twilio dial + realtime media worker are
163
163
  platform-owned Phase 4.
@@ -304,9 +304,9 @@
304
304
  "requires_integration": false,
305
305
  "requires_secret": false,
306
306
  "metered": false,
307
- "executor_ready": "partial",
307
+ "executor_ready": "live",
308
308
  "executor_ref": "tool:ontology.propose_candidate",
309
- "executor_notes": "Staging leg only: records a PENDING PromotionCandidate locally (idempotent on origin_ref+candidate_kind). The cross-plane submission to Core (PENDING -> SUBMITTED -> resolved with a minted core_urn) is a deferred, bridge-owned leg; the promotion service stays platform-owned. Effectful; outside the default READ_RING, granted per agent via enable_agent_tools.",
309
+ "executor_notes": "Stages a PENDING PromotionCandidate locally (idempotent on origin_ref+candidate_kind). The bridge-owned submission sweep then carries it cross-plane (PENDING -> SUBMITTED -> resolved with a Core-minted core_urn) under MW_ONTOLOGY_PROMOTION_REPORTING_ENABLED; Core stays the sole URN minter and its ingress fails closed independently. Effectful; outside the default READ_RING, granted per agent via enable_agent_tools.",
310
310
  "agent_exposable": true,
311
311
  "agent_exposure_path": "native_tool",
312
312
  "approval_required": false,
@@ -9,6 +9,9 @@ Use this skill when the request needs tenant-defined data structures.
9
9
 
10
10
  - Define tenant data in `schemas/schema.ts` or `schema.mw`, not ad hoc Django tables.
11
11
  - Prefer declarative schema changes before adding custom code surfaces.
12
+ - To map local objects onto shared, URN-anchored ontology entities, declare
13
+ `ontologyMappings` (with `anchor`, `promotionRule`, and `overlay` helpers) in
14
+ the same schema source; the procedure is in `ontology-authoring/SKILL.md`.
12
15
  - Index only the fields that need query/filter behavior.
13
16
  - Treat runtime-backed content as the authoring source; publish safe snapshots for anonymous public delivery.
14
17
  - Treat `mw.core.site` as already present in the runtime baseline.
@@ -55,6 +55,14 @@ unattended; without `--yes` it returns `confirmation_required`).
55
55
  activate. On a BYO host, set `MW_GATEWAY_BASE_URL` in the tenant-app so the
56
56
  template's `next.config.mjs` proxies same-origin `/_mw/*` to the gateway
57
57
  (managed-subdomain hosts are gateway-fronted and need no rewrite).
58
+ - **Local tenant-app against the dev platform:** target the dev platform
59
+ explicitly (`export MW_CLI_PLATFORM_BASE_URL=https://dev.minutework.ai` and
60
+ `minutework login --platform https://dev.minutework.ai`), link a sandbox
61
+ runtime, then run `minutework deploy --live`. Set `tenant-app/.env.local`
62
+ `MW_GATEWAY_BASE_URL` to the returned canonical live customer-web host such as
63
+ `https://<label>.customers.dev.minutework.ai` before running local `next dev`.
64
+ Do not set it to bare `https://dev.minutework.ai`; the gateway resolves
65
+ `/_mw` customer auth by the live customer-web host.
58
66
 
59
67
  ## Boundaries and current limits
60
68
 
@@ -1,7 +1,9 @@
1
1
  NEXT_PUBLIC_MW_APP_ID=tenant.app
2
2
  MW_TEMPLATE_APP_NAME=Tenant App
3
3
  MW_PUBLIC_BASE_URL=
4
- # Only needed when hosting this app off-platform (Vercel / custom domain). Set to the
5
- # MinuteWork platform gateway base URL to transparently proxy same-origin /_mw/* customer
6
- # auth to the gateway. Leave blank for managed-subdomain hosts (gateway-fronted).
4
+ # Only needed when hosting this app off-platform (Vercel / custom domain) or
5
+ # running local next dev against a live customer-web binding. Set this to the
6
+ # canonical live customer-web host returned by `minutework deploy --live`, such as
7
+ # https://<label>.customers.dev.minutework.ai. Do not set it to bare
8
+ # https://dev.minutework.ai.
7
9
  MW_GATEWAY_BASE_URL=
@@ -64,6 +64,21 @@ runtime-command demo, or a server-only public-content token adapter.
64
64
  defaults to `tenant.app`
65
65
  - `MW_TEMPLATE_APP_NAME` controls the display name and defaults to `Tenant App`
66
66
  - `MW_PUBLIC_BASE_URL` is optional and only affects metadata routes
67
+ - `MW_GATEWAY_BASE_URL` is only needed when the app is not directly
68
+ gateway-fronted. For local auth against dev, set it to the canonical live
69
+ customer-web host returned by `minutework deploy --live`, for example
70
+ `https://<label>.customers.dev.minutework.ai`. Do not set it to bare
71
+ `https://dev.minutework.ai`; `/_mw` auth is resolved from the live
72
+ customer-web host.
73
+
74
+ Local real-auth dev loop:
75
+
76
+ 1. `export MW_CLI_PLATFORM_BASE_URL=https://dev.minutework.ai`
77
+ 2. `minutework login --platform https://dev.minutework.ai`
78
+ 3. `minutework link --runtime --sandbox`
79
+ 4. `minutework deploy --live`
80
+ 5. set `MW_GATEWAY_BASE_URL` to the returned `*.customers.dev.minutework.ai`
81
+ live host, then run local `next dev`.
67
82
 
68
83
  ## Validation
69
84
 
@@ -22,11 +22,11 @@ function resolveTurbopackRoot(startDirectory) {
22
22
 
23
23
  // Bring-your-own host support: when this tenant-app is hosted off-platform (Vercel
24
24
  // or a custom domain) instead of being fronted by the MinuteWork gateway, set
25
- // MW_GATEWAY_BASE_URL so same-origin `/_mw/*` customer-auth calls are transparently
26
- // proxied to the platform gateway. The gateway serves customer auth for this tenant's
27
- // live canonical customer-web host (provisioned via `minutework deploy --live`), so
28
- // @minutework/web-auth keeps its same-origin contract without a remote project URL.
29
- // Unset by default: managed-subdomain hosts are gateway-fronted and need no rewrite.
25
+ // MW_GATEWAY_BASE_URL to the live canonical customer-web host returned by
26
+ // `minutework deploy --live`. The gateway serves customer auth only for that
27
+ // host, so local dev should point at e.g. https://<label>.customers.dev.minutework.ai,
28
+ // not the bare platform origin. Unset by default: managed-subdomain hosts are
29
+ // gateway-fronted and need no rewrite.
30
30
  const gatewayBaseUrl = (process.env.MW_GATEWAY_BASE_URL || "").trim().replace(/\/+$/, "");
31
31
 
32
32
  const nextConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minutework",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "MinuteWork CLI for workspace scaffolding, local preview workflows, and hosted preview deploys.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "jiti": "^2.6.1",
26
26
  "zod": "^4.3.6",
27
27
  "@minutework/platform-config": "0.1.3",
28
- "@minutework/schema-compiler": "0.1.12"
28
+ "@minutework/schema-compiler": "0.1.13"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^24.9.1",