Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ai/chatgpt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [1.2.1] - 2026-11-10

### Added

- Quota Insights: persistent counter observations, observed capacity lower bounds, last net increase and conditional recovery scenarios.
- Adjustable recovery horizon, +1 and +5 scenarios, and full-recovery scenarios when the API supplies capacity.
- Shared tutorial and platform documentation.

### Fixed

- Usage totals no longer fall back to configured allowances.
- Forecasts distinguish observed recovery from guaranteed refill mechanics.

## [1.2.0] - 2026-11-10

### Changed
Expand Down Expand Up @@ -94,3 +107,4 @@
[1.1.1]: https://github.com/thenolle/userscripts/releases/tag/better-chatgpt-v1.1.1
[1.1.2]: https://github.com/thenolle/userscripts/releases/tag/better-chatgpt-v1.1.2
[1.2.0]: https://github.com/thenolle/userscripts/releases/tag/better-chatgpt-v1.2.0
[1.2.1]: https://github.com/thenolle/userscripts/releases/tag/better-chatgpt-v1.2.1
37 changes: 19 additions & 18 deletions ai/chatgpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@ Updates arrive automatically. The script also checks on its own and offers to up

## Features

| Feature | What you get |
| ----------------- | ------------------------------------------------------------------------------------------------------------------ |
| Usage Status | Remaining counts reported by ChatGPT, your plan, and low/empty alerts; totals and reset schedules are not inferred |
| Code Blocks V2 | Language badges, syntax colours, line numbers, wrap, fold, download, indentation-safe copy |
| Message Splitter | Paste any amount of text; split into parts or attach as a file only when needed |
| Prompt Library | Your prompts plus community prompts, with a form for placeholders |
| Batch Runner | Run one template over a list, with pause, resume and reload recovery |
| Selection Toolbar | Ask, explain, summarize, fact-check or quote highlighted text |
| Exporter | Markdown, text, Word, PDF and JSON |
| Draft Guard | Drafts survive reloads; size meter; warning before closing with unsent text |
| Command Palette | Search every action |
| Enter as Newline | Enter adds a line, a shortcut sends |
| Message Queue | Queue follow-ups while an answer generates; they send one by one |
| Recall | Search everything you sent and reuse it |
| Tutorial | Guided tours of every feature, started from the “?” button in the header |
| Max Width | Full-width conversations, optional sidebar removal |
| Update Checker | Checks on load and every few minutes, tells you once per version |
| Context Packs | Save sourced excerpts from conversations and assemble a previewable briefing for your next task |
| Feature | What you get |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Usage Status | Remaining counts reported by ChatGPT, your plan, and low/empty alerts; totals and reset schedules are not inferred |
| Quota Insights | Persistent counter observations, observed capacity lower bounds, last net increase, and conditional recovery scenarios |
| Code Blocks V2 | Language badges, syntax colours, line numbers, wrap, fold, download, indentation-safe copy |
| Message Splitter | Paste any amount of text; split into parts or attach as a file only when needed |
| Prompt Library | Your prompts plus community prompts, with a form for placeholders |
| Batch Runner | Run one template over a list, with pause, resume and reload recovery |
| Selection Toolbar | Ask, explain, summarize, fact-check or quote highlighted text |
| Exporter | Markdown, text, Word, PDF and JSON |
| Draft Guard | Drafts survive reloads; size meter; warning before closing with unsent text |
| Command Palette | Search every action |
| Enter as Newline | Enter adds a line, a shortcut sends |
| Message Queue | Queue follow-ups while an answer generates; they send one by one |
| Recall | Search everything you sent and reuse it |
| Tutorial | Guided tours of every feature, started from the “?” button in the header |
| Max Width | Full-width conversations, optional sidebar removal |
| Update Checker | Checks on load and every few minutes, tells you once per version |
| Context Packs | Save sourced excerpts from conversations and assemble a previewable briefing for your next task |

## Shortcuts

Expand Down
48 changes: 48 additions & 0 deletions ai/chatgpt/docs/quota-insights.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Quota insights
description: Capacity evidence, observed recovery and conditional forecasts.
section: Guides
order: 25
---

# Quota insights

Open Settings → Quota Insights → Open Quota Insights, or find it in the command palette.

## What is recorded

The feature stores remaining counts, observation times, explicit API caps and reported reset timestamps. It does not store conversation text.

History is limited to 30 days and 2,000 observations per counter.

## Maximum allowance

An observed peak means capacity is at least that large. A plateau does not prove the maximum.

Full-recovery scenarios require an explicit API cap. A reported reset timestamp alone does not establish the refill amount.

## Recovery calculations

Positive changes are observed net recovery. Additional spending between observations can hide refill.

The engine calculates an observed net recovery rate across comparable intervals. It excludes gaps longer than five minutes and intervals known to be cap-bound.

Rate scenarios require 30 minutes of comparable observations, at least three positive intervals and a recent observation.

## Forecasts

The panel can show conditional +1, +5, full recovery and recovery within a selected number of minutes.

These scenarios assume the observed net recovery rate continues and no additional units are spent. They are not guaranteed refill schedules or calibrated confidence intervals.

Rolling-window recovery and batch resets can behave differently. The existing Perplexity rolling estimator remains separate.

## Privacy and account changes

Saved observations are local to each userscript.

Perplexity uses its existing account/tier namespace. ChatGPT currently partitions by reported plan, not a verified account id. Do not mix accounts in the same userscript storage when evaluating its history.

## Tutorial

The Help menu includes a Quota insights walkthrough explaining observations, lower bounds and projections.
2 changes: 1 addition & 1 deletion ai/chatgpt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nolly/ai-chatgpt",
"version": "1.2.0",
"version": "1.2.1",
"private": true,
"type": "module",
"license": "PolyForm-Strict-1.0.0",
Expand Down
138 changes: 70 additions & 68 deletions ai/chatgpt/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import {
BatchRunnerFeature,
CodeBlocksFeature,
CommandPaletteFeature,
ContextPacksFeature,
DraftGuardFeature,
EnterAsNewlineFeature,
ExporterFeature,
MaxWidthFeature,
MessageSplitterFeature,
PromptLibraryFeature,
PromptQueueFeature,
RecallFeature,
SelectionToolbarFeature,
TutorialFeature,
UpdatesFeature,
configurePlatform,
configureUi
BatchRunnerFeature,
CodeBlocksFeature,
CommandPaletteFeature,
ContextPacksFeature,
DraftGuardFeature,
EnterAsNewlineFeature,
ExporterFeature,
MaxWidthFeature,
MessageSplitterFeature,
PromptLibraryFeature,
PromptQueueFeature,
RecallFeature,
SelectionToolbarFeature,
TutorialFeature,
UpdatesFeature,
configurePlatform,
configureUi,
QuotaInsightsFeature
} from '@nolly/ai'
import { App } from './app'
import { fileBudget } from './budget'
Expand All @@ -38,60 +39,61 @@ import { installTheme } from './theme'
import { tutorialSource } from './tutorial-source'

const onSend = (listener: () => void): (() => void) =>
session.subscribe((event) => {
if (event === 'generation-start') listener()
})
session.subscribe((event) => {
if (event === 'generation-start') listener()
})

whenReady(() => {
configureUi({
id: 'better-chatgpt',
title: 'Better ChatGPT',
version: __VERSION__,
marker: uiMarker,
composerActions: () => ({ first: findAttachButton(), submit: findPrimaryAction()?.element ?? null })
})
configureUi({
id: 'better-chatgpt',
title: 'Better ChatGPT',
version: __VERSION__,
marker: uiMarker,
composerActions: () => ({ first: findAttachButton(), submit: findPrimaryAction()?.element ?? null })
})

configurePlatform({
id: 'better-chatgpt',
storage,
logger,
composer: composerKit,
generation: generationKit,
sendPrompt,
onSend,
threadOf,
promptsUrl: URLS.prompts,
exporter: exportSource,
release: { name: 'Better ChatGPT', slug: SLUG, version: __VERSION__, metaUrl: URLS.meta, installUrl: URLS.install, releasesUrl: URLS.releases },
tutorial: tutorialSource,
codeBlockRoot: (pre) => pre.closest<HTMLElement>('[data-chatgpt-copy-code]') ?? pre.closest<HTMLElement>('[data-code-block]'),
rejectEditable,
send: (editable) => void composerKit.sendComposer(editable),
splitterDefaults: SPLITTER_DEFAULTS,
attachBlocked: () => (fileBudget(session).remainingUploads === 0 ? 'No file uploads left until your limit resets.' : null),
scroller: findScroller
})
configurePlatform({
id: 'better-chatgpt',
storage,
logger,
composer: composerKit,
generation: generationKit,
sendPrompt,
onSend,
threadOf,
promptsUrl: URLS.prompts,
exporter: exportSource,
release: { name: 'Better ChatGPT', slug: SLUG, version: __VERSION__, metaUrl: URLS.meta, installUrl: URLS.install, releasesUrl: URLS.releases },
tutorial: tutorialSource,
codeBlockRoot: (pre) => pre.closest<HTMLElement>('[data-chatgpt-copy-code]') ?? pre.closest<HTMLElement>('[data-code-block]'),
rejectEditable,
send: (editable) => void composerKit.sendComposer(editable),
splitterDefaults: SPLITTER_DEFAULTS,
attachBlocked: () => (fileBudget(session).remainingUploads === 0 ? 'No file uploads left until your limit resets.' : null),
scroller: findScroller
})

installTheme()
installTheme()

new App()
.register((context) => new HeaderButtonFeature(context))
.register((context) => new PromptLibraryFeature(context))
.register((context) => new SelectionToolbarFeature(context))
.register((context) => new MaxWidthFeature(context, { storage, sidebar: { rule: { id: 'left-sidebar', selector: 'aside' }, label: 'Left Sidebar', defaultRemoved: false } }))
.register((context) => new CodeBlocksFeature(context))
.register((context) => new EnterAsNewlineFeature(context))
.register((context) => new MessageSplitterFeature(context))
.register((context) => new BatchRunnerFeature(context))
.register((context) => new DraftGuardFeature(context))
.register((context) => new CommandPaletteFeature(context))
.register((context) => new PromptQueueFeature(context))
.register((context) => new RecallFeature(context))
.register((context) => new ContextPacksFeature(context))
.register((context) => new ExporterFeature(context))
.register((context) => new UpdatesFeature(context))
.register((context) => new UsageFeature(context))
.register((context) => new TutorialFeature(context))
.register((context) => new DiagnosticsFeature(context))
.start()
new App()
.register((context) => new HeaderButtonFeature(context))
.register((context) => new PromptLibraryFeature(context))
.register((context) => new SelectionToolbarFeature(context))
.register((context) => new MaxWidthFeature(context, { storage, sidebar: { rule: { id: 'left-sidebar', selector: 'aside' }, label: 'Left Sidebar', defaultRemoved: false } }))
.register((context) => new CodeBlocksFeature(context))
.register((context) => new EnterAsNewlineFeature(context))
.register((context) => new MessageSplitterFeature(context))
.register((context) => new BatchRunnerFeature(context))
.register((context) => new DraftGuardFeature(context))
.register((context) => new CommandPaletteFeature(context))
.register((context) => new PromptQueueFeature(context))
.register((context) => new RecallFeature(context))
.register((context) => new ContextPacksFeature(context))
.register((context) => new ExporterFeature(context))
.register((context) => new UpdatesFeature(context))
.register((context) => new UsageFeature(context))
.register((context) => new QuotaInsightsFeature(context))
.register((context) => new TutorialFeature(context))
.register((context) => new DiagnosticsFeature(context))
.start()
})
10 changes: 9 additions & 1 deletion ai/chatgpt/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { parseFileLimitMb, parseJson, parseLimits, parseUsage } from './payloads
import type { LimitProgress, UsageSnapshot } from './payloads'
import { interpret } from './stream'
import type { ChatEvent } from './stream'
import { QuotaLedger } from '@nolly/ai'
import { storage } from './storage'

export type SessionEvent = 'generation-start' | 'generation-end' | 'conversation' | 'model' | 'limits' | 'usage' | 'plan' | 'user-message'

Expand All @@ -20,6 +22,7 @@ export class ChatSession {

private readonly limitMap = new Map<string, LimitProgress>()
private readonly listeners = new Set<(event: SessionEvent) => void>()
private readonly quotaLedger = new QuotaLedger(storage)
private parser = new SseParser()

constructor(spy: ResponseSpy) {
Expand Down Expand Up @@ -61,7 +64,12 @@ export class ChatSession {
}

private mergeLimits(limits: readonly LimitProgress[]): void {
for (const limit of limits) this.limitMap.set(limit.feature, limit)
const now = Date.now()
for (const limit of limits) {
this.limitMap.set(limit.feature, limit)
const resetAt = limit.resetAfter ? Date.parse(limit.resetAfter) : Number.NaN
this.quotaLedger.observe(`chatgpt:${this.plan ?? 'unidentified'}`, limit.feature, limit.feature.replace(/_/g, ' '), limit.remaining, null, Number.isFinite(resetAt) ? resetAt : null, now)
}
this.emit('limits')
}

Expand Down
4 changes: 2 additions & 2 deletions ai/chatgpt/src/tours.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createPdfTour } from '@nolly/ai'
import { createPdfTour, createQuotaTour } from '@nolly/ai'
import { contextPacksTour, loadPromptShortcut, loadShortcut, tour } from '@nolly/ai'
import type { Tour } from '@nolly/ai'
import { composerKit } from './kit'
Expand Down Expand Up @@ -146,4 +146,4 @@ const contextPacks: Tour = {
}
}

export const TOURS: readonly Tour[] = [gettingStarted, usage, longMessages, prompts, batch, codeBlocks, exporting, selection, palette, contextPacks, createPdfTour()]
export const TOURS: readonly Tour[] = [gettingStarted, usage, longMessages, prompts, batch, codeBlocks, exporting, selection, palette, contextPacks, createPdfTour(), createQuotaTour()]
14 changes: 14 additions & 0 deletions ai/perplexity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to Better Perplexity are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).

## [1.2.1] - 2026-11-10

### Added

- Quota Insights: persistent counter observations, observed capacity lower bounds, last net increase and conditional recovery scenarios.
- Adjustable recovery horizon, +1 and +5 scenarios, and full-recovery scenarios when the API supplies capacity.
- Shared tutorial and platform documentation.

### Fixed

- Usage totals no longer fall back to configured allowances.
- Forecasts distinguish observed recovery from guaranteed refill mechanics.

## [1.2.0] - 2026-11-10

### Changed
Expand Down Expand Up @@ -186,3 +199,4 @@ First public release.
[1.1.1]: https://github.com/thenolle/userscripts/releases/tag/better-perplexity-v1.1.1
[1.1.2]: https://github.com/thenolle/userscripts/releases/tag/better-perplexity-v1.1.2
[1.2.0]: https://github.com/thenolle/userscripts/releases/tag/better-perplexity-v1.2.0
[1.2.1]: https://github.com/thenolle/userscripts/releases/tag/better-perplexity-v1.2.1
1 change: 1 addition & 0 deletions ai/perplexity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Updates arrive automatically. The script also checks on its own and offers to up
| Feature | What you get |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Usage status | Reported remaining counts per mode in the header, hover summary and details dialog; totals and reset schedules are not invented |
| Quota Insights | Persistent counter observations, observed capacity lower bounds, last net increase and conditional recovery scenarios |
| Code Blocks V2 | Language badges, syntax colours, line numbers, wrap, fold, download, indentation-safe selection copy |
| Big messages | Paste any amount of text; split into parts or attach as a file only when needed |
| Prompt library | Your prompts plus community prompts, with a form for placeholders |
Expand Down
Loading
Loading