@notis_ai/cli 0.2.0-beta.191.1 → 0.2.0-beta.197.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.
Files changed (107) hide show
  1. package/README.md +485 -86
  2. package/config/portal-route-roots.json +47 -0
  3. package/dist/agent-hooks/notis-agent-hook.mjs +32663 -6357
  4. package/dist/base-skills/notis-apps/SKILL.md +88 -67
  5. package/dist/base-skills/notis-apps/references/architecture.md +114 -167
  6. package/dist/base-skills/notis-apps/references/design.md +26 -107
  7. package/dist/base-skills/notis-apps/references/memory.md +58 -0
  8. package/dist/base-skills/notis-apps/references/reading.md +52 -74
  9. package/dist/base-skills/notis-apps/references/release.md +104 -142
  10. package/dist/base-skills/notis-apps/references/sdk.md +113 -60
  11. package/dist/base-skills/notis-apps/references/troubleshooting.md +22 -21
  12. package/dist/base-skills/notis-apps/references/views.md +142 -0
  13. package/dist/base-skills/notis-cli/SKILL.md +4 -4
  14. package/dist/base-skills/notis-cli/references/app-delivery.md +12 -11
  15. package/dist/base-skills/notis-cli/references/native-databases.md +6 -6
  16. package/dist/base-skills/notis-cli/references/tool-examples.md +4 -4
  17. package/dist/base-skills/notis-query/SKILL.md +34 -60
  18. package/dist/base-skills/notis-query/references/database-discovery.md +59 -69
  19. package/dist/base-skills/notis-query/references/documents.md +63 -50
  20. package/dist/base-skills/notis-query/references/query.md +57 -524
  21. package/dist/sdk/src/bundleModule.ts +79 -0
  22. package/dist/sdk/src/components/DocumentEditor.tsx +6 -3
  23. package/dist/sdk/src/components/DocumentPage.tsx +141 -0
  24. package/dist/sdk/src/components/RecordComponents.tsx +33 -0
  25. package/dist/sdk/src/components/RenderChartData.tsx +19 -0
  26. package/dist/sdk/src/config.ts +4 -26
  27. package/dist/sdk/src/documents.ts +2 -0
  28. package/dist/sdk/src/hooks/useAction.ts +28 -0
  29. package/dist/sdk/src/hooks/useCloudComputer.ts +35 -4
  30. package/dist/sdk/src/hooks/useCloudComputerShell.ts +114 -0
  31. package/dist/sdk/src/hooks/useHandover.ts +5 -4
  32. package/dist/sdk/src/hooks/useNativeDocumentBody.ts +50 -0
  33. package/dist/sdk/src/hooks/useNativeDocuments.ts +83 -0
  34. package/dist/sdk/src/hooks/useNotis.ts +3 -0
  35. package/dist/sdk/src/hooks/useNotisNavigation.ts +26 -11
  36. package/dist/sdk/src/hooks/useQuery.ts +7 -4
  37. package/dist/sdk/src/hooks/useViewParams.ts +121 -0
  38. package/dist/sdk/src/hooks/useViewerReads.ts +129 -0
  39. package/dist/sdk/src/index.ts +36 -0
  40. package/dist/sdk/src/interactions/shortcuts.tsx +17 -3
  41. package/dist/sdk/src/nativeData.ts +39 -0
  42. package/dist/sdk/src/presentation.tsx +82 -0
  43. package/dist/sdk/src/provider.tsx +9 -4
  44. package/dist/sdk/src/queryCache.ts +5 -3
  45. package/dist/sdk/src/queryErrors.ts +51 -0
  46. package/dist/sdk/src/runtime.ts +146 -8
  47. package/dist/sdk/src/space.ts +425 -0
  48. package/dist/sdk/src/styles.css +96 -72
  49. package/dist/sdk/src/vite.ts +11 -1
  50. package/dist/skill-sync/index.js +458 -68
  51. package/dist/skill-sync/index.js.map +4 -4
  52. package/dist/skill-sync-worker.mjs +451 -77
  53. package/dist/space-harness/host.js +66 -0
  54. package/dist/view-renderer/dist/host.css +1 -0
  55. package/dist/view-renderer/dist/host.js +1042 -0
  56. package/dist/view-renderer/dist/theme.css +73 -0
  57. package/dist/view-renderer/src/dom.js +180 -0
  58. package/dist/view-renderer/src/errors.js +8 -0
  59. package/dist/view-renderer/src/host.tsx +173 -0
  60. package/dist/view-renderer/src/index.js +4 -0
  61. package/dist/view-renderer/src/pool.js +76 -0
  62. package/dist/view-renderer/src/remote-broker.js +59 -0
  63. package/dist/view-renderer/src/renderer.js +201 -0
  64. package/package.json +11 -5
  65. package/skills/notis-apps/cli.md +270 -163
  66. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +3 -3
  67. package/skills/notis-onboarding/BRIEF.md +7 -3
  68. package/src/command-specs/apps.js +1 -8
  69. package/src/command-specs/files.js +29 -0
  70. package/src/command-specs/handover.js +45 -16
  71. package/src/command-specs/helpers.js +1 -0
  72. package/src/command-specs/index.js +10 -4
  73. package/src/command-specs/skills.js +229 -0
  74. package/src/command-specs/spaces.js +572 -0
  75. package/src/command-specs/views.js +69 -0
  76. package/src/runtime/agent-browser.js +30 -7
  77. package/src/runtime/app-boundary-validator.js +7 -4
  78. package/src/runtime/app-data-literals.js +82 -0
  79. package/src/runtime/app-platform.js +321 -253
  80. package/src/runtime/confined-space-build.js +74 -0
  81. package/src/runtime/confined-space-verify.js +49 -0
  82. package/src/runtime/native-record-files.js +47 -0
  83. package/src/runtime/retired-sdk-files.js +20 -0
  84. package/src/runtime/skill-sync/cloud-client.ts +26 -4
  85. package/src/runtime/skill-sync/index.ts +154 -35
  86. package/src/runtime/skill-sync/local-scanner.ts +125 -17
  87. package/src/runtime/skill-sync/native-identity.ts +102 -0
  88. package/src/runtime/skill-sync/native-plan.ts +59 -0
  89. package/src/runtime/skill-sync/sync-plan.ts +16 -9
  90. package/src/runtime/skill-sync/types.ts +32 -6
  91. package/src/runtime/source-root.js +32 -0
  92. package/src/runtime/space-collection-scaffold.js +66 -0
  93. package/src/runtime/space-database-structures.js +229 -0
  94. package/src/runtime/space-fixture-broker.js +50 -0
  95. package/src/runtime/space-lock.js +337 -0
  96. package/src/runtime/space-platform.js +105 -0
  97. package/src/runtime/space-source.js +281 -0
  98. package/src/runtime/space-test-server.js +327 -0
  99. package/src/runtime/space-verification.js +89 -0
  100. package/src/runtime/space-verify-browser-worker.js +51 -0
  101. package/src/runtime/space-view-manifest.js +254 -0
  102. package/src/runtime/sync-skills.js +1 -1
  103. package/src/runtime/transport.js +8 -1
  104. package/src/runtime/view-render.js +49 -0
  105. package/src/space-harness-host.ts +103 -0
  106. package/template/app/globals.css +1 -0
  107. package/src/command-specs/reports.js +0 -97
@@ -1,72 +1,93 @@
1
1
  ---
2
2
  name: notis-apps
3
- description: Design and package Notis apps, or inspect their live views and resources. Use when users want an installable Notis app or need rendered content, charts, or filters that ordinary data tools do not provide.
4
- feature_flag: store
3
+ description: Explain Notis Spaces, sharing, resource links and lifecycle; build or update their views and linked Skills, or inspect a saved view with its current data.
4
+ feature_flag: spaces
5
5
  mcp_resource: true
6
- mcp_tool_patterns: ["LOCAL_NOTIS_INSTALL_APP"]
7
- mcp_references: ["references/release.md", "references/architecture.md", "references/design.md", "references/sdk.md", "references/troubleshooting.md", "references/reading.md", "references/context.md"]
6
+ mcp_tool_patterns: ["LOCAL_NOTIS_INSTALL_APP", "LOCAL_NOTIS_MANAGE_SPACE", "LOCAL_NOTIS_FIND_VIEWS", "LOCAL_NOTIS_RENDER_VIEW"]
7
+ mcp_references: ["references/release.md", "references/architecture.md", "references/design.md", "references/sdk.md", "references/views.md", "references/memory.md", "references/troubleshooting.md", "references/reading.md", "references/context.md"]
8
8
  ---
9
9
 
10
- # Notis Apps
11
-
12
- Build apps that feel native to Notis: compact, readable, responsive, and useful.
13
- Use Vite + React, `@notis/sdk`, and the existing scaffold components. Use the Notis
14
- CLI for app operations: `npx --package @notis_ai/cli@latest -- notis ...`.
15
-
16
- ## Read existing apps and resources
17
-
18
- Use ordinary data tools for straightforward reads. When the task needs a live
19
- render, chart, filter, or visual inspection, follow [Read Notis web content](references/reading.md).
20
- It covers apps, views, reports, HTML and file documents without requiring the
21
- user to open Portal or Desktop. Use the agent's available browser capability;
22
- this is not an app build, deployment, or Portal editing-context workflow.
23
-
24
- ## Build → inspect → fix → deliver
25
-
26
- For every app UI create/edit task, read both [Design](references/design.md) and
27
- [Delivery](references/release.md). Then:
28
-
29
- 1. **Understand the result.** Identify the main user action and the requested
30
- change. For a reported visual bug, describe what is wrong in the actual
31
- screen before editing. Preserve what already works.
32
- 2. **Start from native patterns.** Pull the existing app or choose the closest
33
- Store scaffold. Use the appropriate page layout instead of inventing a new
34
- visual system. Make routine choices yourself; ask only for missing decisions
35
- that materially change the result.
36
- 3. **Build, look, improve.** Run build and verification, then actually inspect
37
- the rendered app. Follow the short visual check in the design guide. Fix what
38
- is wrong and recheck the affected screen; a passing build is not visual approval.
39
- 4. **Deliver the checked result.** Follow the delivery guide and existing user
40
- authorization. Confirm the released result inside Notis before calling it
41
- verified. Say plainly what is local, deployed, or still unverified.
42
-
43
- ## Keep these boundaries
44
-
45
- - User and repository instructions take precedence, including preview-only,
46
- no-deploy, and explicit-consent requirements. Store publication is separate.
47
- - Preserve the exact app identity, account/team scope, permissions, and user data.
48
- Reconcile an uncertain release instead of blindly retrying it.
49
- - Before Store submission, complete the [publication privacy and portability gate](references/release.md#publication-privacy-and-portability-gate).
50
- Public examples must be fictional; never publish the owner's workspace data.
51
- - Use SDK hooks and declared tools. Let Notis own its sidebar, search, runtime,
52
- and rendering boundary; do not query host DOM or recreate that chrome in the app.
53
-
54
- ## References — only as needed
55
-
56
- - [SDK hooks](references/sdk.md): reads, edits, selection, and navigation.
57
- - [App contracts](references/architecture.md): configuration, packaging, and data ownership.
58
- - [Troubleshooting](references/troubleshooting.md): a specific failure or mismatch.
59
-
60
- The CLI distributes this skill and its references from the canonical product
61
- source. Do not maintain competing copies.
62
-
63
- ## Shared views, independent reports and feedback
64
-
65
- Use a shared app view when many records should share one implementation. Use
66
- `notis-reports` when an app-owned record needs its own independently authored
67
- SDK presentation. A report is not a new app, and changing it must not deploy or
68
- replace shared app routes. The agent chooses live data versus captured results.
69
-
70
- Share selected text, comments, loaded resources or app-defined annotations through
71
- [generic context pills](references/context.md). Apps own annotation storage and
72
- presentation; the chat owns unsent context drafts. Passive context is not execution approval.
10
+ # Notis Spaces
11
+
12
+ Build compact, readable views with Vite, React and `@notis/sdk`. A Space owns its
13
+ presentation; native databases hold its records. Use the pre-authenticated Notis
14
+ CLI locally or on the cloud computer: `npx --package @notis_ai/cli@latest -- notis`.
15
+ Discover tools and inspect their live schemas before using them.
16
+
17
+ ## Choose the workflow
18
+
19
+ | Task | Read |
20
+ | --- | --- |
21
+ | Build or change a Space | [View authoring](references/views.md), [Design](references/design.md), then [Delivery](references/release.md) |
22
+ | Read a saved view, chart, report or HTML page | [Read and render](references/reading.md) |
23
+ | Choose a memory policy | [Memory](references/memory.md) |
24
+ | Compose records, navigation or declared reads | [SDK](references/sdk.md) |
25
+ | Explain resources, sharing and lifecycle | [Platform boundaries](references/architecture.md) |
26
+ | Diagnose a failed check or release | [Troubleshooting](references/troubleshooting.md) |
27
+
28
+ Use ordinary native data tools when they answer the question. For what a page
29
+ actually displays, resolve its current link and render the deployed view.
30
+
31
+ ## Author → verify → deliver
32
+
33
+ 1. Read the exact existing Space and its resources. Preserve IDs, schemas, data,
34
+ source revision and the deployment lock. A familiar name is not identity.
35
+ 2. Pull editable source with `notis spaces pull`. For a new local collection,
36
+ use `notis spaces init`; reconcile/create its remote Space only when needed.
37
+ 3. Every view declares `specVersion: 2`, `path`, `description`, `readableContext`,
38
+ typed `params`, executable `shows` and an explicit `memory` policy. A native
39
+ record param identifies the database it opens; its one main view declares
40
+ `main: true`. Use `useViewParams` and `useShown` in the actual page.
41
+ 4. Build and verify the selected frozen source. Keep explicit fictional fixtures
42
+ for all reads. Inspect EN/FR at 390px and 1440px. Fix failed reads, clipping,
43
+ wrong data and state transitions before release.
44
+ 5. Deploy/promote within the user's authorization. Read back the exact published
45
+ revision, render its live view link and inspect the affected interaction.
46
+ A successful local build is not proof of deployment or live data.
47
+ 6. Return the view-qualified link and distinguish local checks, publication to
48
+ the installed Space, and Store publication. Reconcile uncertain outcomes with
49
+ the original request ID; do not repeat a successful mutation for a missing link.
50
+
51
+ ## Structure and resources
52
+
53
+ Use `LOCAL_NOTIS_MANAGE_SPACE` for `create`, `rename`, `move`, `trash`, `restore`
54
+ and `list_bin`. Read the current `revision` first; retain a stable `request_id`.
55
+ Explain access changes before moving a Space: Editors of the new parent gain its
56
+ subtree, and people who only reached it through the old parent lose it.
57
+
58
+ Resources own their links. Use `links` on the native Skill, automation or database
59
+ writer: add with the Space revision, remove with binding ID/revision; a move is
60
+ both in one transaction. Every database keeps at least one Space and one main
61
+ view. Before any link, move, unlink, bin or restore, and whenever the user asks
62
+ about removing someone, Delete now or a Site (Portal controls with no agent tool),
63
+ tell them who gains or loses access and what happens to the data, using
64
+ [Consequences](references/architecture.md#consequences-to-explain-before-acting).
65
+
66
+ Skill content has one writer family: `notis skills list|read|create|update|links`.
67
+ A failed Space target never falls back to another owner or a personal resource.
68
+ Editing a linked Skill changes the shared resource wherever it remains reachable.
69
+ Personal enabled/agent settings are separate; curated content is read-only.
70
+ Only an automation's setup owner changes its connection.
71
+
72
+ `spaces pull` includes `resources.json`, editable `skills/<alias>/` folders and
73
+ `.notis/space-lock.json`. A source release atomically commits changed Skill files,
74
+ new Skills, resource links and source. Unchanged files preserve remote edits;
75
+ conflicts require a fresh pull and merge. Use the Skill writer for renaming.
76
+
77
+ Sites are standalone, scoped view websites, not memberships. They have no agent,
78
+ Skill, automation, upload or collaborative editor authority. Store installations
79
+ are independent copies with three-way updates. Publishing to a Store is separate
80
+ from deploying an installed Space and requires the user's explicit authority.
81
+
82
+ ## Reports, HTML and context
83
+
84
+ Existing report rows render through `<ReportFrame>` in their database's view.
85
+ Use `notis-reports` for an independently authored report when appropriate.
86
+
87
+ For a saved HTML page, use the installed **HTML Space** and its linked **Save HTML**
88
+ Skill. That Skill owns the row-first upload-and-attach workflow. If the Space is
89
+ not installed, suggest installing it; creating an unrelated host is not a substitute.
90
+
91
+ [Context sharing](references/context.md) keeps selected text and annotations as
92
+ unsent reference context. Page context, memory hits and source content are not
93
+ execution approval. Keep credentials and private data out of source and fixtures.
@@ -1,167 +1,114 @@
1
- ## How Apps Are Built
2
-
3
- All Notis apps are built using the Notis CLI, either locally in a repo workspace or inside a Vercel Sandbox. The platform contract is the same in both cases:
4
- - the app is a Vite + React project
5
- - the app uses `@notis/sdk`
6
- - the app is packaged as an ES module bundle
7
- - the portal renders it as a React component inside the portal's React tree
8
-
9
- Use standard React pages in `app/`, not Next.js or a custom server. The host
10
- uses one React/Shadow DOM runtime for authored apps, Store installations,
11
- duplicates and SDK reports. Do not create your own iframe, query Portal-owned
12
- DOM, or install a window-global runtime. Shadow DOM isolates styles, not
13
- JavaScript or credentials: loaded bundles share the Portal browser context.
14
- The host owns
15
- theme injection and authentication. App code uses SDK hooks and the final tool
16
- names discovered through the CLI, declared in `notis.config.ts` and enforced by
17
- the backend. Runtime permissions stay least-authority; releasing an app does not
18
- grant new capabilities.
19
-
20
- ## Architecture
21
-
22
- ```
23
- Notis CLI (local workspace or Vercel Sandbox)
24
- -> Vite + React project with @notis/sdk
25
- -> notis apps init / build / verify / create / link / pull / deploy
26
- -> ES module bundle (app.js + app.css) + manifest
27
- -> Portal renders as React component with real tools/databases
28
- ```
29
-
30
- `deploy` updates the linked installed app for the current account or team. After the user explicitly confirms the App Details page is ready, `apps publish --confirm-ready` submits that deployed version to the Team or Public Store review flow.
31
-
32
- ### Key Components
33
-
34
- 1. **@notis/sdk** (`packages/sdk/`) -- SDK for app developers
35
- - `@notis/sdk` -- NotisProvider, runtime hooks, editors, selection helpers, and shortcut primitives
36
- - `@notis/sdk/interactions` -- headless collection actions and interaction types
37
- - `@notis/sdk/config` -- `defineNotisApp()` for notis.config.ts
38
- - `@notis/sdk/vite` -- `notisViteConfig()` for vite.config.ts
39
- - `@notis/sdk/styles.css` -- shadow-safe app shell styles and base app-surface classes
40
-
41
- 2. **CLI** (`packages/cli/src/command-specs/apps.js`) -- release delivery uses init, build, verify, create, deploy, link, pull, doctor, and list
42
-
43
- 3. **Server** (`server/routers/portal_views/`) -- Returns signed bundle URLs, proxies tool calls
44
-
45
- 4. **Portal** (`portal/src/components/apps/`) -- Renders app bundles as React components via AppViewRenderer
46
-
47
- ### Runtime Bridge
48
-
49
- Apps communicate with the platform through the `NotisRuntime` interface, provided by the portal via React context:
50
-
51
- - **Portal**: the portal creates a real `NotisRuntime` and passes it as a prop to `NotisProvider`. All calls go to `/portal_views/runtime_query` via fetch with the user's JWT.
52
- - The portal mounts the app inside a shadow-scoped content surface and injects the runtime before app mount. There is no supported window-global runtime fallback.
53
-
54
- App code never accesses the runtime directly -- it uses SDK hooks (`useTool`, `useTools`, `useNotis`, etc.) which read from the `NotisProvider` context.
55
-
56
- ## Manifest Format
57
-
58
- Generated by `npx --package @notis_ai/cli@latest -- notis apps build` at `.notis/output/manifest.json`:
59
-
60
- ```json
61
- {
62
- "version": 1,
63
- "spec_version": 4,
64
- "app": { "name": "My App", "slug": "my-app", "title": "My App", "description": "...", "icon": "phosphor:..." },
65
- "routes": [
66
- {
67
- "path": "/",
68
- "slug": "index",
69
- "name": "Dashboard",
70
- "icon": "phosphor:squares-four",
71
- "default": true,
72
- "export_name": "index",
73
- "collection": null
74
- }
75
- ],
76
- "bundle": {
77
- "js": "bundle/app.js",
78
- "css": "bundle/app.css"
79
- },
80
- "databases": ["tasks", { "slug": "templates", "seed_documents": true }],
81
- "tools": ["LOCAL_NOTIS_DATABASE_QUERY"]
82
- }
83
- ```
84
-
85
- Use the exact final names returned by tool discovery for explicit app tool declarations. App-specific TypeScript shapes for tool arguments and results live in the app code; the SDK exposes generic tool hooks alongside its native database hooks.
86
-
87
- Routes are canonical: define navigation in `routes`, give every route an explicit
88
- `slug`, and do not rely on legacy `views`. A configured `collection.sidebar` tree
89
- belongs to the host, not app JSX.
90
-
91
- Database strings package schema only. The object form shown above opts that database into copying its current rows as Store starter content. Use it sparingly and only for non-personal fixtures/templates every installer is meant to receive.
92
- Never seed user-created notes, history, leads, or other private records. In source
93
- config the explicit opt-in is `{ slug: 'templates', seedDocuments: true }`.
94
-
95
- For a read-only database catalog app, declare `["LOCAL_NOTIS_DATABASE_LIST_DATABASES", "LOCAL_NOTIS_DATABASE_GET_DATABASE"]`. Use the list tool for the left/catalog pane and the get tool for the selected database detail pane.
96
-
97
- ## Database Schema
98
-
99
- ### apps table
100
-
101
- | Column | Type | Description |
102
- |---|---|---|
103
- | id | uuid PK | App ID |
104
- | user_id | uuid FK | Owner |
105
- | team_id | uuid FK | Team (nullable) |
106
- | name | text | Display name |
107
- | slug | text UNIQUE | URL slug |
108
- | description | text | App description |
109
- | icon | text | Phosphor icon (e.g. "phosphor:list") |
110
- | status | text | draft, active, archived |
111
- | visibility | text | private, team |
112
- | manifest | jsonb | Latest deployed manifest |
113
- | current_version | integer | Version counter |
114
- | source_listing_id | uuid FK | Source App Store listing for installed store apps; cleared when submitted as a derivative |
115
- | installed_snapshot | jsonb | Store-installed baseline used for update/reset comparison |
116
- | customization_overlay | jsonb | User changes over the installed store baseline |
117
- | update_status | text | up_to_date, update_available, needs_resolution, update_failed |
118
- | bundled_automation_ids | uuid[] | Linked automations |
119
- | bundled_skill_ids | uuid[] | Linked skills |
120
-
121
- ### databases ownership
122
-
123
- Every row in the `databases` table carries `owner_app_id` (uuid FK to
124
- `apps.id`, `ON DELETE CASCADE`): a database belongs to exactly one app, and
125
- deleting the app deletes its databases and their documents (`documents` cascade
126
- from `databases`). Install, resource preparation, and Store updates stamp
127
- `owner_app_id` automatically; standalone creation requires the `app` argument.
128
- The app config references existing database slugs; it does not own the schema.
129
- The database row is the schema source of truth. Treat deployed slugs as stable
130
- contracts: rename display titles rather than changing slugs behind live callers.
131
-
132
- ### Storage (Supabase)
133
-
134
- Files stored in `app-code` bucket at `{app_id}/v{version}/`:
135
- - `manifest.json`
136
- - `bundle/app.js`
137
- - `bundle/app.css`
138
-
139
- Editable source snapshots are stored in the private `app-source` bucket at
140
- `{app_id}/v{version}/`. Portal App Store listing screenshots are uploaded to
141
- the public `app-listing-assets` bucket before submission.
142
-
143
- ### Related tables
144
-
145
- - **databases** -- Apps reference these rows by slug. Schema lives on the database row (`schema_metadata` / `original_fields`), not in the app manifest.
146
- - **documents** -- `database_id` links to databases. Properties in `properties` jsonb.
147
- - **app_store_listings** -- Snapshots for publishing to the app store.
148
- - **app_submissions** -- Portal review submissions keyed to an app source version and registry slug.
149
-
150
- ## Server Endpoints
151
-
152
- | Endpoint | Method | Purpose |
153
- |---|---|---|
154
- | `/portal_views/get` | GET | Route detail + runtime descriptor with signed bundle URLs |
155
- | `/portal_views/runtime_query` | POST | Proxy tool calls and DB operations |
156
- | `/portal_views/collection_items` | GET | List collection items |
157
- | `/portal_views/collection_tree` | GET | List normalized collection tree nodes for a tree sidebar route |
158
- | `/portal_views/collection_tree/create` | POST | Create a root or child collection row from the sidebar |
159
- | `/portal_views/collection_tree/rename` | POST | Rename a collection tree item inline |
160
- | `/portal_views/collection_tree/delete` | POST | Delete a collection tree item from the sidebar |
161
- | `/portal_apps/list` | GET | List apps |
162
- | `/portal_apps/get` | GET | Get app detail |
163
- | `/portal_apps/publish` | POST | Submit a deployed app source snapshot for public store review |
164
- | `/portal_apps/listing_assets/upload` | POST | Legacy pre-manifest screenshot upload; do not use for current manifest-media workflows |
165
- | `/portal_apps/submissions` | GET/PATCH | List or edit App Store submissions |
166
- | `/portal_apps/submissions/withdraw` | POST | Close a pending App Store submission |
167
- | `/cli_tools` | POST | CLI tool execution (save_app_files, create_app, etc.) |
1
+ # Platform boundaries
2
+
3
+ A Space is a place with Editors, resources and optional child Spaces. A view is
4
+ that Space's presentation. A collection is a view over native records. The Python
5
+ backend owns authority, schema validation, connections, billing and orchestration.
6
+
7
+ ## Source and runtime
8
+
9
+ Use a Vite/React project with `@notis/sdk`; the selected source compiles to an ES
10
+ module and stylesheet. `defineSpaces` indexes independently deployable definitions;
11
+ `defineSpace` declares one Space. The CLI generates the manifest—edit source,
12
+ not generated metadata. [View authoring](views.md) owns its declaration contract.
13
+
14
+ The Portal renders authored code in a React/Shadow DOM host. Shadow DOM isolates
15
+ styles, not JavaScript authority. SDK hooks receive an opaque scoped runtime;
16
+ source has no account-wide tool, JWT or backend transport. Declare actions and
17
+ resource aliases; the backend resolves exact bindings and saved authorizations.
18
+ Renderers get read-only snapshots, not an editor room or reusable account credential.
19
+
20
+ Native viewer reads are different: `viewerReads: ['databases', 'skills']` lets a
21
+ signed-in viewer inspect only resources they can already reach, read-only. They
22
+ are unavailable to anonymous Sites. A shared database list uses `shows` instead.
23
+
24
+ ## Ownership and sharing
25
+
26
+ Every database stays linked to at least one Space and has one main view. A link
27
+ makes the resource reachable to that Space's Editors; it is not a copy. The same
28
+ Skill may be edited through several Spaces without becoming several Skills.
29
+ A failed target never falls back to a different authority.
30
+
31
+ The protected owner and Editors of a Space and its ancestors can reach it.
32
+ Moving a subtree changes who can reach every child/resource; report the actual
33
+ access delta before moving. Removing an Editor or unlinking a resource revokes
34
+ future reads, writes and memory access through that path.
35
+
36
+ A Site is a scoped standalone website, not an Editor membership. Record Sites
37
+ stay pinned to their record, including views whose record param is not the
38
+ collection database. First-party body/properties/HTML are read-only snapshots.
39
+ Share controls, uploads, collaboration, agents, Skills and automations are not
40
+ available in that anonymous runtime. See the Site consequences below for its
41
+ declared reads, actions and billing.
42
+
43
+ ## Consequences to explain before acting
44
+
45
+ For each requested change, explain who may act, who gains or loses access, what
46
+ happens to data and links, and the applicable defaults, limits and recovery
47
+ options below. Preserve conditional consequences even in a short answer;
48
+ translate implementation fields into their practical effect. Before an actual
49
+ change, explain its consequences and act only within the user's authorization.
50
+ Live tool schemas own the arguments.
51
+
52
+ - **Link** (`links.add` on the Skill, automation or database writer): Editors of
53
+ that Space and of every Space above it gain the resource. It stays one resource
54
+ with the same ID: nothing is copied, no grant or connection moves, and an edit
55
+ shows through every reachable link. Requires Editor on the Space and edit rights
56
+ on the resource.
57
+ - **Move** (`links.add` plus `links.remove` in one update): the new Space's people
58
+ gain it; people who reached it only through the old link lose it. IDs, records,
59
+ schema and bound automations are kept. **A database move across separate Space
60
+ trees** requires an Editor of the database and of both Spaces. The added Space
61
+ receives its main view (`main_view`) and its origin moves there. That main view
62
+ stays pending until the Space deploys a record param with `main: true`;
63
+ meanwhile, bare record links open that Space (`view_warning`).
64
+ - **Unlink**: people who reached the resource only through that link lose it. The
65
+ last reachable Skill or automation link leaves it standalone for the remover, and
66
+ an active automation is paused. A database's last Space link is refused
67
+ (`database_last_space`): offer the move. `LOCAL_NOTIS_DATABASE_DELETE_DATABASE`
68
+ refuses a database linked to a Space (`database_linked_to_space`); a database
69
+ used only in one Space is deleted with that Space when its bin entry is deleted.
70
+ - **Move a Space** (`LOCAL_NOTIS_MANAGE_SPACE` `move`): Editors of the new parent
71
+ gain the whole subtree; people who reached it only through the old parent lose it.
72
+ - **Bin** (`trash`, only after the user confirms): the subtree leaves everyone's
73
+ Spaces for 30 days and keeps its links. Databases linked only inside it go too.
74
+ A database also linked elsewhere stays usable there: the bin lends its main view
75
+ to a published record-param view in a live Space and its origin to a reachable
76
+ live link. Automations created only inside it pause. A record's child Space
77
+ stays under its record, outside the bin, while another live Space still shows
78
+ that record's database; it goes with the bin only when none does.
79
+ - **Restore** (`restore`): the same IDs, Editors, links and databases return, and
80
+ paused automations resume. Lent main views and origins come back unless a
81
+ decision was made meanwhile (a published main claim, an explicit move, a copy).
82
+ A Space whose parent is still in the bin returns at the top level.
83
+ - **Delete now** (Portal Bin; no agent tool): removes the Spaces, their pages and the
84
+ databases only they link, with every row whoever wrote it, and their stored files.
85
+ Databases linked elsewhere stay. Skills and automations stay with a live Space
86
+ that lists them or become standalone for the person who binned the Space.
87
+ `bin_entry_in_use` names a Space that still uses one of its records; that Space
88
+ must move, or be deleted from the bin, first.
89
+ - **Remove a member or leave** (Portal Share window; no agent tool): the person
90
+ loses the subtree. Their own resources that the Space uses are kept for the Space
91
+ first. Keep a copy (on by default) gives them a private copy of the pages,
92
+ databases with their rows and Skills they lose, with automations paused, and
93
+ switches their own Spaces' links to the copies; unchecked, those links become
94
+ unavailable (see recovery below). The owner cannot be removed and hands
95
+ ownership over before leaving.
96
+ - **Site** (Portal; no agent tool): anyone with the link, signed out. A Space Site is
97
+ the Share window's "Publish as a site". One record uses its page's Share popover
98
+ (Create public link, then Shared publicly with Copy link and Stop sharing) or
99
+ "Publish this page as a site" in the Share window. Visitors reach only declared
100
+ actions and reads. Any paid action or read is billed to the grant issuer, not
101
+ the visitor. The Site never exposes an agent, Skill or automation, and a record
102
+ Site cannot reach sibling records. Turning a Site off denies the next request.
103
+
104
+ **Unavailable-link recovery:** a failed link stays unavailable; it never silently
105
+ switches to another source of access. Explain the applicable choices: relink,
106
+ duplicate or remove it.
107
+
108
+ ## Independent copies
109
+
110
+ A Space Store snapshot includes source, declared resources, linked Skill closure
111
+ and only explicitly selected fictional starter rows. An installation remaps IDs
112
+ and main-view claims to the installer's independent copy. Updates compare the
113
+ published baseline, new snapshot and local customizations; unresolved conflicts
114
+ stay explicit. [Delivery](release.md) owns validation and publication steps.