@qikbar/qikbar 0.0.24 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/dist/ai/agent.d.ts +42 -0
  4. package/dist/ai/byok.d.ts +29 -0
  5. package/dist/ai/index.d.ts +8 -0
  6. package/dist/ai/providers.d.ts +82 -0
  7. package/dist/ai/sse.d.ts +9 -0
  8. package/dist/ai.js +36 -0
  9. package/dist/ai.js.map +7 -0
  10. package/dist/chunks/bar-D5CSPT3U.js +2031 -0
  11. package/dist/chunks/bar-D5CSPT3U.js.map +7 -0
  12. package/dist/chunks/chunk-2ADXL7KQ.js +358 -0
  13. package/dist/chunks/chunk-2ADXL7KQ.js.map +7 -0
  14. package/dist/chunks/chunk-6TC6G2C5.js +107 -0
  15. package/dist/chunks/chunk-6TC6G2C5.js.map +7 -0
  16. package/dist/chunks/chunk-HBBSETRF.js +153 -0
  17. package/dist/chunks/chunk-HBBSETRF.js.map +7 -0
  18. package/dist/chunks/chunk-I77YSUJN.js +104 -0
  19. package/dist/chunks/chunk-I77YSUJN.js.map +7 -0
  20. package/dist/chunks/chunk-IJ3WUM3T.js +544 -0
  21. package/dist/chunks/chunk-IJ3WUM3T.js.map +7 -0
  22. package/dist/chunks/chunk-MPTP2EWW.js +8 -0
  23. package/dist/chunks/chunk-MPTP2EWW.js.map +7 -0
  24. package/dist/chunks/chunk-N4Y2Z6YD.js +69 -0
  25. package/dist/chunks/chunk-N4Y2Z6YD.js.map +7 -0
  26. package/dist/chunks/chunk-PQEHV3D4.js +124 -0
  27. package/dist/chunks/chunk-PQEHV3D4.js.map +7 -0
  28. package/dist/chunks/chunk-VXTYD56F.js +453 -0
  29. package/dist/chunks/chunk-VXTYD56F.js.map +7 -0
  30. package/dist/chunks/chunk-YCVJQ7U3.js +52 -0
  31. package/dist/chunks/chunk-YCVJQ7U3.js.map +7 -0
  32. package/dist/core/define.d.ts +40 -0
  33. package/dist/core/frecency.d.ts +16 -0
  34. package/dist/core/hotkeys.d.ts +39 -0
  35. package/dist/core/lazy.d.ts +48 -0
  36. package/dist/core/search.d.ts +42 -0
  37. package/dist/core/storage.d.ts +5 -0
  38. package/dist/core/types.d.ts +601 -0
  39. package/dist/extensions/index.d.ts +30 -0
  40. package/dist/extensions/math.d.ts +14 -0
  41. package/dist/extensions.js +476 -0
  42. package/dist/extensions.js.map +7 -0
  43. package/dist/index.d.ts +27 -0
  44. package/dist/index.js +67 -0
  45. package/dist/index.js.map +7 -0
  46. package/dist/qikbar.global.js +259 -0
  47. package/dist/qikbar.global.js.map +7 -0
  48. package/dist/react/index.d.ts +66 -0
  49. package/dist/react.js +119 -0
  50. package/dist/react.js.map +7 -0
  51. package/dist/server/index.d.ts +47 -0
  52. package/dist/server.js +93 -0
  53. package/dist/server.js.map +7 -0
  54. package/dist/styles.css +222 -0
  55. package/dist/theme.d.ts +5 -0
  56. package/dist/theme.js +20 -0
  57. package/dist/theme.js.map +7 -0
  58. package/dist/ui/bar.d.ts +252 -0
  59. package/dist/ui/dom.d.ts +21 -0
  60. package/dist/ui/icons.d.ts +88 -0
  61. package/dist/ui/markdown.d.ts +8 -0
  62. package/dist/ui/nav.d.ts +8 -0
  63. package/dist/ui/styles.d.ts +6 -0
  64. package/dist/ui/themes.d.ts +27 -0
  65. package/dist/ui/views.d.ts +148 -0
  66. package/dist/utils.d.ts +10 -0
  67. package/dist/utils.js +50 -0
  68. package/dist/utils.js.map +7 -0
  69. package/package.json +88 -43
  70. package/dist/qikbar.es.js +0 -8748
  71. package/dist/qikbar.umd.js +0 -113
  72. package/dist/types/boot.d.ts +0 -72
  73. package/dist/types/index.d.ts +0 -1
  74. package/dist/types/init.d.ts +0 -2
  75. package/dist/types/main.d.ts +0 -4
  76. package/dist/types/shared/AsyncRoot.d.ts +0 -5
  77. package/dist/types/shared/CommandFooter.d.ts +0 -5
  78. package/dist/types/shared/Crumbs.d.ts +0 -6
  79. package/dist/types/shared/Details.d.ts +0 -3
  80. package/dist/types/shared/ErrorBoundary.d.ts +0 -15
  81. package/dist/types/shared/Icon.d.ts +0 -4
  82. package/dist/types/shared/List.d.ts +0 -30
  83. package/dist/types/shared/Qikbar.d.ts +0 -5
  84. package/dist/types/shared/Root.d.ts +0 -4
  85. package/dist/types/shared/Search.d.ts +0 -1
  86. package/dist/types/shared/commandContext.d.ts +0 -8
  87. package/dist/types/shared/useDebounce.d.ts +0 -1
  88. package/dist/types/utils/liquid.d.ts +0 -4
  89. package/dist/types/vite-env.d.ts +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Qikbar contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ <p>
2
+ <img src="https://raw.githubusercontent.com/nearbycoder/qikbar-next/main/assets/logo-wordmark-light.png" width="240" alt="Qikbar">
3
+ </p>
4
+
5
+ # qikbar
6
+
7
+ **The open-source command bar for any web app.** Raycast-style search, routing, actions, extensions and AI in one tiny, themeable package with zero dependencies.
8
+
9
+ 📖 **Docs:** [qikbar.com/docs](https://qikbar.com/docs) · 🤖 **For AI agents:** [qikbar.com/llms-full.txt](https://qikbar.com/llms-full.txt)
10
+
11
+ ```bash
12
+ npm install @qikbar/qikbar
13
+ ```
14
+
15
+ ## Vanilla
16
+
17
+ ```ts
18
+ import { createQikbar, form } from '@qikbar/qikbar'
19
+ import { calculator, themeSwitcher } from '@qikbar/qikbar/extensions'
20
+
21
+ const bar = createQikbar({
22
+ navigate: (href) => router.push(href),
23
+ routes: [
24
+ { path: '/', title: 'Dashboard', icon: 'home' },
25
+ { path: '/settings', title: 'Settings', icon: 'settings' },
26
+ ],
27
+ commands: [
28
+ { title: 'Toggle sidebar', icon: 'layout-dashboard', shortcut: 'mod+b', run: () => toggleSidebar() },
29
+ {
30
+ title: 'Invite teammate',
31
+ icon: 'users',
32
+ view: form({
33
+ title: 'Invite teammate',
34
+ fields: [{ name: 'email', label: 'Email', type: 'email', required: true }],
35
+ onSubmit: async (values, ctx) => {
36
+ await api.invite(values.email)
37
+ ctx.toast({ title: 'Invite sent', style: 'success' })
38
+ },
39
+ }),
40
+ },
41
+ ],
42
+ sources: [
43
+ {
44
+ id: 'projects',
45
+ title: 'Projects',
46
+ search: async ({ query, signal }) =>
47
+ (await fetch(`/api/projects?q=${query}`, { signal }).then((r) => r.json())).map((p) => ({
48
+ title: p.name,
49
+ icon: 'folder',
50
+ href: `/projects/${p.id}`,
51
+ })),
52
+ },
53
+ ],
54
+ extensions: [calculator(), themeSwitcher()],
55
+ theme: 'linear',
56
+ })
57
+ ```
58
+
59
+ ## React
60
+
61
+ ```tsx
62
+ import { Qikbar, useCommands } from '@qikbar/qikbar/react'
63
+
64
+ <Qikbar routes={routes} commands={commands} navigate={(href) => router.push(href)} />
65
+
66
+ // Page-specific commands, anywhere in the tree
67
+ useCommands([{ title: 'Archive project', icon: 'trash', run: archive }], [archive])
68
+ ```
69
+
70
+ ## AI
71
+
72
+ ```ts
73
+ import { createQikbar, proxy } from '@qikbar/qikbar'
74
+ createQikbar({ routes, commands, ai: proxy('/api/qikbar') })
75
+
76
+ // app/api/qikbar/route.ts
77
+ import { createHandler, anthropic } from '@qikbar/qikbar/server'
78
+ export const POST = createHandler({ provider: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }) })
79
+ ```
80
+
81
+ Press <kbd>Tab</kbd> in the bar to ask AI. The model can search and run your commands. Providers: `anthropic`, `openai`, `gemini`, `openaiCompatible`, `ollama`, `browserAI`, `proxy`, `byok`.
82
+
83
+ ## Script tag
84
+
85
+ ```html
86
+ <script src="https://unpkg.com/@qikbar/qikbar/dist/qikbar.global.js"></script>
87
+ <script>Qikbar.createQikbar({ autoIndex: true })</script>
88
+ ```
89
+
90
+ ## License
91
+
92
+ MIT
@@ -0,0 +1,42 @@
1
+ import type { AIClient, AIMessage, AIProvider, AIToolCall, AIToolDefinition } from '../core/types.js';
2
+ /** Create the simple `ask` / `stream` client exposed as `ctx.ai`. */
3
+ export declare function createAIClient(provider: AIProvider, defaultSystem?: string): AIClient;
4
+ export interface RuntimeTool {
5
+ definition: AIToolDefinition;
6
+ /** Human-readable label for the UI ("Opening Billing…"). */
7
+ label?: (args: Record<string, unknown>) => string;
8
+ run: (args: Record<string, unknown>, signal: AbortSignal) => Promise<unknown>;
9
+ }
10
+ export type AgentEvent = {
11
+ type: 'text';
12
+ text: string;
13
+ } | {
14
+ type: 'tool_start';
15
+ call: AIToolCall;
16
+ label: string;
17
+ } | {
18
+ type: 'tool_end';
19
+ call: AIToolCall;
20
+ ok: boolean;
21
+ result: string;
22
+ } | {
23
+ type: 'message';
24
+ message: AIMessage;
25
+ } | {
26
+ type: 'error';
27
+ error: string;
28
+ };
29
+ export interface RunAgentOptions {
30
+ provider: AIProvider;
31
+ /** Conversation so far (not mutated). */
32
+ messages: AIMessage[];
33
+ system?: string;
34
+ tools?: RuntimeTool[];
35
+ maxSteps?: number;
36
+ signal: AbortSignal;
37
+ }
38
+ /**
39
+ * Run a tool-calling loop: stream the model's answer, execute requested
40
+ * tools, feed results back, repeat until the model stops calling tools.
41
+ */
42
+ export declare function runAgent(options: RunAgentOptions): AsyncIterable<AgentEvent>;
@@ -0,0 +1,29 @@
1
+ import type { AIProvider, Extension, StorageAdapter } from '../core/types.js';
2
+ export type ByokVendor = 'anthropic' | 'openai' | 'gemini' | 'openai-compatible';
3
+ export interface ByokSettings {
4
+ vendor: ByokVendor;
5
+ apiKey: string;
6
+ model?: string;
7
+ baseURL?: string;
8
+ }
9
+ export interface ByokOptions {
10
+ /** Vendors offered in settings. Default: all. */
11
+ vendors?: ByokVendor[];
12
+ /** Storage key. Default `"qikbar:byok"`. */
13
+ key?: string;
14
+ storage?: StorageAdapter;
15
+ }
16
+ /**
17
+ * "Bring your own key": your users paste their own API key, stored only in their
18
+ * browser. Pair with `byok.settings()` so they can configure it from the bar.
19
+ *
20
+ * ```ts
21
+ * createQikbar({ ai: byok(), extensions: [byok.settings()] })
22
+ * ```
23
+ */
24
+ export declare const byok: ((options?: ByokOptions) => AIProvider) & {
25
+ /** An extension with an "AI Settings" command where users enter their own key. */
26
+ settings: typeof settingsExtension;
27
+ };
28
+ declare function settingsExtension(options?: ByokOptions): Extension;
29
+ export {};
@@ -0,0 +1,8 @@
1
+ export { anthropic, browserAI, gemini, ollama, openai, openaiCompatible, proxy } from './providers.js';
2
+ export type { AnthropicOptions, GeminiOptions, OpenAIOptions, ProxyOptions } from './providers.js';
3
+ export { byok } from './byok.js';
4
+ export type { ByokOptions, ByokSettings, ByokVendor } from './byok.js';
5
+ export { createAIClient, runAgent } from './agent.js';
6
+ export type { AgentEvent, RunAgentOptions, RuntimeTool } from './agent.js';
7
+ export { parseNDJSON, parseSSE } from './sse.js';
8
+ export type { AIClient, AIEvent, AIMessage, AIProvider, AIRequest, AIToolCall, AIToolDefinition } from '../core/types.js';
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Zero-dependency AI providers. Each one streams text and tool calls through
3
+ * the same `AIProvider` interface, so the bar works with any model.
4
+ *
5
+ * Security: providers that take an `apiKey` call the vendor directly from the
6
+ * browser. That's fine for prototypes, internal tools, and "bring your own key"
7
+ * setups where users paste their own key. For production apps with a shared
8
+ * key, use `proxy()` on the client and `createHandler()` from `@qikbar/qikbar/server`.
9
+ */
10
+ import type { AIProvider } from '../core/types.js';
11
+ export interface AnthropicOptions {
12
+ apiKey?: string;
13
+ /** Default `"claude-opus-5-5"`. Use `"claude-haiku-5-5"` for the lowest latency and cost. */
14
+ model?: string;
15
+ baseURL?: string;
16
+ maxTokens?: number;
17
+ /** Reasoning effort. Default `"low"` — a command bar should feel instant. */
18
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | false;
19
+ /**
20
+ * Server-side refusal fallbacks (Claude API only). When a safety classifier
21
+ * declines a request, the API re-runs it on a fallback model. Default `true`
22
+ * on models that support it.
23
+ */
24
+ fallbacks?: boolean;
25
+ headers?: Record<string, string>;
26
+ /** Custom fetch (e.g. for proxies or tests). */
27
+ fetch?: typeof fetch;
28
+ }
29
+ export declare function anthropic(options?: AnthropicOptions): AIProvider;
30
+ export interface OpenAIOptions {
31
+ apiKey?: string;
32
+ /** Default `"gpt-6-luna"`. */
33
+ model?: string;
34
+ /** Point at any OpenAI-compatible API: Groq, OpenRouter, Together, Mistral, Ollama (`http://localhost:11434/v1`), LM Studio, vLLM… */
35
+ baseURL?: string;
36
+ maxTokens?: number;
37
+ headers?: Record<string, string>;
38
+ /** Some local models don't support tools. Default true. */
39
+ tools?: boolean;
40
+ fetch?: typeof fetch;
41
+ /** Provider id shown in the UI. Default `"openai"`. */
42
+ id?: string;
43
+ }
44
+ export declare function openai(options?: OpenAIOptions): AIProvider;
45
+ /** Any OpenAI-compatible endpoint (Groq, OpenRouter, Together, Mistral, DeepSeek, xAI, Ollama, LM Studio…). */
46
+ export declare function openaiCompatible(options: OpenAIOptions & {
47
+ baseURL: string;
48
+ model: string;
49
+ }): AIProvider;
50
+ /** Local models via Ollama. */
51
+ export declare function ollama(options?: {
52
+ model: string;
53
+ baseURL?: string;
54
+ tools?: boolean;
55
+ }): AIProvider;
56
+ export interface GeminiOptions {
57
+ apiKey?: string;
58
+ /** Default `"gemini-flash-latest"`. */
59
+ model?: string;
60
+ baseURL?: string;
61
+ maxTokens?: number;
62
+ headers?: Record<string, string>;
63
+ fetch?: typeof fetch;
64
+ }
65
+ export declare function gemini(options?: GeminiOptions): AIProvider;
66
+ /**
67
+ * Chrome's built-in on-device model via the Prompt API (`LanguageModel`).
68
+ * Free and private, no API key. No tool calling. Check `browserAI.isAvailable()` first.
69
+ */
70
+ export declare const browserAI: (() => AIProvider) & {
71
+ /** Whether the on-device model can be used in this browser. */
72
+ isAvailable(): Promise<boolean>;
73
+ };
74
+ export interface ProxyOptions {
75
+ /** Your endpoint created with `createHandler()` from `@qikbar/qikbar/server`. */
76
+ url: string;
77
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
78
+ credentials?: RequestCredentials;
79
+ fetch?: typeof fetch;
80
+ }
81
+ /** Stream through your own server so API keys never reach the browser. */
82
+ export declare function proxy(options: ProxyOptions | string): AIProvider;
@@ -0,0 +1,9 @@
1
+ export interface SSEMessage {
2
+ event?: string;
3
+ data: string;
4
+ }
5
+ /** Parse a Server-Sent Events stream. */
6
+ export declare function parseSSE(response: Response): AsyncIterable<SSEMessage>;
7
+ /** Parse a newline-delimited JSON stream. */
8
+ export declare function parseNDJSON<T = unknown>(response: Response): AsyncIterable<T>;
9
+ export declare function errorFromResponse(response: Response, provider: string): Promise<Error>;
package/dist/ai.js ADDED
@@ -0,0 +1,36 @@
1
+ import {
2
+ byok
3
+ } from "./chunks/chunk-6TC6G2C5.js";
4
+ import {
5
+ anthropic,
6
+ browserAI,
7
+ gemini,
8
+ ollama,
9
+ openai,
10
+ openaiCompatible,
11
+ parseNDJSON,
12
+ parseSSE,
13
+ proxy
14
+ } from "./chunks/chunk-2ADXL7KQ.js";
15
+ import {
16
+ createAIClient,
17
+ runAgent
18
+ } from "./chunks/chunk-N4Y2Z6YD.js";
19
+ import "./chunks/chunk-I77YSUJN.js";
20
+ import "./chunks/chunk-YCVJQ7U3.js";
21
+ import "./chunks/chunk-MPTP2EWW.js";
22
+ export {
23
+ anthropic,
24
+ browserAI,
25
+ byok,
26
+ createAIClient,
27
+ gemini,
28
+ ollama,
29
+ openai,
30
+ openaiCompatible,
31
+ parseNDJSON,
32
+ parseSSE,
33
+ proxy,
34
+ runAgent
35
+ };
36
+ //# sourceMappingURL=ai.js.map
package/dist/ai.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }