Extension context

activate(context) receives the complete public extension context. It is intentionally small: host access is scoped by contribution, permission, project, and terminal session.

Use it in activate

TypeScript
import { defineExtension } from '@terminay/extension-api';

export default defineExtension({
  activate(context) {
    console.info(context.extensionId, context.apiVersion);
    const registration = context.agents.registerProvider('codex', provider);
    context.subscriptions.add(registration);
  },
  async deactivate() {
    // Optional extension-owned cleanup.
  },
});

Export defineExtension({ activate, deactivate? }). activate and the optional deactivate may return a promise.

Context members

MemberTypeUse
extensionIdstringThe immutable ID from the manifest.
apiVersionstringThe API version negotiated by Terminay for this activation.
paths.configurationstringPrivate configuration directory for this extension.
paths.datastringPrivate durable-data directory for this extension.
paths.cachestringPrivate cache directory for this extension.
registerProjectEnvironmentProvider(registration)voidRegister a provider definition, runtime, and optional dependency-operation handler.
agents.registerProvider(providerId, runtime)AgentProviderRegistrationRegister an agent runtime; its disposable registration exposes providerId.
subscriptions.add(disposable)DisposableGive host-owned lifecycle cleanup a disposable; returns the same disposable.

Registration shapes

RegistrationRequired values
Project environment{ definition, runtime, dependencyOperations? }. See Project environments.
Agent providerA manifest-declared providerId and { mappingVersion, matchesForeground, observe } runtime. See Agent providers.

Lifecycle and boundaries

  • Use subscriptions for registrations, watchers, and other Disposable resources; Terminay disposes them when the activation ends.
  • agents is available only to manifests granted agent-observation.
  • The context does not expose renderer UI, routes, Electron, raw PTYs, unrestricted filesystem access, host transports, or private Terminay packages.