fluxy-bot 0.2.3 → 0.2.5

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/dist/sw.js CHANGED
@@ -1 +1 @@
1
- if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),u={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>u[e]||l(e))).then(e=>(r(...e),o))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"de4171236598f5a00a8a0f04f195a3b6"},{url:"assets/index-D2PQx64r.css",revision:null},{url:"assets/index-BxQ8et35.js",revision:null},{url:"manifest.webmanifest",revision:"f73683d89ca6b3b7b63451130e165f71"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});
1
+ if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>i(e,r),u={module:{uri:r},exports:o,require:l};s[r]=Promise.all(n.map(e=>u[e]||l(e))).then(e=>(t(...e),o))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"de4171236598f5a00a8a0f04f195a3b6"},{url:"assets/index-D2PQx64r.css",revision:null},{url:"assets/index-BxQ8et35.js",revision:null},{url:"manifest.webmanifest",revision:"f73683d89ca6b3b7b63451130e165f71"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"),{denylist:[/^\/fluxy/]}))});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Self-hosted AI bot — run your own AI assistant from anywhere",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,42 @@ interface ActiveQuery {
22
22
 
23
23
  const activeQueries = new Map<string, ActiveQuery>();
24
24
 
25
+ export interface AgentAttachment {
26
+ type: 'image' | 'file';
27
+ name: string;
28
+ mediaType: string;
29
+ data: string; // base64
30
+ }
31
+
32
+ /** Build a multi-part prompt with attachments for the SDK */
33
+ function buildMultiPartPrompt(text: string, attachments: AgentAttachment[]): AsyncIterable<SDKUserMessage> {
34
+ return (async function* () {
35
+ const content: any[] = [];
36
+
37
+ for (const att of attachments) {
38
+ if (att.type === 'image') {
39
+ content.push({
40
+ type: 'image',
41
+ source: { type: 'base64', media_type: att.mediaType, data: att.data },
42
+ });
43
+ } else {
44
+ content.push({
45
+ type: 'document',
46
+ source: { type: 'base64', media_type: att.mediaType, data: att.data },
47
+ });
48
+ }
49
+ }
50
+
51
+ content.push({ type: 'text', text: text || '(attached files)' });
52
+
53
+ yield {
54
+ type: 'user' as const,
55
+ message: { role: 'user' as const, content },
56
+ parent_tool_use_id: null,
57
+ } as SDKUserMessage;
58
+ })();
59
+ }
60
+
25
61
  /** Read the OAuth token stored by claude-auth */
26
62
  function readOAuthToken(): string | null {
27
63
  try {
@@ -56,6 +92,7 @@ export async function startFluxyAgentQuery(
56
92
  prompt: string,
57
93
  model: string,
58
94
  onMessage: (type: string, data: any) => void,
95
+ attachments?: AgentAttachment[],
59
96
  ): Promise<void> {
60
97
  const oauthToken = readOAuthToken();
61
98
  if (!oauthToken) {
@@ -71,9 +108,12 @@ export async function startFluxyAgentQuery(
71
108
 
72
109
  let fullText = '';
73
110
 
111
+ const sdkPrompt: string | AsyncIterable<SDKUserMessage> =
112
+ attachments?.length ? buildMultiPartPrompt(prompt, attachments) : prompt;
113
+
74
114
  try {
75
115
  const claudeQuery = query({
76
- prompt,
116
+ prompt: sdkPrompt,
77
117
  options: {
78
118
  model,
79
119
  cwd: DATA_DIR,
@@ -65,11 +65,11 @@ export async function startSupervisor() {
65
65
  if (req.url === '/fluxy' || req.url === '/fluxy/') {
66
66
  const indexPath = path.join(paths.distFluxy, 'fluxy.html');
67
67
  if (fs.existsSync(indexPath)) {
68
- res.writeHead(200, { 'Content-Type': 'text/html' });
68
+ res.writeHead(200, { 'Content-Type': 'text/html', 'Cache-Control': 'no-cache, no-store, must-revalidate' });
69
69
  res.end(fs.readFileSync(indexPath));
70
70
  } else {
71
71
  // Fallback: dev mode or build not yet done
72
- res.writeHead(200, { 'Content-Type': 'text/html' });
72
+ res.writeHead(200, { 'Content-Type': 'text/html', 'Cache-Control': 'no-cache' });
73
73
  res.end('<html><body style="background:#212121;color:#f5f5f5;display:flex;align-items:center;justify-content:center;height:100vh;font-family:system-ui"><p>Fluxy chat not built yet. Run <code>npm run build</code></p></body></html>');
74
74
  }
75
75
  return;
@@ -128,7 +128,7 @@ export async function startSupervisor() {
128
128
  if (config.ai.provider === 'anthropic') {
129
129
  startFluxyAgentQuery(convId, content, config.ai.model, (type, eventData) => {
130
130
  ws.send(JSON.stringify({ type, data: eventData }));
131
- });
131
+ }, data.attachments);
132
132
  return;
133
133
  }
134
134
 
package/vite.config.ts CHANGED
@@ -22,6 +22,9 @@ export default defineConfig({
22
22
  react(),
23
23
  VitePWA({
24
24
  registerType: 'autoUpdate',
25
+ workbox: {
26
+ navigateFallbackDenylist: [/^\/fluxy/],
27
+ },
25
28
  manifest: {
26
29
  name: 'Fluxy',
27
30
  short_name: 'Fluxy',