Skip to content

Chore: dependency, API updates. - #11

Merged
ryan-roemer merged 11 commits into
mainfrom
chore/updates
Aug 5, 2026
Merged

ryan-roemer merged 11 commits into
mainfrom
chore/updates

Conversation

@ryan-roemer

@ryan-roemer ryan-roemer commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Updates CDN/imported dependencies and adapts the app’s WebMCP + Prompt API integration to Chrome’s “one constrained prompt per session” limitation by rebuilding sessions per iteration and replaying conversation history.

Changes:

  • Bumps browser-imported libraries (React, Marked, @mcp-b/*) and dev tooling (eslint/prettier), plus adds a dependency check script.
  • Introduces getModelContext() and updates WebMCP detection/registration paths; updates iframe permissions policy delegation for tools.
  • Refactors agent/tool loops to create a fresh tool-aware Prompt API session per iteration and on retry, replaying prior history.

Chrome's Prompt API allows at most one responseConstraint prompt per session; a second always rejects with kErrorUnknown, well below any context limit. clone() inherits the state and append() doesn't help. This broke every tool loop at iteration 2.

- runToolLoop takes a createIterationSession(history) factory and runs each iteration on a fresh session, replaying history via initialPrompts
- promptSessionConstrainedWithRetry retries on a new session instead of re-prompting the exhausted one (same latent bug on the timeout path)
- slimToolResult: chunk.text is an array, so slice() capped chunk count instead of characters and excerpts were never truncated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates CDN/imported dependencies and adapts the app’s WebMCP + Prompt API integration to Chrome’s “one constrained prompt per session” limitation by rebuilding sessions per iteration and replaying conversation history.

Changes:

  • Bumps browser-imported libraries (React, Marked, @mcp-b/*) and dev tooling (eslint/prettier), plus adds a dependency check script.
  • Introduces getModelContext() and updates WebMCP detection/registration paths; updates iframe permissions policy delegation for tools.
  • Refactors agent/tool loops to create a fresh tool-aware Prompt API session per iteration and on retry, replaying prior history.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
public/index.html Updates import-map/CDN versions for React/Marked/@MCP-B and relay embed script.
public/app/util/platform.js Adds getModelContext() and uses it for WebMCP detection.
public/app/index.js Switches platform status import to ./util/platform.js.
public/app/bridge/tool-registry.js Uses getModelContext() and awaits local tool registration.
public/app/bridge/iframe-bridge.js Delegates "tools" permission policy to the iframe for local dev cross-origin.
public/app/agents/tool-loop.js Changes tool loop to accept a session factory; manages per-iteration session lifecycle + history replay.
public/app/agents/prompt-api.js Extends tool session creation to accept replayable history; retries constrained prompts on a fresh session.
public/app/agents/agent-loop.js Updates agent loop to pass a per-iteration session factory to runToolLoop; improves excerpt truncation logic.
package.json Adds dep:check script; bumps eslint/prettier versions.
package-lock.json Lockfile updates consistent with dependency/tooling changes.
.gitignore Ignores .claude/settings*.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/app/bridge/tool-registry.js Outdated
Comment thread public/app/agents/prompt-api.js
Comment thread public/app/agents/tool-loop.js Outdated
@ryan-roemer
ryan-roemer merged commit dd67bad into main Aug 5, 2026
1 check passed
@ryan-roemer
ryan-roemer deleted the chore/updates branch August 5, 2026 17:15
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.

2 participants