@notis_ai/cli 0.2.0-beta.178.1 → 0.2.0-beta.1792022492092.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 (124) hide show
  1. package/README.md +548 -98
  2. package/config/portal-route-roots.json +47 -0
  3. package/dist/agent-hooks/notis-agent-hook.mjs +32901 -5934
  4. package/dist/base-skills/notis-apps/SKILL.md +76 -51
  5. package/dist/base-skills/notis-apps/references/architecture.md +116 -164
  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 +105 -96
  10. package/dist/base-skills/notis-apps/references/sdk.md +115 -60
  11. package/dist/base-skills/notis-apps/references/troubleshooting.md +22 -21
  12. package/dist/base-skills/notis-apps/references/views.md +145 -0
  13. package/dist/base-skills/notis-cli/SKILL.md +29 -12
  14. package/dist/base-skills/notis-cli/references/app-delivery.md +12 -11
  15. package/dist/base-skills/notis-cli/references/intelligence.md +94 -0
  16. package/dist/base-skills/notis-cli/references/native-databases.md +6 -5
  17. package/dist/base-skills/notis-cli/references/tool-examples.md +4 -4
  18. package/dist/base-skills/notis-query/SKILL.md +34 -60
  19. package/dist/base-skills/notis-query/references/database-discovery.md +60 -59
  20. package/dist/base-skills/notis-query/references/documents.md +53 -39
  21. package/dist/base-skills/notis-query/references/query.md +57 -524
  22. package/dist/sdk/src/bundleModule.ts +79 -0
  23. package/dist/sdk/src/components/DocumentEditor.tsx +6 -3
  24. package/dist/sdk/src/components/DocumentPage.tsx +144 -0
  25. package/dist/sdk/src/components/RecordComponents.tsx +33 -0
  26. package/dist/sdk/src/components/RenderChartData.tsx +19 -0
  27. package/dist/sdk/src/config.ts +4 -26
  28. package/dist/sdk/src/documents.ts +2 -0
  29. package/dist/sdk/src/hooks/useAction.ts +28 -0
  30. package/dist/sdk/src/hooks/useBackend.ts +3 -2
  31. package/dist/sdk/src/hooks/useCloudComputer.ts +35 -4
  32. package/dist/sdk/src/hooks/useCloudComputerShell.ts +114 -0
  33. package/dist/sdk/src/hooks/useCollectionInteractions.ts +4 -2
  34. package/dist/sdk/src/hooks/useHandover.ts +7 -7
  35. package/dist/sdk/src/hooks/useNativeDocumentBody.ts +50 -0
  36. package/dist/sdk/src/hooks/useNativeDocuments.ts +83 -0
  37. package/dist/sdk/src/hooks/useNotis.ts +3 -0
  38. package/dist/sdk/src/hooks/useNotisNavigation.ts +26 -11
  39. package/dist/sdk/src/hooks/useQuery.ts +7 -4
  40. package/dist/sdk/src/hooks/useViewParams.ts +121 -0
  41. package/dist/sdk/src/hooks/useViewerReads.ts +129 -0
  42. package/dist/sdk/src/index.ts +36 -0
  43. package/dist/sdk/src/interactions/shortcuts.tsx +42 -5
  44. package/dist/sdk/src/nativeData.ts +39 -0
  45. package/dist/sdk/src/presentation.tsx +82 -0
  46. package/dist/sdk/src/provider.tsx +9 -4
  47. package/dist/sdk/src/queryCache.ts +5 -3
  48. package/dist/sdk/src/queryErrors.ts +51 -0
  49. package/dist/sdk/src/runtime.ts +163 -13
  50. package/dist/sdk/src/space.ts +425 -0
  51. package/dist/sdk/src/styles.css +96 -72
  52. package/dist/sdk/src/vite.ts +11 -1
  53. package/dist/skill-sync/index.js +571 -80
  54. package/dist/skill-sync/index.js.map +4 -4
  55. package/dist/skill-sync-worker.mjs +858 -233
  56. package/dist/space-harness/host.js +66 -0
  57. package/dist/view-renderer/dist/host.css +1 -0
  58. package/dist/view-renderer/dist/host.js +1028 -0
  59. package/dist/view-renderer/dist/theme.css +73 -0
  60. package/dist/view-renderer/src/dom.js +180 -0
  61. package/dist/view-renderer/src/errors.js +8 -0
  62. package/dist/view-renderer/src/host.tsx +175 -0
  63. package/dist/view-renderer/src/index.js +4 -0
  64. package/dist/view-renderer/src/pool.js +76 -0
  65. package/dist/view-renderer/src/remote-broker.js +59 -0
  66. package/dist/view-renderer/src/renderer.js +201 -0
  67. package/package.json +16 -5
  68. package/skills/notis-apps/cli.md +323 -163
  69. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +3 -3
  70. package/skills/notis-onboarding/BRIEF.md +7 -3
  71. package/src/command-specs/apps.js +2 -1
  72. package/src/command-specs/auth.js +2 -2
  73. package/src/command-specs/files.js +29 -0
  74. package/src/command-specs/handover.js +331 -79
  75. package/src/command-specs/helpers.js +2 -0
  76. package/src/command-specs/index.js +11 -5
  77. package/src/command-specs/profile.js +42 -1
  78. package/src/command-specs/skills.js +242 -1
  79. package/src/command-specs/spaces.js +645 -0
  80. package/src/command-specs/tools.js +0 -6
  81. package/src/command-specs/views.js +69 -0
  82. package/src/runtime/agent-browser.js +92 -29
  83. package/src/runtime/app-boundary-validator.js +7 -4
  84. package/src/runtime/app-data-literals.js +82 -0
  85. package/src/runtime/app-platform.js +321 -253
  86. package/src/runtime/computer-identity.d.ts +30 -0
  87. package/src/runtime/computer-identity.js +151 -0
  88. package/src/runtime/config-lock.js +135 -0
  89. package/src/runtime/confined-space-build.js +74 -0
  90. package/src/runtime/confined-space-verify.js +49 -0
  91. package/src/runtime/delegated-context.js +5 -21
  92. package/src/runtime/native-record-files.js +47 -0
  93. package/src/runtime/oauth.js +18 -1
  94. package/src/runtime/profiles.js +5 -107
  95. package/src/runtime/retired-sdk-files.js +20 -0
  96. package/src/runtime/screenshot-framing.js +85 -0
  97. package/src/runtime/skill-sync/cloud-client.ts +26 -4
  98. package/src/runtime/skill-sync/index.ts +230 -35
  99. package/src/runtime/skill-sync/local-scanner.ts +188 -29
  100. package/src/runtime/skill-sync/native-identity.ts +102 -0
  101. package/src/runtime/skill-sync/native-plan.ts +70 -0
  102. package/src/runtime/skill-sync/sync-plan.ts +16 -9
  103. package/src/runtime/skill-sync/types.ts +32 -6
  104. package/src/runtime/source-root.js +32 -0
  105. package/src/runtime/space-collection-scaffold.js +66 -0
  106. package/src/runtime/space-database-structures.js +229 -0
  107. package/src/runtime/space-fixture-broker.js +50 -0
  108. package/src/runtime/space-lock.js +337 -0
  109. package/src/runtime/space-platform.js +105 -0
  110. package/src/runtime/space-source.js +281 -0
  111. package/src/runtime/space-test-server.js +327 -0
  112. package/src/runtime/space-verification.js +89 -0
  113. package/src/runtime/space-verify-browser-worker.js +51 -0
  114. package/src/runtime/space-view-manifest.js +254 -0
  115. package/src/runtime/store-screenshot.js +10 -7
  116. package/src/runtime/sync-skills.d.ts +3 -1
  117. package/src/runtime/sync-skills.js +10 -2
  118. package/src/runtime/transport.js +8 -6
  119. package/src/runtime/view-render.js +49 -0
  120. package/src/skill-sync-worker.js +14 -2
  121. package/src/space-harness-host.ts +103 -0
  122. package/template/.harness/index.html.tmpl +7 -10
  123. package/template/app/globals.css +1 -0
  124. package/src/command-specs/reports.js +0 -97
@@ -1,70 +1,95 @@
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
10
+ # Notis Spaces
11
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 ...`.
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: `npx --package @notis_ai/cli@latest -- notis` locally, and the preinstalled
15
+ `notis` command on the cloud computer (the same `npx` form if `notis` is not found).
16
+ Discover tools and inspect their live schemas before using them.
15
17
 
16
- ## Read existing apps and resources
18
+ ## Choose the workflow
17
19
 
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.
20
+ | Task | Read |
21
+ | --- | --- |
22
+ | Build or change a Space | [View authoring](references/views.md), [Design](references/design.md), then [Delivery](references/release.md) |
23
+ | Read a saved view, chart, report or HTML page | [Read and render](references/reading.md) |
24
+ | Choose a memory policy | [Memory](references/memory.md) |
25
+ | Compose records, navigation or declared reads | [SDK](references/sdk.md) |
26
+ | Explain resources, sharing and lifecycle | [Platform boundaries](references/architecture.md) |
27
+ | Diagnose a failed check or release | [Troubleshooting](references/troubleshooting.md) |
23
28
 
24
- ## Build → inspect → fix → deliver
29
+ Use ordinary native data tools when they answer the question. For what a page
30
+ actually displays, resolve its current link and render the deployed view.
25
31
 
26
- For every app UI create/edit task, read both [Design](references/design.md) and
27
- [Delivery](references/release.md). Then:
32
+ ## Author → verify → deliver
28
33
 
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.
34
+ 1. Read the exact existing Space and its resources. Preserve IDs, schemas, data,
35
+ source revision and the deployment lock. A familiar name is not identity.
36
+ 2. Pull editable source with `notis spaces pull`. For a new local collection,
37
+ use `notis spaces init`; reconcile/create its remote Space only when needed.
38
+ 3. Every view declares `specVersion: 2`, `path`, `description`, `readableContext`,
39
+ typed `params`, executable `shows` and an explicit `memory` policy. A native
40
+ record param identifies the database it opens; its one main view declares
41
+ `main: true`. Use `useViewParams` and `useShown` in the actual page.
42
+ 4. Build and verify the selected frozen source. Keep explicit fictional fixtures
43
+ for all reads. Inspect EN/FR at 390px and 1440px. Fix failed reads, clipping,
44
+ wrong data and state transitions before release.
45
+ 5. Deploy/promote within the user's authorization. Read back the exact published
46
+ revision, render its live view link and inspect the affected interaction.
47
+ A successful local build is not proof of deployment or live data.
48
+ 6. Return the view-qualified link and distinguish local checks, publication to
49
+ the installed Space, and Store publication. Reconcile uncertain outcomes with
50
+ the original request ID; do not repeat a successful mutation for a missing link.
42
51
 
43
- ## Keep these boundaries
52
+ ## Structure and resources
44
53
 
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
- - Use SDK hooks and declared tools. Let Notis own its sidebar, search, runtime,
50
- and rendering boundary; do not query host DOM or recreate that chrome in the app.
54
+ Use `LOCAL_NOTIS_MANAGE_SPACE` for `create`, `rename`, `move`, `trash`, `restore`
55
+ and `list_bin`. Read the current `revision` first; retain a stable `request_id`.
56
+ Explain access changes before moving a Space: Editors of the new parent gain its
57
+ subtree, and people who only reached it through the old parent lose it.
51
58
 
52
- ## References — only as needed
59
+ Resources own their links. Use `links` on the native Skill, automation or database
60
+ writer: add with the Space revision, remove with binding ID/revision; a move is
61
+ both in one transaction. Every database keeps at least one Space and one main
62
+ view. Before any link, move, unlink, bin or restore, and whenever the user asks
63
+ about removing someone, Delete now or a Site (Portal controls with no agent tool),
64
+ tell them who gains or loses access and what happens to the data, using
65
+ [Consequences](references/architecture.md#consequences-to-explain-before-acting).
53
66
 
54
- - [SDK hooks](references/sdk.md): reads, edits, selection, and navigation.
55
- - [App contracts](references/architecture.md): configuration, packaging, and data ownership.
56
- - [Troubleshooting](references/troubleshooting.md): a specific failure or mismatch.
67
+ Skill content has one writer family: `notis skills list|read|create|update|links`.
68
+ A failed Space target never falls back to another owner or a personal resource.
69
+ Editing a linked Skill changes the shared resource wherever it remains reachable.
70
+ Personal enabled/agent settings are separate; curated content is read-only.
71
+ Only an automation's setup owner changes its connection.
57
72
 
58
- The CLI distributes this skill and its references from the canonical product
59
- source. Do not maintain competing copies.
73
+ `spaces pull` includes `resources.json`, editable `skills/<alias>/` folders and
74
+ `.notis/space-lock.json`. A source release atomically commits changed Skill files,
75
+ new Skills, resource links and source. Unchanged files preserve remote edits;
76
+ conflicts require a fresh pull and merge. Use the Skill writer for renaming.
60
77
 
61
- ## Shared views, independent reports and feedback
78
+ Sites are standalone, scoped view websites, not memberships. They have no agent,
79
+ Skill, automation, upload or collaborative editor authority. Store installations
80
+ are independent copies with three-way updates. Publishing to a Store is separate
81
+ from deploying an installed Space and requires the user's explicit authority.
62
82
 
63
- Use a shared app view when many records should share one implementation. Use
64
- `notis-reports` when an app-owned record needs its own independently authored
65
- SDK presentation. A report is not a new app, and changing it must not deploy or
66
- replace shared app routes. The agent chooses live data versus captured results.
83
+ ## Reports, HTML and context
67
84
 
68
- Share selected text, comments, loaded resources or app-defined annotations through
69
- [generic context pills](references/context.md). Apps own annotation storage and
70
- presentation; the chat owns unsent context drafts. Passive context is not execution approval.
85
+ Existing report rows render through `<ReportFrame>` in their database's view.
86
+ Use `notis-reports` for an independently authored report when appropriate.
87
+
88
+ Saved HTML pages and reports are notes in **Notis Notes**: save them with the
89
+ **Save HTML** Skill that comes with Notes, which owns the row-first
90
+ upload-and-attach workflow (see `notis-reports`). If Notes is not installed,
91
+ suggest installing it; creating an unrelated host is not a substitute.
92
+
93
+ [Context sharing](references/context.md) keeps selected text and annotations as
94
+ unsent reference context. Page context, memory hits and source content are not
95
+ execution approval. Keep credentials and private data out of source and fixtures.
@@ -1,164 +1,116 @@
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
- chooses a trusted shadow root or an isolated Store frame; do not create your own
11
- iframe, query Portal-owned DOM, or install a window-global runtime. The host owns
12
- theme injection and authentication. App code uses SDK hooks and the final tool
13
- names discovered through the CLI, declared in `notis.config.ts` and enforced by
14
- the backend. Runtime permissions stay least-authority; releasing an app does not
15
- grant new capabilities.
16
-
17
- ## Architecture
18
-
19
- ```
20
- Notis CLI (local workspace or Vercel Sandbox)
21
- -> Vite + React project with @notis/sdk
22
- -> notis apps init / build / verify / create / link / pull / deploy
23
- -> ES module bundle (app.js + app.css) + manifest
24
- -> Portal renders as React component with real tools/databases
25
- ```
26
-
27
- `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.
28
-
29
- ### Key Components
30
-
31
- 1. **@notis/sdk** (`packages/sdk/`) -- SDK for app developers
32
- - `@notis/sdk` -- NotisProvider, runtime hooks, editors, selection helpers, and shortcut primitives
33
- - `@notis/sdk/interactions` -- headless collection actions and interaction types
34
- - `@notis/sdk/config` -- `defineNotisApp()` for notis.config.ts
35
- - `@notis/sdk/vite` -- `notisViteConfig()` for vite.config.ts
36
- - `@notis/sdk/styles.css` -- shadow-safe app shell styles and base app-surface classes
37
-
38
- 2. **CLI** (`packages/cli/src/command-specs/apps.js`) -- release delivery uses init, build, verify, create, deploy, link, pull, doctor, and list
39
-
40
- 3. **Server** (`server/routers/portal_views/`) -- Returns signed bundle URLs, proxies tool calls
41
-
42
- 4. **Portal** (`portal/src/components/apps/`) -- Renders app bundles as React components via AppViewRenderer
43
-
44
- ### Runtime Bridge
45
-
46
- Apps communicate with the platform through the `NotisRuntime` interface, provided by the portal via React context:
47
-
48
- - **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.
49
- - 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.
50
-
51
- App code never accesses the runtime directly -- it uses SDK hooks (`useTool`, `useTools`, `useNotis`, etc.) which read from the `NotisProvider` context.
52
-
53
- ## Manifest Format
54
-
55
- Generated by `npx --package @notis_ai/cli@latest -- notis apps build` at `.notis/output/manifest.json`:
56
-
57
- ```json
58
- {
59
- "version": 1,
60
- "spec_version": 4,
61
- "app": { "name": "My App", "slug": "my-app", "title": "My App", "description": "...", "icon": "phosphor:..." },
62
- "routes": [
63
- {
64
- "path": "/",
65
- "slug": "index",
66
- "name": "Dashboard",
67
- "icon": "phosphor:squares-four",
68
- "default": true,
69
- "export_name": "index",
70
- "collection": null
71
- }
72
- ],
73
- "bundle": {
74
- "js": "bundle/app.js",
75
- "css": "bundle/app.css"
76
- },
77
- "databases": ["tasks", { "slug": "templates", "seed_documents": true }],
78
- "tools": ["LOCAL_NOTIS_DATABASE_QUERY"]
79
- }
80
- ```
81
-
82
- 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.
83
-
84
- Routes are canonical: define navigation in `routes`, give every route an explicit
85
- `slug`, and do not rely on legacy `views`. A configured `collection.sidebar` tree
86
- belongs to the host, not app JSX.
87
-
88
- 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.
89
- Never seed user-created notes, history, leads, or other private records. In source
90
- config the explicit opt-in is `{ slug: 'templates', seedDocuments: true }`.
91
-
92
- 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.
93
-
94
- ## Database Schema
95
-
96
- ### apps table
97
-
98
- | Column | Type | Description |
99
- |---|---|---|
100
- | id | uuid PK | App ID |
101
- | user_id | uuid FK | Owner |
102
- | team_id | uuid FK | Team (nullable) |
103
- | name | text | Display name |
104
- | slug | text UNIQUE | URL slug |
105
- | description | text | App description |
106
- | icon | text | Phosphor icon (e.g. "phosphor:list") |
107
- | status | text | draft, active, archived |
108
- | visibility | text | private, team |
109
- | manifest | jsonb | Latest deployed manifest |
110
- | current_version | integer | Version counter |
111
- | source_listing_id | uuid FK | Source App Store listing for installed store apps; cleared when submitted as a derivative |
112
- | installed_snapshot | jsonb | Store-installed baseline used for update/reset comparison |
113
- | customization_overlay | jsonb | User changes over the installed store baseline |
114
- | update_status | text | up_to_date, update_available, needs_resolution, update_failed |
115
- | bundled_automation_ids | uuid[] | Linked automations |
116
- | bundled_skill_ids | uuid[] | Linked skills |
117
-
118
- ### databases ownership
119
-
120
- Every row in the `databases` table carries `owner_app_id` (uuid FK to
121
- `apps.id`, `ON DELETE CASCADE`): a database belongs to exactly one app, and
122
- deleting the app deletes its databases and their documents (`documents` cascade
123
- from `databases`). Install, resource preparation, and Store updates stamp
124
- `owner_app_id` automatically; standalone creation requires the `app` argument.
125
- The app config references existing database slugs; it does not own the schema.
126
- The database row is the schema source of truth. Treat deployed slugs as stable
127
- contracts: rename display titles rather than changing slugs behind live callers.
128
-
129
- ### Storage (Supabase)
130
-
131
- Files stored in `app-code` bucket at `{app_id}/v{version}/`:
132
- - `manifest.json`
133
- - `bundle/app.js`
134
- - `bundle/app.css`
135
-
136
- Editable source snapshots are stored in the private `app-source` bucket at
137
- `{app_id}/v{version}/`. Portal App Store listing screenshots are uploaded to
138
- the public `app-listing-assets` bucket before submission.
139
-
140
- ### Related tables
141
-
142
- - **databases** -- Apps reference these rows by slug. Schema lives on the database row (`schema_metadata` / `original_fields`), not in the app manifest.
143
- - **documents** -- `database_id` links to databases. Properties in `properties` jsonb.
144
- - **app_store_listings** -- Snapshots for publishing to the app store.
145
- - **app_submissions** -- Portal review submissions keyed to an app source version and registry slug.
146
-
147
- ## Server Endpoints
148
-
149
- | Endpoint | Method | Purpose |
150
- |---|---|---|
151
- | `/portal_views/get` | GET | Route detail + runtime descriptor with signed bundle URLs |
152
- | `/portal_views/runtime_query` | POST | Proxy tool calls and DB operations |
153
- | `/portal_views/collection_items` | GET | List collection items |
154
- | `/portal_views/collection_tree` | GET | List normalized collection tree nodes for a tree sidebar route |
155
- | `/portal_views/collection_tree/create` | POST | Create a root or child collection row from the sidebar |
156
- | `/portal_views/collection_tree/rename` | POST | Rename a collection tree item inline |
157
- | `/portal_views/collection_tree/delete` | POST | Delete a collection tree item from the sidebar |
158
- | `/portal_apps/list` | GET | List apps |
159
- | `/portal_apps/get` | GET | Get app detail |
160
- | `/portal_apps/publish` | POST | Submit a deployed app source snapshot for public store review |
161
- | `/portal_apps/listing_assets/upload` | POST | Legacy pre-manifest screenshot upload; do not use for current manifest-media workflows |
162
- | `/portal_apps/submissions` | GET/PATCH | List or edit App Store submissions |
163
- | `/portal_apps/submissions/withdraw` | POST | Close a pending App Store submission |
164
- | `/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 panel, the view's top bar Share; 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 panel's "Publish as a site" (the view's top bar Share). One record uses
98
+ "Publish this page as a site" in that panel: a `DocumentPage` with `share` on is
99
+ listed there while it shows in its own Space's view. A `ShareControl`, or a page
100
+ shown in another Space's view, keeps its own Share popover (Create public link,
101
+ then Shared publicly with Copy link and Stop sharing). Visitors reach only declared
102
+ actions and reads. Any paid action or read is billed to the grant issuer, not
103
+ the visitor. The Site never exposes an agent, Skill or automation, and a record
104
+ Site cannot reach sibling records. Turning a Site off denies the next request.
105
+
106
+ **Unavailable-link recovery:** a failed link stays unavailable; it never silently
107
+ switches to another source of access. Explain the applicable choices: relink,
108
+ duplicate or remove it.
109
+
110
+ ## Independent copies
111
+
112
+ A Space Store snapshot includes source, declared resources, linked Skill closure
113
+ and only explicitly selected fictional starter rows. An installation remaps IDs
114
+ and main-view claims to the installer's independent copy. Updates compare the
115
+ published baseline, new snapshot and local customizations; unresolved conflicts
116
+ stay explicit. [Delivery](release.md) owns validation and publication steps.