@notis_ai/cli 0.2.0-beta.16.1 → 0.2.0-beta.161.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +435 -133
- package/bin/check-runtime.js +15 -0
- package/bin/notis.js +2 -0
- package/config/notis_app_boundary_rules.json +50 -0
- package/config/notis_app_design_rules.json +135 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +19008 -0
- package/dist/base-skills/notis-apps/SKILL.md +70 -0
- package/dist/base-skills/notis-apps/references/architecture.md +164 -0
- package/dist/base-skills/notis-apps/references/context.md +81 -0
- package/dist/base-skills/notis-apps/references/design.md +165 -0
- package/dist/base-skills/notis-apps/references/reading.md +89 -0
- package/dist/base-skills/notis-apps/references/release.md +99 -0
- package/dist/base-skills/notis-apps/references/sdk.md +62 -0
- package/dist/base-skills/notis-apps/references/troubleshooting.md +23 -0
- package/dist/base-skills/notis-cli/SKILL.md +140 -0
- package/dist/base-skills/notis-cli/references/app-delivery.md +18 -0
- package/dist/base-skills/notis-cli/references/native-databases.md +20 -0
- package/dist/base-skills/notis-cli/references/tool-examples.md +56 -0
- package/dist/base-skills/notis-cli/references/troubleshooting.md +39 -0
- package/dist/base-skills/notis-query/SKILL.md +67 -0
- package/dist/base-skills/notis-query/references/database-discovery.md +59 -0
- package/dist/base-skills/notis-query/references/documents.md +50 -0
- package/dist/base-skills/notis-query/references/query.md +543 -0
- package/dist/skill-sync/index.js +1626 -0
- package/dist/skill-sync/index.js.map +7 -0
- package/dist/skill-sync-worker.mjs +2990 -0
- package/package.json +18 -7
- package/skills/notis-apps/cli.md +313 -0
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +39 -0
- package/skills/notis-onboarding/BRIEF.md +129 -0
- package/skills/notis-query/cli.md +39 -0
- package/src/agent-hook-entry.js +5 -0
- package/src/cli.js +294 -25
- package/src/command-specs/agents.js +392 -0
- package/src/command-specs/apps.js +1470 -202
- package/src/command-specs/auth.js +114 -137
- package/src/command-specs/diagnostics.js +729 -0
- package/src/command-specs/handover.js +374 -0
- package/src/command-specs/helpers.js +84 -82
- package/src/command-specs/index.js +25 -6
- package/src/command-specs/meta.js +150 -18
- package/src/command-specs/onboarding.js +290 -0
- package/src/command-specs/profile.js +358 -0
- package/src/command-specs/reports.js +86 -0
- package/src/command-specs/skills.js +75 -0
- package/src/command-specs/smoke.js +386 -0
- package/src/command-specs/tools.js +455 -139
- package/src/runtime/agent-browser.js +632 -0
- package/src/runtime/agent-memory-state.js +126 -0
- package/src/runtime/agent-setup.js +383 -0
- package/src/runtime/app-boundary-validator.js +404 -0
- package/src/runtime/app-changelog.js +79 -0
- package/src/runtime/app-platform.js +2633 -210
- package/src/runtime/app-registry-scaffolds.js +367 -0
- package/src/runtime/app-test-server.js +292 -0
- package/src/runtime/assets/store-screenshot-dark.png +0 -0
- package/src/runtime/auth-recovery.js +110 -0
- package/src/runtime/base-skills.d.ts +20 -0
- package/src/runtime/base-skills.js +167 -0
- package/src/runtime/channel.js +133 -0
- package/src/runtime/delegated-context.js +68 -0
- package/src/runtime/errors.js +1 -0
- package/src/runtime/git.js +233 -0
- package/src/runtime/login-listener.js +15 -0
- package/src/runtime/oauth.js +2622 -0
- package/src/runtime/output.js +37 -5
- package/src/runtime/ports.js +31 -0
- package/src/runtime/profiles.js +906 -55
- package/src/runtime/skill-sync/cloud-client.ts +99 -0
- package/src/runtime/skill-sync/index.ts +697 -0
- package/src/runtime/skill-sync/local-scanner.ts +1046 -0
- package/src/runtime/skill-sync/symlink-manager.ts +433 -0
- package/src/runtime/skill-sync/sync-plan.ts +22 -0
- package/src/runtime/skill-sync/types.ts +110 -0
- package/src/runtime/skill-sync/write-cloud-skill.ts +50 -0
- package/src/runtime/skill-sync-service.js +109 -0
- package/src/runtime/store-screenshot.js +143 -0
- package/src/runtime/sync-skills.d.ts +37 -0
- package/src/runtime/sync-skills.js +231 -0
- package/src/runtime/telemetry.js +92 -0
- package/src/runtime/transport.js +324 -45
- package/src/skill-sync-worker-entry.js +2 -0
- package/src/skill-sync-worker.js +50 -0
- package/template/.harness/index.html.tmpl +430 -0
- package/template/CHANGELOG.md +5 -0
- package/template/app/globals.css +28 -3
- package/template/app/layout.tsx +6 -3
- package/template/app/page.tsx +49 -42
- package/template/components/page-heading.tsx +23 -0
- package/template/components/ui/badge.tsx +7 -4
- package/template/components/ui/button.tsx +1 -1
- package/template/components/ui/card.tsx +24 -11
- package/template/components/ui/native-select.tsx +24 -0
- package/template/notis.config.ts +24 -6
- package/template/package-lock.json +3642 -0
- package/template/package.json +19 -16
- package/template/packages/{notis-sdk → sdk}/package.json +14 -4
- package/template/packages/sdk/src/agentContext.ts +36 -0
- package/template/packages/sdk/src/components/DocumentEditor.tsx +103 -0
- package/template/packages/sdk/src/components/Markdown.tsx +60 -0
- package/template/packages/sdk/src/components/MarkdownEditor.tsx +121 -0
- package/template/packages/sdk/src/components/MultiSelectActionBar.tsx +285 -0
- package/template/packages/sdk/src/components/MultiSelectCheckbox.tsx +97 -0
- package/template/packages/sdk/src/components/MultiSelectDragOverlay.tsx +39 -0
- package/template/packages/sdk/src/components/NotisCommentBoundary.tsx +172 -0
- package/template/packages/sdk/src/components/NotisSelectionBoundary.tsx +59 -0
- package/template/packages/sdk/src/components/ShortcutHints.tsx +56 -0
- package/template/packages/sdk/src/components/Skeleton.tsx +24 -0
- package/template/packages/sdk/src/config.ts +257 -0
- package/template/packages/sdk/src/documents.ts +256 -0
- package/template/packages/sdk/src/hooks/useActiveResource.ts +19 -0
- package/template/packages/sdk/src/hooks/useAgentContext.ts +23 -0
- package/template/packages/sdk/src/hooks/useCloudComputer.ts +64 -0
- package/template/packages/sdk/src/hooks/useCollectionInteractions.ts +836 -0
- package/template/packages/sdk/src/hooks/useDatabaseSchema.ts +49 -0
- package/template/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
- package/template/packages/sdk/src/hooks/useDocument.ts +43 -0
- package/template/packages/sdk/src/hooks/useDocuments.ts +84 -0
- package/template/packages/sdk/src/hooks/useHandover.ts +78 -0
- package/template/packages/sdk/src/hooks/useLongPressSelection.ts +79 -0
- package/template/packages/sdk/src/hooks/useMultiSelect.ts +95 -0
- package/template/packages/{notis-sdk → sdk}/src/hooks/useNotis.ts +10 -4
- package/template/packages/{notis-sdk → sdk}/src/hooks/useNotisNavigation.ts +11 -8
- package/template/packages/sdk/src/hooks/useQuery.ts +71 -0
- package/template/packages/sdk/src/hooks/useTool.ts +65 -0
- package/template/packages/sdk/src/hooks/useToolQuery.ts +12 -0
- package/template/packages/sdk/src/hooks/useTopBarSearch.ts +81 -0
- package/template/packages/sdk/src/hooks/useUpsertDocument.ts +95 -0
- package/template/packages/sdk/src/index.ts +161 -0
- package/template/packages/sdk/src/interactions/actions.ts +59 -0
- package/template/packages/sdk/src/interactions/shortcuts.tsx +694 -0
- package/template/packages/sdk/src/interactions/visibility.ts +13 -0
- package/template/packages/sdk/src/interactions.ts +45 -0
- package/template/packages/sdk/src/provider.tsx +44 -0
- package/template/packages/sdk/src/queryCache.ts +170 -0
- package/template/packages/sdk/src/runtime.ts +451 -0
- package/template/packages/sdk/src/styles.css +247 -0
- package/template/packages/sdk/src/tailwind.ts +66 -0
- package/template/packages/sdk/src/vite.ts +73 -0
- package/template/packages/{notis-sdk → sdk}/tsconfig.json +1 -0
- package/template/postcss.config.mjs +1 -1
- package/template/tailwind.config.ts +1 -6
- package/template/tsconfig.json +1 -0
- package/src/command-specs/db.js +0 -163
- package/src/runtime/app-preview-server.js +0 -312
- package/template/packages/notis-sdk/src/config.ts +0 -48
- package/template/packages/notis-sdk/src/helpers.ts +0 -131
- package/template/packages/notis-sdk/src/hooks/useAppState.ts +0 -50
- package/template/packages/notis-sdk/src/hooks/useCollectionItem.ts +0 -58
- package/template/packages/notis-sdk/src/hooks/useDatabase.ts +0 -87
- package/template/packages/notis-sdk/src/hooks/useDocument.ts +0 -61
- package/template/packages/notis-sdk/src/hooks/useTool.ts +0 -49
- package/template/packages/notis-sdk/src/hooks/useUpsertDocument.ts +0 -57
- package/template/packages/notis-sdk/src/index.ts +0 -47
- package/template/packages/notis-sdk/src/provider.tsx +0 -44
- package/template/packages/notis-sdk/src/runtime.ts +0 -159
- package/template/packages/notis-sdk/src/styles.css +0 -123
- package/template/packages/notis-sdk/src/vite.ts +0 -54
- /package/template/packages/{notis-sdk → sdk}/src/hooks/useBackend.ts +0 -0
- /package/template/packages/{notis-sdk → sdk}/src/hooks/useTools.ts +0 -0
- /package/template/packages/{notis-sdk → sdk}/src/ui.ts +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from 'react';
|
|
4
|
+
import { useNotisRuntime } from '../provider';
|
|
5
|
+
import type { ToolCallOptions } from '../runtime';
|
|
6
|
+
|
|
7
|
+
type ToolArguments = Record<string, unknown>;
|
|
8
|
+
|
|
9
|
+
type ToolCall<TArgs extends ToolArguments | undefined, TResult> = undefined extends TArgs
|
|
10
|
+
? (args?: Exclude<TArgs, undefined>, options?: ToolCallOptions) => Promise<TResult>
|
|
11
|
+
: (args: TArgs, options?: ToolCallOptions) => Promise<TResult>;
|
|
12
|
+
|
|
13
|
+
export interface ToolCallState {
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: Error | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface UseToolResult<
|
|
19
|
+
TArgs extends ToolArguments | undefined = ToolArguments | undefined,
|
|
20
|
+
TResult = unknown,
|
|
21
|
+
> extends ToolCallState {
|
|
22
|
+
call: ToolCall<TArgs, TResult>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Call a specific Notis tool by name.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const { call, loading } = useTool('LOCAL_NOTIS_WEB_SEARCH');
|
|
30
|
+
* const result = await call({ query: 'latest news' });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function useTool<
|
|
34
|
+
TArgs extends ToolArguments | undefined = ToolArguments | undefined,
|
|
35
|
+
TResult = unknown,
|
|
36
|
+
>(toolName: string): UseToolResult<TArgs, TResult> {
|
|
37
|
+
const runtime = useNotisRuntime();
|
|
38
|
+
const [loading, setLoading] = useState(false);
|
|
39
|
+
const [error, setError] = useState<Error | null>(null);
|
|
40
|
+
|
|
41
|
+
const call = useCallback(
|
|
42
|
+
async (args?: ToolArguments, options?: ToolCallOptions): Promise<TResult> => {
|
|
43
|
+
if (!runtime) {
|
|
44
|
+
throw new Error('Notis runtime not available. Ensure NotisProvider is mounted.');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setLoading(true);
|
|
48
|
+
setError(null);
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const result = await runtime.callTool<TResult>(toolName, args, options);
|
|
52
|
+
return result;
|
|
53
|
+
} catch (err) {
|
|
54
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
55
|
+
setError(e);
|
|
56
|
+
throw e;
|
|
57
|
+
} finally {
|
|
58
|
+
setLoading(false);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
[runtime, toolName],
|
|
62
|
+
) as ToolCall<TArgs, TResult>;
|
|
63
|
+
|
|
64
|
+
return { call, loading, error };
|
|
65
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useNotisRuntime } from '../provider';
|
|
4
|
+
import { useQuery, type UseQueryOptions } from './useQuery';
|
|
5
|
+
|
|
6
|
+
/** An explicitly identified read-only tool, cached by tool name and exact arguments. */
|
|
7
|
+
export function useToolQuery<T = unknown>(name: string, args: Record<string, unknown> = {}, options: UseQueryOptions) {
|
|
8
|
+
const runtime = useNotisRuntime();
|
|
9
|
+
return useQuery<T>(['tool', name, args], () => runtime!.callTool<T>(name, args, {
|
|
10
|
+
readOnly: true, dedupe: true,
|
|
11
|
+
}), options);
|
|
12
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
|
|
4
|
+
import { useNotisRuntime } from '../provider';
|
|
5
|
+
|
|
6
|
+
interface TopBarSearchOptions {
|
|
7
|
+
/** Current value shown in the top bar search input. */
|
|
8
|
+
value: string;
|
|
9
|
+
/** Called when the user types in the top bar. */
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
/** Placeholder text for the input. Defaults to 'Search…'. */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Called when the user presses Enter. May return a Promise. */
|
|
14
|
+
onSubmit?: () => void | Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface TopBarSearchActions {
|
|
18
|
+
/** Toggle the loader that replaces the search icon in the top bar. */
|
|
19
|
+
setLoading: (loading: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Registers this view's search binding with the portal's top bar search input.
|
|
24
|
+
* While the component is mounted, typing in the top bar calls `onChange`,
|
|
25
|
+
* pressing Enter calls `onSubmit`, and the `value` prop drives the input.
|
|
26
|
+
*
|
|
27
|
+
* Use `setLoading(true)` only for an explicitly submitted search action, then
|
|
28
|
+
* restore the icon with `setLoading(false)`. Automatic reads use content
|
|
29
|
+
* skeletons initially and refresh populated content silently.
|
|
30
|
+
*
|
|
31
|
+
* Without a portal runtime, this hook is a safe no-op.
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const [q, setQ] = useState('');
|
|
35
|
+
* const { setLoading } = useTopBarSearch({
|
|
36
|
+
* value: q,
|
|
37
|
+
* onChange: setQ,
|
|
38
|
+
* placeholder: 'Search notes…',
|
|
39
|
+
* onSubmit: async () => {
|
|
40
|
+
* setLoading(true);
|
|
41
|
+
* try { await runSearch(q); } finally { setLoading(false); }
|
|
42
|
+
* },
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Callback refs retain the latest committed handlers without re-registering
|
|
47
|
+
* search on every app render. Inline callbacks are safe.
|
|
48
|
+
*/
|
|
49
|
+
export function useTopBarSearch(opts: TopBarSearchOptions): TopBarSearchActions {
|
|
50
|
+
const runtime = useNotisRuntime();
|
|
51
|
+
const { value, onChange, placeholder, onSubmit } = opts;
|
|
52
|
+
const callbacks = useRef({ onChange, onSubmit });
|
|
53
|
+
useLayoutEffect(() => { callbacks.current = { onChange, onSubmit }; });
|
|
54
|
+
const hasSubmit = Boolean(onSubmit);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const register = runtime?.registerTopBarSearch;
|
|
58
|
+
if (!register) return;
|
|
59
|
+
register({
|
|
60
|
+
onChange: (next) => callbacks.current.onChange(next),
|
|
61
|
+
placeholder,
|
|
62
|
+
onSubmit: hasSubmit ? () => callbacks.current.onSubmit?.() : undefined,
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
register(null);
|
|
66
|
+
};
|
|
67
|
+
}, [runtime, placeholder, hasSubmit]);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
runtime?.setTopBarSearchValue?.(value);
|
|
71
|
+
}, [runtime, value]);
|
|
72
|
+
|
|
73
|
+
const setLoading = useCallback(
|
|
74
|
+
(loading: boolean) => {
|
|
75
|
+
runtime?.setTopBarSearchLoading?.(loading);
|
|
76
|
+
},
|
|
77
|
+
[runtime],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return { setLoading };
|
|
81
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from 'react';
|
|
4
|
+
import { useNotisRuntime } from '../provider';
|
|
5
|
+
import { normalizeDocumentRecord } from '../documents';
|
|
6
|
+
import type { DocumentRecord } from '../runtime';
|
|
7
|
+
|
|
8
|
+
export interface UpsertDocumentArgs {
|
|
9
|
+
documentId?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Property values keyed by property name (already-plain values). */
|
|
12
|
+
properties?: Record<string, unknown>;
|
|
13
|
+
/** Markdown content; converted server-side to BlockNote. Exclusive with contentBlocknote. */
|
|
14
|
+
contentMarkdown?: string | null;
|
|
15
|
+
/** BlockNote block JSON. Exclusive with contentMarkdown. */
|
|
16
|
+
contentBlocknote?: Array<Record<string, unknown>> | null;
|
|
17
|
+
/** 'archive' soft-deletes the document (sets archived_at); 'restore' undoes it. */
|
|
18
|
+
operation?: 'create' | 'update' | 'archive' | 'restore';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface UpsertToolResult {
|
|
22
|
+
status?: string;
|
|
23
|
+
document?: unknown;
|
|
24
|
+
message?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UseUpsertDocumentResult {
|
|
29
|
+
upsert: (args: UpsertDocumentArgs) => Promise<DocumentRecord>;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
error: Error | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function upsertToolName(databaseSlug: string): string {
|
|
35
|
+
return `LOCAL_NOTIS_DATABASE_UPSERT_${databaseSlug.replace(/-/g, '_').toUpperCase()}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function buildToolArgs(args: UpsertDocumentArgs): Record<string, unknown> {
|
|
39
|
+
const payload: Record<string, unknown> = {};
|
|
40
|
+
if (args.documentId) payload.document_id = args.documentId;
|
|
41
|
+
if (typeof args.title === 'string') payload.title = args.title;
|
|
42
|
+
if (args.properties) Object.assign(payload, args.properties);
|
|
43
|
+
if ('contentMarkdown' in args) payload.content_markdown = args.contentMarkdown ?? '';
|
|
44
|
+
if ('contentBlocknote' in args) payload.content_blocknote = args.contentBlocknote ?? null;
|
|
45
|
+
if (args.operation) payload.operation = args.operation;
|
|
46
|
+
return payload;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Create/update/archive documents in a Notis database.
|
|
51
|
+
*
|
|
52
|
+
* ```tsx
|
|
53
|
+
* const { upsert } = useUpsertDocument('journal_entries');
|
|
54
|
+
* await upsert({ documentId, properties: { Mood: 'Great' }, contentMarkdown: reflection });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export function useUpsertDocument(databaseSlug: string): UseUpsertDocumentResult {
|
|
58
|
+
const runtime = useNotisRuntime();
|
|
59
|
+
const [loading, setLoading] = useState(false);
|
|
60
|
+
const [error, setError] = useState<Error | null>(null);
|
|
61
|
+
|
|
62
|
+
const upsert = useCallback(
|
|
63
|
+
async (args: UpsertDocumentArgs): Promise<DocumentRecord> => {
|
|
64
|
+
if (!runtime) {
|
|
65
|
+
throw new Error('Notis runtime not available. Ensure NotisProvider is mounted.');
|
|
66
|
+
}
|
|
67
|
+
if ('contentMarkdown' in args && 'contentBlocknote' in args) {
|
|
68
|
+
throw new Error('Provide contentMarkdown or contentBlocknote, not both.');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
setLoading(true);
|
|
72
|
+
setError(null);
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const result = await runtime.callTool<UpsertToolResult>(
|
|
76
|
+
upsertToolName(databaseSlug),
|
|
77
|
+
buildToolArgs(args),
|
|
78
|
+
);
|
|
79
|
+
if (!result.document) {
|
|
80
|
+
throw new Error(result.error ?? result.message ?? 'Failed to save document');
|
|
81
|
+
}
|
|
82
|
+
return normalizeDocumentRecord(result.document);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
85
|
+
setError(e);
|
|
86
|
+
throw e;
|
|
87
|
+
} finally {
|
|
88
|
+
setLoading(false);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[runtime, databaseSlug],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return { upsert, loading, error };
|
|
95
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @notis/sdk - The Notis App SDK
|
|
3
|
+
*
|
|
4
|
+
* Public API for building Notis apps. Import hooks and the provider from
|
|
5
|
+
* this entrypoint. For configuration, use `@notis/sdk/config`. For the
|
|
6
|
+
* Vite config builder, use `@notis/sdk/vite`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Provider
|
|
10
|
+
export { NotisProvider, useNotisRuntime } from './provider';
|
|
11
|
+
|
|
12
|
+
// Hooks
|
|
13
|
+
export { useQuery, useQueryClient } from './hooks/useQuery';
|
|
14
|
+
export type { UseQueryOptions, UseQueryResult } from './hooks/useQuery';
|
|
15
|
+
export { createQueryClient, createPrefetchQueue, queryKey } from './queryCache';
|
|
16
|
+
export type { NotisQueryClient, QuerySnapshot, QueryFetchOptions } from './queryCache';
|
|
17
|
+
export { useNotis } from './hooks/useNotis';
|
|
18
|
+
export { useDocuments } from './hooks/useDocuments';
|
|
19
|
+
export type { UseDocumentsOptions, UseDocumentsResult } from './hooks/useDocuments';
|
|
20
|
+
export { useDatabaseSubscription } from './hooks/useDatabaseSubscription';
|
|
21
|
+
export type {
|
|
22
|
+
UseDatabaseSubscriptionOptions,
|
|
23
|
+
UseDatabaseSubscriptionResult,
|
|
24
|
+
} from './hooks/useDatabaseSubscription';
|
|
25
|
+
export { useDocument } from './hooks/useDocument';
|
|
26
|
+
export type { UseDocumentOptions, UseDocumentResult } from './hooks/useDocument';
|
|
27
|
+
export { useUpsertDocument } from './hooks/useUpsertDocument';
|
|
28
|
+
export type { UpsertDocumentArgs, UseUpsertDocumentResult } from './hooks/useUpsertDocument';
|
|
29
|
+
export { useDatabaseSchema } from './hooks/useDatabaseSchema';
|
|
30
|
+
export type { UseDatabaseSchemaResult } from './hooks/useDatabaseSchema';
|
|
31
|
+
export { useTool } from './hooks/useTool';
|
|
32
|
+
export type { ToolCallState, UseToolResult } from './hooks/useTool';
|
|
33
|
+
export { useTools } from './hooks/useTools';
|
|
34
|
+
export { useHandover } from './hooks/useHandover';
|
|
35
|
+
export type { UseHandoverResult } from './hooks/useHandover';
|
|
36
|
+
export { useCloudComputer } from './hooks/useCloudComputer';
|
|
37
|
+
export type { UseCloudComputerResult } from './hooks/useCloudComputer';
|
|
38
|
+
export { useNotisNavigation } from './hooks/useNotisNavigation';
|
|
39
|
+
export { useTopBarSearch } from './hooks/useTopBarSearch';
|
|
40
|
+
export { useBackend } from './hooks/useBackend';
|
|
41
|
+
export { useMultiSelect } from './hooks/useMultiSelect';
|
|
42
|
+
export { useCollectionInteractions, COLLECTION_ITEM_ATTRIBUTE } from './hooks/useCollectionInteractions';
|
|
43
|
+
export { useActiveResource } from './hooks/useActiveResource';
|
|
44
|
+
export {
|
|
45
|
+
ShortcutProvider,
|
|
46
|
+
SHORTCUT_SCOPE_PRIORITY,
|
|
47
|
+
isEditableShortcutEvent,
|
|
48
|
+
shortcutDisplay,
|
|
49
|
+
useShortcuts,
|
|
50
|
+
} from './interactions/shortcuts';
|
|
51
|
+
|
|
52
|
+
// Documents & markdown
|
|
53
|
+
export { Markdown } from './components/Markdown';
|
|
54
|
+
export type { MarkdownProps } from './components/Markdown';
|
|
55
|
+
export { DocumentEditor } from './components/DocumentEditor';
|
|
56
|
+
export { MarkdownEditor } from './components/MarkdownEditor';
|
|
57
|
+
export { NotisSelectionBoundary, NOTIS_CONTEXT_CLIPBOARD_TYPE } from './components/NotisSelectionBoundary';
|
|
58
|
+
export type { NotisSelectionBoundaryProps } from './components/NotisSelectionBoundary';
|
|
59
|
+
export {
|
|
60
|
+
asRecord,
|
|
61
|
+
blockNoteToPlainText,
|
|
62
|
+
extractRichText,
|
|
63
|
+
getDocumentPreview,
|
|
64
|
+
getRelationIds,
|
|
65
|
+
getSecretValue,
|
|
66
|
+
isPresentString,
|
|
67
|
+
markdownToPlainText,
|
|
68
|
+
normalizeDatabaseProperty,
|
|
69
|
+
normalizeDocumentRecord,
|
|
70
|
+
normalizePropertyValue,
|
|
71
|
+
optionalString,
|
|
72
|
+
} from './documents';
|
|
73
|
+
|
|
74
|
+
// Multi-select components
|
|
75
|
+
export { MultiSelectActionBar } from './components/MultiSelectActionBar';
|
|
76
|
+
export { MultiSelectCheckbox, MultiSelectCheckbox as SelectionCheckbox } from './components/MultiSelectCheckbox';
|
|
77
|
+
export { MultiSelectDragOverlay, MultiSelectDragOverlay as SelectionMarquee } from './components/MultiSelectDragOverlay';
|
|
78
|
+
export { ShortcutHints } from './components/ShortcutHints';
|
|
79
|
+
export type {
|
|
80
|
+
DragRect,
|
|
81
|
+
MultiSelectController,
|
|
82
|
+
UseMultiSelectOptions,
|
|
83
|
+
} from './hooks/useMultiSelect';
|
|
84
|
+
export type {
|
|
85
|
+
MultiSelectAction,
|
|
86
|
+
MultiSelectActionBarProps,
|
|
87
|
+
} from './components/MultiSelectActionBar';
|
|
88
|
+
export type { MultiSelectCheckboxProps } from './components/MultiSelectCheckbox';
|
|
89
|
+
export type { MultiSelectDragOverlayProps } from './components/MultiSelectDragOverlay';
|
|
90
|
+
export type { MultiSelectCheckboxProps as SelectionCheckboxProps } from './components/MultiSelectCheckbox';
|
|
91
|
+
export type { MultiSelectDragOverlayProps as SelectionMarqueeProps } from './components/MultiSelectDragOverlay';
|
|
92
|
+
export type { ShortcutHint, ShortcutHintsProps } from './components/ShortcutHints';
|
|
93
|
+
export type {
|
|
94
|
+
CollectionInteractionController,
|
|
95
|
+
CollectionInteractionReason,
|
|
96
|
+
CollectionKeyboardShortcuts,
|
|
97
|
+
CollectionNavigationContext,
|
|
98
|
+
CollectionNavigationDirection,
|
|
99
|
+
CollectionSelectionChange,
|
|
100
|
+
SelectionMarqueeRect,
|
|
101
|
+
UseCollectionInteractionsOptions,
|
|
102
|
+
} from './hooks/useCollectionInteractions';
|
|
103
|
+
export type {
|
|
104
|
+
ShortcutDefinition,
|
|
105
|
+
ShortcutHelpEntry,
|
|
106
|
+
ShortcutScope,
|
|
107
|
+
UseShortcutsOptions,
|
|
108
|
+
} from './interactions/shortcuts';
|
|
109
|
+
export type {
|
|
110
|
+
CollectionAction,
|
|
111
|
+
CollectionActionContext,
|
|
112
|
+
CollectionActionIntent,
|
|
113
|
+
ResolvedCollectionAction,
|
|
114
|
+
} from './interactions/actions';
|
|
115
|
+
|
|
116
|
+
// Types (re-exported for convenience)
|
|
117
|
+
export type {
|
|
118
|
+
AppDescriptor,
|
|
119
|
+
CloudComputerCliAuthFacts,
|
|
120
|
+
CloudComputerFacts,
|
|
121
|
+
CloudComputerSandboxFacts,
|
|
122
|
+
ContextAttributeValue,
|
|
123
|
+
ContextResource,
|
|
124
|
+
ContextSelection,
|
|
125
|
+
CollectionItem,
|
|
126
|
+
CollectionItemDetail,
|
|
127
|
+
DatabaseDescriptor,
|
|
128
|
+
DatabaseProperty,
|
|
129
|
+
DatabasePropertyOption,
|
|
130
|
+
DatabasePropertyType,
|
|
131
|
+
DocumentContentType,
|
|
132
|
+
DocumentRecord,
|
|
133
|
+
HandoverPayload,
|
|
134
|
+
HandoverResult,
|
|
135
|
+
NotisDocumentEditorProps,
|
|
136
|
+
NotisMarkdownEditorProps,
|
|
137
|
+
NotisMarkdownEditorSavePayload,
|
|
138
|
+
NotisMarkdownEditorSaveResult,
|
|
139
|
+
NotisRuntime,
|
|
140
|
+
NotisRuntimeContext,
|
|
141
|
+
NotisRuntimeUI,
|
|
142
|
+
QueryFilter,
|
|
143
|
+
RouteDescriptor,
|
|
144
|
+
SecretPropertyValue,
|
|
145
|
+
SubscribeDatabaseOptions,
|
|
146
|
+
ToolDescriptor,
|
|
147
|
+
ToolCallOptions,
|
|
148
|
+
ToolInputSchema,
|
|
149
|
+
} from './runtime';
|
|
150
|
+
|
|
151
|
+
export { useToolQuery } from './hooks/useToolQuery';
|
|
152
|
+
|
|
153
|
+
export { Skeleton, ViewSkeleton } from './components/Skeleton';
|
|
154
|
+
|
|
155
|
+
export { useLongPressSelection } from './hooks/useLongPressSelection';
|
|
156
|
+
export { isInteractionElementVisible } from './interactions/visibility';
|
|
157
|
+
|
|
158
|
+
export type { AgentContextContent, AgentContextItem, ContextAttachment } from './agentContext';
|
|
159
|
+
export { useAgentContext } from './hooks/useAgentContext';
|
|
160
|
+
export { NotisCommentBoundary, NotisCommentBox } from './components/NotisCommentBoundary';
|
|
161
|
+
export type { NotisCommentBoundaryProps, NotisCommentBoxProps } from './components/NotisCommentBoundary';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type CollectionActionIntent =
|
|
4
|
+
| 'archive' | 'star' | 'delete'
|
|
5
|
+
| 'enable' | 'disable' | 'pause' | 'resume'
|
|
6
|
+
| 'move' | 'add-to-folder' | 'complete' | 'start-progress'
|
|
7
|
+
| 'custom';
|
|
8
|
+
|
|
9
|
+
export interface CollectionActionContext<T> {
|
|
10
|
+
selectedIds: string[];
|
|
11
|
+
selectedItems: T[];
|
|
12
|
+
clearSelection: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CollectionAction<T> {
|
|
16
|
+
id: string;
|
|
17
|
+
intent?: CollectionActionIntent;
|
|
18
|
+
label?: string;
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** Omit to use the intent default, supply a key to override, or false to remove it. */
|
|
21
|
+
shortcut?: string | false;
|
|
22
|
+
destructive?: boolean;
|
|
23
|
+
disabled?: boolean | ((context: CollectionActionContext<T>) => boolean);
|
|
24
|
+
pending?: boolean;
|
|
25
|
+
onRun: (context: CollectionActionContext<T>) => void | Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ResolvedCollectionAction {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
shortcut?: string;
|
|
33
|
+
destructive?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
pending?: boolean;
|
|
36
|
+
onRun: () => void | Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const ACTION_DEFAULTS: Record<Exclude<CollectionActionIntent, 'custom'>, { label: string; shortcut: string }> = {
|
|
40
|
+
archive: { label: 'Archive', shortcut: 'E' },
|
|
41
|
+
star: { label: 'Star', shortcut: 'S' },
|
|
42
|
+
delete: { label: 'Delete', shortcut: '#' },
|
|
43
|
+
enable: { label: 'Enable', shortcut: 'E' },
|
|
44
|
+
disable: { label: 'Disable', shortcut: 'D' },
|
|
45
|
+
pause: { label: 'Pause', shortcut: 'P' },
|
|
46
|
+
resume: { label: 'Resume', shortcut: 'R' },
|
|
47
|
+
move: { label: 'Move', shortcut: 'M' },
|
|
48
|
+
'add-to-folder': { label: 'Add to folder', shortcut: 'F' },
|
|
49
|
+
complete: { label: 'Mark complete', shortcut: 'C' },
|
|
50
|
+
'start-progress': { label: 'Start progress', shortcut: 'P' },
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export function collectionActionDefaults(intent: CollectionActionIntent | undefined): {
|
|
54
|
+
label?: string;
|
|
55
|
+
shortcut?: string;
|
|
56
|
+
} {
|
|
57
|
+
if (!intent || intent === 'custom') return {};
|
|
58
|
+
return ACTION_DEFAULTS[intent];
|
|
59
|
+
}
|