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
| Member | Type | Use |
|---|---|---|
extensionId | string | The immutable ID from the manifest. |
apiVersion | string | The API version negotiated by Terminay for this activation. |
paths.configuration | string | Private configuration directory for this extension. |
paths.data | string | Private durable-data directory for this extension. |
paths.cache | string | Private cache directory for this extension. |
registerProjectEnvironmentProvider(registration) | void | Register a provider definition, runtime, and optional dependency-operation handler. |
agents.registerProvider(providerId, runtime) | AgentProviderRegistration | Register an agent runtime; its disposable registration exposes providerId. |
subscriptions.add(disposable) | Disposable | Give host-owned lifecycle cleanup a disposable; returns the same disposable. |
Registration shapes
| Registration | Required values |
|---|---|
| Project environment | { definition, runtime, dependencyOperations? }. See Project environments. |
| Agent provider | A 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.