Skip to main content

Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
•JSR Score94%•
License
Apache-2.0
•
Downloads459/wk
•
Publisheda day ago (0.0.10)

The plugin authoring contract for NetScript: a fluent definePlugin builder producing type-safe manifests that host tooling turns into runtime files, services, and Aspire resources.

Examples

Define a plugin

import { definePlugin, inspectPlugin } from "@netscript/plugin";

const plugin = definePlugin("@example/plugin", "0.0.1-alpha.0").build();

console.log(inspectPlugin(plugin).summary);

Classes

c
DuplicatePluginError(name: string)

Error thrown when a plugin name is registered more than once.

c
PluginBuilder<
TName extends string = never,
TVersion extends string = never,
TContributions extends PluginContributions = Record<PropertyKey, never>,
TDependencies extends PluginDependencies = Record<PropertyKey, never>
>
(state?: PluginBuilderState<TDependencies>)

Fluent builder for assembling plugin manifests.

  • build(): TName extends never ? never : TVersion extends never ? never : PluginManifest

    Build an immutable plugin manifest.

  • withAspire(aspire: ContributionInput<string, TDependencies>): PluginBuilder<TName, TVersion, TContributions & { readonly aspire: string; }, TDependencies>

    Set the Aspire contribution module path.

  • withAuthor(author: string): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set the plugin author.

  • withBackgroundProcessor(processor: ContributionInput<BackgroundProcessorContribution, TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly backgroundProcessors: readonly BackgroundProcessorContribution[]; }
    , TDependencies>

    Add a background processor contribution.

  • withContractVersions(versions: ContributionInput<readonly ContractVersionContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly contractVersions: readonly ContractVersionContribution[]; }
    , TDependencies>

    Add contract version contributions.

  • withDbSchemas(schemas: ContributionInput<readonly DbSchemaContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly databaseSchemas: readonly DbSchemaContribution[]; }
    , TDependencies>

    Add database schema contributions.

  • withDependencies<TDeps extends PluginDependencies>(dependencies: TDeps): PluginBuilder<TName, TVersion, TContributions, TDeps>

    Set typed plugin dependencies available to contribution callbacks.

  • withDescription(description: string): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set the plugin description.

  • withDisplayName(displayName: string): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set the display name used by UI surfaces.

  • withDoctor(doctor: ContributionInput<string, TDependencies>): PluginBuilder<TName, TVersion, TContributions & { readonly doctor: string; }, TDependencies>

    Set the plugin adapter module that contributes doctor checks.

  • withE2e(e2e: ContributionInput<readonly E2eContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly e2e: readonly E2eContribution[]; }
    , TDependencies>

    Add end-to-end gate contributions.

  • withHooks(hooks: PluginLifecycleHooks): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set plugin lifecycle hooks.

  • withLicense(license: string): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set the plugin license identifier.

  • withMetadata(metadata: PluginMetadata): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set runtime-safe plugin metadata.

  • withMigrations(migrations: ContributionInput<readonly MigrationContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly migrations: readonly MigrationContribution[]; }
    , TDependencies>

    Add migration contributions.

  • withName<T extends string>(name: T): PluginBuilder<T, TVersion, TContributions, TDependencies>

    Set the plugin package name.

  • withPermissions(permissions: readonly string[]): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set permissions requested by the plugin.

  • withRuntimeConfigTopics(topics: ContributionInput<readonly RuntimeConfigTopicContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly runtimeConfigTopics: readonly RuntimeConfigTopicContribution[]; }
    , TDependencies>

    Add runtime config topic contributions.

  • withSdkClients(references: ContributionInput<readonly SdkClientContributionReference[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly sdkClients: readonly SdkClientContributionReference[]; }
    , TDependencies>

    Add declarative SDK client-contribution factory references.

  • withService(service: ContributionInput<ServiceContribution, TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly services: readonly ServiceContribution[]; }
    , TDependencies>

    Add a service contribution.

  • withStreamTopics(topics: ContributionInput<readonly StreamTopicContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly streamTopics: readonly StreamTopicContribution[]; }
    , TDependencies>

    Add stream topic contributions.

  • withTags(tags: readonly string[]): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set plugin discovery tags.

  • withTelemetry(telemetry: ContributionInput<readonly TelemetryContribution[], TDependencies>): PluginBuilder<TName, TVersion,
    TContributions
    & { readonly telemetry: readonly TelemetryContribution[]; }
    , TDependencies>

    Add telemetry contributions.

  • withType(type: PluginType): PluginBuilder<TName, TVersion, TContributions, TDependencies>

    Set the plugin category.

  • withVersion<T extends string>(version: T): PluginBuilder<TName, T, TContributions, TDependencies>

    Set the plugin semantic version.

c
PluginCompositionError(diagnostics: readonly PluginCompositionDiagnostic[])

Error thrown when a set of plugin manifests cannot be composed into one root host.

  • diagnostics: readonly PluginCompositionDiagnostic[]

    Structured diagnostics, in manifest order.

c

Base class for plugin contribution extension axes.

  • axis: ContributionAxis

    Contribution axis implemented by the concrete contribution.

c
PluginError(
message: string,
options?: ErrorOptions
)

Base error for plugin package failures.

c
PluginValidationError(
message: string,
issues?: readonly string[]
)

Error thrown when a plugin definition is invalid.

Functions

f
assertSuccessfulProbe(
result: ProbeHttpResult,
label: string
): void

Throw when a probe response is not in the 2xx range.

f
definePlugin<TName extends string, TVersion extends string>(
name: TName,
version: TVersion
): PluginBuilder<
TName,
TVersion,
Record<PropertyKey, never>,
Record<PropertyKey, never>
>

Start a new plugin manifest builder chain.

f
inspectPlugin(target:
string
| InspectablePluginManifest
| InspectablePluginRegistry
): InspectionReport

Inspect a plugin manifest, registry, or path-like target.

f
joinProbeUrl(
baseUrl: string,
path: string
): string

Join a base URL and a probe path.

f
normalizeProbePath(path: string): string

Normalize a probe path so it always begins with a single leading slash.

f
parsePluginManifest(json: unknown): PluginManifestParseResult

Parse and validate a plugin manifest without executing plugin code.

f
resolveProbeUrl(
envVarNames: readonly string[],
fallbackUrl: string,
options?: ResolveProbeUrlOptions
): string

Resolve a service base URL from a prioritized list of environment variables.

f
runPluginVerificationCli(result: PluginVerificationResult): void

Print a PluginVerificationResult as JSON and set the process exit code.

f
summarizeResponse(response: Response): Promise<ProbeHttpResult>

Summarize an HTTP response for probe diagnostics.

f
verifyPlugin(
manifest: VerifiablePluginManifest,
expectations: PluginExpectations
): PluginVerificationResult

Verify a plugin manifest against a declarative set of expectations.

Interfaces

I

Background processor contributed by a plugin.

  • concurrency: number

    Optional processor concurrency.

  • entrypoint: string

    Processor entrypoint path.

  • name: string

    Logical processor name.

I

Contract version contributed by a plugin.

  • loader: string

    Module path that loads this contract version.

  • version: string

    Version identifier contributed by the plugin.

I

Database schema file contributed by a plugin.

  • engine: "postgres" | "mysql" | "mssql" | "sqlite"

    Database engine targeted by the schema.

  • path: string

    Path to the contributed schema file.

I

End-to-end test contribution.

  • command: string

    Command used to execute the test contribution.

  • name: string

    Test contribution name.

I

Expected Aspire contribution module path and the finding emitted on mismatch.

  • message: string

    Finding emitted when the Aspire module path does not match.

  • module: string

    Expected Aspire contribution module path.

I

Expected contract version contribution, matched by version and loader.

  • loader: string

    Expected contract loader module path.

  • message: string

    Finding emitted when no matching contract contribution is found.

  • version: string

    Expected contract version label.

I

Expected database schema contribution, matched by path and engine.

  • engine: string

    Expected database engine identifier.

  • message: string

    Finding emitted when no matching schema contribution is found.

  • path: string

    Expected schema file path.

I

Expected plugin dependency alias and the finding emitted when it is absent.

  • alias: string

    Dependency alias that must be truthy on manifest.dependencies.

  • message: string

    Finding emitted when the dependency is absent.

I

Expected end-to-end gate contribution, matched by name and optional command.

  • command: string

    Expected gate command, when matched on command.

  • message: string

    Finding emitted when no matching gate contribution is found.

  • name: string

    Expected gate name.

I

Expected manifest-level helper function and the finding emitted when it is absent.

  • key: string

    Manifest key that must be typed function.

  • message: string

    Finding emitted when the helper is absent.

I

Expected named contribution (processor, stream topic, telemetry), matched by name.

  • message: string

    Finding emitted when no matching contribution is found.

  • name: string

    Expected contribution name.

I

Expected runtime config topic contribution, matched by name and optional schemaPath.

  • message: string

    Finding emitted when no matching topic contribution is found.

  • name: string

    Expected topic name.

  • schemaPath: string

    Expected JSON schema module path, when matched on schemaPath.

I

Expected service contribution, matched by name and optional entrypoint/port.

  • entrypoint: string

    Expected service entrypoint module path, when matched on entrypoint.

  • message: string

    Finding emitted when no matching service contribution is found.

  • name: string

    Expected contribution name.

  • port: number

    Expected service port, when matched on port.

I

Minimal plugin manifest shape accepted by the plugin inspector.

  • Contribution groups keyed by contribution axis.

  • name: string

    Plugin package name.

  • version: string

    Plugin version.

I

Minimal registry shape accepted by the plugin inspector.

  • list: () => readonly InspectablePluginManifest[]

    List registered plugin manifests.

I

JSON-stable diagnostic report returned by plugin inspectors.

  • details: Record<string, unknown>

    JSON-stable detail payload for machine readers.

  • package: "@netscript/plugin"

    Package identifier inspected by this report.

  • summary: string

    Short diagnostic summary suitable for CLI output.

  • target: string

    Human-readable target name or path supplied to the inspector.

I

Data or schema migration contribution.

  • name: string

    Migration name.

  • path: string

    Path to the migration module or asset.

I

Immutable state accumulated by the plugin builder chain.

  • author: string

    Plugin author name or organization.

  • contributions: PluginContributions

    Contributions accumulated by builder methods.

  • dependencies: TDependencies

    Typed dependencies available to contribution callbacks.

  • description: string

    Plugin description.

  • displayName: string

    Display name shown in host UI surfaces.

  • hooks: PluginLifecycleHooks

    Lifecycle hooks supplied by the plugin.

  • license: string

    Plugin license identifier.

  • metadata: PluginMetadata

    Runtime-safe metadata attached to the manifest.

  • name: string

    Plugin package name.

  • permissions: readonly string[]

    Host permissions requested by the plugin.

  • tags: readonly string[]

    Discovery tags attached to the manifest.

  • type: PluginType

    Plugin category.

  • version: string

    Plugin semantic version.

I

Structured diagnostic describing one plugin composition failure.

  • axis: string

    Contribution key involved, when the failure concerns a contribution.

  • code: PluginCompositionDiagnosticCode

    Stable failure code.

  • Plugin that already owns the conflicting identity, for duplicates.

  • identity: string

    Contribution identity or dependency name involved.

  • message: string

    Human-readable explanation naming the plugin, axis, and identity involved.

  • plugin: string

    Name of the plugin manifest that carries the failing declaration.

I

Context supplied to plugin lifecycle hooks.

  • isDev: boolean

    Whether the host is running in development mode.

  • logger: PluginLogger

    Logger supplied by the host.

  • manifest: unknown

    Parsed plugin manifest.

  • pluginRoot: string

    Absolute plugin root path when the plugin is local.

  • projectRoot: string

    Absolute project root path for the host application.

I

Contribution groups supported by plugin manifests.

  • aspire: string

    Aspire contribution module reference.

  • backgroundProcessors: readonly BackgroundProcessorContribution[]

    Background processor contributions registered by the plugin.

  • cli: { readonly doctorChecks?: readonly "auth-backend"[]; }

    CLI capabilities owned by the plugin and consumed generically by the host.

  • contractVersions: readonly ContractVersionContribution[]

    Contract version contributions registered by the plugin.

  • databaseSchemas: readonly DbSchemaContribution[]

    Database schema contributions registered by the plugin.

  • doctor: string

    Plugin adapter module containing doctor checks.

  • e2e: readonly E2eContribution[]

    End-to-end test contributions registered by the plugin.

  • migrations: readonly MigrationContribution[]

    Migration contributions registered by the plugin.

  • runtimeConfigTopics: readonly RuntimeConfigTopicContribution[]

    Runtime config topic contributions registered by the plugin.

  • sdkClients: readonly SdkClientContributionReference[]

    Declarative SDK client-contribution factories made available by the plugin.

  • services: readonly ServiceContribution[]

    Service contributions registered by the plugin.

  • streamTopics: readonly StreamTopicContribution[]

    Stream topic contributions registered by the plugin.

  • telemetry: readonly TelemetryContribution[]

    Telemetry contributions registered by the plugin.

I

Metadata describing one runtime end-to-end gate contributed by a plugin.

  • command: readonly string[]

    Command used by the evaluator or CLI E2E runner.

  • description: string

    Human-readable gate summary.

  • id: string

    Stable gate identifier.

I

Declarative description of the manifest a plugin is expected to expose.

  • aspire: ExpectedAspire

    Expected Aspire contribution module path.

  • backgroundProcessors: readonly ExpectedNamed[]

    Expected background processor contributions.

  • contractVersions: readonly ExpectedContractVersion[]

    Expected contract version contributions.

  • databaseSchemas: readonly ExpectedDbSchema[]

    Expected database schema contributions.

  • dependencies: readonly ExpectedDependency[]

    Expected dependency aliases.

  • e2e: readonly ExpectedE2eGate[]

    Expected end-to-end gate contributions.

  • helpers: readonly ExpectedHelper[]

    Expected manifest-level helper functions.

  • name: string

    Expected plugin package name.

  • runtimeConfigTopics: readonly ExpectedRuntimeConfigTopic[]

    Expected runtime config topic contributions.

  • services: readonly ExpectedService[]

    Expected service contributions.

  • streamTopics: readonly ExpectedNamed[]

    Expected stream topic contributions.

  • telemetry: readonly ExpectedNamed[]

    Expected telemetry contributions.

  • version: string

    Expected plugin version (derive from the plugin's deno.json).

I

Published scaffold.plugin.json contract consumed by NetScript installers.

  • capabilities: PluginManifestCapabilities

    Static capability summary used before plugin code executes.

  • databaseRequirement: PluginDatabaseRequirement

    Optional configuration-dependent SQL requirement, resolved before installation.

  • description: string

    Human-readable plugin description.

  • displayName: string

    Human-readable plugin name.

  • linking: PluginManifestLinking

    Resource links reconciled generically for first- and third-party plugins.

  • name: string

    Published plugin package name.

  • officialSource: PluginManifestOfficialSource

    Existing source metadata retained for first-party compatibility.

  • peerDependencies: Readonly<Record<string, string>>

    Peer package requirements expected by the plugin scaffolder.

  • postScripts: readonly PluginManifestPostScript[]

    Optional plugin-owned scripts executed after a successful scaffold.

  • provider: PluginManifestProvider

    Existing provider metadata retained for first-party compatibility.

  • scaffolder: PluginManifestScaffolder

    Plugin-owned scaffold entrypoint metadata.

  • schemaVersion: PLUGIN_MANIFEST_SCHEMA_VERSION

    Published protocol schema version.

  • version: string

    Published plugin package version.

I

Validation issue exposed by the plugin installer manifest schema.

  • message: string

    Human-readable validation message.

  • path: readonly PropertyKey[]

    Path segments locating the invalid value.

I

Stable public validation surface for the plugin installer manifest schema.

  • parse(value: unknown): PluginInstallerManifest

    Parse a value or throw when it is not a valid installer manifest.

  • safeParse(value: unknown):
    { readonly success: true; readonly data: PluginInstallerManifest; }
    | { readonly success: false; readonly error: { readonly issues: readonly PluginInstallerManifestSchemaIssue[]; }; }

    Parse a value without throwing.

I

Lifecycle hooks supported by plugin definitions.

  • afterGenerate: (context: PluginContext) => void | Promise<void>

    Hook called after generation tasks complete.

  • beforeGenerate: (context: PluginContext) => void | Promise<void>

    Hook called before generation tasks run.

  • setup: (context: PluginContext) => void | Promise<void>

    Hook called when the plugin is initialized.

  • teardown: (context: PluginContext) => void | Promise<void>

    Hook called when the plugin is torn down.

I

Logger shape supplied to plugin lifecycle hooks.

  • debug: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit a debug-level lifecycle message.

  • error: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit an error-level lifecycle message.

  • info: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit an info-level lifecycle message.

  • warn: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit a warning-level lifecycle message.

I

Plugin manifest consumed by NetScript hosts and tooling.

  • author: string

    Plugin author.

  • contributions: PluginContributions

    Contribution groups registered by the plugin.

  • dependencies: PluginDependencies

    Typed plugin dependencies consumed by this plugin.

  • description: string

    Human-readable plugin description.

  • displayName: string

    Display name used in UI surfaces.

  • hooks: PluginLifecycleHooks

    Lifecycle hooks registered by the plugin.

  • license: string

    Plugin license identifier.

  • metadata: PluginMetadata

    Runtime-safe metadata.

  • name: string

    Plugin package name.

  • permissions: readonly string[]

    Permissions requested by the plugin.

  • tags: readonly string[]

    Plugin tags for discovery.

  • type: PluginType

    Plugin category.

  • version: string

    Plugin semantic version.

I

Capability summary statically declared by a plugin manifest.

  • Whether the plugin scaffolder adds background workers or processors.

  • Whether the plugin scaffolder adds database migration or schema files.

  • hasRoutes: boolean

    Whether the plugin scaffolder adds service routes or HTTP endpoints.

  • Whether the plugin-owned scaffolder accepts the optional MCP scaffold request.

I

Declarative resource-linking contract shared by first- and third-party plugins.

  • Optional background-processor configuration key owned by the plugin.

  • Stable plugin identity used to resolve declared plugin dependencies.

  • consumers: PluginManifestLinkingConsumers

    Named service and app resources that consume this producer.

  • dependencies: readonly string[]

    Canonical plugin dependencies resolved to their installed resource keys.

  • pluginReferences: readonly string[]

    Explicit plugin resource keys referenced by this producer.

  • Plugin resource configuration key exposed to consumers.

I

Named host resources that consume a plugin producer.

  • apps: readonly string[]

    App configuration keys that receive the plugin reference.

  • services: readonly string[]

    Service configuration keys that receive the plugin reference.

I

Compatibility metadata for existing first-party source-copy discovery.

  • Optional background source directory name.

  • Optional background entrypoint copied or generated for the plugin.

  • Generated background worker port. Zero requests host allocation.

  • Canonical first-party plugin source name.

  • dependencies: readonly string[]

    First-party plugin source dependencies by directory name.

  • Plugin adapter module that owns static doctor checks.

  • permissions: readonly string[]

    Runtime permissions used by generated plugin services.

  • pluginDir: string

    Source plugin directory name.

  • pluginReferences: readonly string[]

    Generated plugin service references.

  • requiresDb: boolean

    Whether the plugin source requires database wiring.

  • requiresKv: boolean

    Whether the plugin source requires Deno KV wiring.

  • Generated service configuration key.

  • Service entrypoint copied or generated for the plugin.

  • servicePort: number

    Generated service port.

I

Validation failure returned when a plugin manifest cannot be parsed.

  • issues: readonly PluginManifestParseIssue[]

    Structured validation issues suitable for CLI rendering.

  • message: string

    Human-readable failure summary.

I

Single validation issue returned by plugin manifest parsing.

  • message: string

    Human-readable validation failure.

  • path: string

    Dot-separated path to the invalid manifest field.

I

Minimal parser shape for manifest validators exposed by this package.

  • parse: (input: unknown) => TOutput

    Parse an unknown manifest candidate into the validator output type.

I

Script export executed after a plugin-owned scaffold succeeds.

  • args: readonly string[]

    Static arguments passed to the post-script.

  • export: string

    Published export path or local script path to execute.

I

Compatibility metadata for existing plugin-kind provider registration.

  • category: "plugin" | "background-processor"

    Provider category used by the host plugin registry.

  • concurrencyEnvVar: string | null

    Environment variable used to configure concurrency.

  • defaultConcurrency: number | null

    Default concurrency when supported.

  • Default background or service entrypoint.

  • defaultPermissions: readonly string[]

    Default runtime permissions for generated services.

  • Whether the provider requires database wiring by default.

  • Whether the provider requires Deno KV wiring by default.

  • Default service entrypoint, omitted when the plugin has no service.

  • Whether telemetry is enabled by default.

  • displayName: string

    Human-readable provider name.

  • infrastructureOptionalDeps: readonly string[]

    Optional infrastructure dependency capabilities.

  • infrastructureRequires: readonly string[]

    Required infrastructure capabilities.

  • kind: string

    Plugin kind registered by the provider.

  • pluginType: "background-processor" | "api" | "frontend" | "utility"

    Plugin category used by runtime tooling.

  • portRangeKey: string

    Port range bucket used by generated services.

  • Whether generated services support configurable concurrency.

  • watchFlag: string

    Optional watch flag used by generated dev commands.

I

Plugin-owned scaffold entrypoint declared by the manifest.

  • export: string

    Published export path that implements the scaffold entrypoint.

  • requiredPermissions: PluginScaffolderRequiredPermissions

    Static permission declaration for the scaffold entrypoint.

I

Declared Deno permissions required by a plugin-owned scaffolder.

  • net: readonly string[]

    Network hosts or permission scopes required by the scaffolder.

  • read: readonly string[]

    Read paths or permission scopes required by the scaffolder.

  • write: readonly string[]

    Write paths or permission scopes required by the scaffolder.

  • findings: readonly string[]

    Human-readable verification findings (empty when ok is true).

  • inspection: InspectionReport

    Plugin inspector report for the manifest.

  • ok: boolean

    Whether the manifest satisfied every supplied expectation.

I

HTTP response summary captured by an E2E probe.

  • bodyPreview: string

    Response body preview for diagnostics.

  • status: number

    HTTP status code.

  • statusText: string

    HTTP status text.

  • url: string

    Requested URL.

I

Options controlling resolveProbeUrl behavior.

  • Strip a single trailing slash from the resolved URL. Defaults to true (the sagas/streams behavior); pass false to preserve a URL verbatim.

I

Runtime config topic contributed by a plugin.

  • name: string

    Runtime config topic name.

  • schemaPath: string

    Optional path to the JSON schema for this topic.

I

Context supplied by the NetScript installer to a plugin-owned scaffolder.

  • dryRun: boolean

    Whether the scaffolder must report planned changes without writing files.

  • logger: PluginLogger

    Logger supplied by the host installer.

  • options: Readonly<Record<string, unknown>>

    Plugin-specific scaffold options passed by the installer.

  • Absolute path to the target workspace root.

I

Result returned by a plugin-owned scaffolder.

  • createdFiles: readonly string[]

    Workspace-relative files created or planned by the scaffolder.

  • Whether database migration or schema files were added or planned.

  • modifiedFiles: readonly string[]

    Workspace-relative files modified or planned by the scaffolder.

  • status: "applied" | "planned" | "skipped" | "failed"

    Whether the scaffolder applied changes, planned changes, skipped work, or failed.

  • uiRegistryItems: readonly string[]

    Optional first-party UI registry items required by the emitted userland surface.

I

Declarative reference to a published SDK client-contribution factory.

  • export: string

    Named factory export within the published module.

  • id: `${string}:${string}`

    Globally named contribution identifier exposed by the referenced factory.

  • module: string

    Published module specifier containing the contribution factory.

  • protocol: { readonly family: "netscript.sdk-client"; readonly major: 1; }

    Stable protocol discriminator supported by the SDK contribution seam.

  • targets: readonly ("browser" | "server")[]

    Runtime targets on which the factory is safe to load.

I

Service contributed by a plugin.

  • entrypoint: string

    Service entrypoint path.

  • name: string

    Logical service name.

  • port: number

    Optional service port.

I

Stream topic contributed by a plugin.

  • name: string

    Logical topic name.

  • subject: string

    Stream subject or routing key.

I

Telemetry instrumentation contribution.

  • module: string

    Module path that installs the instrumentation.

  • name: string

    Instrumentation contribution name.

I

Contract version contribution (fields optional for structural assignability).

  • loader: string

    Contract loader module path.

  • version: string

    Contract version label.

I

Contribution axes read by verifyPlugin.

  • aspire: string

    Aspire contribution module path.

  • backgroundProcessors: readonly VerifiableNamedContribution[]

    Background processor contributions.

  • contractVersions: readonly VerifiableContractContribution[]

    Contract version contributions.

  • databaseSchemas: readonly VerifiableDbSchemaContribution[]

    Database schema contributions.

  • e2e: readonly VerifiableE2eContribution[]

    End-to-end gate contributions.

  • runtimeConfigTopics: readonly VerifiableRuntimeConfigContribution[]

    Runtime config topic contributions.

  • services: readonly VerifiableNamedContribution[]

    Service contributions.

  • streamTopics: readonly VerifiableNamedContribution[]

    Stream topic contributions.

  • telemetry: readonly VerifiableNamedContribution[]

    Telemetry contributions.

I

Database schema contribution (fields optional for structural assignability).

  • engine: string

    Database engine identifier.

  • path: string

    Schema file path.

I

End-to-end gate contribution (fields optional for structural assignability).

I

Contribution carrying a name, optionally an entrypoint and port.

  • entrypoint: string

    Optional service entrypoint module path.

  • name: string

    Contribution name.

  • port: number

    Optional service port.

I

Manifest shape consumed by verifyPlugin.

  • contributions: VerifiableContributions

    Contribution groups keyed by contribution axis.

  • dependencies: Readonly<Record<string, unknown>>

    Plugin dependency manifest keyed by dependency alias.

I

Runtime config topic contribution (fields optional for structural assignability).

  • name: string

    Topic name.

  • schemaPath: string

    Optional JSON schema module path.

Type Aliases

T
ContributionAxis =
"service"
| "sdk-client"
| "background-processor"
| "stream-topic"
| "database-schema"
| "runtime-config-topic"
| "contract-version"
| "e2e"
| "telemetry"
| "migration"
| "aspire"

Supported plugin contribution axis value.

T
ContributionInput<TValue, TDependencies extends PluginDependencies> = TValue | ((ctx: DependencyContext<TDependencies>) => TValue)

Contribution value or callback resolved by the plugin builder.

T
DependencyContext<TDependencies extends PluginDependencies> = { readonly deps: TDependencies; }

Dependency context supplied to contribution callback inputs.

  • deps: TDependencies

    Typed dependencies registered on the builder.

T
PluginCompositionDiagnosticCode =
"duplicate-plugin"
| "unknown-contribution-key"
| "invalid-contribution"
| "duplicate-contribution"
| "missing-dependency"
| "dependency-version-mismatch"
| "invalid-version"

Stable code identifying why a root plugin composition is invalid.

T
PluginDependencies = Readonly<Record<string, PluginManifest>>

Typed plugin dependency record keyed by caller-chosen aliases.

T
PluginManifestParseResult =
{ readonly ok: true; readonly manifest: PluginInstallerManifest; }
| { readonly ok: false; readonly error: PluginManifestParseError; }

Result returned by static plugin manifest parsing.

T
PluginMetadata = Record<string, PluginMetadataValue>

Metadata attached to plugin manifests.

T
PluginMetadataValue =
string
| number
| boolean
| null
| readonly PluginMetadataValue[]
| { readonly [key: string]: PluginMetadataValue; }

Runtime-safe metadata values.

T
PluginScaffoldEntrypoint = (context: ScaffolderContext) => Promise<ScaffoldResult>

Entrypoint signature implemented by plugin-owned ./scaffold exports.

T
PluginType = "background-processor" | "api" | "frontend" | "utility"

Supported plugin category value.

Variables

v

Current published schema version for scaffold.plugin.json.

v
PLUGIN_TYPES: readonly PluginType[]

Supported plugin categories.

v
PluginInstallerManifestSchema: PluginInstallerManifestValidator

Zod validator for the published NetScript plugin installer manifest.

Add Package

deno add jsr:@netscript/plugin

Import symbol

import * as _netscript_plugin__Plugin_definition_DSL_and_diagnostics_for_NetScript_plugin_packages___The_root_entrypoint_is_the_plugin_authoring_contract__Host_tooling__CLI_integration__SDK_discovery__adapters__and_fixtures_live_on_subpaths____netscript_plugin_config_____netscript_plugin_cli_____netscript_plugin_protocol_____netscript_plugin_sdk___and___netscript_plugin_testing___ from "@netscript/plugin";
or

Import directly with a jsr specifier

import * as _netscript_plugin__Plugin_definition_DSL_and_diagnostics_for_NetScript_plugin_packages___The_root_entrypoint_is_the_plugin_authoring_contract__Host_tooling__CLI_integration__SDK_discovery__adapters__and_fixtures_live_on_subpaths____netscript_plugin_config_____netscript_plugin_cli_____netscript_plugin_protocol_____netscript_plugin_sdk___and___netscript_plugin_testing___ from "jsr:@netscript/plugin@^0.0.10";