DEVELOPER QUICKSTART / JAVASCRIPT
Keep your app in control.
Your application requests supported work from a person's persistent Square65. The owner approves your exact website origin; Square65 schedules only on that person's currently connected, eligible browsers.
Today’s boundary: Square65 supports explicit workload descriptors and a restricted numeric map subset—not arbitrary code. Local AI inference stays on this device. With explicit opt-in, its similarity-scoring workload can share embeddings with trusted computers; this is not pooled inference or a speedup claim.
1. Connect your Square65
Call authorize() from a user click. The owner signs in to Square65, sees your website origin and selects which requested permissions to grant. By default the SDK requests only compute:request; add computers:read only when your app genuinely needs device labels or live capacity. The SDK uses a one-use PKCE handoff; the application receives a scoped, short-lived capability—not computer credentials.
import { Square65, LocalInference } from "/sdk/index.js";
const square65 = new Square65({ serverUrl: "https://square65.com", local: false });
connectButton.onclick = async () => {
await square65.authorize({ scopes: ["compute:request", "computers:read"] });
await square65.connect();
};
square65.on("state", (state) => renderCapacity(state.computers));
The served /sdk/index.d.ts types product events such as computer changes, placement decisions, queue updates, and owner preemption; custom event names retain an unknown payload. First-party apps can import LocalInference from the same entry point for on-device embeddings. Inference is not scheduled across Square65 computers.
2. Declare the work your app supports
Use a supported descriptor and let Square65 choose placement. Keep the result in your application; show whether computers are selected or idle and why.
const pixels = await square65.use({
kind: "fractal-render",
width: 768,
height: 768,
maxIterations: 240,
tileRows: 16,
});
showImage(pixels);
square65.map(numbers, pureNumericCallback) is available for 1–50,000 finite numbers. Optional { captures } may contain finite numbers and bounded numeric arrays; captured arrays can be indexed using the map index in the supported expression subset. Captures are serialized workload data visible to selected computers—never place secrets there. The generated source limit is 768,000 UTF-8 bytes. run(work) remains a compatibility alias for use(work), and the older Hash constructor name remains available for existing integrations.
const scores = await square65.map(
noteVectorValues,
(value, index) => value * queryVector[index % dimensions],
{ captures: { queryVector, dimensions } },
);
3. Add a computer only with its owner’s consent
Use the Add Computer element or your own link flow. The joining owner reviews what participation means, sets a task limit, consents, and can pause. Work inputs sent to another computer may be visible to that computer’s owner. A connected computer can remain idle when it is unlikely to help.
<script type="module" src="/sdk/hash-element.js"></script>
<square65-add-computer></square65-add-computer>
Owners enroll computers through My Square65 and can see which browsers are currently online. Application permissions are exact-origin and revocable from the account page. A participating computer can inspect the workload inputs it receives, so disclose that before sending user data.
Explore the reference app
Square65 Local AI is the first-party app: a real browser-local embedding model, local search by default, and opt-in Square65 similarity scoring. Raw note text and model inference stay local; embeddings can reveal semantic information.