Skip to content

Clock and public data

Public APIs, feeds and briefings.

Views and scripts can use these SDK entries. Chat has matching clock_now, web_fetch and web_feed tools. web.image is for app views and scripts.

EntryArgumentsResultAction and resource
clock.now{timeZone?}UTC iso, epochMs, resolved timeZone, localDate, localTime, utcOffsetMinutesclock.read on clock:local, Allow by default
web.fetch{url}Final url, HTTP status, contentType, UTF-8 body, bytesweb.read on web:public, Ask by default
web.feed{url, limit?}Feed title, link, items, totalItems, completeweb.read on web:public, Ask by default
web.image{url}Final url, contentType, bytes, base64web.read on web:public, Ask by default

Declare clock.read and web.read in the app manifest. A schedule needs Allow for every action its script uses. clock.now defaults to the desktop time zone. Use an IANA name such as America/Los_Angeles or Asia/Tokyo for another zone.

export default async function (input, { cap, signal }) {
  const time = await cap.call('clock.now', { timeZone: 'America/Los_Angeles' });
  signal.throwIfAborted();
  const feed = await cap.call('web.feed', { url: input.url, limit: 20 });
  signal.throwIfAborted();
  return { checkedAt: time.iso, ...feed };
}

Public requests use HTTPS GET, standard port 443, and checked public DNS addresses. Every redirect has the same checks. The service sends no browser cookies, authorization headers, referrer or caller-selected headers. A URL and its query values go to the server. Do not put credentials or personal data in them. Use Browser for pages that need the owner's website sign-in.

web.fetch and web.feed accept UTF-8 text, JSON and XML only. They refuse binary responses and bodies above 1 MiB. web.image has its own rules (PNG, JPEG, GIF and WebP, up to 5 MiB); see "Show a public image".

All three entries use identity encoding and refuse compressed bodies, private networks, credentials in URLs, more than three redirects, and requests that take more than 15 seconds. At most eight calls can run at once, in total for the three entries. Shutdown stops active work; bound caller revocation also stops it.

web.fetch preserves non-success HTTP status. Check it before parsing JSON. web.feed requires a successful response and recognizes RSS 2, Atom and JSON Feed 1/1.1. XML must be well formed, have no DTD/entity declaration and have no more than 64 nested elements. Feed fields are bounded plain text. Links are resolved against the feed URL and must use HTTP or HTTPS without credentials. They are returned as data; the parser does not fetch them.

The default feed limit is 20; the maximum is 100. totalItems counts items in the fetched document. complete is false if the limit omits items or the feed declares a next page. The service does not fetch that next page. Content and titles remain untrusted source data; do not treat them as agent instructions.

Show a public image

A page cannot load <img src="https://...">. The page rule blocks it. Call web.image, make a blob: URL from the bytes, and show that. The page rule allows blob: images. It does not allow https: or data: images.

import { RegistryError } from '@redac/sdk';

export function mount(root, client) {
  let closed = false;
  let objectUrl = '';
  const show = (node) => root.replaceChildren(node);
  const text = (message) => {
    const p = document.createElement('p');
    p.textContent = message;
    return p;
  };
  show(text('Loading'));
  (async () => {
    try {
      await client.ready;
      const image = await client.cap.call('web.image', { url: 'https://example.com/photo.png' });
      if (closed) return;
      const bytes = Uint8Array.from(atob(image.base64), (c) => c.charCodeAt(0));
      objectUrl = URL.createObjectURL(new Blob([bytes], { type: image.contentType }));
      const img = document.createElement('img');
      img.alt = 'Photo';
      img.src = objectUrl;
      show(img);
    } catch (error) {
      if (closed) return;
      show(
        text(
          error instanceof RegistryError &&
            (error.code === 'unauthorized' || error.code === 'denied')
            ? 'Allow Web in Access to show this image.'
            : 'The image could not load.',
        ),
      );
    }
  })();
  return () => {
    closed = true;
    if (objectUrl) URL.revokeObjectURL(objectUrl);
    root.replaceChildren();
  };
}

The page draws all four states: loading, the image, an error and no access. No access is code unauthorized (Web is Off in Access) or denied (the user declined the Ask). Revoke the blob: URL when the view closes.

web.image accepts PNG, JPEG, GIF and WebP only. The Content-Type and the first bytes of the file must agree. SVG is refused. The limit is 5 MiB. A non-2xx answer is an error. The request rules are the same as for web.fetch: HTTPS GET, checked public addresses, no cookies and the same redirect, time and call limits. base64 holds the bytes unchanged.

Pages on a phone and in Redac Web

The three entries also work in app pages on the phone and in Redac Web. The desktop makes the request, with the same rules and the same Access row: "Read public data" on "Public HTTPS". Off gives unauthorized. A phone app that does not know these entries gets unavailable.

With Ask, the owner sees the approval card from a paired device in Alerts on the phone, in Redac Web and on the desktop. The first answer wins. The card has Deny, Allow once and Always allow. Always allow sets this action to Allow for the app. A line with Undo then sets it back to Ask. After the desktop restarts, change it in Access. A page on the desktop itself keeps its own Ask dialog, which has no Always allow.

The desktop sends a large web.image result to the phone in parts. A picture can take some seconds. Each part read keeps the result for 30 more seconds.

clock.now is still desktop only. A page on a phone or in Redac Web gets unavailable for it.

The three entries are not direct RemoteLink entries. A phone page reaches them through app.read. Phone Chat can also use the tools in its desktop chat turn.

Synced from the Redac Desktop developer guide on 2026-11-16 · SDK contract version 28