stacks-ai 0.2.4 → 0.2.7

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.
@@ -1,4 +1,4 @@
1
- import{g}from"./index-CHhe65ps.js";import{c as h,o as y,a as m}from"./index-D0ZoqtYh.js";const r={},p=t=>{const e={anthropic:"anthropic-api-key",openai:"openai-api-key",google:"gemini-api-key"},a=localStorage.getItem(e[t]);return a||{anthropic:r==null?void 0:r.VITE_ANTHROPIC_API_KEY,openai:r==null?void 0:r.VITE_OPENAI_API_KEY,google:r==null?void 0:r.VITE_GEMINI_API_KEY}[t]||""},u=async t=>{const a=await(await fetch(t)).blob();return new Promise((o,l)=>{const n=new FileReader;n.onloadend=()=>{const c=n.result,[,s]=c.split(",");o({data:s,mimeType:a.type})},n.onerror=l,n.readAsDataURL(a)})},P=async(t,e)=>{const a=(e==null?void 0:e.provider)||localStorage.getItem("ai-provider")||"google",o=p(a);if(!o)throw new Error(`${a} API key not configured. Please add your API key in Settings → Providers.`);const{data:l,mimeType:n}=await u(t),c=localStorage.getItem("image-analysis-model");let s;switch(a){case"anthropic":s=m((e==null?void 0:e.model)||c||"claude-sonnet-4-5-20250929",{apiKey:o});break;case"openai":s=y((e==null?void 0:e.model)||c||"gpt-4o",{apiKey:o});break;case"google":{s=h({apiKey:o})((e==null?void 0:e.model)||c||"gemini-2.0-flash-exp");break}default:throw new Error(`Unknown provider: ${a}`)}const d=(await g({model:s,messages:[{role:"user",content:[{type:"image",image:`data:${n};base64,${l}`},{type:"text",text:`Analyze this image and provide:
1
+ import{g}from"./index-BuyyCfeJ.js";import{c as h,o as y,a as m}from"./index-B7ilsstg.js";const r={},p=t=>{const e={anthropic:"anthropic-api-key",openai:"openai-api-key",google:"gemini-api-key"},a=localStorage.getItem(e[t]);return a||{anthropic:r==null?void 0:r.VITE_ANTHROPIC_API_KEY,openai:r==null?void 0:r.VITE_OPENAI_API_KEY,google:r==null?void 0:r.VITE_GEMINI_API_KEY}[t]||""},u=async t=>{const a=await(await fetch(t)).blob();return new Promise((o,l)=>{const n=new FileReader;n.onloadend=()=>{const c=n.result,[,s]=c.split(",");o({data:s,mimeType:a.type})},n.onerror=l,n.readAsDataURL(a)})},P=async(t,e)=>{const a=(e==null?void 0:e.provider)||localStorage.getItem("ai-provider")||"google",o=p(a);if(!o)throw new Error(`${a} API key not configured. Please add your API key in Settings → Providers.`);const{data:l,mimeType:n}=await u(t),c=localStorage.getItem("image-analysis-model");let s;switch(a){case"anthropic":s=m((e==null?void 0:e.model)||c||"claude-sonnet-4-5-20250929",{apiKey:o});break;case"openai":s=y((e==null?void 0:e.model)||c||"gpt-4o",{apiKey:o});break;case"google":{s=h({apiKey:o})((e==null?void 0:e.model)||c||"gemini-2.0-flash-exp");break}default:throw new Error(`Unknown provider: ${a}`)}const d=(await g({model:s,messages:[{role:"user",content:[{type:"image",image:`data:${n};base64,${l}`},{type:"text",text:`Analyze this image and provide:
2
2
  1. A one-sentence description of what you see
3
3
  2. The 6 most dominant colors as hex codes
4
4
 
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
6
6
  <title>Stacks</title>
7
- <script type="module" crossorigin src="./assets/index-DRYEX6gr.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-o3S66-xQ.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-BWvx7AMq.css">
9
9
  </head>
10
10
  <body>
package/dist/mcp/proxy.js CHANGED
@@ -7,22 +7,26 @@
7
7
  */
8
8
  import { WebSocketServer } from "ws";
9
9
  import { spawn } from "child_process";
10
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
10
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync } from "fs";
11
11
  import { homedir } from "os";
12
12
  import { join } from "path";
13
- // Config paths
14
13
  const configDir = join(homedir(), ".stacks");
14
+ const legacyConfigDir = join(homedir(), ".spatial");
15
15
  const configPath = join(configDir, "mcp-proxy-config.json");
16
+ const legacyConfigPath = join(legacyConfigDir, "mcp-proxy-config.json");
16
17
  // Default config
17
18
  const DEFAULT_CONFIG = {
18
19
  port: 3099,
19
20
  servers: {}
20
21
  };
21
- // Load/save config
22
22
  function loadConfig() {
23
23
  if (!existsSync(configDir)) {
24
24
  mkdirSync(configDir, { recursive: true });
25
25
  }
26
+ if (existsSync(legacyConfigPath) && !existsSync(configPath)) {
27
+ copyFileSync(legacyConfigPath, configPath);
28
+ console.log("Migrated MCP config from ~/.spatial to ~/.stacks");
29
+ }
26
30
  if (!existsSync(configPath)) {
27
31
  writeFileSync(configPath, JSON.stringify(DEFAULT_CONFIG, null, 2));
28
32
  return DEFAULT_CONFIG;
@@ -3,15 +3,22 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { z } from "zod";
5
5
  import Database from "better-sqlite3";
6
- import { existsSync, mkdirSync } from "fs";
6
+ import { existsSync, mkdirSync, copyFileSync } from "fs";
7
7
  import { homedir } from "os";
8
8
  import { join } from "path";
9
- // Database setup
10
- const dataDir = join(homedir(), ".stacks");
11
- if (!existsSync(dataDir)) {
12
- mkdirSync(dataDir, { recursive: true });
9
+ const newDataDir = join(homedir(), ".stacks");
10
+ const legacyDataDir = join(homedir(), ".spatial");
11
+ const legacyDbPath = join(legacyDataDir, "canvas.db");
12
+ const newDbPath = join(newDataDir, "canvas.db");
13
+ if (!existsSync(newDataDir)) {
14
+ mkdirSync(newDataDir, { recursive: true });
13
15
  }
14
- const db = new Database(join(dataDir, "canvas.db"));
16
+ if (existsSync(legacyDbPath) && !existsSync(newDbPath)) {
17
+ copyFileSync(legacyDbPath, newDbPath);
18
+ console.error("Migrated database from ~/.spatial to ~/.stacks");
19
+ }
20
+ const dataDir = newDataDir;
21
+ const db = new Database(newDbPath);
15
22
  // Initialize schema
16
23
  db.exec(`
17
24
  CREATE TABLE IF NOT EXISTS spaces (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stacks-ai",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "Stacks - AI-powered infinite canvas for notes, images, and creative organization",
5
5
  "author": "Jason Kneen",
6
6
  "license": "MIT",