Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proactive Box Document Partner

Small, blog-friendly MVP inspired by Designing Proactive Thought Partners for Writing.

The app demonstrates one idea from the paper: a user-configured AI partner can wait for a natural writing pause, inspect the current draft in context, and offer one non-directive question instead of waiting for the user to write a prompt.

What it does

  • Loads the original Markdown document from Box into the editor and grounds suggestions in it.
  • Provides three tiny partner presets: Evidence, Counterpoint, and Clarity.
  • Fires after a five-second pause in the browser, with controls for every pause, every second pause, or at most once per minute.
  • Calls Box AI with POST /2.0/ai/ask.
  • Lets the user choose Box's default model or a supported model override using the exact Box API name.
  • Uses Inter for display text and Google's @material/web Material 3 components with Box blue theme tokens.
  • Uses a desktop-first, flat editorial workspace layout with a persistent suggestion panel and responsive fallback for smaller screens.
  • Lets the writer dismiss the suggestion or save a separate Markdown result to Box.
  • Offers an explicit choice to save a separate Markdown file or upload the draft as a new version of the source file.
  • Uses the official Box Node SDK v10 for file metadata, downloads, Box AI requests, and uploads.

Prerequisites

  • Node.js 18 or newer.
  • A Box developer token or another Box access token with access to the source file.
  • Box AI access enabled for the Box account/app. Box documents the prerequisite as a platform app with the AI scope; see Box AI tutorials.

Run it

# Box AI reference: https://developer.box.com/guides/box-ai/ai-tutorials/ask-questions
cp .env.example .env
# Edit .env and set BOX_ACCESS_TOKEN and BOX_FILE_ID.
npm install
npm start

Open http://localhost:3000 and edit the draft. Do not open public/index.html directly, because the Box document metadata is loaded by the local API server. Stop typing for five seconds to trigger the partner.

The server uses the official box-node-sdk package with a developer token in this deliberately small demo. For production, use OAuth or JWT authentication and a managed secret store.

The model selector uses Box AI's ai_agent override with the basic_text.model field. It includes the current API names from Box's supported AI models, including openai__gpt_5_6_sol. Model availability can vary by Box plan or administrator configuration; if a selected model is unavailable, choose “Box default.”

The UI uses the buildless CDN pattern from Material Web: @material/web/all.js is loaded through esm.run, and Material 3 design tokens are set in the page with Box blue as the primary color. This keeps the blog sample free of a build step; a production app should pin and bundle the dependency.

Verification

npm run check
curl http://localhost:3000/api/file

The first command checks the server syntax. The second performs a read-only Box metadata lookup using BOX_FILE_ID. After the UI's “Save as new Box file” action, verify the new Markdown file in the configured Box account.

Blog-post explanation

The implementation maps the paper's design to Box like this:

Paper concept MVP implementation
Partner role Three hard-coded partner presets in server.js
Event trigger Five-second browser inactivity timer
Frequency control Client-side throttle: every pause, every second pause, or once per minute
Model control Box AI ai_agent_ask.basic_text.model override using Box API names
Contextual heuristic Partner-specific instruction sent to Box AI
Lightweight representation Right-side suggestion card
Graduated engagement Dismiss, save a separate suggestion file, or explicitly save a new source version
Document context Markdown file loaded from Box and supplied to POST /2.0/ai/ask

The app intentionally leaves out webhooks, a database, automatic edits, and a full Box file picker. Those are useful follow-ups, but they obscure the core idea in a first tutorial.

Relevant Box documentation

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages