@kazzle/app 0.1.945 → 0.1.946

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 (41) hide show
  1. package/README.md +2 -2
  2. package/dist/definition.d.ts +434 -0
  3. package/dist/definition.js +171 -0
  4. package/dist/index.d.ts +1 -105
  5. package/dist/index.js +3 -15
  6. package/dist/installations.d.ts +13 -0
  7. package/dist/installations.js +69 -0
  8. package/dist/vendor/kazzle/agents.d.ts +38 -0
  9. package/dist/vendor/kazzle/agents.js +46 -0
  10. package/dist/vendor/kazzle/generated/operations.js +18 -1
  11. package/dist/vendor/kazzle/index.d.ts +3 -0
  12. package/dist/vendor/kazzle/index.js +4 -2
  13. package/dist/vendor/kazzle/kazzle.d.ts +4 -0
  14. package/dist/vendor/kazzle/kazzle.js +7 -2
  15. package/dist/vendor/kazzle/thread-stream.d.ts +11 -0
  16. package/dist/vendor/kazzle/thread-stream.js +41 -0
  17. package/dist/vendor/kazzle/threads.d.ts +77 -0
  18. package/dist/vendor/kazzle/threads.js +70 -0
  19. package/dist/vite.d.ts +1 -1
  20. package/dist/vite.js +1 -1
  21. package/package.json +8 -4
  22. package/templates/ai-app/README.md +3 -0
  23. package/templates/ai-app/kazzle.config.ts +10 -2
  24. package/templates/empty-app/README.md +3 -0
  25. package/templates/empty-app/kazzle.config.ts +10 -2
  26. package/templates/login-app/KAZZLE.md +1 -1
  27. package/templates/login-app/README.md +3 -0
  28. package/templates/login-app/kazzle.config.ts +10 -2
  29. package/templates/process-app/README.md +3 -0
  30. package/templates/process-app/components/process/index.ts +1 -1
  31. package/templates/process-app/kazzle.config.ts +12 -6
  32. package/templates/realtime-app/KAZZLE.md +1 -1
  33. package/templates/realtime-app/README.md +3 -0
  34. package/templates/realtime-app/kazzle.config.ts +10 -2
  35. package/templates/ui-app/README.md +3 -0
  36. package/templates/ui-app/kazzle.config.ts +10 -2
  37. package/templates/ui-db-app/KAZZLE.md +1 -1
  38. package/templates/ui-db-app/README.md +3 -0
  39. package/templates/ui-db-app/kazzle.config.ts +10 -2
  40. package/dist/connections.d.ts +0 -11
  41. package/dist/connections.js +0 -56
@@ -1,11 +1,19 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'component', component: 'ui' },
6
12
  icon: 'components/ui/public/favicon.svg',
7
13
  components: [
8
14
  { name: 'ui', type: 'ui', path: './components/ui' },
9
15
  { name: 'server', type: 'process', path: './components/server/index.ts', runtime: { dev: { command: 'bun run dev' }, prod: { command: 'bun run start' } } },
10
16
  ],
17
+ tools: [],
18
+ skills: [],
11
19
  });
@@ -0,0 +1,3 @@
1
+ # {{APP_NAME}}
2
+
3
+ Describe what this app does and how people use it.
@@ -1,10 +1,18 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'none' },
6
12
  /** Path to the app icon relative to the repo root. Uploaded to CDN on publish. */
7
13
  icon: 'icon.svg',
8
14
  /** App components — each entry defines a deployable unit. */
9
15
  components: [],
16
+ tools: [],
17
+ skills: [],
10
18
  });
@@ -15,4 +15,4 @@ Login rules — these keep sign-in working:
15
15
  - Server routes that touch user data start with `await kazzleAuth.getAppUser(c.req.raw)`; null → return 401.
16
16
  - New backend routes the browser calls must be added to `proxyPaths` in `components/ui/vite.config.ts`. `/api/auth` must stay in that list.
17
17
 
18
- Do not rerun `db.connect`, rewrite manifest env refs, recreate server boilerplate, or reinstall dependencies as setup repair after `app.create` reports template setup complete. Change these files only when the user asks for behavior beyond this template.
18
+ Do not rerun `db.connect`, rewrite app definition env refs, recreate server boilerplate, or reinstall dependencies as setup repair after `app.create` reports template setup complete. Change these files only when the user asks for behavior beyond this template.
@@ -0,0 +1,3 @@
1
+ # {{APP_NAME}}
2
+
3
+ Describe what this app does and how people use it.
@@ -1,8 +1,14 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'component', component: 'ui' },
6
12
  icon: 'components/ui/public/favicon.svg',
7
13
  /** End-user login (Google via Kazzle). Users live in this app's own database. */
8
14
  appLogin: true,
@@ -10,4 +16,6 @@ export default defineConfig({
10
16
  { name: 'ui', type: 'ui', path: './components/ui' },
11
17
  { name: 'server', type: 'process', path: './components/server/index.ts', runtime: { dev: { command: 'bun run dev' }, prod: { command: 'bun run start' } } },
12
18
  ],
19
+ tools: [],
20
+ skills: [],
13
21
  });
@@ -0,0 +1,3 @@
1
+ # {{APP_NAME}}
2
+
3
+ Describe what this app does and how people use it.
@@ -8,7 +8,7 @@
8
8
  * - `Authorization: Bearer ${KAZZLE_TRIGGER_SECRET}` — validate this
9
9
  * before doing any work. Calls without the header are external traffic
10
10
  * and should be handled with your own auth (or rejected).
11
- * - `x-kazzle-trigger-name` — the trigger's `name` from the manifest.
11
+ * - `x-kazzle-trigger-name` — the trigger's `name` from the app definition.
12
12
  * - `x-kazzle-trigger-run-id` — opaque ID for log correlation.
13
13
  * - `x-kazzle-triggered-by` — 'cron' | 'webhook' | 'manual'.
14
14
  *
@@ -1,8 +1,14 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'none' },
6
12
  /** Path to the app icon relative to the repo root. Uploaded to CDN on publish. */
7
13
  icon: 'icon.svg',
8
14
  /** App components — each entry defines a deployable unit. */
@@ -25,10 +31,10 @@ export default defineConfig({
25
31
  ],
26
32
  },
27
33
  ],
28
- // Skills = what the AI knows + can do with this app. Each skill is a folder
29
- // (SKILL.md + optional tools.ts). The tools in tools.ts are backed by
30
- // `POST /tools/<name>` routes in the process component above (the "kitchen").
34
+ tools: [
35
+ { name: '{{APP_NAME}}', type: 'file', path: './skills/tools/tools.ts' },
36
+ ],
31
37
  skills: [
32
- { name: '{{APP_NAME}}', path: './skills/tools/SKILL.md' },
38
+ { name: '{{APP_NAME}}', source: { type: 'file', path: './skills/tools/SKILL.md' } },
33
39
  ],
34
40
  });
@@ -8,4 +8,4 @@ Template-owned setup:
8
8
  - `components/ui/src/` owns the realtime UI and client logic.
9
9
  - `components/ui/package.json` and `components/server/package.json` already contain install, build, and check scripts.
10
10
 
11
- Do not rerun `db.connect`, rewrite manifest env refs, or replace realtime setup after `app.create` reports template setup complete. Change template-owned files only when requirements actually change app behavior.
11
+ Do not rerun `db.connect`, rewrite app definition env refs, or replace realtime setup after `app.create` reports template setup complete. Change template-owned files only when requirements actually change app behavior.
@@ -0,0 +1,3 @@
1
+ # {{APP_NAME}}
2
+
3
+ Describe what this app does and how people use it.
@@ -1,8 +1,14 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'component', component: 'ui' },
6
12
  /** Path to the app icon relative to the repo root. Uploaded to CDN on publish. */
7
13
  icon: 'components/ui/public/favicon.svg',
8
14
  /** App components — each entry defines a deployable unit. Max 1 UI component. */
@@ -10,4 +16,6 @@ export default defineConfig({
10
16
  { name: 'ui', type: 'ui', path: './components/ui' },
11
17
  { name: 'server', type: 'process', path: './components/server/index.ts', runtime: { dev: { command: 'bun run dev' }, prod: { command: 'bun run start' } } },
12
18
  ],
19
+ tools: [],
20
+ skills: [],
13
21
  });
@@ -0,0 +1,3 @@
1
+ # {{APP_NAME}}
2
+
3
+ Describe what this app does and how people use it.
@@ -1,12 +1,20 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'component', component: '{{APP_NAME}}' },
6
12
  /** Path to the app icon relative to the repo root. Uploaded to CDN on publish. */
7
13
  icon: 'components/ui/public/favicon.svg',
8
14
  /** App components — each entry defines a deployable unit. Max 1 UI component. */
9
15
  components: [
10
16
  { name: '{{APP_NAME}}', type: 'ui', path: './components/ui' },
11
17
  ],
18
+ tools: [],
19
+ skills: [],
12
20
  });
@@ -9,4 +9,4 @@ Template-owned setup:
9
9
  - `components/ui/package.json` and `components/server/package.json` already contain the install, build, and check scripts.
10
10
  - The database schema is bootstrapped by template setup before the app is handed back.
11
11
 
12
- Do not rerun `db.connect`, rewrite manifest env refs, recreate server boilerplate, or reinstall dependencies as setup repair after `app.create` reports template setup complete. Change these files only when the user asks for behavior beyond this template.
12
+ Do not rerun `db.connect`, rewrite app definition env refs, recreate server boilerplate, or reinstall dependencies as setup repair after `app.create` reports template setup complete. Change these files only when the user asks for behavior beyond this template.
@@ -0,0 +1,3 @@
1
+ # {{APP_NAME}}
2
+
3
+ Describe what this app does and how people use it.
@@ -1,11 +1,19 @@
1
- import { defineConfig } from '@kazzle/app';
1
+ import { defineApp } from '@kazzle/app';
2
2
 
3
- export default defineConfig({
3
+ export default defineApp({
4
+ schemaVersion: 1,
5
+ name: '{{APP_NAME}}',
4
6
  /** One-line catalog tagline. Required to publish. */
5
7
  subtitle: '{{APP_NAME}}',
8
+ description: { type: 'markdown', path: 'README.md' },
9
+ maxInstallations: 1,
10
+ setup: { type: 'none' },
11
+ launch: { type: 'component', component: 'ui' },
6
12
  icon: 'components/ui/public/favicon.svg',
7
13
  components: [
8
14
  { name: 'ui', type: 'ui', path: './components/ui' },
9
15
  { name: 'server', type: 'process', path: './components/server/index.ts', runtime: { dev: { command: 'bun run dev' }, prod: { command: 'bun run start' } } },
10
16
  ],
17
+ tools: [],
18
+ skills: [],
11
19
  });
@@ -1,11 +0,0 @@
1
- export declare class ConnectionNotConnectedError extends Error {
2
- readonly connectionId: string;
3
- constructor(connectionId: string, message?: string);
4
- }
5
- /**
6
- * A fresh vendor access token for a connection, e.g.
7
- * `new Stripe(await getConnectionToken('8f2a…'))`.
8
- */
9
- export declare function getConnectionToken(connectionId: string): Promise<string>;
10
- /** Forget cached tokens (tests, or after a reconnect). */
11
- export declare function clearConnectionTokenCache(): void;
@@ -1,56 +0,0 @@
1
- // @kazzle/app/connections — use the accounts a person connected in Kazzle
2
- // (Stripe, Gmail, Slack, …) from app code.
3
- //
4
- // Kazzle keeps the OAuth tokens; this asks Kazzle for a fresh one and caches it
5
- // until it expires. Identify the connection by its vault secret id (the AI that
6
- // built the app has it from the vault). Requires KAZZLE_API_KEY and
7
- // KAZZLE_API_URL, both injected into every component at deploy and `kazzle run`.
8
- //
9
- // Dependency-free on purpose (uses global fetch). Do not add zod/vite here.
10
- import { kazzleApiUrl } from './client';
11
- export class ConnectionNotConnectedError extends Error {
12
- connectionId;
13
- constructor(connectionId, message) {
14
- super(message ?? `Connection ${connectionId} is not connected. Connect it on the Integrations page in Kazzle.`);
15
- this.connectionId = connectionId;
16
- this.name = 'ConnectionNotConnectedError';
17
- }
18
- }
19
- const DEFAULT_TTL_MS = 60 * 60_000;
20
- const REFRESH_MARGIN_MS = 60_000;
21
- const cache = new Map();
22
- function apiKey() {
23
- const key = process.env['KAZZLE_API_KEY'];
24
- if (!key) {
25
- throw new Error('KAZZLE_API_KEY is not set — connection tokens are only available to deployed Kazzle app components.');
26
- }
27
- return key;
28
- }
29
- /**
30
- * A fresh vendor access token for a connection, e.g.
31
- * `new Stripe(await getConnectionToken('8f2a…'))`.
32
- */
33
- export async function getConnectionToken(connectionId) {
34
- const hit = cache.get(connectionId);
35
- if (hit && hit.expiresAt - Date.now() > REFRESH_MARGIN_MS)
36
- return hit.token;
37
- const res = await fetch(`${kazzleApiUrl()}/connections/${encodeURIComponent(connectionId)}/token`, {
38
- headers: { authorization: `Bearer ${apiKey()}` },
39
- });
40
- if (res.status === 404 || res.status === 409) {
41
- const body = await res.json().catch(() => ({}));
42
- cache.delete(connectionId);
43
- throw new ConnectionNotConnectedError(connectionId, body.message);
44
- }
45
- if (!res.ok) {
46
- throw new Error(`Kazzle connection token request failed: HTTP ${res.status}`);
47
- }
48
- const body = await res.json();
49
- const expiresAt = body.expiresAt ? Date.parse(body.expiresAt) : Date.now() + DEFAULT_TTL_MS;
50
- cache.set(connectionId, { token: body.token, expiresAt: Number.isFinite(expiresAt) ? expiresAt : Date.now() + DEFAULT_TTL_MS });
51
- return body.token;
52
- }
53
- /** Forget cached tokens (tests, or after a reconnect). */
54
- export function clearConnectionTokenCache() {
55
- cache.clear();
56
- }