API versions
This page tells how HADAL marks the age and the stability of each part of the extension API. It also tells how a module works with an older or a newer HADAL. API stability gives the rules for changes and for removals.
The API version
Section titled “The API version”web.api on the server and pocket.version in the browser give the version of the extension API. It is 2 since 0.19.0. It was 1 from 0.14.0.
The version goes up only when a change breaks something that modules use. Additions do not change it.
- Why 2: Pi Durable 1.2 renamed the result field of a tool from
contenttooutput. HADAL still readscontentfrom theexecuteof a drop-in’s tool. But a hook (afterTool) or a wrap (wrapTool) that returnscontentgives the model an empty result, with no error. - The oldest supported version is 1. A module that exports
pocketApi = 1, or nopocketApi, still loads. A module for an older version than 1 does not load. - A module that returns
outputexportspocketApi = 2. HADAL 0.18 then refuses it with a clear message, and does not give the model an empty result.
Since 0.21.0, document definitions should name checkpointWhen in every defineDoc or defineDocFamily call. When it is missing, HADAL supplies checkpointWhen: () => false for older drop-ins, and logs the module and the document kind. Explicit policies stay as they are. Since 0.21.0 (Pi Durable 1.4), a task must not use TaskRuntime.sleep(): it must wait with durable sleepUntil() checkpoints.
Since 0.28.0 (HADAL 1.5), the main entry of @earendil-works/pi-ai does not export TypeBox’s Type. A drop-in that imports Type from it still gets it: HADAL gives drop-ins pi-ai with TypeBox’s Type added, so their tool schemas stay as they were. New code builds its schemas with @earendil-works/pi-schema (Tools). Since then, a watch listener (api.watchDoc) gets one call: watch.start(async (call, context) => …), with call.value, call.ops, and call.retired when call.kind is "value". A document that is retired does not end its watch with a null value any more: the next call has retired: true.
pocketApi
Section titled “pocketApi”A module can export pocketApi: the server module, the browser module, or both.
export const pocketApi = 2;A HADAL with an older API version does not set up such a module. It says why in the Extensions sheet.
The browser reads pocketApi after it imports the browser module. Thus keep the browser module’s top level to declarations, and do its work in the default export.
Since, Stable, Experimental, and Internal
Section titled “Since, Stable, Experimental, and Internal”Each member in the reference and in types/pocket.d.ts has two marks:
- Since 0.14.0: the first release of HADAL that has the member. A pre-release counts as its release. In the types file, this is
@since. - Stable: the member changes only as the stability policy says.
- Experimental: the member can change, or go, in any minor release (
0.15.0), but never in a patch release (0.14.1). See A4 and A14 in API stability. In the types file, this is@experimental. In 0.14.0,host.linkedSessionsis the only experimental member.
Some members of the host are internal: only HADAL’s built-in modules use them. They are not in the types file. They can change in any release. host lists them.
Older and newer HADAL
Section titled “Older and newer HADAL”Members that are new
Section titled “Members that are new”HADAL reloads a module when you edit it, but the host changes only when the server restarts. A module that uses a member that is new to the host must work without it until then. Check that the member is there, and do as before when it is not:
if (typeof host.heldBack === "function") { // Use host.heldBack.}A module that calls a member that is not there fails at its first use, in all sessions.
HADAL before 0.14.0
Section titled “HADAL before 0.14.0”A HADAL before 0.14.0 knows neither pocketApi nor web. There, a module that adds to the app fails at its first web.route or web.client. The Extensions sheet shows the error.
Gallery entries
Section titled “Gallery entries”A gallery entry gives pocketApi and minPocket: the API version and the oldest HADAL that the extension needs. The gallery hides an entry that needs a newer API or a newer HADAL. See Gallery entry.
When each part came
Section titled “When each part came”Each member in the reference has its own Since line. These parts came together:
| Part | Since |
|---|---|
| Built-in modules, the host, tools, sections, hooks | 0.1.0 |
| Drop-ins in the drop-in folder | 0.3.0 |
web: routes, browser modules, events, cleanups |
0.14.0 |
pocketApi, web.api, and pocket.version |
0.14.0 |
pocketApi 2 |
0.19.0 |
Slash commands (web.command) |
0.14.0 |
pocket.toolCall |
0.14.0 |
host.linkedSessions |
0.14.0 |
pocket.panel and pocket.status (experimental) |
0.19.0 |
Slots: pocket.topbar, composerButton, replyAction, insertText, arrange (experimental) |
0.19.0 |
cwd in host.linkedSessions.start and the human-bound linkedSessions.start |
0.19.0 |
stop and archive on host.linkedSessions (experimental) |
0.28.0 |
The session list: pocket.sessionChips, sessionAction, sessionFilter, sessionSearch, and WebRequest.sessions (experimental) |
0.20.0 |
host.registerModelProvider (experimental) |
0.20.0 |
host.fetchPublic (experimental) |
0.20.0 |
Keys in the message boxes: pocket.composerKey (experimental) |
0.20.0 |
The session’s messages: pocket.onConversation, messages, reveal (experimental) |
0.20.0 |
group in pocket.menu (experimental) |
0.21.0 |
Public pages: web.publicPage and web.links (experimental) |
0.22.0 |
People’s values and the browser: host.ask, hide, commandEnv, browser (experimental) |
0.22.0 |
Events, services, and settings: host.on, web.provide, use, onService, settings, setting, onSettings, pocket.settings, onSettings (experimental) |
0.22.0 |
Give Lantern a message: pocket.pip.ask (experimental) |
0.26.0 |
A person’s role: host.roleOf (experimental) |
0.27.0 |
The page’s scroll position: scroll in the host.browser snapshot (experimental) |
0.27.0 |
Answers to pick on an ask’s card: header, choices, multiple, and other in AskField (experimental) |
0.27.0 |
Read-only conversation and descendant usage: ConversationWebRequest.conversationUsage (experimental) |
0.28.0 |
How a run stopped: outcome and failure on run.ended, and failed on a linked session (experimental) |
0.28.0 |
host.sessions.start (experimental) |
0.28.0 |
Workspace providers: host.registerWorkspaceProvider, host.cwdOf, and WebRequest.createSession (experimental) |
0.28.0 |
Presented inputs: web.presentEntry and pocket.entryPresentation (experimental) |
0.28.0 |
Fenced blocks and inline math: pocket.fence and pocket.mathInline (experimental) |
0.28.0 |
answers from linkedSessions.send (experimental) |
0.28.0 |
These pages describe HADAL 0.29.0. Your copy has the pages of its own version in its docs/ folder.