Skip to content

Applies to Cowork 0.1.41 · For everyone who uses Cowork

Extension SDK ​

An Extension is code that runs in its own background process. Cowork loads its entry file and calls activate(api) once. Everything the Extension can do goes through that api object, and through the ctx objects Cowork hands to what it registers. This chapter lists every module and function.

Release status

Functions marked Not yet released are in Cowork's source but not in a released version yet.

Modules ​

ModuleFunctionsNeeds
Entry and Registrationactivate(api) · api.registerConnector · api.registerService · api.log—
Connectorstart(ctx) · stop() · send(reply) · ctx.emit · ctx.log— (in 0.1.41: listed in connectors)
Background Tasksrun(ctx) · ctx.status · ctx.log · ctx.readJson · ctx.writeJson · ctx.env · ctx.dataDir · ctx.signalcapability service
Site Requestsctx.site.request · ctx.site.sessionservice + sites
Service Conversationsctx.agent.handoffservice + agent
Browserctx.browser.adoptTab · releaseTab · evaluate · inject · uninject · captureAudio · stopAudio · onEventcapability browser (audio for sound)

package.json ​

This example uses service and sites, which are not released yet; on 0.1.41 it is refused.

json
{
  "name": "janeapp-operator",
  "version": "0.1.0",
  "pi": { "extensions": ["./index.mjs"] },
  "dozin": {
    "capabilities": ["service"],
    "sites": [{ "host": "welladjustedhk.janeapp.com", "methods": ["GET"], "pathPrefixes": ["/admin/api/v2/"], "minIntervalMs": 1000 }]
  }
}
FieldDescription
nameLowercase letters, digits and hyphens; equals the folder name
versionThe version shown in Settings › Extensions. Required in 0.1.41; from the next version it defaults to 0.0.0
pi.extensionsExactly one entry file. Required in 0.1.41. Not yet released: may be left out, then main is used, else the first of index.mjs, index.js, index.ts
dozin.connectorsIDs of the Connectors it registers. When listed, only these ids can register. In 0.1.41 a Connector can register only if its id is listed here
dozin.capabilitiesbrowser, audio (needs browser), platform-gate-v1, and service Not yet released
dozin.originsWith browser: 1 to 20 exact websites (https://example.com) it may use. Required with browser in 0.1.41; from the next version it may be left out, and then any http(s) site is allowed, still only in tabs the person hands over
dozin.platformsdarwin-arm64, darwin-x64, win32-x64; needs exactly one platform-gate-v1 in capabilities
dozin.secrets Not yet releasedWith service: up to 8 values the person fills in, { env, label }; env matches ^[A-Z][A-Z0-9_]{0,63}$
dozin.sites Not yet releasedWith service: up to 8 sites for ctx.site, { host, methods, pathPrefixes, minIntervalMs }
dozin.agent Not yet releasedWith service: { brief, model?, tools?, secret? } for service conversations

The type name is DozinAPI in both Cowork and Dozin, so one Extension installs unchanged in either.

Rules that apply to every module ​

  • Nothing runs until a person approves the exact files in Settings › Extensions. Changing one file means approving again.
  • A package has at most 200 files and 5 MB; dependencies are not installed.
  • An Extension cannot read cookies, tokens or other extensions' data.

For Micromeet Cowork 0.1.41 · build 261111110020