mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-23 14:17:06 +00:00
9b64d44d5fa45fa6f9911cc10d6e358b4fbdaeb3
7540
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9b64d44d5f |
Update CODEOWNERS file (#4645)
Pretty self-explanatory. Could broaden responsibility and review processes... |
||
|
|
9ca1acf634 |
Benchmarks that gate PRs on I/O regressions, wider test baseline, and npm run check (#4644)
* feat(bench): backend benchmarks that fail a PR for waterfalled or uncached I/O A scenario runs a request against the in-memory backend and records every SQL, key-value, Redis and object-storage round trip on a modeled clock, then reports round trips per destination, serial stages and modeled latency. tools/bench.mjs runs the scenarios on a base commit and on the head and fails on a regression the pull request description does not accept; benchmarks.yaml runs that on every pull request. Also adds npm run check (lint, type check, related tests and the benchmark comparison for the files a branch changed) and describes the distributed deployment in AGENTS.md. * test(bench): scenarios for fs, kv, auth, apps, permissions, sharing and hosted sites * test(puter-js): count the SDK unit tests in the coverage report Only the bundle the API runners load was instrumented, so the unit tests next to the SDK source never counted. In coverage mode the vitest config now instruments SDK source for them and writes one shard per test file. * test(puter-js): unit tests for ui messaging, dialogs, components, uploads, peer and smaller modules * test(backend): cover fs, permission, app, worker, sharing, broadcast and user edge cases * fix(backend): fs write flags are stored as booleans, app stats weeks are ISO weeks - A write's boolean flags reach the store only once read as booleans; any positive number reads as true. - App open stats grouped by week use ISO 8601 weeks for both the buckets and their labels on every database engine, so the two agree across a year boundary. * fix(puter-js): dialog token source, legacy upload cancel, submenu state, typed-array views - The sign-in dialog takes the token only from the popup it opened, and stops listening when it leaves the page. - Cancelling a legacy upload rejects with `upload_aborted` and no longer runs the `error` callback. - A context menu's submenu stays in step with its parent when the parent item is pressed or the submenu closes itself. - The FileReader polyfill reads a typed-array view through its own offset and length. * ci(bench): benchmark a pull request as merged into its base The comparison ran the branch's own head against the tip of the base branch, so a branch behind its base was charged for (or credited with) what the base gained since. The head side is now the merge commit and the base side its first parent. Shards also get a 15 minute timeout. * test(broadcast): shutdown drain tests send boot's own events first Boot queues cache updates that flush 10 ms later. A test body that started after that flush counted it as its own request, which failed 'bounds a hung flush in onServerShutdown' on a slow runner. |
||
|
|
679f577cd8 |
feat(ai): a declined Claude request reruns on a fallback chain, and its conversation stays on the model that answered (#4641)
* Rerun declined Claude requests on Anthropic's fallback model A Claude model with safety classifiers can decline a request and end it with stop_reason "refusal". Requests to the models that have server-side fallback (Fable 5.2, 5.1 and 5, Opus 5.5 and 5, Sonnet 5.5) now carry `fallbacks: "default"` and the server-side-fallback beta, so Anthropic reruns a declined request on the model it recommends for that refusal and the caller gets that model's answer in the same response. - `refusalFallback: false` turns it off for a request. The Anthropic route takes the native `fallbacks` field instead: "default" or a list of models is the caller's own chain, null turns it off. - The `fallback` content block is a `refusal_fallback` chunk in a stream and `refusalFallbacks` on a non-streaming result, where it is taken out of `message.content`. The Anthropic route writes it back as a native block and accepts it in replayed messages. - `usageDetails.fallbackModel` names the model that answered. - A final refusal is forwarded as before, without the fallback-credit fields of `stop_details`. - A request Anthropic rejects over a fallback the caller did not ask for is sent again without it. * Meter each Claude fallback attempt on the model that ran it A request Anthropic reruns on a fallback model is several attempts, each billed at its own model's rates. `usage.iterations` carries one entry per attempt and the top-level counts describe only the attempt that answered. - Every attempt is its own charge, priced at the rates of the model that ran it and recorded under that model's key: the answer from the top-level counts, each declined attempt from its iteration entry. Nothing is counted twice, and a fast request's attempts are priced at each model's fast rates. - The reported `usage` keeps the answering attempt under the plain keys and adds a declined attempt's tokens under `declined_` keys. Like the advisor's, only their recorded cost prices them, and they are no part of the request's own prompt or output totals. - A provider's `requestPricing` can name the models the upstream may rerun the request on. The credit gate then prices the prompt and the capped output once per model, each at its own rates and cost factor, for the affordability check, the output cap and the hold. Claude names the priciest target of default routing, or every model of a chain the caller named. * Charge a declined Claude request only when Anthropic bills it Anthropic bills a request its classifiers decline before any output only in the bio, frontier_llm and reasoning_extraction categories; any other category, or none, is not billed. A request declined after it produced output is billed for its prompt and that output. Metering follows the same rule for each attempt: the final refusal by its `stop_details.category`, and an attempt that declined before a fallback by the `trigger.category` of its `fallback` block. An attempt Anthropic does not bill is recorded with its token counts at no cost. An attempt whose refusal details are missing is charged as before. * Estimate images inside tool results as attachments The credit gate's prompt estimate read a `tool_result` as the text of its serialized content, so a base64 image inside one counted as text, at many times the tokens the image costs. An image or document block inside a tool result is now estimated the way a top-level one is, from its payload size. Text and other blocks in the result are counted as before. * Name each Claude model's fallback chain, and keep a declined conversation on the model that answered A request to a Claude model with fallback targets names them in order (Opus 5, then Opus 4.8) instead of asking for default routing, which leaves some refusal categories declined. puter.js remembers the model that answered a declined turn and names it on later turns of the same conversation, so they skip the declined attempt. The backend runs such a request on that model and presents it in the requested model's response format. * Rerun a declined Claude request from the driver, one attempt at a time A request a Claude model declines is now rerun by the chat driver on the model's fallback models, instead of by Anthropic inside the same API call. The request sent upstream is the same as before this branch: no `fallbacks` field and no extra beta header. Each rerun is a whole attempt of its own. It goes through the credit gate against the balance left after the declined attempt, takes its own hold once the declined attempt's hold is released, and is metered by the provider under its own model. A request reserves one attempt at a time, as any other chat request does. When the balance can't cover the rerun, or the rerun fails, the response is the refusal. A non-streamed request is rerun on any refusal. A streamed request is rerun only when it was declined before any output, and the answer follows a `refusal_fallback` chunk on the same stream. The response reports the model that answered in `usageDetails.fallbackModel`, each switch in `refusalFallbacks`, the declined attempts' tokens under `declined_` usage keys, and the total charged in `usage.cost`. It keeps the requested model's format. A conversation pinned to a fallback model that declines continues down the rest of the requested model's fallback models. The Anthropic route reads `fallbacks: null` or `false` as an opt-out and ignores any other value. Claude restores `puter_path` parts after a refusal, so a rerun uploads the files again. |
||
|
|
04b9244913 |
feat(workers): a suspended account's workers stop serving until the suspension lifts (#4649)
Suspending an account already made its hosted sites answer 404, but its deployed worker scripts kept running. - On `user.suspended` the worker driver removes each of the owner's deployed scripts and keeps the rows. On `user.unsuspended` it deploys them again from their source files, without the per-worker notification. The local runtime needs no redeploy: it builds a worker from source on its next request. - Hot reload skips a suspended owner, so a write by someone the source file is shared with does not bring the script back. - The local worker runtime answers 404 for a suspended owner's worker instead of deploying it on demand. |
||
|
|
bc456982e9 |
feat(metering): events for an actor's balance and for a refusal a listener can make good (#4643)
* feat(metering): report an actor's balance each time it is worked out `metering.balance` carries what an actor on a metered plan has left to spend and the plan it was worked out under. It is emitted when usage settles and when a credit gate re-reads the balance, so an extension can act on a low balance without reading it itself. The balance a settling batch reports now counts the purchased credit that batch drew, so the credit gate and the exhausted notice follow the batch that spends the last of it instead of the one after. A batch that settles right after a credits change still reports the credit as read, since that read may predate the change. `MeteringService.isUnmetered` is public, for callers that need to tell a plan with nothing to run out of from one that has run out. * feat(metering): let a listener top an actor up at the moment of refusal `metering.out-of-credits` is emitted, and waited on, when an actor is about to be refused for lack of credit. A listener that adds credit sets `refilled`, and the refused work is tried once more instead of failing. It is asked from the three places a refusal is decided: the credit gate on routes, the shared credit reservation the AI drivers use, and the chat driver's own gate. Each tries again once, after the listener answers, and refuses as before when nothing was added. * fix(metering): count a flush's write once in a read with no cached base An increment for a counter with no cached base read the store after its buffer snapshot with nothing ordering the two, so a flush landing in between was counted from both, and that store read was then kept as the base. It now reads the store the way other reads do, starting from the increment's own snapshot. A write that has reached the store but is not yet applied to the buffer looks the same from the buffer as one still on its way. `kv.get` can now answer with the last fence token a writer applied to a key, and a read counts such a write's amounts from one side only. A read that sees a write sent between its snapshots is retried. A base is laid from a store read only if no write was out when it was read and none has been sent since. |
||
|
|
1b5e588241 |
Bring back the dashboard's Open Desktop card, pointed at desktop.puter.com (#4648)
The Home tab's Open Desktop card returns with its markup, styles and strings, and links to https://desktop.puter.com instead of /desktop. A plain click opens the desktop the way the Apps tab opens an app in its own tab: the launch params (app instance id, app id, Puter origin, API origin, locale) go in the URL, and the app token is handed to the tab through the opener rather than placed in the URL. The token is requested by origin, so fetchUserAppTokenForLaunch accepts an origin and returns the app uid the server resolved. Without a token the tab still opens at the plain URL. A modified click, or a refused tab, stays a plain link. |
||
|
|
e17783931f |
fix(ai): follow-ups to the AI driver stack: optional image type hint, stable fuzz cases, provider-only integration workflow (#4638)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* fix(ai): the image type hint only has to be a string when a request carries an input image * fix(ai): OpenAI speech to text answers 400 to a prompt that is a list or an object * test(ai): a fuzz case keeps its input and route when the catalog changes, and a suite that reaches no provider fails * fix(ai): a model id with a colon after its vendor keeps its name when it is qualified * fix(ai): the native Gemini request type accepts the xhigh effort Hydrogen takes * style: restore the repo formatting in files the AI stack reflowed * docs(ai): the image reference and quotas page cover Replicate's safety reruns * ci: the AI provider workflow runs only the provider tests and passes every provider's key |
||
|
|
1eed9659e2 |
Forward Claude inference speed from SDK chat options (#4627)
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
4d4b0b0990 |
Qualify published chat model names while preserving routing aliases (#4624)
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
651a303bb0 |
Point Mistral's floating Large aliases at Large 4, apply its GA price and cap its output (#4623)
* Point Mistral's floating Large aliases at Large 4 and apply its GA price Mistral made Large 4 generally available on 2026-11-05, moved `mistral-large-latest` to it, and deprecated Large 3 and Medium 3.5, which both retire on 2027-04-30. - `mistral-large-latest`, `mistral-large` and `mistralai/mistral-large-latest` resolve to `mistral-large-4`. They resolved to `mistral-large-2512`, which stays callable by its own id until Mistral retires it. - Large 4 uses Mistral's current rates: $0.70 input, $0.07 cached input and $2.10 output per million tokens, in place of the preview rates. It is marked open-weight. - The Large 3 and Medium 3.5 entries carry their retirement date. * Cap Mistral Large 4 output at the 262,144 tokens Mistral accepts The catalog listed `mistral-large-4` with a 1,000,000-token output limit, equal to its context window. Mistral rejects a request for more than 262,144 completion tokens, so a request that left `max_tokens` unset, or set it higher, failed with a 400 whenever the account's credit covered more than 262,144 output tokens. - `max_tokens` for `mistral-large-4` is 262,144. The context window stays at 1,000,000 tokens. - A test sends `mistral-large-4` and `mistral-large-latest` through the chat driver with ample credit and checks the cap that reaches Mistral. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
4ec125bbc6 |
Add Gemini 4 Carbon, Gemini 4 Hydrogen and Kling 4 video models (#4616)
* Add Gemini 4 Carbon and Kling 4 video models * Include Kling 4 models in the video driver catalog test * Document the Kling 4 prompt limit for non-English text Kling 4.0 and 4.0 Flash take 26,000 characters of English but 11,000 of other languages, with mixed text sharing the limit in proportion. The video page and the quotas page said 26,000 for every prompt. - txt2vid.md and rate-limits-and-quotas.md give both limits, the rule for mixed text, and the error each one returns. - Puter still rejects only a prompt over 26,000 characters. Kling enforces the lower limit, and its refusal reaches the caller as `upstream_bad_request` with nothing charged. A test covers that path. * Add Gemini 4 Hydrogen and cap unary Gemini 4 Carbon output Google released `gemini-4-hydrogen` on 2026-11-12. It uses the same native request shape as Carbon and Argon. - Hydrogen is served natively at $1.50 input, $7.50 output and $0.075 cached input per million tokens, with fast service at 1.8 times those rates. It accepts `low`, `medium`, `high` and `xhigh` reasoning effort, ignores temperature, and takes text and images. - A Carbon response that isn't streamed is capped at 32,768 output tokens, as Argon's already is, and the credit hold is sized to that cap. Google reports this limit for both models. The cap is now a field of the native model options instead of a check on Argon's id. - chat.md and rate-limits-and-quotas.md list Hydrogen's reasoning levels and limits and Carbon's unary cap. * Move the reasoning_effort model list out of the chat options table The `reasoning_effort` row in chat.md listed the models that read the option. Model-specific details belong under Model-specific features, which already gives each family's accepted values. - The row no longer names models. - The Gemini and Moonshot Kimi sections say that their other models ignore the option. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
f6139147fd |
Hold the AI concurrency slot until a detached chat completion settles (#4615)
A chat completion keeps running for up to 10 minutes after the caller hangs up, so the upstream can report usage. It now counts against the caller's concurrency cap for as long as the upstream runs, instead of until the response closes. - The chat driver registers its upstream run with the request's concurrency slot, so `/drivers/call` keeps the slot until the upstream is done. The cleanup after it does not hold the slot. - The route concurrency gate now uses the same CallSlot as `/drivers/call`: the slot is held until the response is done and the work the handler registered has settled. The OpenAI- and Anthropic-compatible chat routes register the completion, so a non-streaming call counts until the upstream answers too. - CallSlot moves to core/http, since the route gate below the controllers uses it. The context key is renamed keepConcurrencySlot. - rate-limits-and-quotas.md says a completion counts until the model finishes it, even after a disconnect. Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
2d12dcc99f |
Reorganize AI drivers and harden request handling (#4614)
* Move the AI drivers into drivers/ai
The seven drivers/ai-* folders and the AI-only helpers in drivers/util
become one tree:
drivers/ai/interfaces/<interface>/ the Puter-facing drivers
drivers/ai/providers/<vendor>/<interface>/ vendor adapters, catalogs, tests
drivers/ai/protocols/openaiCompatible/ the shared OpenAI wire protocol
drivers/ai/shared/ helpers several interfaces use
Files are moved and their relative imports rewritten; no implementation
changes. Driver names, aliases, interfaces, config keys, model ids and
usage keys are unchanged.
The chat catalog registration test scanned providers/*/ next to itself.
It now scans providers/*/chat/ and fails if the scan finds no catalog, so
a wrong directory can't pass it.
General helpers that non-AI code also uses stay in drivers/util: file
input, data URIs, upstream errors, stream piping, CRUD limits.
* Document the AI driver layout
doc/ai-drivers.md explains what interfaces, providers, protocols and
shared each own, the import rules between them, where a new file goes,
and the steps for adding a provider or an AI interface. It also lists
the three places that don't follow the layout yet.
doc/architecture.md and AGENTS.md link to it.
* Move catalogPrice into ai/shared
Chat providers and the Cloudflare and xAI image catalogs all parse vendor
prices with catalogPrice, so it lives in shared/ instead of the chat
interface's pricing helpers. The image catalogs no longer import from
the chat interface.
* Move the Textract and Mistral OCR calls into provider classes
OCRDriver held both vendors' clients, request building, response
normalizing and metering. That now lives in TextractOcrProvider
(providers/awsTextract/ocr) and MistralOcrProvider (providers/mistral/ocr),
both implementing IOcrProvider. The driver keeps the provider catalog,
model resolution, auth and credit gates, and input resolution.
The page estimate, document detection and credit hold both providers use
are in interfaces/ocr/common.ts.
No behavior change: same validation order, error messages, usage keys,
holds and charges.
* Move the ElevenLabs voice changer into a provider class
VoiceChangerDriver built the ElevenLabs request, measured the converted
audio and metered it, and imported the output formats from the ElevenLabs
text-to-speech provider. That code is now in providers/elevenlabs:
outputFormats.ts formats both speech interfaces use
speechToSpeech/ElevenLabsSpeechToSpeechProvider.ts
speechToSpeech/measuredOutput.ts WAV, Opus and byte-rate timing
speechToSpeech/costs.ts
The driver keeps provider resolution, test mode and the auth check. With
one provider it holds the class directly; there is no provider interface.
No behavior change: same validation order, error messages, usage keys,
holds and charges.
* Move the AI billing helpers the realtime relay uses below the driver layer
OpenAIRealtimeRelayService is a service, and it imported the cost factor,
the provider key reader and a transcription price from drivers/ai. Those
now live in src/backend/util, which both layers can import:
util/aiCostFactor.ts withAiCostFactor, withAiCreditHold and the
request cost helpers, unchanged
util/aiProviderKey.ts readProviderKey, cut from providerRegistry.ts
util/aiPrices.ts the gpt-transcribe per-second price, read by the
OpenAI speech-to-text cost table and the relay
withStreamedAiCharge returns a DriverStreamResult, so it stays in the
driver layer as drivers/ai/shared/streamedAiCharge.ts with its tests.
MeteringService is untouched. No prices or billing behavior change.
* Remove the aiUserIdentifier alias
shared/aiUserIdentifier.ts re-exported upstreamUserIdentifier under a
second name, and only its own test imported it. The alias is gone; its
tests, which cover truncation and actor shapes the other file didn't,
replace the four cases in upstreamIdentifier.test.ts.
* Move the AI test helpers into the AI tree
drivers/integrationTestUtil.ts held helpers for AI provider tests, but a
store test and the realtime relay test imported from it too.
drivers/ai/shared/integrationTestUtil.ts the provider test helpers
testEnv.ts optionalEnv and skipUnlessEnv,
for any env-gated suite
testUtil.ts withAiCostFactorHook, next to
the server it hooks
No test under services/ or stores/ imports from the driver layer's AI
code now. The typecheck baseline entry for the moved file is renamed, not
regenerated.
* Split the tool and compaction helpers by dialect
FunctionCalling.js and compaction.js each held Puter-facing parsing next
to OpenAI and Anthropic request shapes. Each dialect now owns its mapping:
interfaces/chat/utils normalize_tools_object, readCompaction and the
other dialect-neutral checks
protocols/openaiCompatible/openaiParams.ts
toolsToWire (was make_openai_tools) and
toOpenAiContextManagement
providers/claude/chat/contextManagement.ts
toAnthropicContextManagement
toolsToWire takes the dialect as its second argument, like the other
mappers in that module, and takes an array; every caller already guarded
the empty case.
make_claude_tools is removed. Nothing but its tests called it: the Claude
provider uses claudeToolPolicy directly. The three cases only those tests
had are added to the claudeToolPolicy tests. The chat interface helpers no
longer import from providers/claude.
* Remove the unused ImageProvider base class
Every image provider implements IImageProvider directly; nothing extended
or imported the abstract class in interfaces/image/ImageProvider.ts.
The guide's import rules now say that only an interface's driver file
imports providers, which holds since the tool helpers stopped importing
the Claude policy.
* Rerun Replicate predictions an output safety checker rejects
Some community models check the generated image and fail the
prediction with "Try running it again" for a share of seeds, whatever
the prompt. adirik/realvisxl-v3.0-turbo failed 5 of 24 runs of "a small
red cube on a white table" that way.
A prediction that fails with that message is now run again, up to two
more times, inside the same deadline and credit hold. A request that
pins a seed is not rerun, because the same seed is rejected again.
Only the prediction that succeeds is metered, as before.
* Answer malformed AI requests with a 400 where they enter
A value that used to end in an unclassified error, in a request or in
an upstream answer, now gets a classified one before provider code runs
on it. A value a driver or provider ignored or refused before is
handled as it was.
Every driver:
- shared/scalarOptions.ts answers 400 for a value that cannot be
converted to text, such as { "toString": null }, in the options a
driver reads as text, a number or a flag. The chat, video, text to
speech, speech to text, voice changer and OCR drivers call it first.
- An unknown provider name that is not text gets the same 400 as any
other unknown name.
Chat requests:
- A falsy `tools` means no tools on every provider.
- A tool call id or a content block type that cannot be converted to
text is a 400.
- A tool result that is an object is sent as its JSON, like the content
of a `tool` message.
- `include` that is not an array is a 400.
- `anthropicBetas` that is not a list of names is dropped.
- Gemini's native route answers 400 when no user or assistant message
is left to send.
- The prompt estimate reads a compaction block whose content is not a
string.
Image, video, speech and OCR requests:
- The image driver checks `input_image_mime_type` with `quality` and
`resolution`.
- The video driver answers 400 for a model that is not a string.
- The voice changer answers 400 for an `output_format` that is not a
string.
- Mistral OCR answers 400 when the SDK refuses the options before
sending them, as Mistral chat does.
Upstream answers to chat:
- A choice without a message is the existing 400 bad_response, which
still falls back.
- A usage count that is not a number is reported as zero in the cost
event, as pricing already skips it.
* Fuzz the AI drivers with seeded requests and upstream answers
Two seeded suites send malformed input through the real drivers and
providers. The vendors are played at the HTTP boundary, so each
provider's request and response code runs.
- ChatCompletionDriver.fuzz.test.ts covers the 17 chat providers that
have a static catalog. Requests with a few values changed must
resolve or reject below 500 without marking a route unhealthy.
Valid requests against wrong statuses, bodies of the wrong shape and
broken event streams must end with an answer or a classified error.
A stream only has to end; the error line it carries is not checked.
- mediaDrivers.fuzz.test.ts covers the image, video, speech and OCR
drivers, called as a user with unlimited metering so a request gets
past file input and the credit hold. Every vendor refuses the
request, and every call must end with a classified error.
shared/fuzzTestUtil.ts holds the seeded random source, the hostile JSON
values, the mutation, and the stand-in for fetch, undici and axios. An
SDK that calls https.request itself fails the suite. PUTER_FUZZ_CASES
raises the case count for a longer run. doc/ai-drivers.md describes the
suites.
* Restore the CODEOWNERS default owner and wildcard patterns
The default owner line read `- @Salazareo`, which only matches a file
named `-`, so files without a specific owner had none. Three patterns
had their `*` escaped, which GitHub rejects as invalid, so their lines
assigned no owner.
---------
Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
|
||
|
|
af01a554fe |
feat(gui): a top-up asked for from a page names the app it runs as (#4637)
The framed top-up passes the deployment's dialog the app the framing page's origin resolves to, as the framed upgrade does. The dashboard link puter.js opens when no frame can show carries the app in `topup_app`. |
||
|
|
3e11e7dc79 |
refactor: keep folder sort and layout in puter.kv, drop /set_sort_by and /set_layout (#4642)
Explorer saved each folder's sort and layout through POST /set_sort_by and
/set_layout, which wrote them onto the folder's fsentries row. stat only
returns `layout`, so a saved sort was never read back.
The GUI now keeps them in the user's key-value store, one key per folder
uid (`folder_view:<uid>` holding `{ sort_by, sort_order, layout }`), via
helpers/folderViewPrefs.js. A change to one preference keeps the others.
A folder with nothing stored falls back to the layout its fsentry still
carries, then to the defaults, so existing layouts carry over.
refresh_item_container reads the folder's view after stat and re-sorts
items that went in under the previous sort; a view for a folder the
window has left is ignored. update_window_path no longer applies sort and
layout itself, since the refresh it starts does.
With no callers left, DesktopController and its two routes are removed.
The fsentries columns and stat's `layout` field stay.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
5b1b5b8a7a |
fix(puter-js): apps launched from desktop.puter.com take its messages (#4640)
In an app, puter.js trusted only https://puter.com as the GUI origin, so every desktop message from desktop.puter.com failed the origin check and was dropped. The desktop waits for the app's answer to windowWillClose, so app windows there never closed; itemsOpened, drag-and-drop, focus, theme and locale changes were lost the same way, and a reauth request was posted to the wrong origin. An app now takes its GUI origin from the launch URL's `puter.origin`, but only when that is one of Puter's own desktops (exactly https://puter.com or https://desktop.puter.com); anything else keeps https://puter.com, so a page that frames an app still can't drive it. An explicit PUTER_ORIGIN still wins, and a top-level page never reads it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b2eb8ed895 |
feat(auth): a first-party page served on its own origin signs in with a session of its own (#4635)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
A deployment can list origins of its own pages in `first_party_session_origins`. When such a page asks the GUI to sign it in, the sign-in hands it a GUI token on a `web` session of its own, parented to the user's sign-in, instead of an app token. The session is minted by POST /auth/first-party-session, which only the GUI's own page script may call, and only as the user's sign-in itself: app tokens, access tokens and a session minted this way are refused. It never gets a session cookie, ends with the sign-in it was handed out under (revoking either takes the tokens minted under the page along), is not counted as a sign-in, and stays up with its sign-in when all other sessions are revoked. The sessions list shows it under its sign-in, titled with the page's host and badged as a site session. |
||
|
|
d1cbfb9fb1 |
fix(puter-js): a godmode app opened in its own tab stays signed in across a reload (#4632)
A tab the desktop opened for an app boots the SDK as a top-level page, where a session-type token was kept in memory only. Once the desktop hands such a tab its launch token, the SDK now keeps it in sessionStorage, as a framed app does, and a reload of that tab reads it back before any stored app token. A page that wasn't handed a token this way still persists no session token. |
||
|
|
ac44de819d |
fix(hosting): choose the site and subdomain from Host, not X-Forwarded-Host (#4459)
With trust proxy on, express derives req.hostname and req.subdomains from X-Forwarded-Host, which any client can send, while host validation reads the raw Host. A request could serve one hosted site's files on the main domain, or reach the API on a hosting host. The header is now dropped before routing. Fixes PUT-2272 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4ad53899da |
feat(auth): debug app sessions that act as a user in one app (#4629)
Adds a `debug_app` session kind and AuthService.createDebugAppToken, which mints an app-under-user token on its own session row instead of the user's app session. The row has a hard expiry that activity never slides, its calls record no user activity, it is hidden from the user's session list, and a password reset revokes it. SessionStore.deleteExpiredDebugAppSessions purges expired rows. Migrations add the kind to the sessions constraint on sqlite, mysql and postgres. |
||
|
|
c253b7e05e |
feat(auth): signups record the request's TLS fingerprint when a fronting proxy supplies one (#4622)
`tlsFingerprintHeader` names a request header that a TLS-terminating proxy sets to the client's TLS fingerprint. When set, the value is exposed as `req.tlsFingerprint`, stored on the new `user.signup_tls_fingerprint` column, passed to `puter.signup.validate`, and forwarded to the phone verification provider when it is a JA4. |
||
|
|
647995133e |
fix(http): responses stay under Node's close-listener limit, starting with WebDAV GET (#4621)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* fix(webdav): GET pipes the file without stacking close listeners on the response stream.pipeline put seven close listeners on the response. With metering, compression, the concurrency gate and request tracing on top, every WebDAV download crossed Node's ten-listener warning. GET now uses pipeToResponse, like the other file download routes. * fix(drivers): a streamed result stops its source on unpipe instead of its own close listener pipe already unpipes when the response finishes, closes or fails, so the extra close listener only spent part of the response's listener budget. The routes that hold a response open now have a test that keeps each within that budget. * refactor(http): everything that waits on a response's close shares one listener Egress metering, the concurrency gate, the large-body budget, route lifecycle events, driver call slots, disconnect aborts and SSE writers each put their own close listener on the response. They now register callbacks with onResponseClose, which keeps one listener per response and runs them in the order added, so a streamed response holds three close listeners instead of five or six and request tracing has room for its own. * test(webdav): handle streamed response errors in test sink Co-authored-by: Salazareo <25314977+Salazareo@users.noreply.github.com> * test(webdav): a storage failure mid-download is covered against a real response --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Salazareo <25314977+Salazareo@users.noreply.github.com> |
||
|
|
9d3a049988 |
document puter.host behavior (#4606)
* document puter.host behavior * update |
||
|
|
1c5909331c |
fix(fs): a path lookup of an old row returns its healed path while the replica catches up (#4612)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* fix(fs): a healed entry carries its written path, and an entry with no path answers 404 The lineage heal now returns the entry with the path it just wrote instead of re-reading the row, so a replica that hasn't caught up can't hand back the old NULL path. Entries that still have no path are kept out of the cache, resolve to the usual 404 in the fs routes, and an ACL check on a resource with no path refuses instead of throwing. * fix(fs): heal paths along one parent chain, fill only empty paths, and return the healed row from the primary The path lineage now picks the target row and walks up its own parent_uid links, so each row in a healed path is the parent of the next. The backfill only fills a NULL path and never replaces one that is set. Both lineage routes return the row read back from the primary, so every column is current. Path-less entries are kept out of the cache by the cache writers themselves, and a missing or empty path is unresolvable both in resolveOrNotFound and in ACLService.check. * fix(fs): a path lineage resolves only to a row still at that path, and the backfill runs its updates concurrently The lineage lookup now answers a miss when the row read back from the primary sits at a different path than the one walked, and doesn't cache it. The backfill runs its per-row updates through runWithConcurrencyLimit and drops cached entries only for rows it actually filled. ACLService.check refuses only a resource with no string path, so an empty client path keeps its existing 400. * fix(fs): build healed paths from the primary's ancestor chain, and invalidate the paths the heal wrote Both lineage routes now read the ancestor chain from the primary and write the path it spells, so a lagging replica's names never end up in a path column. A path lookup whose replica walk no longer matches the primary's chain is a miss and writes nothing. The backfill drops the cached entries of the rows it filled in one call, keyed by the path it wrote. The lazy-chain comparison now lets a missing path reach ACLService.check on both sides. * fix(fs): leave path-less uid and id lookups to resolveNode resolveNode already answers a uid or id lookup whose entry has no path as not found, and a path lookup always returns an entry with its path, so resolveOrNotFound goes back to trusting what it resolves. The readdir case for a broken parent chain is covered by the existing HTTP test. * fix(fs): the ancestor walk stops at a fixed depth and updates only rows with an empty path The primary's ancestor walk now selects each row's path and hands only the rows whose path is NULL to the backfill, so filled ancestors cost no UPDATE. The walk stops after LINEAGE_MAX_DEPTH steps; a chain that has not reached a row without a parent by then is treated as broken and the row is left alone. * fix(fs): a listing heals its path-less entries a bounded number at a time * test(fs): a stored path the parent chain no longer spells heals from the primary, and a listing leaves a path-less entry uncached --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
5d541cd8e2 |
fix(auth): a just-minted read URL or token is found while the replica catches up (#4556)
* fix(auth): a just-minted read URL or token is found while the replica catches up * fix(auth): a token's grants aren't cached when it's revoked mid-mint * fix(permissions): a mint succeeds when its grants cannot be read back to cache The grants are already stored at that point, so a failed read-back drops the cache key and the next read fills it. * test(auth): assert the grant list cached at mint; skip the sqlite-copy replica test on postgres * fix(auth): test that a token row is read from the primary only when both replica lookups miss * fix(auth): one-line comments on the replica-then-primary token row lookup * perf(auth): a mint caches the grants it stored without reading them back --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
fb526bfb7e |
perf(share): skip the ancestor read for owners with nothing shared in their own home (#4597)
* fix(share): look up a cross-owner move's origin by its former owner The move listener now passes the event's fromUserId down to the origin side of the fan-out, so the shares at the former location are looked up under the owner they belong to, and re-marks the new owner as shared before the fan-out runs instead of after it starts. Neither changes what recipients hear today: the origin's ancestors already carry the former owner, and the fan-out reads ancestors before it consults the owner-shares cache. Both are needed once the fan-out checks the entry's owner before reading ancestors. Tests cover a real cross-owner move with a cold owner-shares cache, and a hand-over to an owner with nothing shared. * perf(share): skip the ancestor read when the entry's owner shares nothing Every fs write, create, rename and move resolved the entry's ancestors (a cache batch) before asking whether any owner on that chain had anything shared. Ask about the entry's owner first, plus the former owner for the origin side of a cross-owner move, and return no audience without reading ancestors when none of them has a share. Otherwise the lookup runs as before. Self-contained so it can be reverted on its own. It assumes every entry in a shared subtree carries the subtree owner's user id. Entries that older writers created under someone else's shared folder with the writer's own id would stop notifying that folder's recipients when the writer has nothing shared, so this only holds once existing data has no such mixed-owner subtrees. * fix(share): read ancestors whenever an entry sits outside its owner's home The early return in the share fan-out assumed every entry in a subtree carries the subtree owner's id. Rows from older writers don't always: an app writing into another user's AppData stamped itself as the owner, so an entry in a shared folder can name an owner with nothing shared. Skip the ancestor read only when the entry's owner has nothing shared and the path sits in that owner's own home directory; anything under another user's home takes the full lookup as before, whatever the data holds. The owner's username comes from a per-process map (60s TTL, 10k entries) backed by the user store's cache, so a hit costs nothing and a miss one user cache read, against the ancestor batch it replaces. * refactor(share): drop the former-owner hint from the move fan-out With the home-directory check, the origin side of a cross-owner move sits under the former owner's home, not the entry's new owner's, so it always takes the full ancestor lookup and finds the former owner's shares through the chain. Passing fromUserId down and re-marking the new owner before the fan-out no longer change anything, so both go back to how they were. The test for a hand-over to an owner with nothing shared stays; the slower duplicate that waited out the cache is removed. * perf(share): keep the chain owner check after the ancestor read The early return replaced the check that ran after the ancestor read, so an entry outside its owner's home went on to the share-table lookup even when nobody on its chain had anything shared. Ask about every owner on the chain again once the ancestors are in hand, as before. * fix(share): mark the new owner shared before a hand-over's fan-out The fan-out now reads the owner-shares cache before it reads ancestors. On a move into another user's home, a "nothing shared" answer cached for the new owner shortly before the move made the destination side skip the entry's re-pointed share, so its recipient was told the item was removed rather than moved. Mark the new owner shared before the fan-out starts whenever the move changed the owner. The earlier "drop the former-owner hint" commit said this ordering no longer mattered; it does for the destination side. * perf(share): cache missing usernames and share in-flight lookups The home check now uses isOwnHomePath with the owner's username. The per-process username map also keeps a null answer for an owner with no account or no username, and a burst of writes by one owner shares a single user lookup, as the owner-shares lookups already do. A failed lookup is not cached and reads as someone else's home, so the full ancestor lookup runs. Tests cover an owner with no account, a home that differs only in case and a renamed owner, each taking the full lookup. * test(share): run the hand-over's revoke for real and assert the destination read * perf(share): check the home path before asking whether the owner shares An entry outside its owner's home goes straight to the full read, which asks about every owner on the chain together. The username cache is read once per call and the single-caller home helper is inlined. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
1abd25eb31 |
ci: take release-please from its current home, scope three workflow tokens and lock the actions (#4521)
* ci: take release-please from its current home google-github-actions/release-please-action is archived: the action moved to googleapis/release-please-action, same code, same inputs, same major version, and that is where the fixes now land. The release-please workflow references the maintained repository. * ci: declare what the three unscoped workflows may do with the token Docs Build, Maintain Release Merge PR and Notify HeyPuter had no permissions block, so they ran with the repository's default token scope. Docs Build only checks out and builds, Notify HeyPuter only calls the dispatch endpoint with its own token: both declare contents: read. Maintain Release Merge PR pushes the auto-update/release branch and opens the release pull request, so it declares contents: write and pull-requests: write. The other workflows already declared their scopes and are left as they are. * ci: stop persisting the checkout credentials in the jobs that never push actions/checkout keeps the job token in the clone's git config, where every later step can read it. Twelve checkouts now set persist-credentials: false: the backend and puter.js test jobs, the coverage jobs, the type checks, the docs build, the AI provider tests and the Docker image build read the clone and push nothing with git. The two checkouts of Maintain Release Merge PR keep the token: that job resets the release branch and pushes it through create-pull-request. * ci: lock the workflow actions to the commits they resolve to GitHub's workflow dependency lockfile holds the commit each action reference resolves to, transitive actions included, and the runner uses those commits even if a tag moves later. .github/workflows/actions.lock comes from gh actions-lock (v0.4.1), which also narrowed every reference to the exact release it locked, so Dependabot keeps bumping versions and its security alerts keep matching. Re-run the same command after adding or bumping an action. * ci: drop the unused token scope from Notify HeyPuter, match workflow indentation * ci: remove the disabled release workflows release-please and Maintain Release Merge PR have been disabled since 2024; releases are cut from calver tags. Their entries leave the lockfile with them. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
b5e4f20087 |
fix: KV size and credit edge cases, a metering double count, site name caching, /token-read content type (#4618)
* fix(fs): /token-read serves a file with no known extension as application/octet-stream * fix(kv): a value too large once stored rejects with value_too_large, and a consistent read of several keys is consistent * fix(kv): remove on an account with no credits left removes the paths and returns null * fix(metering): a buffered increment whose base read fails is not also written through * fix(hosting): site lookups by name share one cache entry for every spelling * fix(metering): an increment whose base read fails is written through and taken back out of the buffer * fix(hosting): create stores a site name trimmed and lowercased |
||
|
|
bdb88507df | throw error for get usage APIs (#4608) | ||
|
|
0694b76751 |
feat(email): sends name a stream, and streams add headers, a from address and message tags from config (#4520)
* feat(email): sends name a stream, and streams add headers, a from address and message tags from config
`email.streams` maps a stream name to optional headers, a from address and a
tags header. A send that names a configured stream gets that stream's
headers (caller headers win) and from address (when the caller gives none),
and its tags rendered as `name=value` pairs into the tags header. Unknown or
missing streams change nothing, and `streams` never reaches the transport.
Account mail is sent on `auth`, share and app feedback mail on `notify`, and
the signup confirmation on `signup` unless a `puter.signup.validate` listener
names another stream, which is remembered in the account metadata for
resends, deferred sends and save-account.
The signup response carries `confirmation_email_sent` when a confirmation
email was due at signup, and `/send-confirm-email` answers `{ sent }`.
PUT-2346
* fix(email): review fixes for stream naming
* fix(email): contact form mail names the notify stream, streams resolve from own config entries, the no-transport log shows the stream
Templated sends take only replyTo and stream; the header and tag options had no caller.
* fix(signup): a claimed row drops its earlier confirmation stream, and save-account reports a failed send under its own stage
|
||
|
|
e7ee778985 |
perf(notifications): notify and mark-ack skip their primary read-backs (#4547)
* perf(notifications): notify returns the row it wrote instead of reading it back The service hands the driver the row the store built on insert, and a group replacement builds the row it leaves from the one it looked up, so neither path reads the row back from the primary. * perf(notifications): mark-ack reads the row's fixed columns from a replica The type, app uid and audience the dismissal event carries never change, so they are read from a replica alongside the update, and from the primary only when the replica has no row yet. * test(notifications): cover a repeat dismissal and tidy notify docs * fix(notifications): a repeat mark-ack returns without waiting for the replica read, and a failed replica read is logged * refactor(notifications): NotificationRow spells out the row's columns, and a replacement passes the app uid it already has |
||
|
|
c3ff8ca3b2 |
fix(permissions): an app opened on a file in a shared folder can read and save it (#4555)
* fix(permissions): an app opened on a file in a shared folder can read and save it * perf(permissions): app scans check implied options before scanning the user * test(permissions): cover app grants on folders and revoked shares * fix(permissions): an app's folder grant counts only while its user holds that folder The app branch of the ACL check counted a user-to-app grant on any folder above the file. It now counts a grant on the file itself, or on a folder above it that the user holds at the asked mode, so the grant and the user's own access meet on the same node. * test(fs): the other-app case pins 404 beside the opened app's 200 |
||
|
|
39d931306d |
fix(auth): sign-in relays a token set between waits (#4572)
* fix(auth): sign-in relays a token set between waits
* fix(auth): sign-in relay skips another app's stored token and survives a failed store
* fix(auth): sign-in relay always clears the stored copy and logs only the error message
* fix(auth): the sign-in relay keeps only signed app tokens, per app, and a subscribed wait answers without Redis
/login/set stores a token only when this server signed it for an app, under a
key that includes the app, so a later set for another app or an unsigned value
leaves a pending token in place. /login/wait takes the stored copy once and
falls back to listening when Redis cannot be read. A token that arrives by
event is delivered to every subscribed wait for that app; the stored copy is
then removed best-effort, and left in place when the wait's client has gone.
A relayed token for another app no longer ends the wait. The event payload is
back to { authtoken }.
* chore(events): event types file matches main again
|
||
|
|
70e823c5af |
feat(email): notification emails ask listeners before each recipient (#4596)
* feat(email): notification emails ask listeners before each recipient
Share notification emails (account holders and invites) and the app
feedback email to the owner now emit `email.notify.validate` with
`{ to, kind, allow }` once per recipient address, next to the existing
unsubscribe and blocked-domain checks. A listener that sets `allow` to
false skips that recipient's email; the others are sent as before. The
invite check runs before its send budget is claimed and the feedback
check before the per-app cap slot, so a skipped address uses neither.
When no listener answers or the hook fails, the email is sent.
* refactor(email): type the notify kind as a template name, drop the dead catch
`emitAndWait` already catches a listener that throws, so the try/catch
around it never ran; a failed listener leaves `allow` true and the email
is sent. `kind` is now `EmailTemplateName`, so renaming a template breaks
the type check instead of the listener.
* fix(share): ask email.notify.validate when the digest is sent
A digest entry can wait out its window or a retried send, so the
listener is asked about the recipient right before the mail goes.
Invites are still asked once more before their budget is claimed.
* fix(email): any falsy allow on email.notify.validate skips the mail
Matches how email.validate reads its answer. The helper also takes the
event client as required, since every caller has one.
* feat(email): email.notify.validate carries every recipient of one kind of mail
The payload is { kind, recipients: [{ to, allow }] }. Share invites ask
once for all their addresses before any budget is claimed; the digest
send and the feedback mail ask with one entry. kind is narrowed to the
three templates that ask.
|
||
|
|
1bc1953344 |
chore(deps): bump ws from 8.22.0 to 8.22.2 (#4567)
Bumps [ws](https://github.com/websockets/ws) from 8.22.0 to 8.22.2. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.22.0...8.22.2) --- updated-dependencies: - dependency-name: ws dependency-version: 8.22.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
0f83bb9b56 |
chore(deps): bump nodemailer from 10.1.4 to 10.1.7 (#4478)
Bumps [nodemailer](https://github.com/nodemailer/nodemailer) from 10.1.4 to 10.1.7. - [Release notes](https://github.com/nodemailer/nodemailer/releases) - [Changelog](https://github.com/nodemailer/nodemailer/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodemailer/nodemailer/compare/v10.1.4...v10.1.7) --- updated-dependencies: - dependency-name: nodemailer dependency-version: 10.1.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
1ae95d97e8 |
build(deps-dev): bump @babel/core from 7.29.7 to 7.29.13 (#4565)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.29.7 to 7.29.13. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.29.13/packages/babel-core) --- updated-dependencies: - dependency-name: "@babel/core" dependency-version: 7.29.13 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
31f8936da2 |
build(deps): bump undici from 7.30.1 to 7.30.2 (#4566)
Bumps [undici](https://github.com/nodejs/undici) from 7.30.1 to 7.30.2. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](https://github.com/nodejs/undici/compare/v7.30.1...v7.30.2) --- updated-dependencies: - dependency-name: undici dependency-version: 7.30.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
aab559c9c1 |
chore(deps): bump zod from 4.4.3 to 4.6.7 (#4465)
Bumps [zod](https://github.com/colinhacks/zod) from 4.4.3 to 4.6.7. - [Release notes](https://github.com/colinhacks/zod/releases) - [Commits](https://github.com/colinhacks/zod/compare/v4.4.3...v4.6.7) --- updated-dependencies: - dependency-name: zod dependency-version: 4.6.7 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
7f1d46028a |
chore(deps): bump fastify from 5.12.5 to 5.12.7 (#4464)
Bumps [fastify](https://github.com/fastify/fastify) from 5.12.5 to 5.12.7. - [Release notes](https://github.com/fastify/fastify/releases) - [Commits](https://github.com/fastify/fastify/compare/v5.12.5...v5.12.7) --- updated-dependencies: - dependency-name: fastify dependency-version: 5.12.7 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
39d9482409 |
chore(deps): bump body-parser from 2.3.0 to 2.4.0 (#4463)
Bumps [body-parser](https://github.com/expressjs/body-parser) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/expressjs/body-parser/releases) - [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md) - [Commits](https://github.com/expressjs/body-parser/compare/v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: body-parser dependency-version: 2.4.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
4a958b3ca1 |
fix(gui): desktop push status counts only Puter's devices and follows subscription changes (#4550)
* fix(gui): desktop push status counts only Puter's devices and follows subscription changes - fix(gui): desktop push status counts only Puter's own devices - fix(gui): the desktop keeps its push subscription when the browser replaces it - docs(gui): shorten push comments to one line - fix(gui): removed browsers stay off after a subscription change, and websites can reach Puter push - docs(puter-js): fit the desktop push request comment on one line - fix(gui): background push registration checks every earlier endpoint and waits out a 429 - fix(puter-js): inside the desktop, requestPermission leaves a held push grant to the desktop - fix(gui): a browser that stays off after being removed forgets its receipt - fix(gui): push status holds right after enable(), and a subscription change is picked up after a run in flight - fix(gui): an app's push grant counts whenever the app list can't be read * fix(puter.js): a held push grant is left to the desktop only when it says it answers push The desktop lists `push-permission` in `puter.gui_features` on the app iframe's URL. Without it the SDK settles a held `notifications:push` from its own check, so a desktop whose requestPermission handler has no held check shows no dialog for a grant the app already holds. * fix(gui): a held push grant isn't asked again beside other access, and never counts without an app uid requestPermission drops a push grant held for Puter's devices from the dialog and asks only for what is missing. The app list lookup answers no for a missing app uid, whatever the list says; an app the list leaves out still keeps its grant, since the list is capped and can trail a grant. * test(puter.js): e2e for a push grant the app already holds inside the desktop A held grant resolves true with no dialog, and a request for it beside access the app is missing shows only the missing access. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
4653ff6dae |
fix(gui): a removed browser stays off, and launches reuse the page's push status (#4549)
* fix(gui): a browser removed from push stays off until its user turns it on
The silent registration on load and app launch no longer replaces a
subscription the user removed in Puter. When the server answers
push_device_removed, the browser's subscription and its receipt are
dropped and the browser is recorded as turned off, so later loads leave
it alone. Turning push on from Settings or a push dialog still replaces
the removed subscription.
* perf(gui): launches reuse the page's last push status
The built-in push client keeps the last registered status it read in
memory, for the same user and subscription. App launches and an app's
puter.notifications.status() answer from it instead of listing devices
again. It is dropped on enable(), disable(), an unregistered answer and
the worker's subscription-changed message, and the Notifications tab
and push dialogs still read fresh, so a new page load always asks the
server.
* fix(notifications): a background enable opens no sign-in, and a page keeps its last push on for five minutes
_enableWebPush takes { background } in place of { renewRemoved }: a call
without a click leaves a removed browser removed and sends its requests
without interactive sign-in.
The desktop's push client keeps the on that enable() read, so the next
cached status lists no devices, and asks the server again once that on is
five minutes old.
* fix(gui): the kept push on belongs to the user whose devices were listed, and a failed enable() keeps none
A status read or enable() that another user's sign-in overlapped keeps no
on, and an enable() that fails drops what a read begun meanwhile kept.
|
||
|
|
a5c7b427b8 |
fix(puter-js): a confirmed push subscription registers for another account without a new confirmation (#4548)
* fix(puter-js): a confirmed push subscription registers for another account without a new confirmation The server's verify and active subscribe answers can carry a receipt for the subscription. It is kept per worker scope and sent with the next announce of the same endpoint, so the Puter desktop registers the same browser for the next signed-in account without another confirmation push. The receipt is forgotten when the subscription is ended, replaced or removed, and when the app is turned off in Puter. A server without receipts behaves as before. * docs(puter-js): shorten a push helper comment * fix(notifications): keep receipts only in the Puter GUI and store the new one as soon as the server answers |
||
|
|
cd3600bae9 |
fix(fs): overwrite a file in place when a write spells its name in another case or normalization form (#4620)
* fix(fs): overwrite a file in place when a write spells its name in another case or normalization form * docs(fs): say a write needs overwrite off to get a new name beside a look-alike one |
||
|
|
2db55bd636 |
perf(share): read share owners from the entry owner column and backfill missing ones (#4598)
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* perf(share): skip the legacy owner probe once a recorded share answers ownerHasShares ran its recorded-owner and legacy NULL-owner queries side by side, so the join to fsentries ran even when the first query already found a share. Run the legacy half only when the recorded half finds nothing; the answers stay the same. * perf(share): drop the NULL-owner fallbacks from owner and outbound reads ownerHasShares, listOutbound, countOutbound, the outbound apps summary and the team-row filter behind listByHolder/countByHolder each carried a second half for share rows written before entry_owner_user_id existed, matched by joining fsentries on a NULL owner. The column migration backfilled those rows from fsentries, so the joins only add work: each costs about min(owner's files, NULL-owner rows) per call. Every remaining read goes through entry_owner_user_id alone. Invite rows (no fsentry, no owner) are matched as before: they were never reachable through the joins. Self-contained so it can be reverted on its own. It assumes existing data has no share row that names an fsentry but has a NULL entry_owner_user_id; if any remain, they stop showing up in these reads. * fix(share): backfill the entry owner on share rows written without it The share reads now match on entry_owner_user_id alone. Add a migration for each engine that fills that column from fsentries on every row that names an entry but still has a NULL owner, so the backfill runs before the reads stop looking at NULL-owner rows and their answers don't depend on what existing data holds. Rows that name no entry (invites) keep a NULL owner, and a replay finds nothing to fill. * fix(share): record the entry owner when a claim names its entry applyPending can point a claimed invite at an entry, but left entry_owner_user_id NULL, so the row was missing from the owner's reads that now match on that column alone. Fill it from fsentries with the same subquery the upserts use. The share service claims without an entry today; the parameter stays for callers that pass one. * refactor(share): read the app from the data column directly Every caller of the app filter and the app expression passes the share row's own data column now, so the column argument goes. Also names the owner probe test after what it checks and puts back an unrelated line the earlier formatting pass had reflowed. * chore(share): drop the redundant MySQL and Postgres owner backfills MySQL and Postgres replay every migration file on boot, and mysql_mig_47 and postgres_mig_36 already end with the same owner backfill, so they re-run it on every boot. Only SQLite, which tracks a schema version and runs each file once, needs its own backfill migration (0103). * fix(share): list a team row for its members when no entry owner is recorded * refactor(share): claiming an invite leaves its entry and owner as written * test(db): run the share owner backfill against the full prior schema * fix(share): ship the owner backfill as its own MySQL and Postgres migration The backfill at the end of mysql_mig_47 and postgres_mig_36 replays on boot only when database.migrationPaths is set. A new file gives installs that apply migrations another way a step to run; a replay finds nothing to fill. |
||
|
|
36e2d199c8 |
fix(fs): refuse instead of replacing an entry whose name differs only by an emoji or accent (#4589)
* fix(fs): refuse instead of replacing an entry whose name differs only by an emoji or accent MySQL compares fsentries names and paths under collations that also fold accents and most emoji, so a lookup for one name could return a sibling with another, and writes then overwrote and renamed it. Path lookups now return only an entry whose stored path matches the requested one after NFC normalization and lower-casing; case-only and NFC/NFD spellings still resolve as before. Name-collision checks opt in to the folded match and treat it as taken by a different entry: write, mkdir, touch, rename, shortcut, move and copy dedupe when asked and otherwise answer 409, and never replace or return that entry. * fix(fs): leave a sibling's subtree alone when a folder its path folds onto is renamed or moved The subtree rewrite matches descendants with `path LIKE 'old/%'`, and LIKE compares under the path collation (ASCII case on SQLite). With a sibling folder whose path differs only that way, renaming or moving one folder also rewrote the paths below the other. When another row sits at such a path, the rewrite now follows parent links down from the moved folder instead. Without one, the rewrite is unchanged, after one indexed lookup. * fix(fs): resolve an entry whose stored path is spelled unlike its names, and heal that path on the first read Older rows can store a `path` whose spelling differs from the names on their parent chain in ways the path collation ignores. A lookup that finds such a row by its real spelling now confirms it through the parent chain, writes the path from the stored names, and returns it, so overwriting, touching or copying over it by name works and the next read takes the single indexed query again. The lineage walk now writes a row's path only when it differs byte for byte from the one its names give, and drops only those rows' cache keys, so a walk over rows that are already right issues no writes. Whether an entry found at a name is a different, folded name is decided by its own name and its path after that walk, not by a stale path column. With `foldedNames`, a row only the path collation matches still counts as holding the name. * fix(fs): match entry names under full case mapping Names are compared after upper- then lower-casing, with a dotted capital I taken as I, so a request in another case finds the stored entry for Greek final sigma (`οδος.txt` for `ΟΔΟΣ.txt`), German sharp s (`STRASSE.txt` for `Straße.txt`) and Turkish dotted I (`istanbul.txt` for `İstanbul.txt`). Accent, emoji, kana and width differences still make two names different. * fix(fs): name the existing entry when a folded name is already taken, and show why a confirmed replace failed `item_with_same_name_exists` from write, move and copy now carries the existing entry's own name in `entry_name` when it differs from the requested one only by accents or emoji, so the prompt names the file the folder shows. In the GUI, a replace confirmed from that prompt that still fails is reported with its error message and counts as not written, instead of rejecting out of `handle_same_name_exists` and leaving the caller waiting. * fix(webdav): answer MKCOL with 405 and COPY or MOVE with Overwrite: F with 412 on a folded name The existence checks before MKCOL, COPY and MOVE now see an entry whose name differs from the target only by accents or emoji, so those requests answer as for an existing target instead of reaching the filesystem and coming back as 409. * docs(fs): list the errors write, move and copy return when a name is taken `puter.fs.write()` gets an Errors section with `item_with_same_name_exists`, `cannot_overwrite_a_directory` and `conflict`, the last for a name that differs from an existing one only by accents or emoji. The move and copy pages say how they reject in that case. * fix(fs): walk the parent chain on the primary when a path lookup reads hard A lookup that asks for a try-hard read (the checks after a create or move hits the unique key) now also runs its parent-chain walk on the primary, and falls back to the primary for the entry it finds. Before, the walk read a replica, so a name the replica had not seen yet came back as missing and the mkdir or move surfaced the duplicate-key error as a 500 instead of a 409. Lookups without a try-hard read are unchanged. A try-hard lookup issues the same number of queries; its walk reads the primary instead of a replica. * fix(fs): treat a folder only the collation matches as missing instead of naming a file in it A name-collision lookup lets only the last segment of the path match a differently spelled name. When a folder above it matches only under the collation (`😁dir` for `😀dir`), the lookup reports no occupant, so a write, mkdir or touch there fails as for a missing folder: 404, or with `createMissingParents` a 409 that names the folder. Before, it reported the file inside the other folder and answered 409 naming that file. A folder whose stored path is spelled that way still counts as the same folder, so lookups built from stored paths find what they did before. A rename onto a name the unique key already holds now answers 409 when the lookup before it missed the occupant, instead of a 500. * fix(fs): name the existing entry when a rename's name is folded, and leave a copy onto itself out of the copy docs A rename refused because the folder holds a name that differs only by accents or emoji now names that entry in its 409, as write, move and copy do. A copy onto a folded spelling of the source's own name answers as a copy onto itself (400 with `overwrite`), so the copy page's paragraph on folded names now covers only items other than the source. * fix(fs): walk the parent chain on the primary only when a hard read found another spelling of the path |
||
|
|
8616b00f7b |
fix(gui): save a URL from showSaveFilePicker, and always answer the app when the save dialog closes (#4587)
* fix(gui): save a URL from showSaveFilePicker and always answer the picker The save picker downloads an http(s) URL itself, without cookies or a referrer, up to 100 MiB, and writes it where the user chose, in apps and on websites. A failed download shows an error. In apps, a save dialog that closes without saving (failed download, failed write, close button) answers fileSaveCancelled once instead of leaving the call pending. * fix(gui): answer the save picker with the save's real outcome when it closes mid-save Closing the save dialog while a URL is downloading stops the download, writes nothing and answers fileSaveCancelled, in apps and on websites. In apps, closing it once a write has started leaves the answer to the write: fileSaved if it lands, fileSaveCancelled if it fails, never both. A save that throws shows an error and answers fileSaveCancelled instead of leaving the dialog stuck, and a second Enter during a save is ignored. On an https desktop only https URLs are accepted, with a message saying so, since the browser blocks http downloads there. * fix(gui): retry signing a saved file once, and say so when the app can't get it The app save picker signs the written file for the app with one retry. If both tries fail, the user is told the file was saved but couldn't be passed back, and the app gets fileSaveCancelled. The picker's one-answer state (answered, closed, saving, writing) lives in helpers/savePickerAnswer.js so the website picker can share it. * fix(gui): answer the website save picker once, with the save's real outcome The website save picker runs one save at a time, so a second Enter is ignored. Closing it while a URL downloads stops the download, writes nothing and answers fileSaveCancelled; closing it once the write has started leaves the answer to the write, so the page hears fileSaved or fileSaveCancelled, never both. A failed download shows an error, answers fileSaveCancelled and closes the picker, as in apps, and so does a save that throws. A saved file that can't be signed is reported to the user and answered as cancelled. * fix(gui): show apostrophes in the save picker's failure messages |
||
|
|
873303a7c4 |
fix(events): offer a queued delivery only to connections that run its handler (#4590)
* fix(events): offer a queued delivery only to connections that run its handler A queue subscription with an events worker was sent to every connection of the app. A connection without the handler declined it at once, which moved it to the worker while the tab with the handler was still running it. puter.js now sends `events.handle` with the persistent subscriptions a connection runs a handler for, on connect and whenever that set changes. The server puts the connection in a room for each queue row it holds, and offers the row's deliveries only to that room. With nobody in it anywhere in the region, the delivery goes to the worker at once. A peer region handed such a delivery declines it straight back when none of its connections run the handler. Rows without a worker are still sent to the whole app room. * fix(events): probe the handler room only when the app has a connection in the region A queued delivery for a pair with no connection here goes to the worker on the same local lookup and presence read as before, with no request to the other nodes. * fix(events): probe a forwarded batch's handler rooms together, within one timeout A region receiving a batch now looks up every handler room its queued deliveries need before it sends any of them: each distinct room once, up to 16 at a time, all under one shared 500 ms deadline. A room not answered by then counts as empty, so its delivery is declined home with `no_handler` and never sent. Deliveries still go out in the batch's order, and a batch with no such delivery probes nothing. * fix(events): resend a handler announce refused for the call budget puter.js now sends `events.handle` with an ack and a 10 second timeout. When the server refuses it with `too_many_requests`, the client sends the current set again after 10 seconds, until one goes through or the connection is replaced. No answer, as from a server without the verb, and any other refusal are left alone. A connection that never had a persistent handler sends no announce; one that had sends an empty set when the last is removed. The rate limits page now says that announces count toward the acknowledgement budget. * docs(events): say when a client starts getting first try at queued events A client counts once the server has registered its handler, shortly after it connects or calls `onPersistent()`. Before then, an event for a subscription with an events worker goes to another client with the handler or to the worker. * fix(socket): settle a cluster room count on the first node that holds a socket A count ask now hears each node's answer as it arrives: the first node holding a socket answers it at once, every node saying none answers it once all have said so, and a node that never answers only decides it when no answering node holds one. The request sent is unchanged, so every node answers it as before. * fix(events): look up handler connections in the region's record, not every node Each connection that announces a handler is kept in a per-subscription sorted set in the region's Redis, scored by renewal: added after it joins the handler room, removed before it leaves or on disconnect, renewed every minute while it runs one, and counted only for three minutes after its last renewal. Handing out a queued delivery, and receiving a forwarded one, now check this node's sockets and then that set with one read, instead of asking every node in the region to count the room. A connection the set names but that is gone gets the delivery sent to an empty room, and the socket lease hands it to the worker as before. * fix(events): try the next region with the app open after one declines for want of a handler A queued delivery's region is picked by app presence, so the first region tried can have the app open without the handler. Its no_handler decline now hands the delivery to the next region with the app open that hasn't had it, and the worker runs it once none is left. A lease that lapses still goes to the worker. A decline now counts only when it comes from the region the current attempt went to (this region for a local attempt). The region goes into the entry in the same write as the attempt's lease, so a second decline from a region already tried can't take the next region's lease. An attempt made after a decline stamps its lease in its own field, which a server that doesn't make such attempts never reads, so it can't take that lease back either. |
||
|
|
11107f3108 |
fix(permissions,share): revoked team shares and removed links aren't read back from a lagging replica (#4554)
* fix(permissions): a revoked group grant isn't read back from a lagging replica * fix(share): links removed by trash or a move aren't read back from a lagging replica, in any region * test(permissions): start each test server in the file on an empty redis mock * fix(permissions): node deletes find just-made grants on the primary; add a group membership hook * fix(share): link revokes reach peer regions even when the local marker fails, and subtree retires read the primary * fix(permissions): read a group's members after the grant is deleted * fix(permissions): mark group members before a group grant is deleted The member read and the marker now come before the delete, so a failed member read leaves the grant in place for a retry and member reads are already on the primary when the row goes. Members are read again after the delete, best effort, to include someone who joined meanwhile. The node-delete path returns those members, so ShareService bumps the same list instead of reading each group again from a replica. readUserGroupPerms checks the marker without the unused base-key GET. * perf(share): trash and delete read grants from a replica unless the owner shared just now --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |