Skip to content

Add mossJARVIS community demo - #401

Open
AyanBhardwaj1 wants to merge 2 commits into
usemoss:mainfrom
AyanBhardwaj1:add-moss-jarvis
Open

Add mossJARVIS community demo#401
AyanBhardwaj1 wants to merge 2 commits into
usemoss:mainfrom
AyanBhardwaj1:add-moss-jarvis

Conversation

@AyanBhardwaj1

Copy link
Copy Markdown

Pull Request Checklist

Please ensure that your PR meets the following requirements:

  • I have read the CONTRIBUTING guide.
  • I have updated the documentation (if applicable).
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 35 changed files in this pull request and generated 6 comments.

Files not reviewed (2)
  • moss-live-labs/community-demos/mossJARVIS/app/globals.css: Generated file
  • moss-live-labs/community-demos/mossJARVIS/pnpm-lock.yaml: Generated file

Comment thread moss-live-labs/community-demos/mossJARVIS/app/page.tsx
Comment thread moss-live-labs/community-demos/mossJARVIS/src-tauri/tauri.conf.json
Comment thread moss-live-labs/community-demos/mossJARVIS/src-tauri/src/lib.rs
Comment thread moss-live-labs/community-demos/mossJARVIS/app/page.tsx
Comment thread moss-live-labs/community-demos/mossJARVIS/app/second-brain.tsx
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@AyanBhardwaj1

Copy link
Copy Markdown
Author

Committed Copilot changes, please merge.

}

const response = await fetch("/api/jarvis/tts", {
method: "POST",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING ```ts
const response = await fetch("/api/jarvis/tts", { ... });
...
const response = await fetch("/api/jarvis/tts", {

This redeclares block-scoped `response` and `url` in the same `try` block, so the Next/TypeScript build fails before the app can run; if renamed, it would also bill/play the same TTS response twice. Delete the second fetch/playback block and keep one request with `URL.revokeObjectURL` in a `finally`.

const remoteDocuments = (await client.getDocs(indexName)).filter(validDocument).map(withoutEmbedding);
const remoteById = new Map(remoteDocuments.map((doc) => [doc.id, JSON.stringify(doc)]));
documents = mergeDocuments(remoteDocuments, localDocuments);
const pending = documents.filter((doc) => remoteById.get(doc.id) !== JSON.stringify(doc));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING ```ts
documents = mergeDocuments(remoteDocuments, localDocuments);

Offline deletes are not durable: `deleteBrainMemory()` removes the doc locally when Moss is offline, but the remote copy remains, and the next successful startup merges every remote doc back into local storage. Track deletion tombstones/`deletedAt` IDs in the local store, apply them before this merge, and replay `deleteDocs()` when cloud sync recovers.

const directory = dataDirectory();
const destination = memoryFile();
const temporary = `${destination}.${process.pid}.tmp`;
const payload: LocalStore = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING ```ts
const temporary = ${destination}.${process.pid}.tmp;

Every local-memory write in the process uses the same temp file, and the read/merge/write sequence is not serialized. Concurrent turn, ingest, remember, or delete requests can overwrite the temp payload, fail `rename()` with `ENOENT`, or drop one request's documents. Put store mutations behind a process-wide mutex/queue or durable store, and use unique temp names such as `randomUUID()` inside that critical section.

export async function POST(request: Request) {
try {
const body = (await request.json()) as Record<string, unknown>;
const action = typeof body.action === "string" ? body.action : "";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING ```ts
const body = (await request.json()) as Record<string, unknown>;

The loopback API executes cost-incurring actions using process-global API keys without any origin check or request token; after credentials are configured, another local process or reachable browser context can POST to `/api/jarvis` and use the user's OpenRouter/ElevenLabs keys. Reject non-same-origin requests and require a per-session CSRF/auth token header before parsing and dispatching actions.

.arg("server.js")
.current_dir(server_dir)
.env("PORT", "3000")
.env("HOSTNAME", "127.0.0.1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONSIDER ```rust
.env("PORT", "3000")

The packaged desktop app always starts and opens port 3000. If anything else is already listening there, the sidecar Next server can fail while `wait_for_server()` succeeds against the unrelated process, and the WebView opens the wrong app. Pick/probe a free loopback port, pass it to `PORT`, `wait_for_server(port)`, and `WebviewUrl`, and check `child.try_wait()` or a Jarvis health endpoint during startup.

@github-actions

Copy link
Copy Markdown

Codex review

The PR adds a large standalone Jarvis demo, but several issues break the app or undermine the memory/security guarantees. The highest-impact problems are a compile-time duplicate declaration, data consistency bugs, and unauthenticated loopback APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants