@notis_ai/cli 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -20
- package/dist/agent-hooks/notis-agent-hook.mjs +19750 -0
- package/{skills → dist/base-skills}/notis-apps/SKILL.md +84 -53
- package/{skills → dist/base-skills}/notis-cli/SKILL.md +9 -9
- package/dist/base-skills/notis-query/SKILL.md +705 -0
- package/dist/skill-sync/index.js +1528 -0
- package/dist/skill-sync/index.js.map +7 -0
- package/package.json +5 -2
- package/skills/notis-apps/cli.md +38 -17
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +39 -0
- package/skills/notis-onboarding/BRIEF.md +16 -0
- package/src/agent-hook-entry.js +5 -0
- package/src/cli.js +23 -14
- package/src/command-specs/agents.js +392 -0
- package/src/command-specs/apps.js +871 -387
- package/src/command-specs/auth.js +63 -10
- package/src/command-specs/index.js +6 -0
- package/src/command-specs/onboarding.js +69 -5
- package/src/command-specs/skills.js +56 -0
- package/src/runtime/agent-memory-state.js +126 -0
- package/src/runtime/agent-setup.js +383 -0
- package/src/runtime/app-dev-consumers.js +154 -0
- package/src/runtime/app-dev-host-lock.js +80 -0
- package/src/runtime/app-dev-roots.js +284 -0
- package/src/runtime/app-dev-server.js +212 -22
- package/src/runtime/app-dev-sessions.js +105 -145
- package/src/runtime/app-platform.js +1291 -165
- package/src/runtime/app-registry-scaffolds.js +367 -0
- package/src/runtime/base-skills.d.ts +20 -0
- package/src/runtime/base-skills.js +167 -0
- package/src/runtime/login-listener.js +15 -0
- package/src/runtime/oauth.js +1506 -141
- package/src/runtime/output.js +7 -0
- package/src/runtime/ports.js +16 -0
- package/src/runtime/profiles.js +0 -5
- package/src/runtime/skill-sync/cloud-client.ts +96 -0
- package/src/runtime/skill-sync/index.ts +644 -0
- package/src/runtime/skill-sync/local-scanner.ts +1046 -0
- package/src/runtime/skill-sync/symlink-manager.ts +383 -0
- package/src/runtime/skill-sync/sync-plan.ts +22 -0
- package/src/runtime/skill-sync/types.ts +103 -0
- package/src/runtime/skill-sync/write-cloud-skill.ts +50 -0
- package/src/runtime/store-screenshot.js +6 -1
- package/src/runtime/sync-skills.d.ts +37 -0
- package/src/runtime/sync-skills.js +215 -0
- package/template/app/layout.tsx +5 -1
- package/template/notis.config.ts +1 -0
- package/template/packages/sdk/package.json +2 -1
- package/template/packages/sdk/src/components/DocumentEditor.tsx +13 -3
- package/template/packages/sdk/src/components/MarkdownEditor.tsx +121 -0
- package/template/packages/sdk/src/components/MultiSelectActionBar.tsx +37 -119
- package/template/packages/sdk/src/components/MultiSelectCheckbox.tsx +5 -1
- package/template/packages/sdk/src/components/MultiSelectDragOverlay.tsx +1 -1
- package/template/packages/sdk/src/components/NotisSelectionBoundary.tsx +55 -0
- package/template/packages/sdk/src/components/ShortcutHints.tsx +56 -0
- package/template/packages/sdk/src/config.ts +19 -0
- package/template/packages/sdk/src/documents.ts +7 -1
- package/template/packages/sdk/src/hooks/useActiveResource.ts +19 -0
- package/template/packages/sdk/src/hooks/useCollectionInteractions.ts +709 -0
- package/template/packages/sdk/src/hooks/useHandover.ts +3 -0
- package/template/packages/sdk/src/hooks/useMultiSelect.ts +44 -482
- package/template/packages/sdk/src/hooks/useTool.ts +5 -4
- package/template/packages/sdk/src/index.ts +47 -2
- package/template/packages/sdk/src/interactions/actions.ts +46 -0
- package/template/packages/sdk/src/interactions/shortcuts.tsx +628 -0
- package/template/packages/sdk/src/interactions.ts +41 -0
- package/template/packages/sdk/src/provider.tsx +2 -1
- package/template/packages/sdk/src/runtime.ts +89 -4
- package/dist/scaffolds/notis-database/CHANGELOG.md +0 -5
- package/dist/scaffolds/notis-database/app/globals.css +0 -44
- package/dist/scaffolds/notis-database/app/layout.tsx +0 -6
- package/dist/scaffolds/notis-database/app/page.tsx +0 -1088
- package/dist/scaffolds/notis-database/components/ui/badge.tsx +0 -28
- package/dist/scaffolds/notis-database/components/ui/button.tsx +0 -53
- package/dist/scaffolds/notis-database/components/ui/card.tsx +0 -56
- package/dist/scaffolds/notis-database/components/ui/table.tsx +0 -120
- package/dist/scaffolds/notis-database/components.json +0 -20
- package/dist/scaffolds/notis-database/index.html +0 -12
- package/dist/scaffolds/notis-database/lib/types.ts +0 -132
- package/dist/scaffolds/notis-database/lib/utils.ts +0 -6
- package/dist/scaffolds/notis-database/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-fixtures.json +0 -1839
- package/dist/scaffolds/notis-database/notis.config.ts +0 -73
- package/dist/scaffolds/notis-database/package-lock.json +0 -3935
- package/dist/scaffolds/notis-database/package.json +0 -32
- package/dist/scaffolds/notis-database/packages/sdk/package.json +0 -36
- package/dist/scaffolds/notis-database/packages/sdk/src/components/DocumentEditor.tsx +0 -93
- package/dist/scaffolds/notis-database/packages/sdk/src/components/Markdown.tsx +0 -60
- package/dist/scaffolds/notis-database/packages/sdk/src/components/MultiSelectActionBar.tsx +0 -278
- package/dist/scaffolds/notis-database/packages/sdk/src/components/MultiSelectCheckbox.tsx +0 -91
- package/dist/scaffolds/notis-database/packages/sdk/src/components/MultiSelectDragOverlay.tsx +0 -39
- package/dist/scaffolds/notis-database/packages/sdk/src/config.ts +0 -234
- package/dist/scaffolds/notis-database/packages/sdk/src/documents.ts +0 -250
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useBackend.ts +0 -41
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useCloudComputer.ts +0 -97
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDatabaseSchema.ts +0 -85
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDatabaseSubscription.ts +0 -76
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDocument.ts +0 -78
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDocuments.ts +0 -121
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useHandover.ts +0 -75
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useMultiSelect.ts +0 -539
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useNotis.ts +0 -34
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useNotisNavigation.ts +0 -49
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useTool.ts +0 -64
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useTools.ts +0 -56
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useTopBarSearch.ts +0 -73
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useUpsertDocument.ts +0 -95
- package/dist/scaffolds/notis-database/packages/sdk/src/index.ts +0 -100
- package/dist/scaffolds/notis-database/packages/sdk/src/provider.tsx +0 -43
- package/dist/scaffolds/notis-database/packages/sdk/src/runtime.ts +0 -351
- package/dist/scaffolds/notis-database/packages/sdk/src/styles.css +0 -186
- package/dist/scaffolds/notis-database/packages/sdk/src/ui.ts +0 -15
- package/dist/scaffolds/notis-database/packages/sdk/src/vite.ts +0 -56
- package/dist/scaffolds/notis-database/packages/sdk/tsconfig.json +0 -15
- package/dist/scaffolds/notis-database/postcss.config.mjs +0 -8
- package/dist/scaffolds/notis-database/src/dev-main.tsx +0 -23
- package/dist/scaffolds/notis-database/src/mock-runtime.ts +0 -561
- package/dist/scaffolds/notis-database/tailwind.config.ts +0 -59
- package/dist/scaffolds/notis-database/tsconfig.json +0 -23
- package/dist/scaffolds/notis-database/vite.config.ts +0 -22
- package/dist/scaffolds/notis-journal/CHANGELOG.md +0 -29
- package/dist/scaffolds/notis-journal/app/globals.css +0 -37
- package/dist/scaffolds/notis-journal/app/insights/page.tsx +0 -513
- package/dist/scaffolds/notis-journal/app/journal-core.tsx +0 -362
- package/dist/scaffolds/notis-journal/app/journal-ui.tsx +0 -337
- package/dist/scaffolds/notis-journal/app/layout.tsx +0 -6
- package/dist/scaffolds/notis-journal/app/page.tsx +0 -486
- package/dist/scaffolds/notis-journal/components/ui/badge.tsx +0 -28
- package/dist/scaffolds/notis-journal/components/ui/button.tsx +0 -53
- package/dist/scaffolds/notis-journal/components/ui/card.tsx +0 -56
- package/dist/scaffolds/notis-journal/components.json +0 -20
- package/dist/scaffolds/notis-journal/index.html +0 -12
- package/dist/scaffolds/notis-journal/lib/utils.ts +0 -6
- package/dist/scaffolds/notis-journal/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-journal/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-journal/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-journal/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-journal/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-journal/metadata/screenshot-6.png +0 -0
- package/dist/scaffolds/notis-journal/metadata/screenshot-fixtures.json +0 -132
- package/dist/scaffolds/notis-journal/notis.config.ts +0 -93
- package/dist/scaffolds/notis-journal/package-lock.json +0 -4615
- package/dist/scaffolds/notis-journal/package.json +0 -34
- package/dist/scaffolds/notis-journal/packages/sdk/package.json +0 -36
- package/dist/scaffolds/notis-journal/packages/sdk/src/components/DocumentEditor.tsx +0 -93
- package/dist/scaffolds/notis-journal/packages/sdk/src/components/Markdown.tsx +0 -60
- package/dist/scaffolds/notis-journal/packages/sdk/src/components/MultiSelectActionBar.tsx +0 -278
- package/dist/scaffolds/notis-journal/packages/sdk/src/components/MultiSelectCheckbox.tsx +0 -91
- package/dist/scaffolds/notis-journal/packages/sdk/src/components/MultiSelectDragOverlay.tsx +0 -39
- package/dist/scaffolds/notis-journal/packages/sdk/src/config.ts +0 -234
- package/dist/scaffolds/notis-journal/packages/sdk/src/documents.ts +0 -250
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useBackend.ts +0 -41
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useCloudComputer.ts +0 -97
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useDatabaseSchema.ts +0 -85
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useDatabaseSubscription.ts +0 -76
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useDocument.ts +0 -78
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useDocuments.ts +0 -121
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useHandover.ts +0 -75
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useMultiSelect.ts +0 -539
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useNotis.ts +0 -34
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useNotisNavigation.ts +0 -49
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useTool.ts +0 -64
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useTools.ts +0 -56
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useTopBarSearch.ts +0 -73
- package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useUpsertDocument.ts +0 -95
- package/dist/scaffolds/notis-journal/packages/sdk/src/index.ts +0 -100
- package/dist/scaffolds/notis-journal/packages/sdk/src/provider.tsx +0 -43
- package/dist/scaffolds/notis-journal/packages/sdk/src/runtime.ts +0 -351
- package/dist/scaffolds/notis-journal/packages/sdk/src/styles.css +0 -186
- package/dist/scaffolds/notis-journal/packages/sdk/src/ui.ts +0 -15
- package/dist/scaffolds/notis-journal/packages/sdk/src/vite.ts +0 -56
- package/dist/scaffolds/notis-journal/packages/sdk/tsconfig.json +0 -15
- package/dist/scaffolds/notis-journal/postcss.config.mjs +0 -8
- package/dist/scaffolds/notis-journal/skills/journal-onboarding/SKILL.md +0 -120
- package/dist/scaffolds/notis-journal/src/dev-main.tsx +0 -58
- package/dist/scaffolds/notis-journal/src/mock-runtime.ts +0 -199
- package/dist/scaffolds/notis-journal/tailwind.config.ts +0 -58
- package/dist/scaffolds/notis-journal/tsconfig.json +0 -23
- package/dist/scaffolds/notis-journal/vite.config.ts +0 -10
- package/dist/scaffolds/notis-notes/CHANGELOG.md +0 -5
- package/dist/scaffolds/notis-notes/app/globals.css +0 -3
- package/dist/scaffolds/notis-notes/app/layout.tsx +0 -6
- package/dist/scaffolds/notis-notes/app/page.tsx +0 -1943
- package/dist/scaffolds/notis-notes/app/phosphor-icons.ts +0 -596
- package/dist/scaffolds/notis-notes/components/ui/badge.tsx +0 -28
- package/dist/scaffolds/notis-notes/components/ui/button.tsx +0 -53
- package/dist/scaffolds/notis-notes/components/ui/card.tsx +0 -56
- package/dist/scaffolds/notis-notes/components.json +0 -20
- package/dist/scaffolds/notis-notes/lib/utils.ts +0 -6
- package/dist/scaffolds/notis-notes/lib/visible-properties.ts +0 -144
- package/dist/scaffolds/notis-notes/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-fixtures.json +0 -752
- package/dist/scaffolds/notis-notes/notis.config.ts +0 -80
- package/dist/scaffolds/notis-notes/package-lock.json +0 -4636
- package/dist/scaffolds/notis-notes/package.json +0 -35
- package/dist/scaffolds/notis-notes/packages/sdk/package.json +0 -36
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/DocumentEditor.tsx +0 -93
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/Markdown.tsx +0 -60
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/MultiSelectActionBar.tsx +0 -278
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/MultiSelectCheckbox.tsx +0 -91
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/MultiSelectDragOverlay.tsx +0 -39
- package/dist/scaffolds/notis-notes/packages/sdk/src/config.ts +0 -234
- package/dist/scaffolds/notis-notes/packages/sdk/src/documents.ts +0 -250
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useBackend.ts +0 -41
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useCloudComputer.ts +0 -97
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDatabaseSchema.ts +0 -85
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDatabaseSubscription.ts +0 -76
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDocument.ts +0 -78
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDocuments.ts +0 -121
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useHandover.ts +0 -75
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useMultiSelect.ts +0 -539
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useNotis.ts +0 -34
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useNotisNavigation.ts +0 -49
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useTool.ts +0 -64
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useTools.ts +0 -56
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useTopBarSearch.ts +0 -73
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useUpsertDocument.ts +0 -95
- package/dist/scaffolds/notis-notes/packages/sdk/src/index.ts +0 -100
- package/dist/scaffolds/notis-notes/packages/sdk/src/provider.tsx +0 -43
- package/dist/scaffolds/notis-notes/packages/sdk/src/runtime.ts +0 -351
- package/dist/scaffolds/notis-notes/packages/sdk/src/styles.css +0 -186
- package/dist/scaffolds/notis-notes/packages/sdk/src/ui.ts +0 -15
- package/dist/scaffolds/notis-notes/packages/sdk/src/vite.ts +0 -56
- package/dist/scaffolds/notis-notes/packages/sdk/tsconfig.json +0 -15
- package/dist/scaffolds/notis-notes/postcss.config.mjs +0 -8
- package/dist/scaffolds/notis-notes/tailwind.config.ts +0 -58
- package/dist/scaffolds/notis-notes/tsconfig.json +0 -23
- package/dist/scaffolds/notis-notes/vite.config.ts +0 -10
- package/dist/scaffolds/notis-random/CHANGELOG.md +0 -15
- package/dist/scaffolds/notis-random/README.md +0 -33
- package/dist/scaffolds/notis-random/app/globals.css +0 -11
- package/dist/scaffolds/notis-random/app/history/page.tsx +0 -67
- package/dist/scaffolds/notis-random/app/layout.tsx +0 -7
- package/dist/scaffolds/notis-random/app/page.tsx +0 -289
- package/dist/scaffolds/notis-random/components/ui/button.tsx +0 -50
- package/dist/scaffolds/notis-random/components/ui/card.tsx +0 -16
- package/dist/scaffolds/notis-random/components/ui/input.tsx +0 -23
- package/dist/scaffolds/notis-random/components.json +0 -20
- package/dist/scaffolds/notis-random/index.html +0 -12
- package/dist/scaffolds/notis-random/lib/notis-tools.ts +0 -128
- package/dist/scaffolds/notis-random/lib/rng.ts +0 -202
- package/dist/scaffolds/notis-random/lib/roll-record.ts +0 -189
- package/dist/scaffolds/notis-random/lib/utils.ts +0 -25
- package/dist/scaffolds/notis-random/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-fixtures.json +0 -753
- package/dist/scaffolds/notis-random/notis.config.ts +0 -86
- package/dist/scaffolds/notis-random/package-lock.json +0 -4513
- package/dist/scaffolds/notis-random/package.json +0 -36
- package/dist/scaffolds/notis-random/packages/sdk/package.json +0 -36
- package/dist/scaffolds/notis-random/packages/sdk/src/components/DocumentEditor.tsx +0 -93
- package/dist/scaffolds/notis-random/packages/sdk/src/components/Markdown.tsx +0 -60
- package/dist/scaffolds/notis-random/packages/sdk/src/components/MultiSelectActionBar.tsx +0 -278
- package/dist/scaffolds/notis-random/packages/sdk/src/components/MultiSelectCheckbox.tsx +0 -91
- package/dist/scaffolds/notis-random/packages/sdk/src/components/MultiSelectDragOverlay.tsx +0 -39
- package/dist/scaffolds/notis-random/packages/sdk/src/config.ts +0 -234
- package/dist/scaffolds/notis-random/packages/sdk/src/documents.ts +0 -250
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useBackend.ts +0 -41
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useCloudComputer.ts +0 -97
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDatabaseSchema.ts +0 -85
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDatabaseSubscription.ts +0 -76
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDocument.ts +0 -78
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDocuments.ts +0 -121
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useHandover.ts +0 -75
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useMultiSelect.ts +0 -539
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useNotis.ts +0 -34
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useNotisNavigation.ts +0 -49
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useTool.ts +0 -64
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useTools.ts +0 -56
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useTopBarSearch.ts +0 -73
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useUpsertDocument.ts +0 -95
- package/dist/scaffolds/notis-random/packages/sdk/src/index.ts +0 -100
- package/dist/scaffolds/notis-random/packages/sdk/src/provider.tsx +0 -43
- package/dist/scaffolds/notis-random/packages/sdk/src/runtime.ts +0 -351
- package/dist/scaffolds/notis-random/packages/sdk/src/styles.css +0 -186
- package/dist/scaffolds/notis-random/packages/sdk/src/ui.ts +0 -15
- package/dist/scaffolds/notis-random/packages/sdk/src/vite.ts +0 -56
- package/dist/scaffolds/notis-random/packages/sdk/tsconfig.json +0 -15
- package/dist/scaffolds/notis-random/postcss.config.mjs +0 -6
- package/dist/scaffolds/notis-random/src/dev-main.tsx +0 -70
- package/dist/scaffolds/notis-random/src/mock-runtime.ts +0 -129
- package/dist/scaffolds/notis-random/tailwind.config.ts +0 -50
- package/dist/scaffolds/notis-random/tsconfig.json +0 -23
- package/dist/scaffolds/notis-random/vite.config.ts +0 -11
- package/dist/scaffolds.json +0 -49
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration utilities for notis.config.ts.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* ```ts
|
|
6
|
-
* // notis.config.ts
|
|
7
|
-
* import { defineNotisApp } from '@notis/sdk/config';
|
|
8
|
-
*
|
|
9
|
-
* export default defineNotisApp({
|
|
10
|
-
* name: 'My App',
|
|
11
|
-
* description: 'Does things',
|
|
12
|
-
* icon: 'phosphor:squares-four',
|
|
13
|
-
* databases: ['tasks'],
|
|
14
|
-
* routes: [
|
|
15
|
-
* {
|
|
16
|
-
* path: '/',
|
|
17
|
-
* slug: 'notes',
|
|
18
|
-
* name: 'Notes',
|
|
19
|
-
* default: true,
|
|
20
|
-
* collection: {
|
|
21
|
-
* database: 'notes',
|
|
22
|
-
* titleProperty: 'Name',
|
|
23
|
-
* parentProperty: 'Parent',
|
|
24
|
-
* sidebar: {
|
|
25
|
-
* mode: 'tree',
|
|
26
|
-
* allowCreate: true,
|
|
27
|
-
* },
|
|
28
|
-
* },
|
|
29
|
-
* },
|
|
30
|
-
* ],
|
|
31
|
-
* tools: [...],
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
export interface NotisRouteConfig {
|
|
37
|
-
path: string;
|
|
38
|
-
slug: string;
|
|
39
|
-
name: string;
|
|
40
|
-
icon?: string;
|
|
41
|
-
parentSlug?: string | null;
|
|
42
|
-
default?: boolean;
|
|
43
|
-
exportName?: string;
|
|
44
|
-
collection?: {
|
|
45
|
-
database: string;
|
|
46
|
-
titleProperty: string;
|
|
47
|
-
parentProperty?: string | null;
|
|
48
|
-
sidebar?: {
|
|
49
|
-
mode: 'flat-list' | 'tree';
|
|
50
|
-
allowCreate: boolean;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const NOTIS_APP_CATEGORIES = [
|
|
56
|
-
'Productivity',
|
|
57
|
-
'Sales & Marketing',
|
|
58
|
-
'Operations',
|
|
59
|
-
'Product & Engineering',
|
|
60
|
-
'Personal',
|
|
61
|
-
] as const;
|
|
62
|
-
|
|
63
|
-
export type NotisAppCategory = typeof NOTIS_APP_CATEGORIES[number];
|
|
64
|
-
|
|
65
|
-
export interface NotisAppDatabaseConfig {
|
|
66
|
-
/** Database slug, as declared by the app. */
|
|
67
|
-
slug: string;
|
|
68
|
-
/**
|
|
69
|
-
* Ship this database's rows to everyone who installs the app.
|
|
70
|
-
*
|
|
71
|
-
* Off by default: declaring a database publishes its STRUCTURE, never its
|
|
72
|
-
* content. Turn it on only for starter content that every installer should
|
|
73
|
-
* receive - a default folder tree, a set of templates - and never for a
|
|
74
|
-
* database that accumulates the author's own data.
|
|
75
|
-
*/
|
|
76
|
-
seedDocuments?: boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface NotisAppAuthor {
|
|
80
|
-
name: string;
|
|
81
|
-
handle?: string;
|
|
82
|
-
url?: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface NotisAppSkillConfig {
|
|
86
|
-
/** Stable source-owned key used by other app declarations. */
|
|
87
|
-
key: string;
|
|
88
|
-
/**
|
|
89
|
-
* Path to the skill, relative to notis.config.ts. Either a Markdown file
|
|
90
|
-
* (`./skills/onboarding.md`) or a directory holding SKILL.md plus its
|
|
91
|
-
* supporting files (`./skills/onboarding/`), which are packaged on deploy
|
|
92
|
-
* and materialized next to SKILL.md in the sandbox.
|
|
93
|
-
*/
|
|
94
|
-
path: string;
|
|
95
|
-
/** User-facing name used for the installed skill. */
|
|
96
|
-
name: string;
|
|
97
|
-
description?: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface NotisAppOnboardingConfig {
|
|
101
|
-
/** Key of a skill declared in `skills`. */
|
|
102
|
-
skill: string;
|
|
103
|
-
/** Editable message placed in Notis when onboarding is opened. */
|
|
104
|
-
prompt: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface NotisAppScreenshotConfig {
|
|
108
|
-
/** Conventional metadata/screenshot-N.png source path. */
|
|
109
|
-
path: string;
|
|
110
|
-
/** Meaningful description used by the Store gallery and assistive technology. */
|
|
111
|
-
alt: string;
|
|
112
|
-
/** Route slug captured by `notis apps screenshot`. */
|
|
113
|
-
route?: string;
|
|
114
|
-
/**
|
|
115
|
-
* Named scenario from metadata/screenshot-fixtures.json. Its `tools` and
|
|
116
|
-
* `requests` override the file-level ones key by key for this capture, and
|
|
117
|
-
* its `actions` run once the route has mounted -- so one route can be shown
|
|
118
|
-
* in several states (populated, empty, a panel opened) without the states
|
|
119
|
-
* leaking into each other.
|
|
120
|
-
*/
|
|
121
|
-
scenario?: string;
|
|
122
|
-
/** Optional CSS selector captured as the truthful focal region for this Store image. */
|
|
123
|
-
focus?: string;
|
|
124
|
-
/** Portal color scheme used while rendering this screenshot. Defaults to light. */
|
|
125
|
-
theme?: 'light' | 'dark';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Named accent tokens for an app's avatar. Keep in sync with the portal
|
|
130
|
-
* `ACCENT_NAMES` and the server `ACCENT_TOKENS`.
|
|
131
|
-
*/
|
|
132
|
-
export const NOTIS_APP_ACCENTS = [
|
|
133
|
-
'blue',
|
|
134
|
-
'violet',
|
|
135
|
-
'emerald',
|
|
136
|
-
'amber',
|
|
137
|
-
'rose',
|
|
138
|
-
'sky',
|
|
139
|
-
'fuchsia',
|
|
140
|
-
'teal',
|
|
141
|
-
] as const;
|
|
142
|
-
|
|
143
|
-
export type NotisAppAccent = typeof NOTIS_APP_ACCENTS[number];
|
|
144
|
-
|
|
145
|
-
export interface NotisAppCapabilities {
|
|
146
|
-
/**
|
|
147
|
-
* Read every database in the workspace, not only the ones this app declares
|
|
148
|
-
* in `databases` or created itself.
|
|
149
|
-
*
|
|
150
|
-
* An app runtime is otherwise sandboxed to its own databases, so a catalog or
|
|
151
|
-
* explorer app sees an empty list without this. `'read'` is the only accepted
|
|
152
|
-
* value and it never grants writes: `LOCAL_NOTIS_DATABASE_UPSERT_*` stays
|
|
153
|
-
* bound to the app's own databases.
|
|
154
|
-
*/
|
|
155
|
-
workspaceDatabases?: 'read';
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Read a few facts about the user's cloud computer: whether a sandbox exists
|
|
159
|
-
* and is running, and whether the GitHub CLI is signed in there.
|
|
160
|
-
*
|
|
161
|
-
* Without this an app has to infer them — the Workspaces app treated a
|
|
162
|
-
* configured repository as proof that `gh auth login` had happened, which
|
|
163
|
-
* cannot show an account name and cannot notice a revoked credential.
|
|
164
|
-
* `'read'` never creates, resumes or commands a sandbox. Read it with
|
|
165
|
-
* `useCloudComputer()`.
|
|
166
|
-
*
|
|
167
|
-
* `'shell'` additionally asks to command the cloud computer: it unlocks
|
|
168
|
-
* `LOCAL_NOTIS_RUN_SANDBOX_SHELL` and the sandbox file tools from this app's
|
|
169
|
-
* views (they are denied to every view otherwise), and implies the read
|
|
170
|
-
* facts. This is the same authority the user's own agent has on the sandbox,
|
|
171
|
-
* so the user is asked for it explicitly at install or in the Store grant
|
|
172
|
-
* step; declare it only when the app's core actions genuinely run there.
|
|
173
|
-
*/
|
|
174
|
-
cloudComputer?: 'read' | 'shell';
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export interface NotisAppConfig {
|
|
178
|
-
/** URL-safe app slug. Existing apps may still use a display name here. */
|
|
179
|
-
name: string;
|
|
180
|
-
/** Human display title, Raycast-style. Falls back to `name`. */
|
|
181
|
-
title?: string;
|
|
182
|
-
description?: string;
|
|
183
|
-
/**
|
|
184
|
-
* App icon. A `phosphor:<name>` value (e.g. `phosphor:dice-five`) or
|
|
185
|
-
* `metadata/icon.png`. When unset, the app shows its two-letter initials.
|
|
186
|
-
*/
|
|
187
|
-
icon?: string;
|
|
188
|
-
/**
|
|
189
|
-
* Optional accent color for the app avatar. One of {@link NOTIS_APP_ACCENTS}.
|
|
190
|
-
* When unset, a stable accent is derived automatically from the app id.
|
|
191
|
-
*/
|
|
192
|
-
accent?: NotisAppAccent;
|
|
193
|
-
author?: NotisAppAuthor;
|
|
194
|
-
categories?: NotisAppCategory[];
|
|
195
|
-
tagline?: string;
|
|
196
|
-
/** @deprecated Add release entries to the root CHANGELOG.md instead. */
|
|
197
|
-
versionNotes?: string;
|
|
198
|
-
/** Editorial screenshot order and capture scenarios for the Store listing. */
|
|
199
|
-
screenshots?: NotisAppScreenshotConfig[];
|
|
200
|
-
/**
|
|
201
|
-
* Databases this app owns. A bare string publishes structure only; use the
|
|
202
|
-
* object form to opt a database into shipping its rows to installers.
|
|
203
|
-
*/
|
|
204
|
-
databases?: (string | NotisAppDatabaseConfig)[];
|
|
205
|
-
/**
|
|
206
|
-
* Extra permissions the app asks for at install time. Everything here widens
|
|
207
|
-
* what the app can reach beyond its own data, so each one is surfaced to the
|
|
208
|
-
* user before they install.
|
|
209
|
-
*/
|
|
210
|
-
capabilities?: NotisAppCapabilities;
|
|
211
|
-
routes?: NotisRouteConfig[];
|
|
212
|
-
/**
|
|
213
|
-
* Final tool names this app can call at runtime, enforced server-side. Use
|
|
214
|
-
* names returned by shared discovery, including native `LOCAL_NOTIS_*`,
|
|
215
|
-
* connected-service names such as `GMAIL_SEND_EMAIL`,
|
|
216
|
-
* `LOCAL_POSTFORME_*`, and `LOCAL_MCP_<SERVER>_<TOOL>`. App code calls
|
|
217
|
-
* each declared name directly with `useTool`; metered calls use the shared
|
|
218
|
-
* credit-cap and usage-billing path.
|
|
219
|
-
*/
|
|
220
|
-
tools?: string[];
|
|
221
|
-
/** Skills shipped from this app's source tree. */
|
|
222
|
-
skills?: NotisAppSkillConfig[];
|
|
223
|
-
/** Optional onboarding entrypoint exposed from the app sidebar. */
|
|
224
|
-
onboarding?: NotisAppOnboardingConfig;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Identity function that provides type checking and autocomplete for the
|
|
229
|
-
* Notis app configuration. The returned object is read at build time by
|
|
230
|
-
* `notis apps build` to generate the manifest.
|
|
231
|
-
*/
|
|
232
|
-
export function defineNotisApp(config: NotisAppConfig): NotisAppConfig {
|
|
233
|
-
return config;
|
|
234
|
-
}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Document data helpers: normalize raw tool results (Notion-shaped property
|
|
3
|
-
* values, snake_case fields) into the SDK's `DocumentRecord`/`DatabaseProperty`
|
|
4
|
-
* shapes, and derive plain-text projections from typed content.
|
|
5
|
-
*
|
|
6
|
-
* These are pure functions — safe in any context (portal, dev harness, tests).
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
DatabaseProperty,
|
|
11
|
-
DatabasePropertyOption,
|
|
12
|
-
DatabasePropertyType,
|
|
13
|
-
DocumentContentType,
|
|
14
|
-
DocumentRecord,
|
|
15
|
-
SecretPropertyValue,
|
|
16
|
-
} from './runtime';
|
|
17
|
-
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
|
-
// Value primitives
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
export function isPresentString(value: unknown): value is string {
|
|
23
|
-
return typeof value === 'string' && value.trim().length > 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function asRecord(value: unknown): Record<string, unknown> | null {
|
|
27
|
-
return value && typeof value === 'object' && !Array.isArray(value)
|
|
28
|
-
? (value as Record<string, unknown>)
|
|
29
|
-
: null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function optionalString(value: unknown): string | null {
|
|
33
|
-
return isPresentString(value) ? value.trim() : null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Flattens a Notion-shaped rich_text array (or plain string) to text. */
|
|
37
|
-
export function extractRichText(value: unknown): string {
|
|
38
|
-
if (typeof value === 'string') return value;
|
|
39
|
-
if (!Array.isArray(value)) return '';
|
|
40
|
-
return value
|
|
41
|
-
.map((item) => {
|
|
42
|
-
const record = asRecord(item);
|
|
43
|
-
const text = asRecord(record?.text);
|
|
44
|
-
return optionalString(text?.content) ?? optionalString(record?.plain_text) ?? '';
|
|
45
|
-
})
|
|
46
|
-
.join('');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Reads a `secret` property value. The platform only ever sends the pointer
|
|
51
|
-
* ({present, reference, status, metadata}), so this rebuilds it field by field
|
|
52
|
-
* rather than passing the payload through — an app can never surface secret
|
|
53
|
-
* material through this helper, whatever the server sent.
|
|
54
|
-
*/
|
|
55
|
-
export function getSecretValue(value: unknown): SecretPropertyValue {
|
|
56
|
-
const record = asRecord(value);
|
|
57
|
-
const metadata = asRecord(record?.metadata);
|
|
58
|
-
return {
|
|
59
|
-
present: record?.present === true,
|
|
60
|
-
reference: optionalString(record?.reference),
|
|
61
|
-
status: optionalString(record?.status),
|
|
62
|
-
metadata,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** Extracts the ids of a normalized relation property value. */
|
|
67
|
-
export function getRelationIds(value: unknown): string[] {
|
|
68
|
-
if (!Array.isArray(value)) return [];
|
|
69
|
-
return value.filter((item): item is string => isPresentString(item));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
// Property + document normalization
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Collapses a Notion-shaped property value ({type: 'select', select: {...}})
|
|
78
|
-
* into a plain JS value (string, string[], number, boolean, ...). Values that
|
|
79
|
-
* are already plain pass through unchanged.
|
|
80
|
-
*/
|
|
81
|
-
export function normalizePropertyValue(value: unknown): unknown {
|
|
82
|
-
const record = asRecord(value);
|
|
83
|
-
if (!record) return value;
|
|
84
|
-
|
|
85
|
-
const type = optionalString(record.type);
|
|
86
|
-
if (!type) return value;
|
|
87
|
-
|
|
88
|
-
if (type === 'title') return extractRichText(record.title);
|
|
89
|
-
if (type === 'rich_text') return extractRichText(record.rich_text);
|
|
90
|
-
if (type === 'select' || type === 'status') {
|
|
91
|
-
return optionalString(asRecord(record[type])?.name) ?? record[type] ?? null;
|
|
92
|
-
}
|
|
93
|
-
if (type === 'multi_select') {
|
|
94
|
-
const items = Array.isArray(record.multi_select) ? record.multi_select : [];
|
|
95
|
-
return items.map((item) => optionalString(asRecord(item)?.name) ?? item).filter(Boolean);
|
|
96
|
-
}
|
|
97
|
-
if (type === 'relation') {
|
|
98
|
-
const items = Array.isArray(record.relation) ? record.relation : [];
|
|
99
|
-
return items.map((item) => optionalString(asRecord(item)?.id) ?? item).filter(Boolean);
|
|
100
|
-
}
|
|
101
|
-
if (type === 'date') return optionalString(asRecord(record.date)?.start) ?? record.date ?? null;
|
|
102
|
-
// Before the `type in record` fallthrough: a secret value has no `secret`
|
|
103
|
-
// key, so passing it through would hand the caller the raw payload.
|
|
104
|
-
if (type === 'secret') return getSecretValue(record);
|
|
105
|
-
if (type in record) return record[type];
|
|
106
|
-
return value;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function normalizeContentType(value: unknown): DocumentContentType | null {
|
|
110
|
-
return value === 'markdown' || value === 'file' ? value : null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Normalizes a raw document from a Notis database tool result
|
|
115
|
-
* (LOCAL_NOTIS_DATABASE_QUERY / GET_DOCUMENT / UPSERT_*) into a
|
|
116
|
-
* `DocumentRecord`: camelCases fields and collapses property values.
|
|
117
|
-
*/
|
|
118
|
-
export function normalizeDocumentRecord(value: unknown): DocumentRecord {
|
|
119
|
-
const record = asRecord(value) ?? {};
|
|
120
|
-
const rawProperties = asRecord(record.properties) ?? {};
|
|
121
|
-
const properties: Record<string, unknown> = {};
|
|
122
|
-
for (const [key, propertyValue] of Object.entries(rawProperties)) {
|
|
123
|
-
properties[key] = normalizePropertyValue(propertyValue);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
id: optionalString(record.id) ?? '',
|
|
128
|
-
title: optionalString(record.title) ?? 'Untitled',
|
|
129
|
-
url: optionalString(record.url),
|
|
130
|
-
properties,
|
|
131
|
-
icon: optionalString(record.icon),
|
|
132
|
-
cover: optionalString(record.cover),
|
|
133
|
-
databaseSlug: optionalString(record.databaseSlug) ?? optionalString(record.database_slug) ?? undefined,
|
|
134
|
-
contentType: normalizeContentType(record.contentType ?? record.content_type),
|
|
135
|
-
fileType: optionalString(record.fileType) ?? optionalString(record.file_type),
|
|
136
|
-
contentBlocknote: Array.isArray(record.contentBlocknote)
|
|
137
|
-
? (record.contentBlocknote as Array<Record<string, unknown>>)
|
|
138
|
-
: Array.isArray(record.content_blocknote)
|
|
139
|
-
? (record.content_blocknote as Array<Record<string, unknown>>)
|
|
140
|
-
: null,
|
|
141
|
-
contentMarkdown: optionalString(record.contentMarkdown) ?? optionalString(record.content_markdown),
|
|
142
|
-
plainText: optionalString(record.plainText) ?? optionalString(record.plain_text),
|
|
143
|
-
createdAt:
|
|
144
|
-
optionalString(record.createdAt)
|
|
145
|
-
?? optionalString(record.created_at)
|
|
146
|
-
?? optionalString(record.created_time),
|
|
147
|
-
lastEditedTime:
|
|
148
|
-
optionalString(record.lastEditedTime)
|
|
149
|
-
?? optionalString(record.last_edited_time)
|
|
150
|
-
?? optionalString(record.updated_at),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** Normalizes a raw schema property from LOCAL_NOTIS_DATABASE_GET_DATABASE. */
|
|
155
|
-
export function normalizeDatabaseProperty(value: unknown): DatabaseProperty | null {
|
|
156
|
-
const record = asRecord(value);
|
|
157
|
-
const name = optionalString(record?.name);
|
|
158
|
-
if (!record || !name) return null;
|
|
159
|
-
|
|
160
|
-
const rawOptions = Array.isArray(record.options) ? record.options : [];
|
|
161
|
-
const options = rawOptions.flatMap((option): DatabasePropertyOption[] => {
|
|
162
|
-
const optionRecord = asRecord(option);
|
|
163
|
-
const optionName = optionalString(optionRecord?.name);
|
|
164
|
-
if (!optionRecord || !optionName) return [];
|
|
165
|
-
return [{
|
|
166
|
-
id: optionalString(optionRecord.id),
|
|
167
|
-
name: optionName,
|
|
168
|
-
color: optionalString(optionRecord.color),
|
|
169
|
-
order: typeof optionRecord.order === 'number' ? optionRecord.order : undefined,
|
|
170
|
-
}];
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
return {
|
|
174
|
-
id: optionalString(record.id),
|
|
175
|
-
name,
|
|
176
|
-
type: (optionalString(record.type) ?? 'rich_text') as DatabasePropertyType,
|
|
177
|
-
description: optionalString(record.description),
|
|
178
|
-
options,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// ---------------------------------------------------------------------------
|
|
183
|
-
// Plain-text projections
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
|
|
186
|
-
/** Strips markdown syntax to readable plain text (previews, search). */
|
|
187
|
-
export function markdownToPlainText(markdown: string): string {
|
|
188
|
-
return markdown
|
|
189
|
-
// fenced code blocks: keep the code, drop the fences
|
|
190
|
-
.replace(/```[^\n]*\n?/g, '')
|
|
191
|
-
// images: keep alt text
|
|
192
|
-
.replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
193
|
-
// links: keep link text
|
|
194
|
-
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
195
|
-
// html tags
|
|
196
|
-
.replace(/<[^>]+>/g, ' ')
|
|
197
|
-
// headings, blockquotes, list markers, task boxes
|
|
198
|
-
.replace(/^\s{0,3}(#{1,6}\s+|>\s?|[-*+]\s+(\[[ xX]\]\s+)?|\d+\.\s+)/gm, '')
|
|
199
|
-
// emphasis / strikethrough / inline code
|
|
200
|
-
.replace(/(\*\*|__|[*_~`])/g, '')
|
|
201
|
-
// table separators and pipes
|
|
202
|
-
.replace(/^\s*\|?[-:| ]+\|?\s*$/gm, '')
|
|
203
|
-
.replace(/\|/g, ' ')
|
|
204
|
-
// horizontal rules
|
|
205
|
-
.replace(/^\s*([-*_]\s*){3,}$/gm, '')
|
|
206
|
-
.replace(/\s+/g, ' ')
|
|
207
|
-
.trim();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/** Flattens BlockNote block JSON to plain text. */
|
|
211
|
-
export function blockNoteToPlainText(blocks: unknown): string {
|
|
212
|
-
const segments: string[] = [];
|
|
213
|
-
|
|
214
|
-
function visit(node: unknown): void {
|
|
215
|
-
if (typeof node === 'string') {
|
|
216
|
-
if (node.trim()) segments.push(node.trim());
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (Array.isArray(node)) {
|
|
220
|
-
node.forEach(visit);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const record = asRecord(node);
|
|
224
|
-
if (!record) return;
|
|
225
|
-
if (typeof record.text === 'string' && record.text.trim()) {
|
|
226
|
-
segments.push(record.text.trim());
|
|
227
|
-
}
|
|
228
|
-
visit(record.content);
|
|
229
|
-
visit(record.children);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
visit(blocks);
|
|
233
|
-
return segments.join(' ').replace(/\s+/g, ' ').trim();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Best-available plain-text preview for a document:
|
|
238
|
-
* plainText -> contentMarkdown -> contentBlocknote -> title.
|
|
239
|
-
*/
|
|
240
|
-
export function getDocumentPreview(document: DocumentRecord): string {
|
|
241
|
-
if (isPresentString(document.plainText)) {
|
|
242
|
-
return document.plainText.replace(/\s+/g, ' ').trim();
|
|
243
|
-
}
|
|
244
|
-
if (isPresentString(document.contentMarkdown)) {
|
|
245
|
-
return markdownToPlainText(document.contentMarkdown);
|
|
246
|
-
}
|
|
247
|
-
const fromBlocks = blockNoteToPlainText(document.contentBlocknote);
|
|
248
|
-
if (fromBlocks) return fromBlocks;
|
|
249
|
-
return isPresentString(document.title) ? document.title : 'Untitled';
|
|
250
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { useNotisRuntime } from '../provider';
|
|
5
|
-
|
|
6
|
-
interface UseBackendResult {
|
|
7
|
-
/**
|
|
8
|
-
* Make an authenticated request to the Notis backend.
|
|
9
|
-
* The path should be an absolute backend path (e.g. `/portal_composio/actions`).
|
|
10
|
-
*/
|
|
11
|
-
request: (path: string, options?: {
|
|
12
|
-
method?: string;
|
|
13
|
-
headers?: Record<string, string>;
|
|
14
|
-
body?: unknown;
|
|
15
|
-
}) => Promise<unknown>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Raw backend request proxy. Use this for custom server endpoints or
|
|
20
|
-
* integration APIs not covered by the typed hooks.
|
|
21
|
-
*
|
|
22
|
-
* ```tsx
|
|
23
|
-
* const { request } = useBackend();
|
|
24
|
-
* const data = await request('/portal_composio/actions', { method: 'POST', body: { ... } });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export function useBackend(): UseBackendResult {
|
|
28
|
-
const runtime = useNotisRuntime();
|
|
29
|
-
|
|
30
|
-
const request = useCallback(
|
|
31
|
-
async (path: string, options?: { method?: string; headers?: Record<string, string>; body?: unknown }) => {
|
|
32
|
-
if (!runtime) {
|
|
33
|
-
throw new Error('Notis runtime not available. Ensure NotisProvider is mounted.');
|
|
34
|
-
}
|
|
35
|
-
return runtime.request(path, options);
|
|
36
|
-
},
|
|
37
|
-
[runtime],
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return { request };
|
|
41
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { useNotisRuntime } from '../provider';
|
|
5
|
-
import type { CloudComputerFacts } from '../runtime';
|
|
6
|
-
|
|
7
|
-
export interface UseCloudComputerResult {
|
|
8
|
-
/**
|
|
9
|
-
* The facts, or null while the first read is in flight. `facts.available`
|
|
10
|
-
* is false when this host cannot answer — render the app's own fallback.
|
|
11
|
-
*/
|
|
12
|
-
facts: CloudComputerFacts | null;
|
|
13
|
-
loading: boolean;
|
|
14
|
-
error: Error | null;
|
|
15
|
-
/** Re-read the facts. The platform caches them for a few minutes. */
|
|
16
|
-
refresh: () => Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const UNAVAILABLE: CloudComputerFacts = {
|
|
20
|
-
available: false,
|
|
21
|
-
reason: 'unsupported_host',
|
|
22
|
-
sandbox: null,
|
|
23
|
-
cli_auth: {
|
|
24
|
-
gh: { authenticated: null, account: null, checked_at: null, reason: 'unsupported_host' },
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Read-only facts about the user's cloud computer.
|
|
30
|
-
*
|
|
31
|
-
* ```tsx
|
|
32
|
-
* const { facts } = useCloudComputer();
|
|
33
|
-
* const gh = facts?.available ? facts.cli_auth.gh : null;
|
|
34
|
-
*
|
|
35
|
-
* return gh?.authenticated
|
|
36
|
-
* ? <p>Signed in as {gh.account}</p>
|
|
37
|
-
* : <GithubConnect />;
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* Requires `capabilities.cloudComputer: 'read'` in `notis.config.ts` and the
|
|
41
|
-
* user's approval at install time. It answers with state the platform already
|
|
42
|
-
* holds: reading it never creates, resumes or commands a sandbox, and the GitHub
|
|
43
|
-
* probe only runs when the sandbox is already awake. `authenticated: null`
|
|
44
|
-
* therefore means *unknown*, not *signed out* — keep the app's own fallback for
|
|
45
|
-
* that case and for hosts that answer `{ available: false }` (the dev harness,
|
|
46
|
-
* the vite preview).
|
|
47
|
-
*/
|
|
48
|
-
export function useCloudComputer(): UseCloudComputerResult {
|
|
49
|
-
const runtime = useNotisRuntime();
|
|
50
|
-
const [facts, setFacts] = useState<CloudComputerFacts | null>(null);
|
|
51
|
-
// True from the first committed render: the initial read is already queued
|
|
52
|
-
// in an effect, and `{ loading: false, facts: null }` would flash a
|
|
53
|
-
// consumer's fallback branch before the answer arrives.
|
|
54
|
-
const [loading, setLoading] = useState(true);
|
|
55
|
-
const [error, setError] = useState<Error | null>(null);
|
|
56
|
-
const mounted = useRef(true);
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
mounted.current = true;
|
|
60
|
-
return () => {
|
|
61
|
-
mounted.current = false;
|
|
62
|
-
};
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
|
-
const read = useCallback(async (options?: { refresh?: boolean }) => {
|
|
66
|
-
if (!runtime?.cloudComputerFacts) {
|
|
67
|
-
setFacts(UNAVAILABLE);
|
|
68
|
-
setLoading(false);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
setLoading(true);
|
|
73
|
-
setError(null);
|
|
74
|
-
try {
|
|
75
|
-
const next = await runtime.cloudComputerFacts(options);
|
|
76
|
-
if (mounted.current) setFacts(next);
|
|
77
|
-
} catch (err) {
|
|
78
|
-
const e = err instanceof Error ? err : new Error(String(err));
|
|
79
|
-
if (mounted.current) {
|
|
80
|
-
setError(e);
|
|
81
|
-
// A refused or failed read is the same product state as a host that
|
|
82
|
-
// cannot answer: the app shows its fallback instead of an error.
|
|
83
|
-
setFacts(UNAVAILABLE);
|
|
84
|
-
}
|
|
85
|
-
} finally {
|
|
86
|
-
if (mounted.current) setLoading(false);
|
|
87
|
-
}
|
|
88
|
-
}, [runtime]);
|
|
89
|
-
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
void read();
|
|
92
|
-
}, [read]);
|
|
93
|
-
|
|
94
|
-
const refresh = useCallback(() => read({ refresh: true }), [read]);
|
|
95
|
-
|
|
96
|
-
return { facts, loading, error, refresh };
|
|
97
|
-
}
|