notis-apps
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNotis Apps Skill
Notis Apps 技能
Use this skill when the user wants a packaged Notis app -- task manager, CRM, dashboard, internal tool, etc. Notis apps are Vite + React projects that deploy into the Notis portal as installed apps for the current user or team.
Run the Notis CLI through NPX, for example . Sign the CLI in once with ; each account you authorize is a profile you can switch between with . The CLI bundles this base skill and refreshes its canonical copy under on every launch. It is independent of account-skill sync, feature flags, target selection, and cloud deletion.
npx --package @notis_ai/cli@latest -- notis apps listnotis loginnotis profile usenotis-apps~/.notis/skills/base/当用户需要一个打包好的Notis应用(如任务管理器、CRM、仪表盘、内部工具等)时,使用此技能。Notis应用是Vite + React项目,可部署到Notis门户中,作为当前用户或团队的已安装应用。
通过NPX运行Notis CLI,例如 。使用 完成一次CLI登录;您授权的每个账户都是一个配置文件,可通过 在不同配置文件之间切换。CLI会捆绑这个基础技能,并在每次启动时刷新其标准副本至目录下。它独立于账户技能同步、功能标志、目标选择和云删除操作。
npx --package @notis_ai/cli@latest -- notis apps listnotis loginnotis profile usenotis-apps~/.notis/skills/base/How Apps Are Built
应用构建方式
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:
- the app is a Vite + React project
- the app uses
@notis/sdk - the app is packaged as an ES module bundle
- the portal renders it as a React component inside the portal's React tree
所有Notis应用均使用Notis CLI构建,可在本地仓库工作区或Vercel沙箱内进行。两种场景下的平台约定一致:
- 应用为Vite + React项目
- 应用使用
@notis/sdk - 应用打包为ES模块包
- 门户将其作为React组件渲染在门户的React树中
App Workspace Tool Rules
应用工作区工具规则
- Apps are the top-level packaging unit in Notis.
- Choose the execution path before changing an app. A prompt that says the
shell is a hosted/Vercel sandbox, or a shell rooted at , is the hosted sandbox path. A shell on the user's computer with Notis Desktop available is the local Desktop path.
/vercel/sandbox - In a hosted sandbox, do not run : the user's Desktop cannot mount that sandbox filesystem. Unless the user explicitly requests preview-only, read-only, or no deployment, a request to create or edit an app authorizes deploying that app to the user's Workspace after
apps devand automatedapps buildpass. An opt-out stops after those tests with no remote app create/link, database mutation, deploy, or post-deploy checks. Pulling an existing app provides its exact link. For a new app, test first, then reconcile profile state andapps verifyagainst the canonicalapps list --jsonnotis.config.tsand intended personal/team scope: link one exact editable non-development match after a metadata-only (name) detail read proves scope, fail on ambiguity or scope mismatch, or create only when none exists. New CLI-created apps default to personal scope. Before creation, prove that canonicalizing the configinclude_documents: falseyields the configtitle. For personal scope, runnameexactly once. For explicitly requested team scope, discover and inspectapps create "<canonical-config-title>" . --json, dry-run it, execute it exactly once with team visibility and the verified current team scope, verify the returned id/slug/team scope/edit permission, thenLOCAL_NOTIS_CREATE_APPthat exact id. Stop for read-only reconciliation if creation is ambiguous or outcome-unknown. In the local Desktop path, useapps link, let the user test the DEV app, and deploy that development identity directly only after an explicit request. Useapps dev [folder]only for a hosted team-scoped creation or another non-CLI administrative flow that explicitly requires a server-side app row.LOCAL_NOTIS_CREATE_APP - Use to update app metadata.
LOCAL_NOTIS_UPDATE_APP - Use to discover the user's apps.
LOCAL_NOTIS_LIST_APPS - The full app lifecycle uses the CLI in the shell. Always run it through the registry-resolved package, for example ; use the same prefix for
npx --package @notis_ai/cli@latest -- notis apps initandbuild. In hosted shells, the CLI is pre-authenticated throughdeploy.NOTIS_JWT - There are no or
save_apptools. Do not attempt to call them. Use only the CLI for app file operations.load_app - Use (optionally with
npx --package @notis_ai/cli@latest -- notis apps scaffolds list) to discover starting points before scaffolding. Every published Store app is a scaffold; the catalog is served from the public registry, not bundled inside the CLI.--search <term> - Use only to help users choose apps to install, not as a source-clone workflow.
LOCAL_NOTIS_LIST_PUBLIC_APP_STORE - Use only when the user explicitly wants to install from a listing.
LOCAL_NOTIS_INSTALL_APP - Before installing, inspect the listing's . Explain each requested capability and obtain explicit approval; only then pass the matching token in
required_capabilities. Never infer capability approval. The current workspace-wide read token isapproved_capabilities; the read-only cloud computer token isworkspace_databases_read.cloud_computer_read
- 应用是Notis中的顶级打包单元。
- 修改应用前先选择执行路径。若提示shell为托管/Vercel沙箱,或shell根目录为,则为托管沙箱路径;若用户电脑上的shell可使用Notis Desktop,则为本地Desktop路径。
/vercel/sandbox - 在托管沙箱中,请勿运行:用户的Desktop无法挂载该沙箱文件系统。除非用户明确要求仅预览、只读或不部署,否则创建或编辑应用的请求意味着在
apps dev和自动化apps build通过后,授权将应用部署到用户的工作区。选择退出的话,在完成这些测试后将停止操作,不会进行远程应用创建/关联、数据库变更、部署或部署后检查。拉取现有应用会提供其精确链接。对于新应用,先测试,再核对配置文件状态和apps verify与标准apps list --json的notis.config.ts及预期个人/团队范围:在仅读取元数据(name)的详情验证范围后,关联一个精确的可编辑非开发匹配项;若存在歧义或范围不匹配则失败,仅在无匹配项时创建。CLI创建的新应用默认使用个人范围。创建前,需验证将配置include_documents: false标准化后是否等于配置title。对于个人范围,精确运行一次name。对于明确要求的团队范围,发现并检查apps create "<canonical-config-title>" . --json,进行试运行,然后精确运行一次并设置团队可见性和已验证的当前团队范围,验证返回的id/slug/团队范围/编辑权限,再使用LOCAL_NOTIS_CREATE_APP关联该精确id。若创建存在歧义或结果未知,则停止操作并仅进行只读核对。在本地Desktop路径中,使用apps link,让用户测试DEV应用,仅在明确请求后直接部署该开发标识。仅在托管团队范围创建或其他明确需要服务器端应用行的非CLI管理流程中使用apps dev [folder]。LOCAL_NOTIS_CREATE_APP - 使用更新应用元数据。
LOCAL_NOTIS_UPDATE_APP - 使用发现用户的应用。
LOCAL_NOTIS_LIST_APPS - 完整的应用生命周期需在shell中使用CLI。始终通过注册表解析的包运行,例如;
npx --package @notis_ai/cli@latest -- notis apps init和build命令使用相同前缀。在托管shell中,CLI通过deploy预认证。NOTIS_JWT - 不存在或
save_app工具。请勿尝试调用它们。仅使用CLI进行应用文件操作。load_app - 在搭建应用前,使用(可添加
npx --package @notis_ai/cli@latest -- notis apps scaffolds list进行筛选)发现起始模板。每个已发布的商店应用都是一个模板;目录来自公共注册表,而非捆绑在CLI内。--search <term> - 仅在帮助用户选择要安装的应用时使用,而非作为源码克隆流程。
LOCAL_NOTIS_LIST_PUBLIC_APP_STORE - 仅当用户明确想要从列表安装应用时使用。
LOCAL_NOTIS_INSTALL_APP - 安装前,检查列表中的。解释每个请求的权限并获得明确批准;之后再在
required_capabilities中传递匹配的令牌。切勿推断权限已获批准。当前工作区范围的只读令牌为approved_capabilities;只读云计算机令牌为workspace_databases_read。cloud_computer_read
Architecture
架构
Notis CLI (local workspace or Vercel Sandbox)
-> Vite + React project with @notis/sdk
-> notis apps init / dev / build / verify / create / link / pull / deploy
-> ES module bundle (app.js + app.css) + manifest
-> Portal renders as React component with real tools/databasesdeployapps publish --confirm-readyNotis CLI(本地工作区或Vercel沙箱)
-> 集成@notis/sdk的Vite + React项目
-> notis apps init / dev / build / verify / create / link / pull / deploy
-> ES模块包(app.js + app.css)+ 清单
-> 门户将其作为React组件渲染,并对接真实工具/数据库deployapps publish --confirm-readyKey Components
核心组件
-
@notis/sdk () -- SDK for app developers
packages/sdk/- -- NotisProvider, runtime hooks, editors, selection helpers, and shortcut primitives
@notis/sdk - -- headless collection actions and interaction types
@notis/sdk/interactions - --
@notis/sdk/configfor notis.config.tsdefineNotisApp() - --
@notis/sdk/vitefor vite.config.tsnotisViteConfig() - -- shadow-safe app shell styles and base app-surface classes
@notis/sdk/styles.css
-
CLI () -- local development should center on
packages/cli/src/command-specs/apps.js, plus init, build, verify, create, deploy, link, pull, doctor, and listapps dev -
Server () -- Returns signed bundle URLs, proxies tool calls
server/routers/portal_views/ -
Portal () -- Renders app bundles as React components via AppViewRenderer
portal/src/components/apps/
-
@notis/sdk()——面向应用开发者的SDK
packages/sdk/- ——NotisProvider、运行时钩子、编辑器、选择助手和快捷方式原语
@notis/sdk - ——无UI集合操作和交互类型
@notis/sdk/interactions - ——用于notis.config.ts的
@notis/sdk/configdefineNotisApp() - ——用于vite.config.ts的
@notis/sdk/vitenotisViteConfig() - ——支持shadow DOM的应用外壳样式和基础应用表面类
@notis/sdk/styles.css
-
CLI()——本地开发应围绕
packages/cli/src/command-specs/apps.js展开,同时包含init、build、verify、create、deploy、link、pull、doctor和list命令apps dev -
Server()——返回签名的包URL,代理工具调用
server/routers/portal_views/ -
Portal()——通过AppViewRenderer将应用包渲染为React组件
portal/src/components/apps/
Runtime Bridge
运行时桥接
Apps communicate with the platform through the interface, provided by the portal via React context:
NotisRuntime- Portal development: the portal loads a local bundle for an active dev session and still provides a real .
NotisRuntime - Portal: the portal creates a real and passes it as a prop to
NotisRuntime. All calls go toNotisProvidervia fetch with the user's JWT./portal_views/runtime_query - 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.
App code never accesses the runtime directly -- it uses SDK hooks (, , , etc.) which read from the context.
useTooluseToolsuseNotisNotisProvider应用通过接口与平台通信,该接口由门户通过React上下文提供:
NotisRuntime- 门户开发模式:门户为活跃的开发会话加载本地包,并仍提供真实的。
NotisRuntime - 正式门户:门户创建真实的,并将其作为props传递给
NotisRuntime。所有调用均通过fetch发送至NotisProvider,并携带用户的JWT。/portal_views/runtime_query - 门户将应用挂载在shadow作用域的内容表面,并在应用挂载前注入运行时。不支持全局window运行时作为 fallback。
应用代码永远不会直接访问运行时——它使用SDK钩子(、、等),这些钩子从上下文中读取数据。
useTooluseToolsuseNotisNotisProviderHard Rules
硬性规则
- React + Vite only -- No Next.js, no custom server
- ES module bundle -- Vite builds a library-mode bundle with React externalized
- Component rendering -- Apps render as React components directly in the portal. No iframes.
The portal owns the , theme tokens, and runtime provider.
ShadowRoot - HTTP bridge -- Runtime calls use fetch to
/portal_views/runtime_query - Declarative tools -- Tool access is declared in by the final names returned by tool discovery and enforced server-side. Views can call native Notis, connected integrations, PostForMe, and MCP tools directly; metered calls use the same credit-cap and usage-billing path as the CLI.
notis.config.ts - shadcn + Notis theme -- Apps must use shadcn components with the live Notis theme provided by the portal
- Phosphor icons only -- Always prefix. Never emojis.
phosphor: - Database refs only -- references existing databases by slug. The schema source of truth lives in the
notis.config.tstable, not in the manifest. Every native database is owned by exactly one app (databases): creating one throughdatabases.owner_app_idrequires the owning app's slug or id in theLOCAL_NOTIS_DATABASE_UPSERT_DATABASEargument, install/dev materialization stamps ownership automatically, and deleting an app deletes its databases and their documents. An app-owned database slug is a stable deployed contract because bundles and collection routes may call it directly. Do not try to rename that slug with a schema tool; rename the display title instead.app - Use NPX for CLI commands -- Always run .
npx --package @notis_ai/cli@latest -- notis ... - is not store publishing --
apps deployupdates an installed app only and persists its source snapshot. Store review starts separately withapps deployafter explicit user approval.apps publish --confirm-ready - Routes are canonical -- Define navigation only in . Every configured route must declare an explicit
manifest.routes. Do not rely on legacyslug.manifest.views - Portal-owned sidebars stay portal-owned -- If a route uses , treat that sidebar as platform chrome. Do not remove it, recreate it inside app JSX, or replace it with a custom in-app folder rail.
collection.sidebar - Portal globals are off-limits -- Never use , query portal-owned DOM hooks, or create global DOM portals.
window.__NOTIS_RUNTIME__ - Prefer inline optimistic edits -- Rename-like edits for collections, app-owned rows, and sidebar-backed entities should use inline editing with an optimistic UI update, then roll back on backend failure. Use modals only when the edit requires multiple fields or destructive confirmation.
- The execution environment determines the deploy gate -- In the local Desktop path, run , let the user test the automatically mounted DEV app, and do not deploy until the user asks; first deploy promotes that
apps dev [folder]directly, so never create a second app first. In a hosted sandbox,dev_app_idcannot reach the user's Desktop; bootstrapapps dev, build and verify first, then resolve exact identity/resources and deploy to the user's Workspace, verify the remote version and live runtime, and return the exact Portal URL. Automatic deployment is the default for create/edit requests only; an explicit preview-only, read-only, or no-deploy request wins. This standing sandbox authorization does not authorize Store submission.agent-browser - Installed app identity is exact, editable, and scope-proven -- Validate an explicit persisted link for this API/user profile before using it. Otherwise inspect every accessible exact-canonical-slug row, including development rows; link only one editable non-development candidate whose exact detail proves the intended personal/team scope. Fail closed on a development collision, multiple matches, missing scope proof, or scope mismatch, and never infer identity from display name. After first install, keep the validated profile-scoped link so Portal and CLI update the same app instead of creating duplicates.
- Development identities stay separate -- uses
.notis/state.jsonfor the hidden development-runtime row anddev_app_idonly for an accessible installed workspace app, scoped under the authenticated environment. Never pass a runtime app whose manifest hasapp_idtois_dev: true.notis apps link - Automatic mounts are multi-instance and least-authority -- Prod, Beta, and source-development Desktop instances may mount the same source simultaneously with independent authenticated runtimes. Automatic mounting never grants capabilities: reuse existing grants and leave restricted capabilities denied until approved. Consumer leases expire after crashes so the shared host exits after the last live instance. There are no offline rows or manual start/stop controls.
- Store submission is user-gated -- Run only after the user explicitly confirms the current App Details page and Store listing are ready. Deploy the exact approved local state first. The command must reject missing confirmation, incomplete listing media, a local/deployed version mismatch, private visibility, or an existing pending review.
apps publish --confirm-ready - Bump before linked development and every Store update --
notisAppVersionmust contain a semverpackage.json. A linked local source substitutes its installed Workspace app only when the local version is strictly greater than the installed manifest'snotisAppVersion; equal, lower, missing, or invalid versions keep serving the online bundle.release_versionretrieves the online version, so incrementapps pullbeforenotisAppVersionwhen continuing development. For an existing Store app, also increment it beyond the currently published registry version before deploy and submission; registry CI rejects equal or lower versions.apps dev - owns release history -- Keep the complete release history in one root
CHANGELOG.md, newest entry first. Do not add newCHANGELOG.mdvalues toversionNotes. Usenotis.config.ts, or## [Release title] - YYYY-MM-DDfor an unpublished entry. App Details reads What’s New and Version History from the deployed package manifest, while the Store reads them from the latest published snapshot; unpublished workspace edits must never change the Store page. The manifest also exposes{PR_MERGE_DATE}package.jsonas the package version shown in App Details.notisAppVersion - Database rows are private unless explicitly seeded -- A string declaration such as publishes schema only and never includes the developer's rows. Use
databases: ['notes']only for small, intentional starter content that every installer should receive. Never enable it for user-created notes, history, leads, or other personal data.{ slug: 'templates', seedDocuments: true } - Public submissions are complete, reviewable packages -- The registry PR must contain the full editable source tree, Store assets, exact source-declared database schemas, and only explicitly seeded starter rows. Registry CI validates those boundaries before merge; do not hand-edit or strip source files to make a check pass. Fix the app locally, redeploy, and resubmit.
notis-listing.json - New projects default to , and
~/.notis/apps/<slug>overrides it --[dir]andapps inituse this stable, predictable home unless the app belongs in a specific repository, monorepo, or user-chosen location. In those cases, passapps pulland report the resulting path. Do not nest an app inside a directory whose local workspace metadata selects an unrelated Notis runtime or profile: later CLI calls inherit that routing and may target the wrong environment.[dir] - Machine names and display titles use different casing -- In ,
notis.config.tsis the stable machine identity and must be lowercase kebab-case (name).name: 'link-building'is the human-facing app name and must use deliberate display casing (title), preserving product spelling and acronyms such astitle: 'Link Building'andNotis. Never put a title-cased phrase inSEO, never show a raw slug as the title, and never change an existing canonicalnameor remote slug merely to repair display casing. The persistedname, Workspace sidebar, App Details, and Store listing must useapps.name.title
- 仅支持React + Vite——不支持Next.js,不支持自定义服务器
- ES模块包——Vite构建库模式包,React作为外部依赖
- 组件渲染——应用直接作为React组件在门户中渲染,不使用iframe。门户拥有、主题令牌和运行时提供者。
ShadowRoot - HTTP桥接——运行时调用通过fetch发送至
/portal_views/runtime_query - 声明式工具——工具访问权限在中声明,使用工具发现返回的最终名称,并由服务器端强制执行。视图可直接调用原生Notis、已连接的集成、PostForMe和MCP工具;计量调用使用与CLI相同的信用上限和使用计费路径。
notis.config.ts - shadcn + Notis主题——应用必须使用shadcn组件,并搭配门户提供的实时Notis主题
- 仅使用Phosphor图标——始终使用前缀,切勿使用emoji
phosphor: - 仅引用数据库——通过slug引用现有数据库。模式的唯一来源是
notis.config.ts表,而非清单。每个原生数据库仅归一个应用所有(databases):通过databases.owner_app_id创建数据库时,需在LOCAL_NOTIS_DATABASE_UPSERT_DATABASE参数中传入所属应用的slug或id,安装/开发实例化会自动标记所有权,删除应用会删除其数据库及文档。应用所属的数据库slug是稳定的部署约定,因为包和集合路由可能直接调用它。请勿尝试使用模式工具重命名该slug;请改为重命名显示标题。app - 使用NPX执行CLI命令——始终运行
npx --package @notis_ai/cli@latest -- notis ... - 不等于商店发布——
apps deploy仅更新已安装的应用,并保留其源码快照。商店审核需在用户明确批准后,通过apps deploy单独启动。apps publish --confirm-ready - 路由为标准配置——仅在中定义导航。每个配置的路由必须声明明确的
manifest.routes。请勿依赖旧版slug。manifest.views - 门户侧边栏归门户所有——若路由使用,则将该侧边栏视为平台框架。请勿移除它、在应用JSX中重新创建它,或用自定义应用内文件夹导航栏替换它。
collection.sidebar - 禁止访问门户全局对象——切勿使用、查询门户所有的DOM钩子,或创建全局DOM门户。
window.__NOTIS_RUNTIME__ - 优先使用内联乐观编辑——集合、应用所属行和侧边栏支持实体的重命名类编辑应使用内联编辑和乐观UI更新,然后在后端失败时回滚。仅当编辑需要多个字段或破坏性确认时使用模态框。
- 执行环境决定部署条件——在本地Desktop路径中,运行,让用户测试自动挂载的DEV应用,直到用户要求再部署;首次部署会直接升级该
apps dev [folder],因此切勿先创建第二个应用。在托管沙箱中,dev_app_id无法连接到用户的Desktop;启动apps dev,先构建并验证,再解析精确标识/资源并部署到用户的工作区,验证远程版本和实时运行时,然后返回精确的门户URL。自动部署是创建/编辑请求的默认操作;明确的仅预览、只读或不部署请求优先。此沙箱授权不包括商店提交权限。agent-browser - 已安装应用的标识精确、可编辑且范围可验证——使用前验证此API/用户配置文件的明确持久链接。否则检查所有可访问的精确标准slug行,包括开发行;仅关联一个可编辑的非开发候选项,其仅元数据的精确应用详情可验证预期的个人/团队范围。若存在开发冲突、多个匹配项、缺少范围证明或范围不匹配,则失败,切勿从显示名称推断标识。首次安装后,保留已验证的配置文件范围链接,以便门户和CLI更新同一应用,而非创建重复项。
- 开发标识保持独立——使用
.notis/state.json表示隐藏的开发运行时行,仅使用dev_app_id表示可访问的已安装工作区应用,范围限定在已认证环境下。切勿将清单中app_id的运行时应用传递给is_dev: true。notis apps link - 自动挂载为多实例且权限最小化——生产、Beta和源码开发Desktop实例可同时挂载同一源码,且具有独立的已认证运行时。自动挂载永远不会授予权限:重用现有授权,受限权限在获得批准前保持拒绝状态。消费者租约在崩溃后过期,因此共享主机会在最后一个活动实例退出后退出。不存在离线行或手动启动/停止控件。
- 商店提交需用户确认——仅在用户明确确认当前应用详情页面和商店列表准备就绪后,运行。先部署已批准的本地状态。若缺少确认、列表媒体不完整、本地/已部署版本不匹配、可见性为私有或存在待处理审核,该命令会拒绝执行。
apps publish --confirm-ready - 在关联开发和每次商店更新前提升——
notisAppVersion必须包含语义化版本的package.json。仅当本地版本严格大于已安装清单的notisAppVersion时,关联的本地源码才会替代其已安装的工作区应用;版本相等、更低、缺失或无效时,仍会提供在线包。release_version会获取在线版本,因此在继续开发前,需在apps pull前提升apps dev。对于现有商店应用,在部署和提交前,也需将其提升至当前已发布注册表版本之上;注册表CI会拒绝相等或更低的版本。notisAppVersion - 管理发布历史——将完整的发布历史保存在根目录的
CHANGELOG.md中,最新条目放在最前面。请勿向CHANGELOG.md添加新的notis.config.ts值。使用versionNotes格式,或对于未发布条目使用## [Release title] - YYYY-MM-DD。应用详情页面的“新增功能”和“版本历史”从已部署包的清单读取,而商店从最新已发布快照读取;未发布的工作区编辑永远不得更改商店页面。清单还会将{PR_MERGE_DATE}中的package.json作为应用详情页面显示的包版本。notisAppVersion - 数据库行默认为私有,除非明确植入——类似的字符串声明仅发布模式,绝不包含开发者的行。仅当每个安装者都应接收少量有意的起始内容时,使用
databases: ['notes']。切勿为用户创建的笔记、历史记录、销售线索或其他个人数据启用此选项。{ slug: 'templates', seedDocuments: true } - 公共提交需为完整、可审核的包——注册表PR必须包含完整的可编辑源码树、商店资源、源码声明的精确数据库模式,以及仅明确植入的起始行。注册表CI在合并前会验证这些边界;请勿手动编辑或剥离源文件以通过检查。请在本地修复应用,重新部署并重新提交。
notis-listing.json - 新项目默认位于,
~/.notis/apps/<slug>可覆盖此路径——[dir]和apps init使用此稳定、可预测的目录,除非应用属于特定仓库、单体仓库或用户选择的位置。在这些情况下,传入apps pull并报告最终路径。请勿将应用嵌套在本地工作区元数据选择无关Notis运行时或配置文件的目录中:后续CLI调用会继承该路由,可能指向错误的环境。[dir] - 机器名称和显示标题使用不同大小写——在中,
notis.config.ts是稳定的机器标识,必须为小写短横线命名(如name)。name: 'link-building'是面向用户的应用名称,必须使用明确的显示大小写(如title),保留产品拼写和缩写,如title: 'Link Building'和Notis。切勿在SEO中使用标题大小写短语,切勿将原始slug作为标题显示,切勿仅为修复显示大小写而更改现有标准name或远程slug。持久化的name、工作区侧边栏、应用详情页面和商店列表必须使用apps.name。title
Anti-patterns -- NEVER do these
反模式——切勿执行以下操作
These are the most common mistakes agents make. Each one wastes time and produces broken results.
- NEVER assume app deploys create databases for you -- Create or update databases through native Notis database tools or the assistant first, then reference them by slug in . Database creation requires the owning app to exist: pass its slug or id in the
notis.config.tsargument ofapp(create the app first withLOCAL_NOTIS_DATABASE_UPSERT_DATABASEif needed). A database can only be referenced by the app that owns it.LOCAL_NOTIS_CREATE_APP - NEVER bypass the supported workflow by manually stitching together low-level save or lint calls from a local workspace -- Local agents should go through the NPX Notis CLI for ,
apps pull,apps dev,apps build,apps verify,apps create, andapps link.apps deploy - NEVER use to clone a Store listing --
apps pullonly pulls source for an app the user can already access as an installed app. To fork a published Store app, runnpx --package @notis_ai/cli@latest -- notis apps pullinstead: it downloads that app's source from the public registry, and installing the app first is not required.npx --package @notis_ai/cli@latest -- notis apps init "My App" --from <slug> - NEVER apply the local deploy gate to a hosted sandbox -- On the user's local computer, a clean +
apps buildis not deploy consent: hand off the DEV app and wait. In a hosted sandbox, the user's create or edit request is deploy consent for that app becauseapps verifycannot reach their Desktop; deploy only after both commands pass, then verify the remote version. Neither path authorizes Store submission.apps dev - NEVER submit without explicit approval -- A deploy request alone does not authorize Store submission. Run only when the user confirms App Details is ready for Store review.
npx --package @notis_ai/cli@latest -- notis apps publish --confirm-ready - NEVER write raw files -- Write standard React pages in
views/<slug>/index.js.app/ - NEVER invent or bypass the review flow -- Source moves through
npx --package @notis_ai/cli@latest -- notis apps pushandapps pull;apps deploysubmits the deployed snapshot through the same authenticated review endpoint as App Details.apps publish --confirm-ready - NEVER treat as store submission -- It updates the linked installed app for the current account or team scope only. Store submission is a separate, explicitly confirmed step.
apps deploy - NEVER explore server code or tool schemas to invent an alternative app workflow -- Use the Notis CLI.
- NEVER work around a missing portal tree by rendering a duplicate sidebar inside the app -- keep the route manifest as the source of truth and escalate the missing portal sidebar as a platform bug instead.
collection.sidebar - NEVER invent a custom visual language -- Do not ship full-screen gradients, glassmorphism, bright neon palettes, or raw HTML controls as the primary UI. Apps should look like a natural extension of the portal.
- NEVER hand-roll buttons/cards/badges when the scaffold already provides shadcn primitives -- Prefer and portal token classes such as
@/components/ui/*,bg-background,bg-card, andborder-border.text-muted-foreground
这些是代理最常犯的错误,每个错误都会浪费时间并产生无效结果。
- 切勿假设应用部署会自动创建数据库——先通过原生Notis数据库工具或助手创建或更新数据库,然后在中通过slug引用它们。创建数据库需要所属应用已存在:在
notis.config.ts的LOCAL_NOTIS_DATABASE_UPSERT_DATABASE参数中传入其slug或id(若需要,先使用app创建应用)。数据库仅可由所属应用引用。LOCAL_NOTIS_CREATE_APP - 切勿通过手动拼接本地工作区的低级保存或lint调用来绕过支持的工作流——本地代理应通过NPX Notis CLI执行、
apps pull、apps dev、apps build、apps verify、apps create和apps link命令。apps deploy - 切勿使用克隆商店列表——
apps pull仅拉取用户已作为已安装应用访问的应用源码。要复刻已发布的商店应用,请运行npx --package @notis_ai/cli@latest -- notis apps pull:它会从公共注册表下载该应用的源码,无需先安装应用。npx --package @notis_ai/cli@latest -- notis apps init "My App" --from <slug> - 切勿将本地部署条件应用于托管沙箱——在用户的本地计算机上,成功的+
apps build并不代表同意部署:交付DEV应用并等待用户确认。在托管沙箱中,用户的创建或编辑请求即为该应用的部署同意,因为apps verify无法连接到他们的Desktop;仅在两个命令都通过后部署,然后验证远程版本。两种路径均不授权商店提交。apps dev - 切勿未经明确批准提交——仅部署请求并不授权商店提交。仅当用户确认应用详情页面准备好进行商店审核时,才运行。
npx --package @notis_ai/cli@latest -- notis apps publish --confirm-ready - 切勿编写原始文件——在
views/<slug>/index.js目录中编写标准React页面。app/ - 切勿发明命令或绕过审核流程——源码通过
npx --package @notis_ai/cli@latest -- notis apps push和apps pull传递;apps deploy通过与应用详情页面相同的已认证审核端点提交已部署快照。apps publish --confirm-ready - 切勿将视为商店提交——它仅更新当前账户或团队范围的关联已安装应用。商店提交是一个单独的、需明确确认的步骤。
apps deploy - 切勿探索服务器代码或工具模式以发明替代应用工作流——使用Notis CLI。
- 切勿通过在应用内渲染重复侧边栏来解决缺少门户树的问题——将路由清单作为唯一来源,并将缺少门户侧边栏视为平台漏洞上报。
collection.sidebar - 切勿发明自定义视觉语言——切勿将全屏渐变、毛玻璃效果、亮霓虹调色板或原始HTML控件作为主要UI。应用应看起来像是门户的自然扩展。
- 切勿在模板已提供shadcn原语时手动编写按钮/卡片/徽章——优先使用和门户令牌类,如
@/components/ui/*、bg-background、bg-card和border-border。text-muted-foreground
Workflow
工作流
Default to the Store scaffold catalog, not a blank project. Every published Store app is a scaffold: reads the catalog from the public registry, and downloads that app's source. Most user requests overlap with a published app, and starting from one is faster than a bare app.
notis apps scaffolds listnotis apps init --from <slug>- Find a starting point. Run (add
npx --package @notis_ai/cli@latest -- notis apps scaffolds listto filter) to list the published Store apps. If something close matches, run--search <term>to download that app's source from the registry. Only run plainnpx --package @notis_ai/cli@latest -- notis apps init "My App" --from <slug>when no published app fits. Either way the project lands innotis apps init "My App"; add a~/.notis/apps/<slug>argument when the user wants it somewhere else (a tracked git repo, an existing monorepo), and report the path you used.[dir] - Pull your own apps; fork Store apps with .
--fromis for apps the user already has installed or deployed: runapps pull, preserve any local edits in the target directory, then runnpx --package @notis_ai/cli@latest -- notis apps list(lands innpx --package @notis_ai/cli@latest -- notis apps pull <app-id>; pass a~/.notis/apps/<app-slug>argument to place it elsewhere). A pull reproduces the installed release, so increment[dir]package.jsonabove that release beforenotisAppVersion; until then the online bundle remains active. To fork a published Store app, useapps devinstead -- it downloads the source from the registry and does not require installing the app first.apps init --from <slug> - Edit the listing source. In , set
notis.config.tsto the stable lowercase kebab-case identity and setnameto the correctly cased human-facing name; for example,titlewithname: 'link-building'. Treat acronym and brand casing as editorial input, not something to derive mechanically from the slug. Then update description, icon, accent, author, categories, tagline, databases, routes, and tools. Declare a database as a string for schema-only Store packaging; usetitle: 'Link Building'only when its rows are deliberate starter content for every installer. Keep the complete Store release history in the root{ slug: 'templates', seedDocuments: true }, newest entry first, usingCHANGELOG.md(or## [Release title] - YYYY-MM-DDbefore publication). The first entry powers What’s New and the same file powers Version History.{PR_MERGE_DATE}is aiconvalue orphosphor:<name>; when unset the app shows its two-letter initials everywhere (store, sidebar, app details).metadata/icon.pngoptionally pins the avatar color to one ofaccent(default derived from the app id). Icon/accent flow through deploy onto the app row + listing and can also be set later via theblue|violet|emerald|amber|rose|sky|fuchsia|tealtool.update_app - Build pages in . Reuse scaffold code wherever it fits.
app/ - Test the source before remote mutation. Before changing a linked installed app, increment
package.jsonabove the installed release. In a fresh hosted sandbox, bootstrap Agent Browser withnotisAppVersion. Generate configured screenshots; usenpm exec --yes --package agent-browser@latest -- agent-browser installortheme: 'dark'where appropriate and reserve screenshottheme: 'light'for diagnostics. Run--raw, runnpm install, then runnpx --package @notis_ai/cli@latest -- notis apps buildin the sandbox (or the normal NPX verification command locally). Fix every failure. Do not create an app, mutate a database, or deploy before both checks pass.npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verifyis manual triage, not a passing automated gate.--no-browser - Finish the local Desktop path at the DEV handoff. Run ; it creates the development identity and materializes available scaffold database snapshots without requiring a hosted app id. Hand off after the user can see and test the app in its DEV-badged Workspace row. Do not deploy until the user asks, and then run
npx --package @notis_ai/cli@latest -- notis apps dev [folder]directly so the existingapps deployis promoted in place; never rundev_app_idafterapps create. Before handing off, complete all three acceptance checks:apps dev- Root: contains the intended folder (or the app is under the implicit default root).
apps roots list - Bundle: the loopback responds successfully and contains the expected manifest/routes.
/snapshot - Mount and render: the app appears exactly once with a compact badge and its default route renders. For multi-instance work, verify each requested Desktop independently. See Troubleshooting → App is missing from the sidebar if any check fails.
DEV
- Root:
- Gate and resolve one hosted identity after tests pass. If the request is preview-only, read-only, or no-deploy, stop after step 5: do not create or link an app, mutate a database, deploy, or run post-deploy checks. Otherwise, existing edits keep the exact profile-scoped id linked by , after a metadata-only (
apps pull) app-detail read validates its edit permission and scope without materializing databases. For a new hosted app, default the intended scope to personal unless the user explicitly requests team scope, inspectinclude_documents: false, and run.notis/state.json. Consider every accessible exact canonical-slug row, including development rows. Link only one editable, non-development candidate whose metadata-only exact app-detail read proves the intended scope; fail on multiple matches, development-row collisions, missing scope proof, or scope mismatch. Create only when there are zero exact-slug rows. First prove that lowercasing the configapps list --json, replacing non-alphanumeric runs withtitle, and trimming hyphens yields the config-. For personal scope, runnameexactly once and verify the returned id, remote slug, edit permission, and personal scope. For explicitly requested team scope, usenpx --package @notis_ai/cli@latest -- notis apps create "<canonical-config-title>" . --jsonto discover the team-capable app-creation tool, inspect its schema, dry-run it, then executenotis tools searchexactly once with the canonical display title,LOCAL_NOTIS_CREATE_APP, and the exact currentvisibility: "team"when resolved. Verify the result's id, canonical slug,team_id, team visibility, and edit permission, then runteam_idbefore database reconciliation. Never retry an outcome-unknown create; reconcile read-only and stop on ambiguity or any returned identity/scope mismatch.notis apps link <returned-id> . - Reconcile hosted database schemas safely. Read the exact app detail and current schemas first; mutate only missing or changed declarations. For creation, pass the exact app id in the database tool's argument. For an update, resolve the exact
app, verify itsdatabase_idequals the linked app id, update by thatowner_app_id, then read back slug, owner, and schema. Apply only backward-compatible schema expansion before deployment. Stage breaking or destructive changes through an expand-contract sequence and obtain the required destructive approval; never make the currently deployed bundle incompatible before its replacement is live.database_id - Deploy and prove the hosted sandbox result. Use only the exact id established in step 7. Run , read the matching row back with
npx --package @notis_ai/cli@latest -- notis apps deploy, confirm its id and deployed version, then runnpx --package @notis_ai/cli@latest -- notis apps list --json. Return that row's exact profile-appropriatenpx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verify --mode liveonly after every proof passes. Report state precisely: a definite pre-commit rejection is tested but not deployed; a timeout/network/incomplete mutation response is tested, deployment outcome unknown; a confirmed deploy followed by failed readback is deployed but not remotely verified; a failed live check is deployed but live verification failed. Never retry an outcome-unknown mutation.portal_url - Submit only after confirmation. When the user explicitly confirms the current App Details page is ready, ensure the approved state is deployed, then run . The command submits Team apps immediately or opens the Public Store registry review PR. Without that confirmation, stop after deploy.
npx --package @notis_ai/cli@latest -- notis apps publish --confirm-ready
默认使用商店模板目录,而非空白项目。每个已发布的商店应用都是一个模板:从公共注册表读取目录,下载该应用的源码。大多数用户请求与已发布应用重叠,从模板开始比从空白应用更快。
notis apps scaffolds listnotis apps init --from <slug>- 找到起始模板。运行(添加
npx --package @notis_ai/cli@latest -- notis apps scaffolds list进行筛选)列出已发布的商店应用。若有相近匹配项,运行--search <term>从注册表下载该应用的源码。仅当没有已发布应用符合需求时,才运行纯npx --package @notis_ai/cli@latest -- notis apps init "My App" --from <slug>。无论哪种方式,项目都会位于notis apps init "My App";当用户希望将其放在其他位置(如已跟踪的git仓库、现有单体仓库)时,添加~/.notis/apps/<slug>参数,并报告使用的路径。[dir] - 拉取自己的应用;使用复刻商店应用。
--from用于用户已安装或部署的应用:运行apps pull,保留目标目录中的任何本地编辑,然后运行npx --package @notis_ai/cli@latest -- notis apps list(位于npx --package @notis_ai/cli@latest -- notis apps pull <app-id>;传入~/.notis/apps/<app-slug>参数可将其放在其他位置)。拉取操作会重现已安装的版本,因此在[dir]前需将apps dev中的package.json提升至该版本之上;在此之前,在线包仍会生效。要复刻已发布的商店应用,请使用notisAppVersion——它会从注册表下载源码,无需先安装应用。apps init --from <slug> - 编辑列表源码。在中,设置
notis.config.ts为稳定的小写短横线标识,设置name为正确大小写的用户友好名称;例如,title搭配name: 'link-building'。将缩写和品牌大小写视为编辑输入,而非从slug机械推导的内容。然后更新描述、图标、强调色、作者、类别、标语、数据库、路由和工具。将数据库声明为字符串仅用于商店打包模式;仅当数据库行是每个安装者都应接收的有意起始内容时,使用title: 'Link Building'。将完整的商店发布历史保存在根目录的{ slug: 'templates', seedDocuments: true }中,最新条目放在最前面,使用CHANGELOG.md格式(发布前使用## [Release title] - YYYY-MM-DD)。第一条目用于“新增功能”,同一文件用于“版本历史”。{PR_MERGE_DATE}是icon值或phosphor:<name>;未设置时,应用在所有位置(商店、侧边栏、应用详情)显示其两个字母的首字母缩写。metadata/icon.png可将头像颜色固定为accent之一(默认从应用id派生)。图标/强调色会随部署应用到应用行+列表,也可稍后通过blue|violet|emerald|amber|rose|sky|fuchsia|teal工具设置。update_app - 在目录中构建页面。尽可能重用模板代码。
app/ - 远程变更前测试源码。在更改关联的已安装应用前,将中的
package.json提升至已安装版本之上。在新的托管沙箱中,使用notisAppVersion启动Agent Browser。生成配置的截图;根据需要使用npm exec --yes --package agent-browser@latest -- agent-browser install或theme: 'dark',仅在诊断时保留截图theme: 'light'选项。运行--raw,运行npm install,然后在沙箱中运行npx --package @notis_ai/cli@latest -- notis apps build(本地使用常规NPX验证命令)。修复所有失败项。在两项检查通过前,请勿创建应用、变更数据库或部署。npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verify仅用于手动排查,不视为通过自动化检查。--no-browser - 本地Desktop路径在DEV交付时完成。运行;它会创建开发标识,并实例化可用的模板数据库快照,无需托管应用id。在用户可在其DEV标记的工作区行中查看并测试应用后交付。直到用户要求再部署,然后直接运行
npx --package @notis_ai/cli@latest -- notis apps dev [folder],以便现有apps deploy直接升级;切勿在dev_app_id后运行apps dev。交付前完成三项验收检查:apps create- 根目录:包含预期文件夹(或应用在隐式默认根目录下)。
apps roots list - 包:环回响应成功,并包含预期的清单/路由。
/snapshot - 挂载和渲染:应用仅显示一次,带有紧凑的徽章,且其默认路由已渲染。对于多实例工作,独立验证每个请求的Desktop。 若任何检查失败,请参阅故障排除→应用未出现在侧边栏。
DEV
- 根目录:
- 测试通过后锁定并解析一个托管标识。若请求为仅预览、只读或不部署,则在步骤5后停止:请勿创建或关联应用、变更数据库、部署或运行部署后检查。否则,现有编辑会保留关联的精确配置文件范围id,通过仅读取元数据(
apps pull)的应用详情验证其编辑权限和范围,无需实例化数据库。对于新的托管应用,默认预期范围为个人,除非用户明确要求团队范围,检查include_documents: false,并运行.notis/state.json。检查所有可访问的精确标准slug行,包括开发行。仅关联一个可编辑的非开发候选项,其仅元数据的精确应用详情可验证预期范围;若存在多个匹配项、开发行冲突、缺少范围证明或范围不匹配,则失败。仅当没有精确slug行时才创建。首先验证将配置apps list --json转为小写、将非字母数字序列替换为title并修剪-后是否等于配置-。对于个人范围,精确运行一次name,并验证返回的id、远程slug、编辑权限和个人范围。对于明确要求的团队范围,使用npx --package @notis_ai/cli@latest -- notis apps create "<canonical-config-title>" . --json发现支持团队的应用创建工具,检查其模式,进行试运行,然后精确运行notis tools search,传入标准显示标题、LOCAL_NOTIS_CREATE_APP和解析后的精确当前visibility: "team"。验证结果的id、标准slug、team_id、团队可见性和编辑权限,然后在数据库核对前运行team_id。切勿重试结果未知的创建操作;若存在歧义或任何返回的标识/范围不匹配,则停止操作并仅进行只读核对。notis apps link <returned-id> . - 安全核对托管数据库模式。先读取精确的应用详情和当前模式;仅变更缺失或已更改的声明。创建时,在数据库工具的参数中传入精确的应用id。更新时,解析精确的
app,验证其database_id等于关联应用的id,通过该owner_app_id更新,然后回读slug、所有者和模式。部署前仅应用向后兼容的模式扩展。通过扩展-收缩序列分步进行破坏性变更,并获得所需的破坏性批准;切勿在替代包上线前使当前已部署包不兼容。database_id - 部署并验证托管沙箱结果。仅使用步骤7中确定的精确id。运行,使用
npx --package @notis_ai/cli@latest -- notis apps deploy回读匹配的行,确认其id和已部署版本,然后运行npx --package @notis_ai/cli@latest -- notis apps list --json。仅在所有验证通过后,返回该行的精确配置文件对应的npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verify --mode live。精确报告状态:明确的预提交拒绝为已测试但未部署;超时/网络/不完整变更响应为已测试,部署结果未知;确认部署但回读失败为已部署但未远程验证;实时检查失败为已部署但实时验证失败。切勿重试结果未知的变更操作。portal_url - 仅在确认后提交。当用户明确确认当前应用详情页面准备就绪时,确保已批准的状态已部署,然后运行。该命令会立即提交团队应用,或打开公共商店注册表审核PR。若无该确认,则在部署后停止操作。
npx --package @notis_ai/cli@latest -- notis apps publish --confirm-ready
Quick start
快速开始
Choose the local or hosted finish after verification. Local deployment is
user-gated; hosted-sandbox deployment is the default for app create or edit
tasks unless the user explicitly requests preview-only, read-only, or no deploy.
bash
undefined验证后选择本地或托管完成方式。本地部署需用户确认;托管沙箱部署是应用创建或编辑任务的默认方式,除非用户明确要求仅预览、只读或不部署。
bash
undefined1. Pick a published Store app as the scaffold (catalog comes from the public registry)
1. 选择已发布的商店应用作为模板(目录来自公共注册表)
The project lands in ~/.notis/apps/<slug>; append a directory argument when
项目会位于~/.notis/apps/<slug>;当用户希望将应用放在其跟踪的仓库中时,追加目录参数。
the user wants the app in a repo they track.
—
npx --package @notis_ai/cli@latest -- notis apps scaffolds list
npx --package @notis_ai/cli@latest -- notis apps init "My App" --from <slug>
cd ~/.notis/apps/my-app
npm install
npx --package @notis_ai/cli@latest -- notis apps scaffolds list
npx --package @notis_ai/cli@latest -- notis apps init "My App" --from <slug>
cd ~/.notis/apps/my-app
npm install
2. LOCAL COMPUTER: register with Desktop and iterate. After the user approves
2. 本地计算机:在Desktop注册并迭代。用户批准部署后,直接运行deploy升级现有dev_app_id。
deployment, run deploy directly to promote the existing dev_app_id.
—
npx --package @notis_ai/cli@latest -- notis apps dev
npx --package @notis_ai/cli@latest -- notis apps dev
... user tests the DEV-badged app ...
... 用户测试带有DEV徽章的应用 ...
npx --package @notis_ai/cli@latest -- notis apps build
npx --package @notis_ai/cli@latest -- notis apps screenshot
npx --package @notis_ai/cli@latest -- notis apps verify
npx --package @notis_ai/cli@latest -- notis apps deploy
Hosted sandbox finish — never run `apps dev`. Test first, then reconcile the
exact app identity and changed databases before deployment:
```bash
npm exec --yes --package agent-browser@latest -- agent-browser install
npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps screenshot
npx --package @notis_ai/cli@latest -- notis apps build
npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verifynpx --package @notis_ai/cli@latest -- notis apps build
npx --package @notis_ai/cli@latest -- notis apps screenshot
npx --package @notis_ai/cli@latest -- notis apps verify
npx --package @notis_ai/cli@latest -- notis apps deploy
托管沙箱完成方式——切勿运行`apps dev`。先测试,然后在部署前核对精确的应用标识和已更改的数据库:
```bash
npm exec --yes --package agent-browser@latest -- agent-browser install
npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps screenshot
npx --package @notis_ai/cli@latest -- notis apps build
npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verifyNew unlinked app only: reconcile exact canonical slug with apps list. If no
仅针对新的未关联应用:核对精确标准slug与apps list。若无匹配项,使用配置标题创建一次并验证返回的slug。
match exists, create once with the config title and verify the returned slug.
—
npx --package @notis_ai/cli@latest -- notis apps list --json
npx --package @notis_ai/cli@latest -- notis apps list --json
Before create, prove canonicalize(config.title) == config.name.
创建前,验证canonicalize(config.title) == config.name。
npx --package @notis_ai/cli@latest -- notis apps create "<canonical-config-title>" . --json
npx --package @notis_ai/cli@latest -- notis apps create "<canonical-config-title>" . --json
Compare schemas, then create only missing databases or update changed ones by
比较模式,然后仅创建缺失的数据库或通过已验证的database_id更新已更改的数据库,在继续前回读所有者/模式。
verified database_id and read back owner/schema before continuing.
—
npx --package @notis_ai/cli@latest -- notis apps deploy
npx --package @notis_ai/cli@latest -- notis apps list --json
npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verify --mode live
Store submission on either path remains a separate approval-gated action:
```bash
npx --package @notis_ai/cli@latest -- notis apps publish --confirm-readyFor an existing app, link the checkout first so every later command uses the
same profile-scoped installed identity:
bash
npx --package @notis_ai/cli@latest -- notis apps link <app-id> .
npx --package @notis_ai/cli@latest -- notis apps deployOr if editing an installed app locally:
bash
npx --package @notis_ai/cli@latest -- notis apps list
npx --package @notis_ai/cli@latest -- notis apps pull <installed-app-id>
cd ~/.notis/apps/my-app
npm installnpx --package @notis_ai/cli@latest -- notis apps deploy
npx --package @notis_ai/cli@latest -- notis apps list --json
npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verify --mode live
无论哪种路径,商店提交都是单独的需批准操作:
```bash
npx --package @notis_ai/cli@latest -- notis apps publish --confirm-ready对于现有应用,先关联检出的代码,以便后续每个命令都使用相同的配置文件范围已安装标识:
bash
npx --package @notis_ai/cli@latest -- notis apps link <app-id> .
npx --package @notis_ai/cli@latest -- notis apps deploy或者在本地编辑已安装的应用:
bash
npx --package @notis_ai/cli@latest -- notis apps list
npx --package @notis_ai/cli@latest -- notis apps pull <installed-app-id>
cd ~/.notis/apps/my-app
npm installIncrement package.json notisAppVersion above the pulled online release.
将package.json中的notisAppVersion提升至拉取的在线版本之上。
npx --package @notis_ai/cli@latest -- notis apps dev
npx --package @notis_ai/cli@latest -- notis apps build
npx --package @notis_ai/cli@latest -- notis apps verify
npx --package @notis_ai/cli@latest -- notis apps link <installed-app-id> .
npx --package @notis_ai/cli@latest -- notis apps dev
npx --package @notis_ai/cli@latest -- notis apps build
npx --package @notis_ai/cli@latest -- notis apps verify
npx --package @notis_ai/cli@latest -- notis apps link <installed-app-id> .
Only after the user explicitly asks to deploy:
仅在用户明确要求部署时运行:
npx --package @notis_ai/cli@latest -- notis apps deploy
In a hosted sandbox, use the same pull/build/verify sequence but omit `apps
dev`; bootstrap `agent-browser`, materialize any new or changed database schemas
against the exact linked id, deploy automatically after verification, read back
the exact app id/version and `portal_url` with `apps list --json`, run live verification, and return that
exact Portal URL. Never run `apps publish --confirm-ready` without separate
Store approval.npx --package @notis_ai/cli@latest -- notis apps deploy
在托管沙箱中,使用相同的拉取/构建/验证序列,但省略`apps dev`;启动`agent-browser`,针对精确的关联id实例化任何新的或已更改的数据库模式,验证后自动部署,使用`apps list --json`回读精确的应用id/版本和`portal_url`,运行实时验证,然后返回该精确的门户URL。若无单独的商店批准,切勿运行`apps publish --confirm-ready`。Building an App
构建应用
Step 1: Define the config
步骤1:定义配置
Create with:
notis.config.ts- name -- Stable machine identity in lowercase kebab-case, such as ; do not use display casing here
link-building - title -- Human-facing app name with deliberate casing, such as ; preserve brands and acronyms exactly
Link Building - databases -- Slug references to existing Notis databases
- routes -- Route-first sidebar entries with explicit , optional
slug, and optionalparentSlugtree configcollection.sidebar - tools -- Final tool names the app can call at runtime. Use the shared discovery flow (, then
COMPOSIO_SEARCH_TOOLS) while building the app, and copy the returned final names into this list. Examples includeCOMPOSIO_GET_TOOL_SCHEMAS,LOCAL_NOTIS_DATABASE_QUERY,LOCAL_NOTIS_MONID_RUN,GMAIL_SEND_EMAIL, andLOCAL_POSTFORME_CREATE_POST. App code calls each declared name directly throughLOCAL_MCP_<SERVER>_<TOOL>; it does not wrap provider or MCP calls inuseTool. Access stays scoped to the signed-in user's own connections, native database tools stay scoped to the app's databases unlessCOMPOSIO_MULTI_EXECUTE_TOOLis granted, and metered tools use the CLI-equivalent credit-cap and fail-closed usage-billing path.capabilities.workspaceDatabases: 'read'
For collection-backed sidebars, use the route schema directly:
ts
routes: [
{
path: '/',
slug: 'notes',
name: 'Notes',
icon: 'phosphor:note-pencil',
default: true,
collection: {
database: 'notes',
titleProperty: 'Title',
parentProperty: 'Parent note',
sidebar: {
mode: 'tree',
allowCreate: true,
},
},
},
]Use the same page template for the root Notes route and collection/sub-collection detail states. The portal sidebar injects live collection items under the static route row when .
collection.sidebar.mode === 'tree'For arbitrary app-owned resources that are not Notis collection rows, set on the route. Read the decoded identifier from , and link between routes with . Keep collection links on . Publish external preview/source links as the resource ; the host separately supplies the exact Notis review link as for opted-in routes. Handle missing or deleted identifiers with a safe view-level fallback.
resourceDeepLinks: true?resource=useNotis().resourceIdtoRoute('/inbox', { resourceId })?item=urlactive_resource.view_url创建,包含:
notis.config.ts- name——稳定的机器标识,使用小写短横线命名,如;此处请勿使用显示大小写
link-building - title——用户友好的应用名称,使用明确的大小写,如;精确保留品牌和缩写
Link Building - databases——对现有Notis数据库的slug引用
- routes——基于路由的侧边栏条目,带有明确的、可选的
slug和可选的parentSlug树配置collection.sidebar - tools——应用在运行时可调用的最终工具名称。构建应用时使用共享发现流程(,然后
COMPOSIO_SEARCH_TOOLS),并将返回的最终名称复制到此列表中。示例包括COMPOSIO_GET_TOOL_SCHEMAS、LOCAL_NOTIS_DATABASE_QUERY、LOCAL_NOTIS_MONID_RUN、GMAIL_SEND_EMAIL和LOCAL_POSTFORME_CREATE_POST。应用代码通过LOCAL_MCP_<SERVER>_<TOOL>直接调用每个声明的名称;它不会在useTool中包装提供者或MCP调用。访问权限限定在已登录用户自己的连接范围内,原生数据库工具限定在应用的数据库范围内,除非授予COMPOSIO_MULTI_EXECUTE_TOOL权限;计量工具使用与CLI等效的信用上限和失败关闭的使用计费路径。capabilities.workspaceDatabases: 'read'
对于集合支持的侧边栏,直接使用路由模式:
ts
routes: [
{
path: '/',
slug: 'notes',
name: 'Notes',
icon: 'phosphor:note-pencil',
default: true,
collection: {
database: 'notes',
titleProperty: 'Title',
parentProperty: 'Parent note',
sidebar: {
mode: 'tree',
allowCreate: true,
},
},
},
]为根Notes路由和集合/子集合详情状态使用相同的页面模板。当时,门户侧边栏会在静态路由行下注入实时集合项。
collection.sidebar.mode === 'tree'对于不属于Notis集合行的任意应用所属资源,在路由上设置。从读取解码后的标识符,并使用在路由之间跳转。将集合链接保留在上。将外部预览/源码链接发布为资源;主机单独为选择加入的路由提供精确的Notis审核链接作为。使用安全的视图级回退处理缺失或已删除的标识符。
resourceDeepLinks: trueuseNotis().resourceId?resource=toRoute('/inbox', { resourceId })?item=urlactive_resource.view_urlStep 2: Build pages
步骤2:构建页面
Standard React pages in . Use generic SDK tool hooks for data and build on top of the scaffolded shadcn components and portal shell classes (, ):
app/notis-app-shellnotis-app-surfacetsx
'use client';
import { useEffect, useState } from 'react';
import { useTool } from '@notis/sdk';
import { Card } from '@/components/ui/card';
type QueryTasksArgs = { database_id?: string; database_slug?: string; query: { page_size?: number } };
type TaskDoc = { document_id?: string; id?: string; title?: string; properties?: Record<string, unknown> };
type QueryTasksResult = { documents?: TaskDoc[] };
export default function TasksPage() {
const queryTasks = useTool<QueryTasksArgs, QueryTasksResult>('LOCAL_NOTIS_DATABASE_QUERY');
const [documents, setDocuments] = useState<TaskDoc[]>([]);
useEffect(() => {
void queryTasks
.call({ database_id: 'tasks-db-id', query: { page_size: 25 } })
.then((result) => setDocuments(result.documents || []));
}, [queryTasks.call]);
if (queryTasks.loading) return <div>Loading...</div>;
return (
<div className="p-6 space-y-4">
{documents.map((doc) => (
<Card key={doc.id || doc.document_id} className="p-4">
<h3>{doc.title || 'Untitled'}</h3>
<p className="text-muted-foreground">{String(doc.properties?.status || '')}</p>
</Card>
))}
</div>
);
}在目录中创建标准React页面。使用通用SDK工具钩子获取数据,并基于模板的shadcn组件和门户外壳类(、)构建:
app/notis-app-shellnotis-app-surfacetsx
'use client';
import { useEffect, useState } from 'react';
import { useTool } from '@notis/sdk';
import { Card } from '@/components/ui/card';
type QueryTasksArgs = { database_id?: string; database_slug?: string; query: { page_size?: number } };
type TaskDoc = { document_id?: string; id?: string; title?: string; properties?: Record<string, unknown> };
type QueryTasksResult = { documents?: TaskDoc[] };
export default function TasksPage() {
const queryTasks = useTool<QueryTasksArgs, QueryTasksResult>('LOCAL_NOTIS_DATABASE_QUERY');
const [documents, setDocuments] = useState<TaskDoc[]>([]);
useEffect(() => {
void queryTasks
.call({ database_id: 'tasks-db-id', query: { page_size: 25 } })
.then((result) => setDocuments(result.documents || []));
}, [queryTasks.call]);
if (queryTasks.loading) return <div>加载中...</div>;
return (
<div className="p-6 space-y-4">
{documents.map((doc) => (
<Card key={doc.id || doc.document_id} className="p-4">
<h3>{doc.title || '无标题'}</h3>
<p className="text-muted-foreground">{String(doc.properties?.status || '')}</p>
</Card>
))}
</div>
);
}Discovering database schema
发现数据库模式
Before writing app code, inspect the database schema to know what properties exist:
bash
npx --package @notis_ai/cli@latest -- notis tools search "list Notis databases"
npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_LIST_DATABASES --arguments '{}'
npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_GET_DATABASE --arguments '{"database_slug":"social_media_calendar"}'
npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_QUERY --arguments '{"database_id":"social-media-calendar-db-id","query":{"page_size":1}}'Prefer the database returned by or when calling ; use only as a fallback.
idLOCAL_NOTIS_DATABASE_LIST_DATABASESLOCAL_NOTIS_DATABASE_GET_DATABASELOCAL_NOTIS_DATABASE_QUERYdatabase_slugUse through when an app needs schema detail at runtime. Keep database-specific result and property helper types inside the app code.
For document writes, declare the generated canonical tool for the target database, such as , and call it through . Pass flat property values; the server wraps them:
LOCAL_NOTIS_DATABASE_GET_DATABASEuseToolLOCAL_NOTIS_DATABASE_UPSERT_TASKSuseTooltsx
const upsertTask = useTool<Record<string, unknown>, { document?: { id: string } }>('LOCAL_NOTIS_DATABASE_UPSERT_TASKS');
await upsertTask.call({
title: 'My Task',
Status: 'Todo',
Priority: 'P1',
Due: '2025-04-01',
Done: false,
Count: 5,
});Do NOT pass Notion-style wrappers () when upserting.
{select: {name: "Todo"}}编写应用代码前,检查数据库模式以了解存在哪些属性:
bash
npx --package @notis_ai/cli@latest -- notis tools search "list Notis databases"
npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_LIST_DATABASES --arguments '{}'
npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_GET_DATABASE --arguments '{"database_slug":"social_media_calendar"}'
npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_QUERY --arguments '{"database_id":"social-media-calendar-db-id","query":{"page_size":1}}'调用时,优先使用或返回的数据库;仅作为回退使用。
LOCAL_NOTIS_DATABASE_QUERYLOCAL_NOTIS_DATABASE_LIST_DATABASESLOCAL_NOTIS_DATABASE_GET_DATABASEiddatabase_slug当应用在运行时需要模式详情时,通过使用。将数据库特定的结果和属性助手类型保留在应用代码中。对于文档写入,声明目标数据库的生成标准工具,如,并通过调用它。传递扁平的属性值;服务器会自动包装它们:
useToolLOCAL_NOTIS_DATABASE_GET_DATABASELOCAL_NOTIS_DATABASE_UPSERT_TASKSuseTooltsx
const upsertTask = useTool<Record<string, unknown>, { document?: { id: string } }>('LOCAL_NOTIS_DATABASE_UPSERT_TASKS');
await upsertTask.call({
title: '我的任务',
Status: '待办',
Priority: 'P1',
Due: '2025-04-01',
Done: false,
Count: 5,
});写入时请勿传递Notion风格的包装器(如)。
{select: {name: "Todo"}}Design rules
设计规则
- Start from the scaffolded components before writing new UI primitives.
@/components/ui/* - Use restrained portal surfaces: ,
bg-background,bg-card,border-border,text-foreground.text-muted-foreground - Keep layouts compact and dashboard-like. Prefer cards, sections, badges, and tables over marketing-style hero treatments.
- Respect the portal theme. Do not hardcode dark mode or create an app-specific palette.
- If a screen looks like a standalone microsite instead of a portal tool, it is too custom.
- For Notes-style apps, the folder tree belongs to the portal sidebar when configured via . The page content should complement that chrome, not duplicate or replace it.
collection.sidebar - Never indicate selected items with a heavy left-border bar (e.g. paired with a muted background). It looks dated and clashes with the portal chrome. Use a single subtle background change (
border-l-2 border-l-foregroundfor selected,bg-mutedfor hover) and let typography or an icon carry the rest of the state.hover:bg-muted/50 - Do not render any search input inside the app (in-page search rails, "Ask Notis…" pills, command-palette-style bars, etc.). The portal already owns the top-bar search field. Wire your view to it with from
useTopBarSearch({ value, onChange, placeholder, onSubmit })and let the page filter or refetch on the values it receives. The hook also exposes@notis/sdkso the standard top-bar spinner reflects in-flight queries.setLoading
- 在编写新UI原语前,先从模板的组件开始。
@/components/ui/* - 使用克制的门户表面类:、
bg-background、bg-card、border-border、text-foreground。text-muted-foreground - 保持布局紧凑,类似仪表盘。优先使用卡片、区块、徽章和表格,而非营销风格的英雄区设计。
- 遵循门户主题。请勿硬编码深色模式或创建应用特定的调色板。
- 若屏幕看起来像独立的微站点而非门户工具,则过于自定义。
- 对于笔记类应用,当通过配置时,文件夹树属于门户侧边栏。页面内容应补充该框架,而非重复或替换它。
collection.sidebar - 切勿使用粗左边框(如搭配暗淡背景)标记选中项。这种样式过时且与门户框架冲突。使用单一微妙的背景变化(选中时为
border-l-2 border-l-foreground,悬停时为bg-muted),让排版或图标传达其余状态。hover:bg-muted/50 - 请勿在应用内渲染任何搜索输入(页内搜索栏、“询问Notis…”输入框、命令面板式栏等)。门户已拥有顶部栏搜索字段。使用中的
@notis/sdk将视图与它关联,让页面根据接收的值进行筛选或重新获取数据。该钩子还暴露useTopBarSearch({ value, onChange, placeholder, onSubmit }),以便标准顶部栏加载器反映正在进行的查询。setLoading
Sidebar invariants
侧边栏不变量
- When a user asks for folders, sections, or hierarchy in the app sidebar, express that through and
routesincollection.sidebar.notis.config.ts - Treat an existing collection-tree sidebar as a locked structural requirement unless the user explicitly asks to change navigation architecture.
- If the sidebar appears missing for the substituted DEV entry or deployed portal build, do not silently redesign around it. Preserve the manifest contract, call out the discrepancy, and treat it as a portal/runtime bug.
- 当用户要求应用侧边栏包含文件夹、区块或层次结构时,通过中的
notis.config.ts和routes实现。collection.sidebar - 除非用户明确要求更改导航架构,否则将现有集合树侧边栏视为锁定的结构要求。
- 若替换的DEV条目或已部署的门户构建中侧边栏缺失,请勿默默重新设计。保留清单约定,指出差异,并将其视为门户/运行时漏洞。
Step 3: Root layout
步骤3:根布局
tsx
import { NotisProvider } from '@notis/sdk';
import '@notis/sdk/styles.css';
import './globals.css';
export default function AppShell({ children }: { children: React.ReactNode }) {
return <NotisProvider>{children}</NotisProvider>;
}tsx
import { NotisProvider } from '@notis/sdk';
import '@notis/sdk/styles.css';
import './globals.css';
export default function AppShell({ children }: { children: React.ReactNode }) {
return <NotisProvider>{children}</NotisProvider>;
}Manifest Format
清单格式
Generated by at :
npx --package @notis_ai/cli@latest -- notis apps build.notis/output/manifest.jsonjson
{
"version": 1,
"spec_version": 4,
"app": { "name": "My App", "slug": "my-app", "title": "My App", "description": "...", "icon": "phosphor:..." },
"routes": [
{
"path": "/",
"slug": "index",
"name": "Dashboard",
"icon": "phosphor:squares-four",
"default": true,
"export_name": "index",
"collection": null
}
],
"bundle": {
"js": "bundle/app.js",
"css": "bundle/app.css"
},
"databases": ["tasks", { "slug": "templates", "seed_documents": true }],
"tools": ["LOCAL_NOTIS_DATABASE_QUERY"]
}Use canonical tool names for explicit app tool declarations. App-specific TypeScript shapes for tool arguments and results live in the app code; the SDK exposes the generic hook instead of database-specific tool hooks.
notis-*useTool<TArgs, TResult>()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.
For a read-only database catalog app, declare . Use the list tool for the left/catalog pane and the get tool for the selected database detail pane.
["LOCAL_NOTIS_DATABASE_LIST_DATABASES", "LOCAL_NOTIS_DATABASE_GET_DATABASE"]由生成,位于:
npx --package @notis_ai/cli@latest -- notis apps build.notis/output/manifest.jsonjson
{
"version": 1,
"spec_version": 4,
"app": { "name": "My App", "slug": "my-app", "title": "My App", "description": "...", "icon": "phosphor:..." },
"routes": [
{
"path": "/",
"slug": "index",
"name": "Dashboard",
"icon": "phosphor:squares-four",
"default": true,
"export_name": "index",
"collection": null
}
],
"bundle": {
"js": "bundle/app.js",
"css": "bundle/app.css"
},
"databases": ["tasks", { "slug": "templates", "seed_documents": true }],
"tools": ["LOCAL_NOTIS_DATABASE_QUERY"]
}使用标准工具名称进行明确的应用工具声明。工具参数和结果的应用特定TypeScript类型保留在应用代码中;SDK暴露通用的钩子,而非数据库特定的工具钩子。
notis-*useTool<TArgs, TResult>()数据库字符串仅打包模式。上面显示的对象形式选择该数据库将其当前行复制为商店起始内容。谨慎使用,仅用于每个安装者都应接收的非个人固定数据/模板。
对于只读数据库目录应用,声明。使用列表工具作为左侧/目录窗格,使用获取工具作为选中数据库的详情窗格。
["LOCAL_NOTIS_DATABASE_LIST_DATABASES", "LOCAL_NOTIS_DATABASE_GET_DATABASE"]Database Schema
数据库模式
apps table
apps表
| Column | Type | Description |
|---|---|---|
| id | uuid PK | App ID |
| user_id | uuid FK | Owner |
| team_id | uuid FK | Team (nullable) |
| name | text | Display name |
| slug | text UNIQUE | URL slug |
| description | text | App description |
| icon | text | Phosphor icon (e.g. "phosphor:list") |
| status | text | draft, active, archived |
| visibility | text | private, team |
| manifest | jsonb | Latest deployed manifest |
| current_version | integer | Version counter |
| source_listing_id | uuid FK | Source App Store listing for installed store apps; cleared when submitted as a derivative |
| installed_snapshot | jsonb | Store-installed baseline used for update/reset comparison |
| customization_overlay | jsonb | User changes over the installed store baseline |
| update_status | text | up_to_date, update_available, needs_resolution, update_failed |
| bundled_automation_ids | uuid[] | Linked automations |
| bundled_skill_ids | uuid[] | Linked skills |
| 列名 | 类型 | 描述 |
|---|---|---|
| id | uuid PK | 应用ID |
| user_id | uuid FK | 所有者 |
| team_id | uuid FK | 团队(可为空) |
| name | text | 显示名称 |
| slug | text UNIQUE | URL slug |
| description | text | 应用描述 |
| icon | text | Phosphor图标(如"phosphor:list") |
| status | text | draft, active, archived |
| visibility | text | private, team |
| manifest | jsonb | 最新已部署清单 |
| current_version | integer | 版本计数器 |
| source_listing_id | uuid FK | 已安装商店应用的源应用商店列表;作为派生应用提交时清除 |
| installed_snapshot | jsonb | 商店安装的基线,用于更新/重置比较 |
| customization_overlay | jsonb | 用户对已安装商店基线的更改 |
| update_status | text | up_to_date, update_available, needs_resolution, update_failed |
| bundled_automation_ids | uuid[] | 关联的自动化流程 |
| bundled_skill_ids | uuid[] | 关联的技能 |
databases ownership
数据库所有权
Every row in the table carries (uuid FK to
, ): a database belongs to exactly one app, and
deleting the app deletes its databases and their documents ( cascade
from ). Install, dev materialization, and store updates stamp
automatically; standalone creation requires the argument.
databasesowner_app_idapps.idON DELETE CASCADEdocumentsdatabasesowner_app_idappdatabasesowner_app_idapps.idON DELETE CASCADEdocumentsdatabasesowner_app_idappStorage (Supabase)
存储(Supabase)
Files stored in bucket at :
app-code{app_id}/v{version}/manifest.jsonbundle/app.jsbundle/app.css
Editable source snapshots are stored in the private bucket at
. Portal App Store listing screenshots are uploaded to
the public bucket before submission.
app-source{app_id}/v{version}/app-listing-assets文件存储在存储桶的路径下:
app-code{app_id}/v{version}/manifest.jsonbundle/app.jsbundle/app.css
可编辑的源码快照存储在私有存储桶的路径下。门户应用商店列表截图在提交前上传到公共存储桶。
app-source{app_id}/v{version}/app-listing-assetsRelated tables
相关表
- databases -- Apps reference these rows by slug. Schema lives on the database row (/
schema_metadata), not in the app manifest.original_fields - documents -- links to databases. Properties in
database_idjsonb.properties - app_store_listings -- Snapshots for publishing to the app store.
- app_submissions -- Portal review submissions keyed to an app source version and registry slug.
- databases——应用通过slug引用这些行。模式存储在数据库行上(/
schema_metadata),而非应用清单中。original_fields - documents——链接到数据库。属性存储在
database_idjsonb中。properties - app_store_listings——用于发布到应用商店的快照。
- app_submissions——与应用源码版本和注册表slug关联的门户审核提交。
Server Endpoints
服务器端点
| Endpoint | Method | Purpose |
|---|---|---|
| GET | Route detail + runtime descriptor with signed bundle URLs |
| POST | Proxy tool calls and DB operations |
| GET | List collection items |
| GET | List normalized collection tree nodes for a tree sidebar route |
| POST | Create a root or child collection row from the sidebar |
| POST | Rename a collection tree item inline |
| POST | Delete a collection tree item from the sidebar |
| GET | List apps |
| GET | Get app detail |
| POST | Submit a deployed app source snapshot for public store review |
| POST | Legacy pre-manifest screenshot upload; do not use for current manifest-media workflows |
| GET/PATCH | List or edit App Store submissions |
| POST | Close a pending App Store submission |
| POST | CLI tool execution (save_app_files, create_app, etc.) |
| 端点 | 方法 | 用途 |
|---|---|---|
| GET | 路由详情 + 带有签名包URL的运行时描述符 |
| POST | 代理工具调用和数据库操作 |
| GET | 列出集合项 |
| GET | 为树侧边栏路由列出标准化的集合树节点 |
| POST | 从侧边栏创建根或子集合行 |
| POST | 内联重命名集合树项 |
| POST | 从侧边栏删除集合树项 |
| GET | 列出应用 |
| GET | 获取应用详情 |
| POST | 提交已部署的应用源码快照以进行公共商店审核 |
| POST | 旧版清单前截图上传;当前清单媒体工作流请勿使用 |
| GET/PATCH | 列出或编辑应用商店提交 |
| POST | 关闭待处理的应用商店提交 |
| POST | CLI工具执行(save_app_files, create_app等) |
SDK Hook Reference
SDK钩子参考
All hooks and components below are imported from .
already installs ; app code should not add a second provider.
@notis/sdkNotisProviderShortcutProvider| API | Signature | Description |
|---|---|---|
| | App metadata, current route, selected collection item, decoded exact-resource id, ready state |
| | Call a declared tool with app-defined argument/result types. Identical idempotent reads may use |
| | List available tools |
| | Navigate between routes (including |
| | Bind the current view to the Portal-owned top-bar search input |
| | Raw backend request proxy with JWT auth |
| | Query a database and refetch it when its rows change. |
| | Open manager chat with app/resource context plus an optional starter prompt or declared skill. Omit |
| | Read-only cloud computer facts: sandbox existence/status and whether the GitHub CLI is signed in. Requires |
| | Publish the record currently open in the app so manager handover and context menus stay grounded |
| | Keyboard navigation, active-row state, range/toggle selection, marquee selection, and action dispatch for collection UIs |
| | Register scoped keyboard shortcuts. Editable targets are ignored unless explicitly allowed; use |
| | Use the host editor with app-owned persistence, stable |
| | Attach structured, explicitly untrusted app/resource/selection context to selected content and copy operations |
| components | Standard selection controls backed by |
| component | Standard bulk actions with pending/disabled state and shortcut support |
Import headless collection action types and helpers from
. Keep an open detail view synchronized with
, and wrap its selectable content in
so the manager receives both the active record and the
user's exact selection. For , keep stable per
record, pass the latest revision back from , reject revision conflicts
instead of overwriting newer data, and implement whenever the
editor should accept media or file blocks.
@notis/sdk/interactionsuseActiveResourceNotisSelectionBoundaryMarkdownEditorresourceKeyonSaveonUploadFile以下所有钩子和组件均从导入。已安装;应用代码不应添加第二个提供者。
@notis/sdkNotisProviderShortcutProvider| API | 签名 | 描述 |
|---|---|---|
| | 应用元数据、当前路由、选中的集合项、解码后的精确资源id、就绪状态 |
| | 使用应用定义的参数/结果类型调用声明的工具。相同的幂等读取可使用 |
| | 列出可用工具 |
| | 在路由(包括 |
| | 将当前视图与门户拥有的顶部栏搜索输入绑定 |
| | 带有JWT认证的原始后端请求代理 |
| | 查询数据库,并在其行更改时重新获取。 |
| | 打开带有应用/资源上下文的管理器聊天,可选择起始提示或声明的技能。省略 |
| | 只读云计算机信息:沙箱存在/状态以及GitHub CLI是否已登录。需要 |
| | 发布应用中当前打开的记录,以便管理器交接和上下文菜单保持关联 |
| | 集合UI的键盘导航、活动行状态、范围/切换选择、框选和操作调度 |
| | 注册作用域内的键盘快捷键。可编辑目标除非明确允许否则会被忽略;使用 |
| | 使用主机编辑器,带有应用拥有的持久化、稳定的 |
| | 将结构化、明确不受信任的应用/资源/选择上下文附加到选中内容和复制操作 |
| 组件 | 基于 |
| 组件 | 带有待处理/禁用状态和快捷键支持的标准批量操作 |
从导入无UI集合操作类型和助手。使用保持打开的详情视图同步,并将其可选择内容包装在中,以便管理器接收活动记录和用户的精确选择。对于,保持每个记录稳定,从返回最新修订,拒绝修订冲突而非覆盖更新的数据,并在编辑器应接受媒体或文件块时实现。
@notis/sdk/interactionsuseActiveResourceNotisSelectionBoundaryMarkdownEditorresourceKeyonSaveonUploadFileApp configuration additions
应用配置补充
- is the stable local-development identity. Set it when a display rename must not create a second DEV app; otherwise the CLI derives it from
devSlug.name - is only for provider-generated public tool names whose upstream action cannot be reconstructed. Keep the exact final public
toolBindingsinname, then bind it totools; the public name remains the permission boundary.providerToolName
- 是稳定的本地开发标识。当显示重命名不得创建第二个DEV应用时设置它;否则CLI从
devSlug派生它。name - 仅用于提供者生成的公共工具名称,其上游操作无法重构。在
toolBindings中保留精确的最终公共tools,然后将其绑定到name;公共名称仍是权限边界。providerToolName
Typed tool calls
类型化工具调用
useTooltsx
type QueryTasksArgs = { database_id?: string; database_slug?: string; query: { page_size?: number } };
interface TaskDoc {
title: string;
properties: {
Status: string;
Priority: string;
Due: string;
};
};
type QueryTasksResult = { documents: TaskDoc[] };
const queryTasks = useTool<QueryTasksArgs, QueryTasksResult>('LOCAL_NOTIS_DATABASE_QUERY');
const result = await queryTasks.call({ database_id: 'tasks-db-id', query: { page_size: 25 } });
// result.documents[0].properties.Status is typed as stringuseTooltsx
type QueryTasksArgs = { database_id?: string; database_slug?: string; query: { page_size?: number } };
interface TaskDoc {
title: string;
properties: {
Status: string;
Priority: string;
Due: string;
};
};
type QueryTasksResult = { documents: TaskDoc[] };
const queryTasks = useTool<QueryTasksArgs, QueryTasksResult>('LOCAL_NOTIS_DATABASE_QUERY');
const result = await queryTasks.call({ database_id: 'tasks-db-id', query: { page_size: 25 } });
// result.documents[0].properties.Status类型为stringDevelopment Modes
开发模式
Hosted sandbox development
托管沙箱开发
Do not run in a hosted sandbox. The sandbox filesystem is not on the
user's computer, so Desktop cannot mount it. Bootstrap sandbox ,
then build and verify before any remote mutation. For a create or edit request,
unless the user explicitly says preview-only, read-only, or no-deploy, resolve
one exact identity, safely materialize only missing or changed database schemas,
deploy, read back the exact app id/version, run live verification, and return
the exact Portal URL. Inspection, review, and diagnosis remain read-only.
apps devagent-browser请勿在托管沙箱中运行。沙箱文件系统不在用户的计算机上,因此Desktop无法挂载它。启动沙箱,然后在进行任何远程变更前构建并验证。对于创建或编辑请求,除非用户明确表示仅预览、只读或不部署,否则解析一个精确标识,安全实例化仅缺失或已更改的数据库模式,部署,回读精确的应用id/版本,运行实时验证,然后返回精确的门户URL。检查、审核和诊断保持只读。
apps devagent-browserCanonical local development
标准本地开发
bash
npx --package @notis_ai/cli@latest -- notis apps devRuns the real desktop-local development workflow. The CLI should discover all apps in the target workspace and serve their bundles from loopback. Unpublished apps appear in the Electron Portal's Workspace group; linked apps substitute their installed entry only when the local is strictly greater than the installed .
notisAppVersionrelease_versionbash
npx --package @notis_ai/cli@latest -- notis apps dev运行真实的桌面本地开发工作流。CLI应发现目标工作区中的所有应用,并从环回提供其包。未发布的应用出现在Electron门户的工作区组中;仅当本地严格大于已安装的时,关联的应用才会替换其已安装条目。
notisAppVersionrelease_versionTesting
测试
- Build validation: must succeed without errors. Vite surfaces TypeScript and bundling errors during this step.
npx --package @notis_ai/cli@latest -- notis apps build - Headless render verification (recommended after every build): run locally. In a hosted sandbox, first run
npx --package @notis_ai/cli@latest -- notis apps verify, then runnpm exec --yes --package agent-browser@latest -- agent-browser install. It builds unlessnpx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verifyis passed, spins up a loopback harness, drives--skip-buildagainst every route, and reports per-route pass/fail with captured render errors and runtime calls.agent-browser - Local development acceptance: Run once to register the root, then verify each signed-in Desktop instance independently. For an unpublished app, expect one DEV-badged Workspace row. For a linked app, first confirm local
notis apps dev [folder]is strictly greater than installednotisAppVersion, then expect one substituted DEV-badged row; equal or lower must keep the online row and bundle. Verify the default route renders and live edits appear without restarting the CLI or Desktop. Userelease_versionas the persistence proof. Loopback bundle health alone does not prove that an authenticated instance mounted or rendered the app.notis apps roots list - Post-deploy: Read back the exact app id, version, and with
portal_url, runapps list --json, verify the deployed bundle viaapps verify --mode live->/portal_views/get, and return that profile-appropriate exact Portal URL. A confirmed deploy followed by failed readback is deployed but not remotely verified; a failed live check is deployed but live verification failed. The portal renders app bundles directly as React components, so navigate to the app page when an authenticated browser is available.runtime_descriptor.bundle.js_url
- 构建验证:必须成功且无错误。Vite在此步骤中会显示TypeScript和打包错误。
npx --package @notis_ai/cli@latest -- notis apps build - 无头渲染验证(建议每次构建后运行):在本地运行。在托管沙箱中,先运行
npx --package @notis_ai/cli@latest -- notis apps verify,然后运行npm exec --yes --package agent-browser@latest -- agent-browser install。除非传入npx --yes --package @notis_ai/cli@latest --package agent-browser@latest -- notis apps verify,否则它会构建,启动环回工具,驱动--skip-build测试每个路由,并报告每个路由的通过/失败情况,以及捕获的渲染错误和运行时调用。agent-browser - 本地开发验收:运行一次注册根目录,然后独立验证每个已登录的Desktop实例。对于未发布的应用,预期有一个带有DEV徽章的工作区行。对于关联的应用,先确认本地
notis apps dev [folder]严格大于已安装的notisAppVersion,然后预期有一个替换的带有DEV徽章的行;版本相等或更低时必须保留在线行和包。验证默认路由已渲染,且实时编辑无需重启CLI或Desktop即可显示。使用release_version作为持久化证明。仅环回包健康无法证明已认证实例已挂载或渲染应用。notis apps roots list - 部署后:使用回读精确的应用id、版本和
apps list --json,运行portal_url,通过apps verify --mode live->/portal_views/get验证已部署的包,然后返回该配置文件对应的精确门户URL。确认部署但回读失败为已部署但未远程验证;实时检查失败为已部署但实时验证失败。门户直接将应用包渲染为React组件,因此当有已认证浏览器可用时,导航到应用页面。runtime_descriptor.bundle.js_url
Headless harness verification
无头工具验证
Run after . Use after deploy to exercise the real with the CLI JWT instead of stub data; live mode also fails a route whose runtime calls all errored, which a well-behaved error state would otherwise hide. In a hosted sandbox, put on the verification process's with the combined-package command above. only prints URLs for manual triage and does not satisfy the automated deployment gate.
npx --package @notis_ai/cli@latest -- notis apps verifynpx --package @notis_ai/cli@latest -- notis apps build--mode live/portal_views/runtime_queryagent-browserPATH--no-browser在后运行。部署后使用,使用CLI JWT调用真实的而非存根数据;实时模式还会失败所有运行时调用均出错的路由,而行为良好的错误状态会隐藏这些错误。在托管沙箱中,通过上述组合包命令将添加到验证进程的中。仅打印URL供手动排查,不满足自动化部署条件。
npx --package @notis_ai/cli@latest -- notis apps buildnpx --package @notis_ai/cli@latest -- notis apps verify--mode live/portal_views/runtime_queryagent-browserPATH--no-browserWhat the harness catches that npx --package @notis_ai/cli@latest -- notis apps build
does not
npx --package @notis_ai/cli@latest -- notis apps build工具能捕获但npx --package @notis_ai/cli@latest -- notis apps build
不能捕获的问题
npx --package @notis_ai/cli@latest -- notis apps build- Hooks that mount but throw on first read (called with the wrong tool name or argument shape, accessing nested props that are undefined).
useTool - Runtime database queries whose slug is not declared by the app, and collection routes that never query their configured collection database. Declared databases may also support automations or agent workflows, so ordinary routes do not need to query every app database.
- Tool names referenced by hooks but missing from .
notis.config.ts -> tools - Suspense / async boundaries that never resolve because a runtime stub returned the wrong shape.
- Render-time exceptions that the portal would surface as the error boundary.
View crashed
- 挂载但首次读取时抛出错误的钩子(使用错误的工具名称或参数形状,访问未定义的嵌套属性)。
useTool - 运行时数据库查询的slug未被应用声明,以及集合路由从未查询其配置的集合数据库。声明的数据库也可能支持自动化流程或代理工作流,因此普通路由无需查询每个应用数据库。
- 钩子引用但中缺失的工具名称。
notis.config.ts -> tools - 因运行时存根返回错误形状而从未解析的Suspense / 异步边界。
- 门户会显示为错误边界的渲染时异常。
View crashed
What the harness does not catch
工具不能捕获的问题
- Bugs that only manifest with real backend data (auth-scoped filters, RLS, malformed prod records). For those, swap the stub runtime for a real one that posts to with a JWT.
/portal_views/runtime_query - Visual regressions (use + a baseline compare if you need this).
agent-browser screenshot - Bugs that depend on the portal's shadow-DOM stylesheet wrapping. The harness mounts in light DOM, so global Tailwind/shadcn classes work normally; portal-specific theme tokens injected as inline styles are not present.
- 仅在真实后端数据下才会出现的bug(认证范围筛选、RLS、格式错误的生产记录)。对于这些问题,将存根运行时替换为使用JWT提交到的真实运行时。
/portal_views/runtime_query - 视觉回归(若需要,使用+ 基线对比)。
agent-browser screenshot - 依赖门户shadow-DOM样式表包装的bug。工具在普通DOM中挂载,因此全局Tailwind/shadcn类正常工作;作为内联样式注入的门户特定主题令牌不存在。
Troubleshooting
故障排除
Common issues
常见问题
- Deploy fails with network error: Run , then retry with the authenticated API available. Do not bypass DEV-app promotion or installed-app identity with a direct database/storage write.
notis doctor - App shows old code after deploy: Bundle cache is stale. Hard refresh (Cmd+Shift+R) or clear site data in DevTools.
- App is missing from the sidebar: Run , confirm the app is at the root, one direct child, or
apps roots list, and confirm its first build succeeds. For a linked app, compareapps/*package.jsonwith the installed manifest'snotisAppVersion: equal, lower, missing, or invalid intentionally keeps the online app without a DEV badge. If source is stale, preserve any local edits, runrelease_versionto refresh it, then incrementapps pull <app-id> <dir> --forcebefore continuing development. Restarting Desktop reattaches the same persistent roots; no terminal process or manual sidebar action is required.notisAppVersion - returns empty documents: Check that the database ID passed to the tool matches the intended database. Use
LOCAL_NOTIS_DATABASE_QUERYto verify the ID; use the database slug only as a fallback.npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_LIST_DATABASES --arguments '{}' - Properties are : Keep app-local result types for
undefinedand guard optional nested properties when reading live data.useTool<TArgs, TResult>
- 部署因网络错误失败:运行,然后在已认证API可用时重试。请勿绕过DEV应用升级或已安装应用标识,直接进行数据库/存储写入。
notis doctor - 部署后应用显示旧代码:包缓存过期。强制刷新(Cmd+Shift+R)或在DevTools中清除站点数据。
- 应用未出现在侧边栏:运行,确认应用位于根目录、直接子目录或
apps roots list,且首次构建成功。对于关联的应用,比较apps/*中的package.json与已安装清单的notisAppVersion:版本相等、更低、缺失或无效时,会有意保留在线应用且无DEV徽章。若源码过期,保留任何本地编辑,运行release_version刷新,然后在继续开发前提升apps pull <app-id> <dir> --force。重启Desktop会重新连接相同的持久根目录;无需终端进程或手动侧边栏操作。notisAppVersion - 返回空文档:检查传递给工具的数据库ID是否与预期数据库匹配。使用
LOCAL_NOTIS_DATABASE_QUERY验证ID;仅作为回退使用数据库slug。npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_DATABASE_LIST_DATABASES --arguments '{}' - 属性为:为
undefined保留应用本地的结果类型,并在读取实时数据时保护可选的嵌套属性。useTool<TArgs, TResult>