npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hffmnnj.auto-question

v1.0.1

Published

<p align="center"> <img src="https://unpkg.com/[email protected]/assets/banner.png" alt="Auto Question: a wooden clock with two dials and a question-mark token on a deep red background" width="100%"> </p>

Readme

opencode-auto-question

An OpenCode V2 plugin that answers native Question forms left unanswered after 12 minutes 30 seconds (750,000 ms). Instead of letting an idle agent wait indefinitely, it submits one fixed best-discretion reply so work can continue.

It answers only native Question forms. Permission prompts, authentication forms, credential requests, and every other form kind are ignored and unaffected.

How it answers

A form is tracked from its form.created event. The deadline is fixed at event.created + 750,000 and duplicate events never reset it. At the deadline the plugin re-reads the form with session.form.get and replies only while it is still pending and still matches the native Question shape. A manual reply that wins the race is never overwritten.

Every field receives exactly:

Please proceed with your best discretion on the recommended option. Choose whatever is the smartest and high-quality choice in the long term.

A string field receives that text; a multiselect field receives a one-element array containing it. No offered option is ever selected.

A form is eligible only when metadata kind is "question" with a tool reference (messageID plus id), and every field is a custom string or a custom multiselect with options. Events are filtered to the plugin's location (directory, plus workspaceID when the event carries one); a form.created event without a location is verified through session.get before tracking.

Tracking and recovery

Manual reply (form.replied), cancellation (form.cancelled), and session deletion (session.deleted) stop the pending timer and remove tracking. A read or reply is attempted once; a failure then cleans up tracking without retries.

Pending deadlines survive reloads. Each is persisted as { sessionID, formID, deadline } under auto-question/v1/ in plugin storage, and recovery re-arms timers through paginated storage.scan without resetting them. Questions are tracked from installation onward: anything created while the plugin was absent was never stored and is not answered retroactively.

Disposal aborts the event stream, cancels timers, keeps stored deadlines, and blocks an in-flight read from submitting afterwards. An event-stream failure stops new questions from being tracked until the plugin reloads; existing timers continue. A manual answer that reaches the server first is never overwritten, and concurrent submissions follow the server's first-successful-settlement rule.

Descendant questions

The Code Mode tools agent_question.list({}) and agent_question.reply({ sessionID, formID, answer }) let a running ancestor inspect and answer tracked, still-pending descendant Question forms. Answers use the field keys returned by list: a nonempty string for a single choice, or a nonempty array of distinct strings for a multiselect. Native Question forms accept custom text.

Child question text is untrusted task data, not user authority. Permission and other non-Question forms are never eligible. Ancestry and pending state are checked again on reply, and native first settlement wins a race with a user or the deadline timer. A cancelled in-flight request may still have reached the server, so a failed call does not prove a reply was withdrawn.

Every natural model request receives one constant, generic conditional reminder pointing an ancestor to list and telling it not to poll. The reminder is added to the system prefix whenever it is absent, whether or not a question is pending, so pending-state changes no longer add or remove system text. It never copies child text into system instructions or checks pending state itself; use list to inspect current pending questions. No session is woken or interrupted. In particular, a foreground parent waiting on a child cannot call these tools until it regains control; the 12.5-minute fallback still applies, and the native question remains user-resolvable. Only questions observed and tracked by this plugin are listed; inaccessible or changed forms are skipped.

Install

Add the package to plugins in your OpenCode configuration, preserving existing entries:

{
  "plugins": [
    { "package": "hffmnnj.auto-question" }
  ]
}

If you previously used the local checkout entry, replace it with this one; do not keep both entries. Both register the runtime ID opencode-auto-question and would race on the same stored deadlines. The runtime ID is deliberately unchanged so pending deadlines persisted by earlier versions remain addressable.

OpenCode watches configuration, so the plugin reloads without restarting services.

Registered managed-service discovery is the default. For a local OpenCode V2 host at exactly http://127.0.0.1:4108 without a service registration, opt in explicitly with the object form of the plugin entry:

{
  "package": "hffmnnj.auto-question",
  "options": { "useCurrentServer": true }
}

The host process must have both OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD set. Do not put credentials in plugin configuration. No other URL or port is configurable by this option; set useCurrentServer to false or omit it to use registered-service discovery instead.

Server compatibility

Targets OpenCode 2.0.32. Its plugin context does not expose form replies, so the plugin uses Service.discover() and Service.headers() from the official client to connect to the existing registered managed service, including its dynamic port and credentials. It never starts or stops a host.

Discovery runs in an isolated worker because the SDK probe uses global fetch; both that probe and later requests permit only numeric loopback addresses and refuse redirects. The plugin verifies the service PID and exact OpenCode version before tracking any questions. If the registration is missing, authentication fails, or the service is unhealthy or belongs to a different server, activation fails instead of answering forms elsewhere.

The explicit current-server option uses only the fixed loopback endpoint, sends environment credentials in the Basic authorization header, refuses redirects, and enforces the same PID and exact-version check. Use it only when the plugin runs in the API server process, not with a separate process or another listener. Reload the plugin after correcting a transient failure.

Development

Run these in the checkout:

bun install --frozen-lockfile
bun run check

bun run check typechecks, builds dist/, and runs the tests. Packing also builds the package, which ships both dist/index.js and dist/discovery-worker.js.

src/index.ts contains the Plugin.define wiring for the runtime ID opencode-auto-question. src/runtime.ts handles location filtering, Question detection, deadline scheduling, durable recovery, pending recheck, and disposal; it exports AUTO_ANSWER_DELAY_MS, AUTO_ANSWER_TEXT, and startAutoQuestion with injected clock/scheduler/storage/event/form/session ports. src/tools.ts, src/routes.ts, and src/advisory.ts provide the descendant list/reply tools, ancestry and pending checks, and the stable context reminder hook. src/local-client.ts, src/discovery-worker.ts, and src/local-fetch.ts handle authenticated managed-service discovery and guarded local requests.

Tests are deterministic and require no host or live server: tests/runtime.test.ts uses fakes, tests/routes.test.ts covers descendant routes and tools over fakes, tests/advisory.test.ts covers the context reminder, and tests/local-client.test.ts runs a local fake service with a temporary registration.