@kybernesis/kyberagent-extension-sdk 0.1.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../extension-contracts/src/kernel/assignments.ts","../../extension-contracts/src/kernel/capability-attachments.ts","../../extension-contracts/src/kernel/ecosystem.ts","../../extension-contracts/src/kernel/registry.ts","../../extension-contracts/src/host/capabilities.ts","../../extension-contracts/src/kernel/contribution-convention.ts","../../extension-contracts/src/kernel/skills.ts","../../extension-contracts/src/kernel/plugin-install.ts","../../extension-contracts/src/kernel/plugin-contract.ts","../../extension-contracts/src/kernel/bridges.ts","../../extension-contracts/src/kernel/sidecars.ts","../../extension-contracts/src/kernel/outbound-origins.ts","../../extension-contracts/src/kernel/seam.ts","../src/contribution-id-deprecation.ts","../src/seam-ports.ts","../src/index.ts"],"sourcesContent":["import { Schema } from 'effect';\nimport { TurnCapabilityAttachment } from './capability-attachments.js';\n\nexport const KernelAssignmentTargetKind = Schema.Literal('local', 'remote');\nexport type KernelAssignmentTargetKind = Schema.Schema.Type<typeof KernelAssignmentTargetKind>;\n\nexport const KernelAssignmentScope = Schema.Struct({\n agentName: Schema.String,\n workspaceId: Schema.optional(Schema.String),\n});\nexport type KernelAssignmentScope = Schema.Schema.Type<typeof KernelAssignmentScope>;\n\nexport const KernelAssignedSkill = Schema.Struct({\n skillId: Schema.String,\n displayName: Schema.String,\n sourcePluginId: Schema.optional(Schema.String),\n sourcePath: Schema.optional(Schema.String),\n enabled: Schema.Boolean,\n pushedAtMs: Schema.optional(Schema.NonNegativeInt),\n});\nexport type KernelAssignedSkill = Schema.Schema.Type<typeof KernelAssignedSkill>;\n\nexport const KernelAssignedPlugin = Schema.Struct({\n pluginId: Schema.String,\n displayName: Schema.String,\n lifecycleState: Schema.Literal(\n 'available',\n 'assigned',\n 'installed',\n 'active',\n 'blocked',\n 'removed',\n 'enabled',\n 'disabled',\n 'auth-required',\n 'error',\n ),\n assignedAtMs: Schema.optional(Schema.NonNegativeInt),\n autoPushSkills: Schema.Boolean,\n assignedSkillIds: Schema.Array(Schema.String),\n});\nexport type KernelAssignedPlugin = Schema.Schema.Type<typeof KernelAssignedPlugin>;\n\nexport const KernelComposioSecretStatus = Schema.Struct({\n configured: Schema.Boolean,\n scope: Schema.Literal('agent', 'remote-agent', 'daemon'),\n source: Schema.optional(Schema.String),\n keyTail: Schema.optional(Schema.String),\n fingerprint: Schema.optional(Schema.String),\n checkedAtMs: Schema.optional(Schema.NonNegativeInt),\n lastError: Schema.optional(Schema.String),\n slots: Schema.optional(Schema.Array(Schema.Struct({\n slot: Schema.String,\n configured: Schema.Boolean,\n source: Schema.optional(Schema.String),\n keyTail: Schema.optional(Schema.String),\n fingerprint: Schema.optional(Schema.String),\n lastError: Schema.optional(Schema.String),\n checkedAtMs: Schema.optional(Schema.NonNegativeInt),\n }))),\n});\nexport type KernelComposioSecretStatus = Schema.Schema.Type<typeof KernelComposioSecretStatus>;\n\nexport const KernelAssignmentTarget = Schema.Struct({\n agentName: Schema.String,\n displayName: Schema.optional(Schema.String),\n kind: KernelAssignmentTargetKind,\n remoteUrl: Schema.optional(Schema.String),\n workspaceIds: Schema.Array(Schema.String),\n assignedSkills: Schema.Array(KernelAssignedSkill),\n assignedPlugins: Schema.Array(KernelAssignedPlugin),\n auth: Schema.Struct({\n composio: KernelComposioSecretStatus,\n }),\n});\nexport type KernelAssignmentTarget = Schema.Schema.Type<typeof KernelAssignmentTarget>;\n\nexport const KernelAssignmentSummary = Schema.Struct({\n generatedAtMs: Schema.NonNegativeInt,\n targets: Schema.Array(KernelAssignmentTarget),\n});\nexport type KernelAssignmentSummary = Schema.Schema.Type<typeof KernelAssignmentSummary>;\n\nexport const KernelAssignmentPatch = Schema.Struct({\n workspaceId: Schema.optional(Schema.String),\n assignedSkillIds: Schema.optional(Schema.Array(Schema.String)),\n assignedPluginIds: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type KernelAssignmentPatch = Schema.Schema.Type<typeof KernelAssignmentPatch>;\n\nexport const KernelCapabilityManagedBy = Schema.Literal('kyberagent-daemon');\nexport type KernelCapabilityManagedBy = Schema.Schema.Type<typeof KernelCapabilityManagedBy>;\n\nexport const KernelCapabilityLifecycleStatus = Schema.Literal(\n 'available',\n 'pushed',\n 'deps-installed',\n 'configured',\n 'active',\n 'blocked',\n 'error',\n 'removed',\n);\nexport type KernelCapabilityLifecycleStatus = Schema.Schema.Type<\n typeof KernelCapabilityLifecycleStatus\n>;\n\nexport const KernelCapabilityManifestSkill = Schema.Struct({\n skillId: Schema.String,\n displayName: Schema.String,\n sourcePluginId: Schema.optional(Schema.String),\n sourceMarketplace: Schema.optional(Schema.String),\n sourcePath: Schema.optional(Schema.String),\n filesystemPath: Schema.optional(Schema.String),\n managedBy: KernelCapabilityManagedBy,\n pushedAtMs: Schema.NonNegativeInt,\n});\nexport type KernelCapabilityManifestSkill = Schema.Schema.Type<\n typeof KernelCapabilityManifestSkill\n>;\n\nexport const KernelCapabilityManifestPlugin = Schema.Struct({\n pluginId: Schema.String,\n displayName: Schema.String,\n version: Schema.optional(Schema.String),\n sourceMarketplace: Schema.optional(Schema.String),\n sourcePath: Schema.optional(Schema.String),\n filesystemPath: Schema.optional(Schema.String),\n managedBy: KernelCapabilityManagedBy,\n status: KernelCapabilityLifecycleStatus,\n assignedSkillIds: Schema.Array(Schema.String),\n pushedAtMs: Schema.optional(Schema.NonNegativeInt),\n activatedAtMs: Schema.optional(Schema.NonNegativeInt),\n});\nexport type KernelCapabilityManifestPlugin = Schema.Schema.Type<\n typeof KernelCapabilityManifestPlugin\n>;\n\nexport const KernelCapabilityManifestMcpServer = Schema.Struct({\n serverId: Schema.String,\n pluginId: Schema.String,\n runtimeSourceId: Schema.optional(Schema.String),\n status: KernelCapabilityLifecycleStatus,\n configPath: Schema.optional(Schema.String),\n toolCount: Schema.optional(Schema.NonNegativeInt),\n tools: Schema.optional(Schema.Array(Schema.Struct({\n toolName: Schema.String,\n slug: Schema.String,\n description: Schema.optional(Schema.String),\n readOnly: Schema.Boolean,\n sandboxRequired: Schema.Boolean,\n }))),\n managedBy: KernelCapabilityManagedBy,\n updatedAtMs: Schema.NonNegativeInt,\n});\nexport type KernelCapabilityManifestMcpServer = Schema.Schema.Type<\n typeof KernelCapabilityManifestMcpServer\n>;\n\nexport const KernelCapabilityManifestCliTool = Schema.Struct({\n toolId: Schema.String,\n pluginId: Schema.String,\n runtimeSourceId: Schema.optional(Schema.String),\n command: Schema.optional(Schema.String),\n args: Schema.optional(Schema.Array(Schema.String)),\n packageName: Schema.optional(Schema.String),\n binName: Schema.optional(Schema.String),\n status: KernelCapabilityLifecycleStatus,\n managedBy: KernelCapabilityManagedBy,\n updatedAtMs: Schema.NonNegativeInt,\n});\nexport type KernelCapabilityManifestCliTool = Schema.Schema.Type<\n typeof KernelCapabilityManifestCliTool\n>;\n\nexport const KernelCapabilityManifestApp = Schema.Struct({\n appId: Schema.String,\n pluginId: Schema.String,\n runtimeSourceId: Schema.optional(Schema.String),\n status: KernelCapabilityLifecycleStatus,\n connectorId: Schema.optional(Schema.String),\n connectedAccountId: Schema.optional(Schema.String),\n userId: Schema.optional(Schema.String),\n accountLabel: Schema.optional(Schema.String),\n toolCount: Schema.optional(Schema.NonNegativeInt),\n tools: Schema.optional(Schema.Array(Schema.Struct({\n toolName: Schema.String,\n slug: Schema.String,\n description: Schema.optional(Schema.String),\n readOnly: Schema.Boolean,\n sandboxRequired: Schema.Boolean,\n }))),\n managedBy: KernelCapabilityManagedBy,\n updatedAtMs: Schema.NonNegativeInt,\n});\nexport type KernelCapabilityManifestApp = Schema.Schema.Type<\n typeof KernelCapabilityManifestApp\n>;\n\nexport const KernelCapabilityManifestClientConfig = Schema.Struct({\n clientId: Schema.String,\n pluginId: Schema.String,\n configPath: Schema.String,\n status: KernelCapabilityLifecycleStatus,\n managedBy: KernelCapabilityManagedBy,\n updatedAtMs: Schema.NonNegativeInt,\n});\nexport type KernelCapabilityManifestClientConfig = Schema.Schema.Type<\n typeof KernelCapabilityManifestClientConfig\n>;\n\nexport const KernelCapabilityManifest = Schema.Struct({\n version: Schema.Literal(1),\n generatedAtMs: Schema.NonNegativeInt,\n skills: Schema.Array(KernelCapabilityManifestSkill),\n plugins: Schema.Array(KernelCapabilityManifestPlugin),\n mcpServers: Schema.Array(KernelCapabilityManifestMcpServer),\n cliTools: Schema.Array(KernelCapabilityManifestCliTool),\n apps: Schema.Array(KernelCapabilityManifestApp),\n clientConfigs: Schema.Array(KernelCapabilityManifestClientConfig),\n});\nexport type KernelCapabilityManifest = Schema.Schema.Type<typeof KernelCapabilityManifest>;\n\nexport const KernelPluginLifecycleInstallLogStatus = Schema.Literal(\n 'pending',\n 'complete',\n 'blocked',\n 'error',\n 'skipped',\n);\nexport type KernelPluginLifecycleInstallLogStatus = Schema.Schema.Type<\n typeof KernelPluginLifecycleInstallLogStatus\n>;\n\nexport const KernelPluginLifecycleInstallLogEntry = Schema.Struct({\n stepId: Schema.String,\n status: KernelPluginLifecycleInstallLogStatus,\n message: Schema.String,\n timestampMs: Schema.NonNegativeInt,\n touchedPaths: Schema.Array(Schema.String),\n});\nexport type KernelPluginLifecycleInstallLogEntry = Schema.Schema.Type<\n typeof KernelPluginLifecycleInstallLogEntry\n>;\n\nexport const KernelPluginLifecycleTargetState = Schema.Struct({\n agentName: Schema.String,\n displayName: Schema.optional(Schema.String),\n kind: KernelAssignmentTargetKind,\n remoteUrl: Schema.optional(Schema.String),\n status: KernelCapabilityLifecycleStatus,\n assignedSkillIds: Schema.Array(Schema.String),\n mcpServers: Schema.Array(Schema.String),\n cliTools: Schema.Array(Schema.String),\n apps: Schema.Array(Schema.String),\n diagnostics: Schema.Array(Schema.String),\n pushedAtMs: Schema.optional(Schema.NonNegativeInt),\n activatedAtMs: Schema.optional(Schema.NonNegativeInt),\n});\nexport type KernelPluginLifecycleTargetState = Schema.Schema.Type<\n typeof KernelPluginLifecycleTargetState\n>;\n\nexport const KernelPluginLifecycleOperation = Schema.Literal(\n 'push',\n 'activate',\n 'disable',\n 'delete',\n 'repair',\n);\nexport type KernelPluginLifecycleOperation = Schema.Schema.Type<\n typeof KernelPluginLifecycleOperation\n>;\n\nexport const KernelPluginLifecycleOperationRequest = Schema.Struct({\n targets: Schema.optional(Schema.Array(Schema.String)),\n agent: Schema.optional(Schema.String),\n installDependencies: Schema.optional(Schema.Boolean),\n writeClientConfigs: Schema.optional(Schema.Boolean),\n});\nexport type KernelPluginLifecycleOperationRequest = Schema.Schema.Type<\n typeof KernelPluginLifecycleOperationRequest\n>;\n\nexport const KernelPluginLifecycleOperationTargetResult = Schema.Struct({\n agentName: Schema.String,\n kind: KernelAssignmentTargetKind,\n ok: Schema.Boolean,\n status: KernelCapabilityLifecycleStatus,\n diagnostics: Schema.Array(Schema.String),\n touchedPaths: Schema.Array(Schema.String),\n remote: Schema.optional(Schema.Boolean),\n});\nexport type KernelPluginLifecycleOperationTargetResult = Schema.Schema.Type<\n typeof KernelPluginLifecycleOperationTargetResult\n>;\n\nexport const KernelPluginLifecycleOperationResult = Schema.Struct({\n pluginId: Schema.String,\n operation: KernelPluginLifecycleOperation,\n results: Schema.Array(KernelPluginLifecycleOperationTargetResult),\n});\nexport type KernelPluginLifecycleOperationResult = Schema.Schema.Type<\n typeof KernelPluginLifecycleOperationResult\n>;\n\nexport const KernelComposerCapabilitySuggestion = Schema.Struct({\n id: Schema.String,\n kind: Schema.Literal('skill', 'connector-tool', 'mcp-tool', 'cli-tool', 'default-prompt'),\n label: Schema.String,\n description: Schema.optional(Schema.String),\n pluginId: Schema.optional(Schema.String),\n skillId: Schema.optional(Schema.String),\n actionId: Schema.optional(Schema.String),\n connectorId: Schema.optional(Schema.String),\n mcpServerId: Schema.optional(Schema.String),\n cliToolId: Schema.optional(Schema.String),\n toolName: Schema.optional(Schema.String),\n runtimeSourceId: Schema.optional(Schema.String),\n insertText: Schema.String,\n confidence: Schema.optional(Schema.Number),\n matchedKeywords: Schema.optional(Schema.Array(Schema.String)),\n requiresAuth: Schema.Boolean,\n unavailableReason: Schema.optional(Schema.String),\n attachment: Schema.optional(TurnCapabilityAttachment),\n});\nexport type KernelComposerCapabilitySuggestion = Schema.Schema.Type<\n typeof KernelComposerCapabilitySuggestion\n>;\n\nexport const KernelComposerCapabilitySearchResponse = Schema.Struct({\n agentName: Schema.String,\n workspaceId: Schema.optional(Schema.String),\n query: Schema.String,\n suggestions: Schema.Array(KernelComposerCapabilitySuggestion),\n});\nexport type KernelComposerCapabilitySearchResponse = Schema.Schema.Type<\n typeof KernelComposerCapabilitySearchResponse\n>;\n\nexport const decodeKernelAssignmentSummary = Schema.decodeUnknownSync(KernelAssignmentSummary);\nexport const encodeKernelAssignmentSummary = Schema.encodeSync(KernelAssignmentSummary);\nexport const decodeKernelAssignmentPatch = Schema.decodeUnknownSync(KernelAssignmentPatch);\nexport const decodeKernelPluginLifecycleOperationRequest = Schema.decodeUnknownSync(\n KernelPluginLifecycleOperationRequest,\n);\nexport const encodeKernelPluginLifecycleOperationResult = Schema.encodeSync(\n KernelPluginLifecycleOperationResult,\n);\nexport const decodeKernelComposerCapabilitySearchResponse = Schema.decodeUnknownSync(\n KernelComposerCapabilitySearchResponse,\n);\nexport const encodeKernelComposerCapabilitySearchResponse = Schema.encodeSync(\n KernelComposerCapabilitySearchResponse,\n);\n","import { Schema } from 'effect';\n\nexport const TurnCapabilityAttachmentKind = Schema.Literal(\n 'skill',\n 'connector-tool',\n 'mcp-tool',\n 'cli-tool',\n 'default-prompt',\n);\nexport type TurnCapabilityAttachmentKind = Schema.Schema.Type<typeof TurnCapabilityAttachmentKind>;\n\nexport const TurnCapabilityAttachmentStatus = Schema.Literal(\n 'available',\n 'active',\n 'blocked',\n 'error',\n);\nexport type TurnCapabilityAttachmentStatus = Schema.Schema.Type<typeof TurnCapabilityAttachmentStatus>;\n\nexport const TurnCapabilityAttachment = Schema.Struct({\n attachmentId: Schema.String,\n pluginId: Schema.String,\n kind: TurnCapabilityAttachmentKind,\n skillId: Schema.optional(Schema.String),\n connectorId: Schema.optional(Schema.String),\n actionId: Schema.optional(Schema.String),\n mcpServerId: Schema.optional(Schema.String),\n cliToolId: Schema.optional(Schema.String),\n toolName: Schema.optional(Schema.String),\n runtimeSourceId: Schema.optional(Schema.String),\n label: Schema.String,\n insertText: Schema.String,\n requiresAuth: Schema.Boolean,\n status: TurnCapabilityAttachmentStatus,\n disabledReason: Schema.optional(Schema.String),\n});\nexport type TurnCapabilityAttachment = Schema.Schema.Type<typeof TurnCapabilityAttachment>;\n\nexport const decodeTurnCapabilityAttachment = Schema.decodeUnknownSync(TurnCapabilityAttachment);\nexport const encodeTurnCapabilityAttachment = Schema.encodeSync(TurnCapabilityAttachment);\n","import { Schema } from 'effect';\nimport { KernelComposioSecretStatus } from './assignments.js';\n\nexport const EcoAddonExtensionClass = Schema.Literal('kyberagent-native', 'kyberagent-hybrid', 'codex-derived');\nexport type EcoAddonExtensionClass = Schema.Schema.Type<typeof EcoAddonExtensionClass>;\n\nexport const EcoAddonStatus = Schema.Literal('available', 'installed', 'ready', 'authRequired', 'disabled', 'failed');\nexport type EcoAddonStatus = Schema.Schema.Type<typeof EcoAddonStatus>;\n\nexport const EcoAddonPrimaryAction = Schema.Literal('add', 'remove', 'ready', 'configure');\nexport type EcoAddonPrimaryAction = Schema.Schema.Type<typeof EcoAddonPrimaryAction>;\n\nexport const EcoAddonSourceScope = Schema.Literal('desktop-bootstrap', 'marketplace', 'local-daemon', 'remote-daemon', 'bundled');\nexport type EcoAddonSourceScope = Schema.Schema.Type<typeof EcoAddonSourceScope>;\n\nexport const PluginRuntimeSourceKind = Schema.Literal('api', 'mcp', 'cli', 'composio', 'codex-apps', 'sidecar');\nexport type PluginRuntimeSourceKind = Schema.Schema.Type<typeof PluginRuntimeSourceKind>;\n\nexport const ProviderRuntimeProjectionTarget = Schema.Literal('direct-api', 'codex-app-server', 'claude-agent-sdk', 'pi-agent-core');\nexport type ProviderRuntimeProjectionTarget = Schema.Schema.Type<typeof ProviderRuntimeProjectionTarget>;\n\nexport const ProviderRuntimeProjectionSurface = Schema.Literal(\n 'tool-schema',\n 'dynamic-tool',\n 'mcp-server',\n 'skill-context',\n 'host-surface',\n);\nexport type ProviderRuntimeProjectionSurface = Schema.Schema.Type<typeof ProviderRuntimeProjectionSurface>;\n\nexport const ProviderRuntimeProjectionDescriptor = Schema.Struct({\n target: ProviderRuntimeProjectionTarget,\n surface: ProviderRuntimeProjectionSurface,\n runtimeSourceId: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n toolIds: Schema.optional(Schema.Array(Schema.String)),\n alwaysLoad: Schema.optional(Schema.Boolean),\n notes: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type ProviderRuntimeProjectionDescriptor = Schema.Schema.Type<typeof ProviderRuntimeProjectionDescriptor>;\n\nexport const PluginRuntimeSourceDescriptor = Schema.Struct({\n kind: PluginRuntimeSourceKind,\n id: Schema.String,\n label: Schema.String,\n entrypoint: Schema.optional(Schema.String),\n authRequired: Schema.optional(Schema.Boolean),\n providerProjections: Schema.optional(Schema.Array(ProviderRuntimeProjectionDescriptor)),\n});\nexport type PluginRuntimeSourceDescriptor = Schema.Schema.Type<typeof PluginRuntimeSourceDescriptor>;\n\nexport const EcoAddonTargetInstallStatus = Schema.Literal('not-installed', 'installing', 'installed', 'active', 'blocked', 'failed');\nexport type EcoAddonTargetInstallStatus = Schema.Schema.Type<typeof EcoAddonTargetInstallStatus>;\n\nexport const EcoAddonInstallTargetState = Schema.Struct({\n agentKey: Schema.String,\n kind: Schema.Literal('local', 'remote'),\n status: EcoAddonTargetInstallStatus,\n daemonConfirmed: Schema.Boolean,\n threadUsable: Schema.optional(Schema.Boolean),\n threadReadinessReason: Schema.optional(Schema.String),\n remoteUrl: Schema.optional(Schema.String),\n installedAtMs: Schema.optional(Schema.NonNegativeInt),\n activatedAtMs: Schema.optional(Schema.NonNegativeInt),\n reason: Schema.optional(Schema.String),\n});\nexport type EcoAddonInstallTargetState = Schema.Schema.Type<typeof EcoAddonInstallTargetState>;\n\nexport const EcoAddonActivationApp = Schema.Struct({\n appId: Schema.String,\n name: Schema.String,\n needsAuth: Schema.Boolean,\n tools: Schema.Array(Schema.String),\n externalAppId: Schema.optional(Schema.String),\n externalAppKind: Schema.optional(Schema.Literal('codex-connector', 'codex-app-sdk', 'unknown')),\n replacementRuntimeRequired: Schema.optional(Schema.Boolean),\n runtimeStatusReason: Schema.optional(Schema.String),\n});\nexport type EcoAddonActivationApp = Schema.Schema.Type<typeof EcoAddonActivationApp>;\n\nexport const EcoAddonActivationState = Schema.Struct({\n addonId: Schema.String,\n pluginName: Schema.String,\n scope: Schema.String,\n status: EcoAddonStatus,\n ready: Schema.Boolean,\n installed: Schema.Boolean,\n enabled: Schema.Boolean,\n authRequired: Schema.Boolean,\n apps: Schema.Array(EcoAddonActivationApp),\n diagnostics: Schema.Array(Schema.String),\n refreshedAt: Schema.String,\n});\nexport type EcoAddonActivationState = Schema.Schema.Type<typeof EcoAddonActivationState>;\n\nexport const KernelEcoAddon = Schema.Struct({\n addonId: Schema.String,\n pluginId: Schema.String,\n displayName: Schema.String,\n version: Schema.String,\n kind: Schema.Literal('kyberagent-plugin', 'composio-connector', 'mcp-server', 'skill-pack'),\n provenance: EcoAddonExtensionClass,\n extensionClass: EcoAddonExtensionClass,\n sourceLabel: Schema.String,\n source: Schema.String,\n sourceScope: EcoAddonSourceScope,\n uiPronounced: Schema.Boolean,\n enabled: Schema.Boolean,\n dependencyFlags: Schema.Array(Schema.String),\n hostAffordances: Schema.Array(Schema.String),\n skills: Schema.Array(Schema.String),\n apps: Schema.Array(EcoAddonActivationApp),\n mcpServers: Schema.Array(Schema.String),\n hooks: Schema.Array(Schema.String),\n defaultPrompts: Schema.Array(Schema.String),\n capabilities: Schema.Array(Schema.String),\n sidecarRuntimes: Schema.Array(Schema.String),\n permissions: Schema.Array(Schema.String),\n runtimeSources: Schema.optional(Schema.Array(PluginRuntimeSourceDescriptor)),\n});\nexport type KernelEcoAddon = Schema.Schema.Type<typeof KernelEcoAddon>;\n\nexport const EcoAddonCardSummary = Schema.Struct({\n addon: KernelEcoAddon,\n state: EcoAddonActivationState,\n description: Schema.optional(Schema.String),\n developerName: Schema.optional(Schema.String),\n marketplaceName: Schema.optional(Schema.String),\n capabilityLabels: Schema.Array(Schema.String),\n primaryAction: EcoAddonPrimaryAction,\n capabilityShape: Schema.Literal('connector-plus-skills', 'connector-only', 'skills-only', 'mcp-server', 'sidecar-helper', 'mixed'),\n runtimeSource: Schema.Literal('kyberagent', 'composio', 'codex-apps', 'mcp'),\n toolCoverageCount: Schema.NonNegativeInt,\n provenance: EcoAddonExtensionClass,\n extensionClass: EcoAddonExtensionClass,\n sourceLabel: Schema.String,\n dependencyFlags: Schema.Array(Schema.String),\n hostAffordances: Schema.Array(Schema.String),\n parityGaps: Schema.Array(Schema.String),\n installStateByTarget: Schema.Array(EcoAddonInstallTargetState),\n});\nexport type EcoAddonCardSummary = Schema.Schema.Type<typeof EcoAddonCardSummary>;\n\nexport const EcoAddonInstallStep = Schema.Struct({\n stepId: Schema.String,\n kind: Schema.Literal('plugin-install', 'app-connect', 'skill-config', 'mcp-auth', 'sidecar-grant', 'ui-promotion'),\n label: Schema.String,\n description: Schema.String,\n status: Schema.Literal('pending', 'complete', 'blocked', 'optional'),\n actionLabel: Schema.optional(Schema.String),\n targetId: Schema.optional(Schema.String),\n});\nexport type EcoAddonInstallStep = Schema.Schema.Type<typeof EcoAddonInstallStep>;\n\nexport const EcoAddonInstallPlan = Schema.Struct({\n addonId: Schema.String,\n title: Schema.String,\n steps: Schema.Array(EcoAddonInstallStep),\n blocked: Schema.Boolean,\n});\nexport type EcoAddonInstallPlan = Schema.Schema.Type<typeof EcoAddonInstallPlan>;\n\nexport const CapabilityPluginCatalogEntry = Schema.Struct({\n pluginId: Schema.String,\n name: Schema.String,\n description: Schema.optional(Schema.String),\n kind: Schema.Literal('kyberagent-plugin', 'composio-connector', 'codex-derived-plugin', 'mcp'),\n status: Schema.String,\n requiresAuth: Schema.Boolean,\n toolCount: Schema.NonNegativeInt,\n providesSkillTemplates: Schema.Boolean,\n});\nexport type CapabilityPluginCatalogEntry = Schema.Schema.Type<typeof CapabilityPluginCatalogEntry>;\n\nexport const CapabilitySkillInstallTarget = Schema.Struct({\n agentKey: Schema.String,\n kind: Schema.optional(Schema.Literal('local', 'remote')),\n installed: Schema.Boolean,\n ready: Schema.Boolean,\n status: Schema.Literal('installed', 'not-installed', 'blocked'),\n daemonConfirmed: Schema.optional(Schema.Boolean),\n remoteUrl: Schema.optional(Schema.String),\n reason: Schema.optional(Schema.String),\n});\nexport type CapabilitySkillInstallTarget = Schema.Schema.Type<typeof CapabilitySkillInstallTarget>;\n\nexport const CapabilitySkillCatalogEntry = Schema.Struct({\n skillId: Schema.String,\n name: Schema.String,\n description: Schema.optional(Schema.String),\n provenance: Schema.Literal('bundled-with-plugin', 'bundled-with-extension', 'standalone', 'daemon-existing', 'remote-existing'),\n sourcePluginId: Schema.optional(Schema.String),\n sourceExtensionId: Schema.optional(Schema.String),\n requiresConnectors: Schema.Array(Schema.String),\n requiresEnv: Schema.Array(Schema.String),\n installTargets: Schema.Array(CapabilitySkillInstallTarget),\n});\nexport type CapabilitySkillCatalogEntry = Schema.Schema.Type<typeof CapabilitySkillCatalogEntry>;\n\nexport const ConnectorCatalogEntry = Schema.Struct({\n connectorId: Schema.String,\n name: Schema.String,\n description: Schema.optional(Schema.String),\n status: Schema.Literal('available', 'connected', 'unavailable'),\n binding: Schema.Struct({\n status: Schema.Literal('available', 'connected', 'auth-required', 'unavailable'),\n }),\n tools: Schema.Array(\n Schema.Struct({\n toolName: Schema.String,\n description: Schema.optional(Schema.String),\n }),\n ),\n});\nexport type ConnectorCatalogEntry = Schema.Schema.Type<typeof ConnectorCatalogEntry>;\n\nexport const ComposioSettingsState = Schema.Struct({\n configured: Schema.Boolean,\n source: Schema.String,\n apiKeyRedacted: Schema.optional(Schema.String),\n status: KernelComposioSecretStatus,\n});\nexport type ComposioSettingsState = Schema.Schema.Type<typeof ComposioSettingsState>;\n\nexport const MarketplaceTrust = Schema.Literal('official', 'trusted', 'restricted');\nexport type MarketplaceTrust = Schema.Schema.Type<typeof MarketplaceTrust>;\n\nexport const PluginMarketplace = Schema.Struct({\n id: Schema.String,\n url: Schema.String,\n trust: MarketplaceTrust,\n name: Schema.String,\n version: Schema.optional(Schema.String),\n pluginCount: Schema.NonNegativeInt,\n refreshedAtMs: Schema.optional(Schema.NonNegativeInt),\n});\nexport type PluginMarketplace = Schema.Schema.Type<typeof PluginMarketplace>;\n\nexport const EcoAddonSkillConfigWriteRequest = Schema.Struct({\n skillId: Schema.String,\n agentKeys: Schema.Array(Schema.String),\n action: Schema.Literal('install', 'remove'),\n overwrite: Schema.optional(Schema.Boolean),\n});\nexport type EcoAddonSkillConfigWriteRequest = Schema.Schema.Type<typeof EcoAddonSkillConfigWriteRequest>;\n\nexport const EcoAddonTargetMutationRequest = Schema.Struct({\n addonId: Schema.String,\n targets: Schema.optional(Schema.Array(Schema.String)),\n agent: Schema.optional(Schema.String),\n installSkills: Schema.optional(Schema.Boolean),\n overwrite: Schema.optional(Schema.Boolean),\n});\nexport type EcoAddonTargetMutationRequest = Schema.Schema.Type<typeof EcoAddonTargetMutationRequest>;\n\nexport const decodeEcoAddonCardSummary = Schema.decodeUnknownSync(EcoAddonCardSummary);\nexport const decodeEcoAddonSkillConfigWriteRequest = Schema.decodeUnknownSync(EcoAddonSkillConfigWriteRequest);\nexport const decodeEcoAddonTargetMutationRequest = Schema.decodeUnknownSync(EcoAddonTargetMutationRequest);\n","import { Schema } from 'effect';\nimport { HostCapabilityId } from '../host/capabilities.js';\n\n// 'user' = a human principal resolved from a verified identity token (identity/principal.ts);\n// lets the Org→User→Device identity surface through the seam (docs/66 §3, AC1.4).\nexport const KernelPrincipalKind = Schema.Literal('daemon', 'host', 'plugin', 'skill', 'sidecar', 'bridge', 'user');\nexport type KernelPrincipalKind = Schema.Schema.Type<typeof KernelPrincipalKind>;\n\nexport const KernelPermissionId = Schema.Literal(\n 'kernel.registry.read',\n 'plugin.lifecycle.manage',\n 'host.capabilities.read',\n 'surface.render',\n 'composer.capabilities.read',\n 'composer.capabilities.invoke',\n 'sidecars.launch',\n 'threads.read',\n 'threads.write',\n 'settings.read',\n 'settings.write',\n 'artifacts.read',\n 'artifacts.write',\n 'screenshots.capture',\n 'brain.read',\n // A1 shared-capability layer (docs/42 #2, KYB-124): an extension may read a\n // serialized HOST-CONTEXT snapshot (the active agent, …) over the gated seam.\n // The host stays the capability holder; the extension only gets a snapshot.\n 'host.context.read',\n // A1 (docs/42 #2): an extension may REQUEST the host to run an allowlisted\n // command by name (ext→host action). The host authorizes + runs it; the\n // extension never acts directly — it asks the host by name.\n 'host.command.invoke',\n // host.log (docs/76 · ADR-0054, KYB-214): an extension may WRITE a diagnostic\n // log line into the host's durable log (ext→host). The host stamps the\n // extension identity from the frame origin, clamps the level to debug/info/warn\n // (never error/fatal), and rate/size-caps. Sandboxed iframes have no console;\n // this is their gated, attributable diagnostic path.\n 'host.log.write',\n);\nexport type KernelPermissionId = Schema.Schema.Type<typeof KernelPermissionId>;\n\nexport const PluginContributionKind = Schema.Literal(\n 'skillTemplate',\n 'composerCapability',\n 'surface',\n 'settingsPanel',\n 'sidecar',\n 'bridge',\n 'providerAdapter',\n 'contextualAction',\n 'dataEndpoint',\n);\nexport type PluginContributionKind = Schema.Schema.Type<typeof PluginContributionKind>;\n\nexport const ExtensionHostSlot = Schema.Literal(\n 'nav.sidebar',\n 'workspace.surface',\n 'settings.extensions',\n 'chat.visual',\n 'thread.tab.contextMenu',\n 'companion.overlay',\n 'background.sidecar',\n);\nexport type ExtensionHostSlot = Schema.Schema.Type<typeof ExtensionHostSlot>;\n\nexport const WorkspaceTabContributionMetadata = Schema.Struct({\n defaultVisible: Schema.optional(Schema.Boolean),\n defaultLabel: Schema.optional(Schema.String),\n allowRename: Schema.optional(Schema.Boolean),\n});\nexport type WorkspaceTabContributionMetadata = Schema.Schema.Type<\n typeof WorkspaceTabContributionMetadata\n>;\n\nexport const PluginManifestContribution = Schema.Struct({\n contributionId: Schema.String,\n kind: PluginContributionKind,\n displayName: Schema.String,\n requiredHostCapabilities: Schema.Array(HostCapabilityId),\n requiredKernelPermissions: Schema.optional(Schema.Array(KernelPermissionId)),\n routeSegment: Schema.optional(Schema.String),\n mount: Schema.optional(Schema.String),\n presentationClass: Schema.optional(Schema.String),\n hostSlots: Schema.optional(Schema.Array(ExtensionHostSlot)),\n workspaceTab: Schema.optional(WorkspaceTabContributionMetadata),\n});\nexport type PluginManifestContribution = Schema.Schema.Type<typeof PluginManifestContribution>;\n\nexport const PluginThemeTokenMode = Schema.Literal('light', 'dark');\nexport type PluginThemeTokenMode = Schema.Schema.Type<typeof PluginThemeTokenMode>;\n\nexport const PluginThemeTokenSet = Schema.Struct({\n themeId: Schema.String,\n label: Schema.String,\n description: Schema.optional(Schema.String),\n modes: Schema.Array(PluginThemeTokenMode),\n tokens: Schema.Record({\n key: PluginThemeTokenMode,\n value: Schema.Record({ key: Schema.String, value: Schema.String }),\n }),\n});\nexport type PluginThemeTokenSet = Schema.Schema.Type<typeof PluginThemeTokenSet>;\n\n// KYB-202 (ADR-0060 §5, docs/60 §51 \"THE FORK\"): the DECLARED default-activation\n// state of an extension. Replaces the hardcoded `CORE_ACTIVE_EXTENSIONS` allowlist\n// in `seam/registry.ts` — a manifest-visible fact the generator, drift-check and\n// the daemon boot can all read, instead of a constant only the daemon knows.\n// `active` = ships auto-activated on a fresh install (the \"core\" surfaces); absent\n// or `inactive` = arrives inactive under default-deny (KYB-192) and must be turned\n// on by the user. This is the DISTRIBUTION/default-state tier, orthogonal to the\n// surface mount (`web/` in-proc vs `iframe/` sandboxed). The trust tier itself\n// (bundled vs installed) is already carried by `source` ('bundled' | 'user'); an\n// installed (`source: 'user'`) extension can never ship active (ADR-0060 §4/§5).\nexport const PluginShipsState = Schema.Literal('active', 'inactive');\nexport type PluginShipsState = Schema.Schema.Type<typeof PluginShipsState>;\n\nexport const PluginManifestSummary = Schema.Struct({\n pluginId: Schema.String,\n displayName: Schema.String,\n version: Schema.String,\n source: Schema.Literal('bundled', 'workspace', 'user', 'remote'),\n manifestPath: Schema.optional(Schema.String),\n contributions: Schema.Array(PluginManifestContribution),\n themeTokens: Schema.optional(Schema.Array(PluginThemeTokenSet)),\n ships: Schema.optional(PluginShipsState),\n});\nexport type PluginManifestSummary = Schema.Schema.Type<typeof PluginManifestSummary>;\n\nexport const PluginManifestDiscoveryCandidate = Schema.Struct({\n pluginRoot: Schema.String,\n manifestPath: Schema.String,\n source: Schema.Literal('bundled', 'workspace', 'user', 'remote'),\n});\nexport type PluginManifestDiscoveryCandidate = Schema.Schema.Type<\n typeof PluginManifestDiscoveryCandidate\n>;\n\nexport const PluginEnablementState = Schema.Literal('enabled', 'disabled');\nexport type PluginEnablementState = Schema.Schema.Type<typeof PluginEnablementState>;\n\nexport const PluginRuntimeState = Schema.Literal('inactive', 'active', 'blocked', 'error');\nexport type PluginRuntimeState = Schema.Schema.Type<typeof PluginRuntimeState>;\n\nexport const KernelPluginRegistryEntry = Schema.Struct({\n manifest: PluginManifestSummary,\n enablement: PluginEnablementState,\n runtimeState: PluginRuntimeState,\n grantedPermissions: Schema.Array(KernelPermissionId),\n deniedPermissions: Schema.Array(KernelPermissionId),\n});\nexport type KernelPluginRegistryEntry = Schema.Schema.Type<typeof KernelPluginRegistryEntry>;\n\nexport const KernelSurfaceAvailability = Schema.Struct({\n surfaceId: Schema.String,\n pluginId: Schema.String,\n available: Schema.Boolean,\n hostSlots: Schema.optional(Schema.Array(ExtensionHostSlot)),\n requiredHostCapabilities: Schema.Array(HostCapabilityId),\n requiredKernelPermissions: Schema.optional(Schema.Array(KernelPermissionId)),\n missingHostCapabilities: Schema.Array(HostCapabilityId),\n missingKernelPermissions: Schema.optional(Schema.Array(KernelPermissionId)),\n deniedKernelPermissions: Schema.optional(Schema.Array(KernelPermissionId)),\n});\nexport type KernelSurfaceAvailability = Schema.Schema.Type<typeof KernelSurfaceAvailability>;\n\nexport const KernelContributionAvailability = Schema.Struct({\n contributionId: Schema.String,\n pluginId: Schema.String,\n kind: PluginContributionKind,\n available: Schema.Boolean,\n hostSlots: Schema.optional(Schema.Array(ExtensionHostSlot)),\n requiredHostCapabilities: Schema.Array(HostCapabilityId),\n requiredKernelPermissions: Schema.Array(KernelPermissionId),\n missingHostCapabilities: Schema.Array(HostCapabilityId),\n missingKernelPermissions: Schema.Array(KernelPermissionId),\n deniedKernelPermissions: Schema.Array(KernelPermissionId),\n});\nexport type KernelContributionAvailability = Schema.Schema.Type<\n typeof KernelContributionAvailability\n>;\n\nexport const KernelRegistrySnapshot = Schema.Struct({\n generatedAtMs: Schema.NonNegativeInt,\n owner: Schema.Literal('daemon/kernel'),\n plugins: Schema.Array(KernelPluginRegistryEntry),\n permissions: Schema.Array(\n Schema.Struct({\n principalKind: KernelPrincipalKind,\n principalId: Schema.String,\n granted: Schema.Array(KernelPermissionId),\n denied: Schema.Array(KernelPermissionId),\n }),\n ),\n availableHostCapabilities: Schema.Array(HostCapabilityId),\n contributions: Schema.Array(KernelContributionAvailability),\n surfaces: Schema.Array(KernelSurfaceAvailability),\n});\nexport type KernelRegistrySnapshot = Schema.Schema.Type<typeof KernelRegistrySnapshot>;\n\nexport const decodeKernelRegistrySnapshot = Schema.decodeUnknownSync(KernelRegistrySnapshot);\nexport const encodeKernelRegistrySnapshot = Schema.encodeSync(KernelRegistrySnapshot);\nexport const decodePluginManifestDiscoveryCandidate = Schema.decodeUnknownSync(\n PluginManifestDiscoveryCandidate,\n);\nexport const encodePluginManifestDiscoveryCandidate = Schema.encodeSync(\n PluginManifestDiscoveryCandidate,\n);\n","import { Schema } from 'effect';\n\nexport const HostKind = Schema.Literal('desktop', 'web', 'cli', 'sidecar', 'bridge');\nexport type HostKind = Schema.Schema.Type<typeof HostKind>;\n\nexport const HostCapabilityId = Schema.Literal(\n 'host.windows',\n 'host.tray',\n 'host.notifications',\n 'host.embeddedViews',\n 'host.filePicker',\n 'host.localShell',\n 'host.secretPrompt',\n 'host.visualSelection',\n 'host.localFilesystem',\n 'host.terminal',\n 'host.globalInput',\n 'host.contextMenus',\n 'host.accessibility',\n);\nexport type HostCapabilityId = Schema.Schema.Type<typeof HostCapabilityId>;\n\nexport const HostIdentity = Schema.Struct({\n hostId: Schema.String,\n kind: HostKind,\n displayName: Schema.String,\n});\nexport type HostIdentity = Schema.Schema.Type<typeof HostIdentity>;\n\nexport const HostRegistrationRequest = Schema.Struct({\n host: HostIdentity,\n capabilities: Schema.Array(HostCapabilityId),\n heartbeatIntervalMs: Schema.NonNegativeInt,\n observedAtMs: Schema.NonNegativeInt,\n});\nexport type HostRegistrationRequest = Schema.Schema.Type<typeof HostRegistrationRequest>;\n\nexport const HostHeartbeatRequest = Schema.Struct({\n hostId: Schema.String,\n observedAtMs: Schema.NonNegativeInt,\n});\nexport type HostHeartbeatRequest = Schema.Schema.Type<typeof HostHeartbeatRequest>;\n\nexport const RegisteredHost = Schema.Struct({\n host: HostIdentity,\n capabilities: Schema.Array(HostCapabilityId),\n heartbeatIntervalMs: Schema.NonNegativeInt,\n lastHeartbeatAtMs: Schema.NonNegativeInt,\n});\nexport type RegisteredHost = Schema.Schema.Type<typeof RegisteredHost>;\n\nexport const SurfaceCapabilityRequirement = Schema.Struct({\n surfaceId: Schema.String,\n requiredCapabilities: Schema.Array(HostCapabilityId),\n});\nexport type SurfaceCapabilityRequirement = Schema.Schema.Type<typeof SurfaceCapabilityRequirement>;\n\nexport const SurfaceAvailability = Schema.Struct({\n surfaceId: Schema.String,\n available: Schema.Boolean,\n missingCapabilities: Schema.Array(HostCapabilityId),\n});\nexport type SurfaceAvailability = Schema.Schema.Type<typeof SurfaceAvailability>;\n\nexport const HostCapabilityAvailabilitySnapshot = Schema.Struct({\n generatedAtMs: Schema.NonNegativeInt,\n hosts: Schema.Array(RegisteredHost),\n availableCapabilities: Schema.Array(HostCapabilityId),\n surfaces: Schema.Array(SurfaceAvailability),\n});\nexport type HostCapabilityAvailabilitySnapshot = Schema.Schema.Type<\n typeof HostCapabilityAvailabilitySnapshot\n>;\n\nexport const decodeHostRegistrationRequest = Schema.decodeUnknownSync(HostRegistrationRequest);\nexport const encodeHostRegistrationRequest = Schema.encodeSync(HostRegistrationRequest);\nexport const decodeHostHeartbeatRequest = Schema.decodeUnknownSync(HostHeartbeatRequest);\nexport const encodeHostHeartbeatRequest = Schema.encodeSync(HostHeartbeatRequest);\nexport const decodeHostCapabilityAvailabilitySnapshot = Schema.decodeUnknownSync(\n HostCapabilityAvailabilitySnapshot,\n);\nexport const encodeHostCapabilityAvailabilitySnapshot = Schema.encodeSync(\n HostCapabilityAvailabilitySnapshot,\n);\n","import type { PluginContributionKind } from './registry.js';\n\n/**\n * Contribution-id naming convention — convention-over-configuration for the seam.\n *\n * THE PROBLEM (seam audit, 2026-06-24): a `contributionId` is a free string. The\n * SDK validator only checked non-empty + unique, so the id's prefix was divorced\n * from its `kind` and from ownership. 85% of contributions happened to follow a\n * `<kind>.<ext>.<name>` convention by author discipline — but nothing enforced it,\n * and nothing stopped an extension from claiming a host-owned namespace.\n *\n * THE RULE: an extension-owned contributionId must start with the prefix its\n * `kind` predicts, and may never claim a host-owned prefix. Convention by default;\n * the `CONVENTION_EXCEPTIONS` set is the only escape hatch, and it is temporary.\n *\n * Shared here (contracts) because BOTH the SDK validator (`validateExtensionDefinition`)\n * and the capabilities generator must agree on it.\n */\n\n/** kind → the id prefix an EXTENSION-OWNED contribution of that kind must use. */\nexport const CONTRIBUTION_ID_PREFIX_BY_KIND: Record<PluginContributionKind, string> = {\n surface: 'surface',\n settingsPanel: 'settings',\n composerCapability: 'composer',\n contextualAction: 'contextualAction',\n sidecar: 'sidecar',\n bridge: 'bridge',\n dataEndpoint: 'data',\n skillTemplate: 'skill',\n providerAdapter: 'provider',\n};\n\n/**\n * Prefixes reserved for HOST-OWNED capabilities (the brain, host context/command,\n * …). An extension-declared contributionId may never start with one — the host\n * owns these namespaces; an extension is only ever their *consumer* via a gated\n * permission, never their owner. (Capability-model rule 1-4.)\n */\nexport const HOST_OWNED_ID_PREFIXES = ['host', 'brain'] as const;\n\n/**\n * Ids that predate the convention and are grandfathered so enforcement can land\n * WITHOUT (a) cementing a taxonomy still under review, (b) breaking an external\n * identifier, or (c) forcing a rename across the host boundary. Each entry has a\n * documented disposition; resolve it, then delete the entry. DO NOT add casually.\n *\n * Disposition by id (decision of record: docs/kdd/decisions/adr-0027-enforce-a-kind-owner-name-contribution-id-convention-with-re.md):\n * - `host.context`, `host.command` — RESOLVED (SPEC 5 Stage 5A): these were never\n * extension contributions — the host owns the capability. They are no longer\n * declared as fake host-prefixed dataEndpoints; the surface reaches them over\n * the seam gated purely by the `host.context.read` / `host.command.invoke`\n * permissions (handlers.ts registers + serves them). So they no longer need an\n * exception, and the host-owned-namespace reservation now rejects any attempt\n * to re-declare them as a contribution — which is the point.\n * - `gmail.search`, `gmail.send` — EXTERNAL-ID. These mirror Composio's own tool\n * ids; they appear in the user-facing `$gmail.search` composer-insert syntax and\n * across host stores (kernel-assignment-store, composio-runtime, ecosystem). They\n * are a third ownership category — externally-owned connector tools — that the\n * `<kind>.<ext>.<name>` rule does not (yet) model. Forcing `composer.*` would\n * break the external mapping. → needs a connector-aware convention, not a rename.\n */\nexport const CONVENTION_EXCEPTIONS: ReadonlySet<string> = new Set<string>([\n 'gmail.search',\n 'gmail.send',\n]);\n\nexport type ContributionIdVerdict = { ok: true } | { ok: false; error: string };\n\n/**\n * Pure check: does `contributionId` satisfy the convention for its `kind`?\n * Enforces (a) the kind→prefix rule and (b) the host-owned-namespace reservation.\n * Deliberately does NOT enforce a fixed segment count — existing ids range from\n * `surface.pets` (2) to `data.acme.companies` (3); only the prefix is load-bearing.\n */\nexport function validateContributionId(\n contributionId: string,\n kind: PluginContributionKind,\n): ContributionIdVerdict {\n const id = contributionId.trim();\n if (!id) return { ok: false, error: 'contributionId is required' };\n if (CONVENTION_EXCEPTIONS.has(id)) return { ok: true };\n\n const prefix = id.split('.')[0];\n\n if ((HOST_OWNED_ID_PREFIXES as readonly string[]).includes(prefix)) {\n return {\n ok: false,\n error: `contributionId \"${id}\" claims the host-owned namespace \"${prefix}.\": extensions may consume host capabilities via a permission but may never own this namespace`,\n };\n }\n\n const expected = CONTRIBUTION_ID_PREFIX_BY_KIND[kind];\n if (expected && prefix !== expected) {\n return {\n ok: false,\n error: `contributionId \"${id}\" must start with \"${expected}.\" for kind \"${kind}\" (convention <kind>.<ext>.<name>), got \"${prefix}.\"`,\n };\n }\n\n return { ok: true };\n}\n\n// ---------------------------------------------------------------------------\n// Derived compound key (SPEC 2 Stage 1) — a contributionId is a PROJECTION of\n// typed fields, never a hand-typed string. THE PROBLEM (BTW): \"a contributionId\n// is a compound key made of other keys, not handcrafted… it drifts in the\n// handcrafting.\" THE FIX: author the typed `ContributionKey`; `contributionId()`\n// derives the string; it cannot drift because there is no string to type wrong.\n// The wire order `<channel>.<owner>.<name>` is preserved (Hyrum's Law); only the\n// AUTHORING moves from string to typed fields. `parseContributionId` is the\n// inverse, so every current valid id round-trips: contributionId(parse(id))===id.\n// ---------------------------------------------------------------------------\n\n/** Reverse of `CONTRIBUTION_ID_PREFIX_BY_KIND` — id prefix → the kind it predicts.\n * 1:1 because the prefixes are distinct; lets `parseContributionId` recover the kind. */\nexport const CONTRIBUTION_KIND_BY_ID_PREFIX: Readonly<Record<string, PluginContributionKind>> =\n Object.fromEntries(\n Object.entries(CONTRIBUTION_ID_PREFIX_BY_KIND).map(\n ([kind, prefix]) => [prefix, kind as PluginContributionKind],\n ),\n );\n\n/**\n * Connector providers whose ids are EXTERNALLY owned — they mirror a third-party\n * tool id (e.g. `gmail.search`) and are kept by DECLARATION, not hand-typed drift.\n * Derived from `CONVENTION_EXCEPTIONS`: the exception prefixes that are neither a\n * host-owned namespace nor a kind prefix. (Today: `gmail`.)\n */\nexport const EXTERNAL_CONNECTOR_PROVIDERS: ReadonlySet<string> = new Set(\n [...CONVENTION_EXCEPTIONS]\n .map((id) => id.split('.')[0])\n .filter(\n (prefix) =>\n !(HOST_OWNED_ID_PREFIXES as readonly string[]).includes(prefix) &&\n !(prefix in CONTRIBUTION_KIND_BY_ID_PREFIX),\n ),\n);\n\n/** An extension-owned contribution: `<prefix(kind)>.<ext>[.<name>]`. */\nexport interface ExtContributionKey {\n readonly owner: 'ext';\n readonly kind: PluginContributionKind;\n readonly ext: string;\n /** Optional resource within the extension. Omitted → a 2-segment id (e.g. `surface.pets`). */\n readonly name?: string;\n}\n\n/** A host-owned capability: `host.<resource>` / `brain.<resource>`. The resource is\n * typed EXPLICITLY (decision 2026-06-25) — never inferred — so `brain.graph` vs\n * `brain.search` come from the typed field, not hidden coordination. */\nexport interface HostContributionKey {\n readonly owner: 'host';\n readonly namespace: (typeof HOST_OWNED_ID_PREFIXES)[number];\n readonly resource: string;\n}\n\n/** An externally-owned connector tool: `<provider>.<toolId>` (e.g. `gmail.search`). */\nexport interface ExternalContributionKey {\n readonly owner: 'external';\n readonly provider: string;\n readonly toolId: string;\n}\n\n/** The typed source of truth for a contributionId. The string is DERIVED from this. */\nexport type ContributionKey = ExtContributionKey | HostContributionKey | ExternalContributionKey;\n\nconst hasDot = (value: string): boolean => value.includes('.');\nconst isNonEmpty = (value: unknown): value is string =>\n typeof value === 'string' && value.trim().length > 0;\n\n/**\n * Validate a typed key for self-consistency (the contradiction check). A key whose\n * owner/kind/namespace disagree, or that smuggles a `.` into a single segment (which\n * would break the round-trip and re-introduce the hidden structure this design removes),\n * is rejected — so a key that passes can ALWAYS be derived into a convention-valid id.\n */\nexport function validateContributionKey(key: ContributionKey): ContributionIdVerdict {\n switch (key.owner) {\n case 'ext': {\n if (!(key.kind in CONTRIBUTION_ID_PREFIX_BY_KIND)) {\n return { ok: false, error: `unknown contribution kind \"${key.kind}\"` };\n }\n if (!isNonEmpty(key.ext)) return { ok: false, error: 'ext key requires a non-empty \"ext\" segment' };\n if (hasDot(key.ext)) {\n return { ok: false, error: `ext segment \"${key.ext}\" must not contain \".\" — it would smuggle hidden structure and break the derived↔parsed round-trip` };\n }\n if (key.name !== undefined && (!isNonEmpty(key.name) || hasDot(key.name))) {\n return { ok: false, error: `name segment \"${key.name}\" must be non-empty and contain no \".\"` };\n }\n const prefix = CONTRIBUTION_ID_PREFIX_BY_KIND[key.kind];\n const derived = key.name ? `${prefix}.${key.ext}.${key.name}` : `${prefix}.${key.ext}`;\n return validateContributionId(derived, key.kind);\n }\n case 'host': {\n if (!(HOST_OWNED_ID_PREFIXES as readonly string[]).includes(key.namespace)) {\n return { ok: false, error: `host key namespace \"${key.namespace}\" must be one of: ${HOST_OWNED_ID_PREFIXES.join(', ')}` };\n }\n if (!isNonEmpty(key.resource)) return { ok: false, error: 'host key requires a non-empty \"resource\"' };\n if (hasDot(key.resource)) return { ok: false, error: `host resource \"${key.resource}\" must not contain \".\"` };\n return { ok: true };\n }\n case 'external': {\n if (!isNonEmpty(key.provider) || hasDot(key.provider)) {\n return { ok: false, error: `external provider \"${key.provider}\" must be non-empty and contain no \".\"` };\n }\n if (!isNonEmpty(key.toolId)) return { ok: false, error: 'external key requires a non-empty \"toolId\"' };\n return { ok: true };\n }\n }\n}\n\n/**\n * Derive the contributionId string from a typed key — the ONLY sanctioned way to\n * produce one. Throws on a self-contradictory key, so a bad id can never be emitted.\n */\nexport function contributionId(key: ContributionKey): string {\n const verdict = validateContributionKey(key);\n if (!verdict.ok) throw new Error(`invalid ContributionKey: ${verdict.error}`);\n switch (key.owner) {\n case 'ext': {\n const prefix = CONTRIBUTION_ID_PREFIX_BY_KIND[key.kind];\n return key.name ? `${prefix}.${key.ext}.${key.name}` : `${prefix}.${key.ext}`;\n }\n case 'host':\n return `${key.namespace}.${key.resource}`;\n case 'external':\n return `${key.provider}.${key.toolId}`;\n }\n}\n\n/**\n * Inverse of `contributionId` — recover the typed key from an id string. Classifies\n * by the SOURCED first segment: host-owned namespace → host key; a known kind prefix →\n * ext key; a declared external connector → external key. Throws on an unrecognized\n * prefix (e.g. a raw seam channel like `chat.*`/`events.*` that has no kind) rather\n * than guessing — keeping the typed domain honest.\n */\nexport function parseContributionId(rawId: string): ContributionKey {\n const id = rawId.trim();\n if (!id) throw new Error('contributionId is required');\n const segments = id.split('.');\n const prefix = segments[0];\n\n if ((HOST_OWNED_ID_PREFIXES as readonly string[]).includes(prefix)) {\n return {\n owner: 'host',\n namespace: prefix as HostContributionKey['namespace'],\n resource: segments.slice(1).join('.'),\n };\n }\n\n const kind = CONTRIBUTION_KIND_BY_ID_PREFIX[prefix];\n if (kind) {\n const [, ext, ...rest] = segments;\n return rest.length > 0\n ? { owner: 'ext', kind, ext, name: rest.join('.') }\n : { owner: 'ext', kind, ext };\n }\n\n if (EXTERNAL_CONNECTOR_PROVIDERS.has(prefix)) {\n return { owner: 'external', provider: prefix, toolId: segments.slice(1).join('.') };\n }\n\n throw new Error(\n `unrecognized contributionId prefix \"${prefix}.\" in \"${id}\" — not a kind prefix, a host-owned namespace, or a declared external connector`,\n );\n}\n","import { Schema } from 'effect';\n\nexport const KernelSkillOwnerKind = Schema.Literal('bundled', 'agent');\nexport type KernelSkillOwnerKind = Schema.Schema.Type<typeof KernelSkillOwnerKind>;\n\nexport const KernelSkillInvocationMode = Schema.Literal('pure', 'queue_tool_call');\nexport type KernelSkillInvocationMode = Schema.Schema.Type<typeof KernelSkillInvocationMode>;\n\nexport const KernelSkillIndexEntry = Schema.Struct({\n skillId: Schema.String,\n declaredSkillId: Schema.optional(Schema.String),\n name: Schema.String,\n description: Schema.String,\n ownerKind: KernelSkillOwnerKind,\n ownerId: Schema.String,\n invocationMode: KernelSkillInvocationMode,\n invoke: Schema.optional(Schema.String),\n sourcePluginId: Schema.optional(Schema.String),\n sourcePath: Schema.String,\n});\nexport type KernelSkillIndexEntry = Schema.Schema.Type<typeof KernelSkillIndexEntry>;\n\nexport const KernelSkillIndexResponse = Schema.Struct({\n generatedAtMs: Schema.NonNegativeInt,\n owner: Schema.Literal('daemon/kernel'),\n skills: Schema.Array(KernelSkillIndexEntry),\n});\nexport type KernelSkillIndexResponse = Schema.Schema.Type<typeof KernelSkillIndexResponse>;\n\nexport const decodeKernelSkillIndexResponse = Schema.decodeUnknownSync(KernelSkillIndexResponse);\nexport const encodeKernelSkillIndexResponse = Schema.encodeSync(KernelSkillIndexResponse);\n","import { Schema } from 'effect';\nimport { PluginRuntimeSourceDescriptor } from './ecosystem.js';\n\nexport const KernelPluginInstallRuntimeClass = Schema.Literal(\n 'skills-only',\n 'composio-app',\n 'codex-app-tool',\n 'codex-app-sdk-replacement-ready',\n 'codex-app-sdk-replacement-missing',\n 'mcp',\n 'cli-package',\n 'mixed',\n);\nexport type KernelPluginInstallRuntimeClass = Schema.Schema.Type<\n typeof KernelPluginInstallRuntimeClass\n>;\n\nexport const KernelPluginInstallSkill = Schema.Struct({\n skillId: Schema.String,\n skillName: Schema.optional(Schema.String),\n displayName: Schema.String,\n sourcePath: Schema.String,\n skillRoot: Schema.optional(Schema.String),\n requiresConnectors: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type KernelPluginInstallSkill = Schema.Schema.Type<typeof KernelPluginInstallSkill>;\n\nexport const KernelPluginConnectorBinding = Schema.Struct({\n connectorId: Schema.String,\n toolkitSlug: Schema.String,\n appId: Schema.optional(Schema.String),\n externalAppId: Schema.optional(Schema.String),\n externalAppKind: Schema.optional(Schema.Literal('codex-connector', 'codex-app-sdk', 'unknown')),\n displayName: Schema.String,\n authRequired: Schema.Boolean,\n status: Schema.Literal('mapped', 'unmapped', 'connected', 'blocked'),\n reason: Schema.optional(Schema.String),\n});\nexport type KernelPluginConnectorBinding = Schema.Schema.Type<\n typeof KernelPluginConnectorBinding\n>;\n\nexport const KernelPluginMcpServerBinding = Schema.Struct({\n serverId: Schema.String,\n runtimeSourceId: Schema.optional(Schema.String),\n configPath: Schema.optional(Schema.String),\n config: Schema.optional(Schema.Unknown),\n status: Schema.Literal('declared', 'configured', 'blocked'),\n reason: Schema.optional(Schema.String),\n});\nexport type KernelPluginMcpServerBinding = Schema.Schema.Type<\n typeof KernelPluginMcpServerBinding\n>;\n\nexport const KernelPluginCliToolBinding = Schema.Struct({\n toolId: Schema.String,\n command: Schema.optional(Schema.String),\n args: Schema.optional(Schema.Array(Schema.String)),\n packageName: Schema.optional(Schema.String),\n packageRoot: Schema.optional(Schema.String),\n binName: Schema.optional(Schema.String),\n entrypoint: Schema.optional(Schema.String),\n runtimeSourceId: Schema.optional(Schema.String),\n packageManager: Schema.optional(Schema.String),\n status: Schema.Literal('declared', 'installed', 'blocked'),\n reason: Schema.optional(Schema.String),\n});\nexport type KernelPluginCliToolBinding = Schema.Schema.Type<typeof KernelPluginCliToolBinding>;\n\nexport const KernelPluginPackageDependency = Schema.Struct({\n packageId: Schema.String,\n packageName: Schema.String,\n packageRoot: Schema.String,\n packageManager: Schema.optional(Schema.String),\n installCommand: Schema.optional(Schema.String),\n dependencies: Schema.Array(Schema.String),\n devDependencies: Schema.Array(Schema.String),\n});\nexport type KernelPluginPackageDependency = Schema.Schema.Type<\n typeof KernelPluginPackageDependency\n>;\n\nexport const KernelPluginAuthRequirement = Schema.Struct({\n requirementId: Schema.String,\n kind: Schema.Literal('composio', 'mcp-oauth', 'api-key', 'none'),\n targetId: Schema.optional(Schema.String),\n status: Schema.Literal('required', 'satisfied', 'blocked', 'not-required'),\n reason: Schema.optional(Schema.String),\n});\nexport type KernelPluginAuthRequirement = Schema.Schema.Type<\n typeof KernelPluginAuthRequirement\n>;\n\nexport const KernelPluginWorkflowStepStatus = Schema.Literal(\n 'pending',\n 'complete',\n 'blocked',\n 'skipped',\n 'failed',\n);\nexport type KernelPluginWorkflowStepStatus = Schema.Schema.Type<\n typeof KernelPluginWorkflowStepStatus\n>;\n\nexport const KernelPluginWorkflowStep = Schema.Struct({\n stepId: Schema.String,\n label: Schema.String,\n kind: Schema.Literal(\n 'discover',\n 'copy',\n 'skill',\n 'dependency',\n 'connector',\n 'mcp',\n 'cli',\n 'composer',\n 'chat',\n 'cleanup',\n 'validation',\n ),\n status: KernelPluginWorkflowStepStatus,\n reason: Schema.optional(Schema.String),\n});\nexport type KernelPluginWorkflowStep = Schema.Schema.Type<typeof KernelPluginWorkflowStep>;\n\nexport const KernelPluginValidationProbe = Schema.Struct({\n probeId: Schema.String,\n kind: Schema.Literal('manifest', 'push', 'activation', 'composer', 'chat', 'tool-discovery', 'read-only-smoke', 'write-dry-run'),\n safeLive: Schema.Boolean,\n status: KernelPluginWorkflowStepStatus,\n reason: Schema.optional(Schema.String),\n});\nexport type KernelPluginValidationProbe = Schema.Schema.Type<\n typeof KernelPluginValidationProbe\n>;\n\nexport const KernelPluginInstallManifest = Schema.Struct({\n pluginId: Schema.String,\n displayName: Schema.String,\n version: Schema.String,\n sourceMarketplace: Schema.String,\n sourcePath: Schema.String,\n runtimeClass: KernelPluginInstallRuntimeClass,\n skills: Schema.Array(KernelPluginInstallSkill),\n runtimeSources: Schema.Array(PluginRuntimeSourceDescriptor),\n connectorBindings: Schema.Array(KernelPluginConnectorBinding),\n mcpServers: Schema.Array(KernelPluginMcpServerBinding),\n cliTools: Schema.Array(KernelPluginCliToolBinding),\n packageDependencies: Schema.Array(KernelPluginPackageDependency),\n authRequirements: Schema.Array(KernelPluginAuthRequirement),\n installSteps: Schema.Array(KernelPluginWorkflowStep),\n activationBlockers: Schema.Array(Schema.String),\n validationProbes: Schema.Array(KernelPluginValidationProbe),\n uninstallCleanup: Schema.Array(KernelPluginWorkflowStep),\n});\nexport type KernelPluginInstallManifest = Schema.Schema.Type<\n typeof KernelPluginInstallManifest\n>;\n\nexport const KernelPluginValidationStageStatus = Schema.Literal(\n 'pass',\n 'partial',\n 'blocked',\n 'fail',\n 'skipped',\n);\nexport type KernelPluginValidationStageStatus = Schema.Schema.Type<\n typeof KernelPluginValidationStageStatus\n>;\n\nexport const KernelPluginValidationReport = Schema.Struct({\n pluginId: Schema.String,\n status: Schema.Literal('complete', 'partial', 'blocked', 'failed'),\n discovered: KernelPluginValidationStageStatus,\n manifest: KernelPluginValidationStageStatus,\n push: KernelPluginValidationStageStatus,\n config: KernelPluginValidationStageStatus,\n activation: KernelPluginValidationStageStatus,\n composer: KernelPluginValidationStageStatus,\n chat: KernelPluginValidationStageStatus,\n smoke: KernelPluginValidationStageStatus,\n gaps: Schema.Array(Schema.String),\n evidence: Schema.Array(Schema.String),\n validatedAtMs: Schema.NonNegativeInt,\n});\nexport type KernelPluginValidationReport = Schema.Schema.Type<\n typeof KernelPluginValidationReport\n>;\n\nexport const decodeKernelPluginInstallManifest = Schema.decodeUnknownSync(\n KernelPluginInstallManifest,\n);\nexport const encodeKernelPluginInstallManifest = Schema.encodeSync(\n KernelPluginInstallManifest,\n);\nexport const decodeKernelPluginValidationReport = Schema.decodeUnknownSync(\n KernelPluginValidationReport,\n);\nexport const encodeKernelPluginValidationReport = Schema.encodeSync(\n KernelPluginValidationReport,\n);\n","import { Schema } from 'effect';\nimport { HostCapabilityId } from '../host/capabilities.js';\nimport { BridgeDeclaration } from './bridges.js';\nimport {\n EcoAddonExtensionClass,\n PluginRuntimeSourceDescriptor,\n ProviderRuntimeProjectionDescriptor,\n} from './ecosystem.js';\nimport {\n KernelPluginAuthRequirement,\n KernelPluginCliToolBinding,\n KernelPluginConnectorBinding,\n KernelPluginMcpServerBinding,\n KernelPluginValidationProbe,\n} from './plugin-install.js';\nimport {\n KernelPermissionId,\n PluginManifestContribution,\n PluginShipsState,\n PluginThemeTokenSet,\n} from './registry.js';\nimport { SidecarDeclaration } from './sidecars.js';\n\nexport const NormalizedPluginContractSourceKind = Schema.Literal(\n 'kyberagent-native',\n 'codex-marketplace',\n 'local-marketplace',\n 'remote-marketplace',\n 'bundled',\n);\nexport type NormalizedPluginContractSourceKind = Schema.Schema.Type<\n typeof NormalizedPluginContractSourceKind\n>;\n\nexport const NormalizedPluginContractSource = Schema.Struct({\n kind: NormalizedPluginContractSourceKind,\n marketplace: Schema.optional(Schema.String),\n path: Schema.optional(Schema.String),\n manifestPath: Schema.optional(Schema.String),\n provenance: EcoAddonExtensionClass,\n});\nexport type NormalizedPluginContractSource = Schema.Schema.Type<\n typeof NormalizedPluginContractSource\n>;\n\nexport const NormalizedPluginSkillDeclaration = Schema.Struct({\n skillId: Schema.String,\n skillName: Schema.optional(Schema.String),\n displayName: Schema.String,\n description: Schema.optional(Schema.String),\n sourcePath: Schema.optional(Schema.String),\n skillRoot: Schema.optional(Schema.String),\n requiresConnectors: Schema.Array(Schema.String),\n});\nexport type NormalizedPluginSkillDeclaration = Schema.Schema.Type<\n typeof NormalizedPluginSkillDeclaration\n>;\n\nexport const NormalizedPluginToolDeclaration = Schema.Struct({\n toolId: Schema.String,\n runtimeSourceId: Schema.String,\n connectorId: Schema.optional(Schema.String),\n mcpServerId: Schema.optional(Schema.String),\n cliToolId: Schema.optional(Schema.String),\n slug: Schema.optional(Schema.String),\n displayName: Schema.String,\n description: Schema.optional(Schema.String),\n readOnly: Schema.optional(Schema.Boolean),\n sandboxRequired: Schema.optional(Schema.Boolean),\n inputSchema: Schema.optional(Schema.Unknown),\n});\nexport type NormalizedPluginToolDeclaration = Schema.Schema.Type<\n typeof NormalizedPluginToolDeclaration\n>;\n\nexport const NormalizedPluginExtensionContributionSet = Schema.Struct({\n surfaces: Schema.Array(PluginManifestContribution),\n settingsPanels: Schema.Array(PluginManifestContribution),\n contributions: Schema.Array(PluginManifestContribution),\n sidecars: Schema.Array(SidecarDeclaration),\n bridges: Schema.Array(BridgeDeclaration),\n permissions: Schema.Array(KernelPermissionId),\n deniedPermissions: Schema.Array(KernelPermissionId),\n themeTokens: Schema.Array(PluginThemeTokenSet),\n hostCapabilities: Schema.Array(HostCapabilityId),\n providerProjections: Schema.Array(ProviderRuntimeProjectionDescriptor),\n // Path C (docs/80 §5, KYB-209): the origins this extension's OWN backend lives\n // at. ONE declared surface feeding two enforcement points — the per-frame CSP\n // connect-src (Lane A, direct) and the daemon broker allowlist (Lane B,\n // brokered). Always emitted (default []); validated by validateOutboundOrigin.\n outboundOrigins: Schema.Array(Schema.String),\n // KYB-202 (ADR-0060 §5): the declared default-activation state carried from the\n // SDK ExtensionDefinition through to the generated manifest. Optional/omitted\n // means inactive (default-deny); only the core surfaces declare `active`.\n ships: Schema.optional(PluginShipsState),\n});\nexport type NormalizedPluginExtensionContributionSet = Schema.Schema.Type<\n typeof NormalizedPluginExtensionContributionSet\n>;\n\nexport const NormalizedPluginCompatibility = Schema.Struct({\n legacyCodexManifest: Schema.Boolean,\n sdkBacked: Schema.Boolean,\n sourceManifestVersion: Schema.optional(Schema.String),\n notes: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type NormalizedPluginCompatibility = Schema.Schema.Type<typeof NormalizedPluginCompatibility>;\n\nexport const NormalizedPluginContract = Schema.Struct({\n contractVersion: Schema.Literal(1),\n pluginId: Schema.String,\n displayName: Schema.String,\n version: Schema.String,\n description: Schema.optional(Schema.String),\n source: NormalizedPluginContractSource,\n runtimeSources: Schema.Array(PluginRuntimeSourceDescriptor),\n skills: Schema.Array(NormalizedPluginSkillDeclaration),\n connectors: Schema.Array(KernelPluginConnectorBinding),\n mcpServers: Schema.Array(KernelPluginMcpServerBinding),\n cliTools: Schema.Array(KernelPluginCliToolBinding),\n toolDeclarations: Schema.Array(NormalizedPluginToolDeclaration),\n extension: NormalizedPluginExtensionContributionSet,\n authRequirements: Schema.Array(KernelPluginAuthRequirement),\n validationProbes: Schema.Array(KernelPluginValidationProbe),\n compatibility: NormalizedPluginCompatibility,\n});\nexport type NormalizedPluginContract = Schema.Schema.Type<typeof NormalizedPluginContract>;\n\nexport const decodeNormalizedPluginContract = Schema.decodeUnknownSync(NormalizedPluginContract);\nexport const encodeNormalizedPluginContract = Schema.encodeSync(NormalizedPluginContract);\n","import { Schema } from 'effect';\nimport { KernelPrincipalKind } from './registry.js';\n\nexport const BridgeTransport = Schema.Literal('stdio', 'http', 'websocket');\nexport type BridgeTransport = Schema.Schema.Type<typeof BridgeTransport>;\n\nexport const BridgeAdapterKind = Schema.Literal('kyberbot', 'generic');\nexport type BridgeAdapterKind = Schema.Schema.Type<typeof BridgeAdapterKind>;\n\nexport const BridgeDeclaration = Schema.Struct({\n bridgeId: Schema.String,\n displayName: Schema.String,\n adapterKind: BridgeAdapterKind,\n pluginId: Schema.optional(Schema.String),\n transport: BridgeTransport,\n commandTypes: Schema.Array(Schema.String),\n eventTypes: Schema.Array(Schema.String),\n});\nexport type BridgeDeclaration = Schema.Schema.Type<typeof BridgeDeclaration>;\n\nexport const BridgePrincipal = Schema.Struct({\n kind: KernelPrincipalKind,\n id: Schema.String,\n});\nexport type BridgePrincipal = Schema.Schema.Type<typeof BridgePrincipal>;\n\nexport const BridgePairingRequest = Schema.Struct({\n bridgeId: Schema.String,\n principal: BridgePrincipal,\n requestedByHostId: Schema.optional(Schema.String),\n requestedAtMs: Schema.NonNegativeInt,\n});\nexport type BridgePairingRequest = Schema.Schema.Type<typeof BridgePairingRequest>;\n\nexport const BridgeSessionState = Schema.Literal('open', 'closed', 'error');\nexport type BridgeSessionState = Schema.Schema.Type<typeof BridgeSessionState>;\n\nexport const BridgeSessionRecord = Schema.Struct({\n sessionId: Schema.String,\n bridgeId: Schema.String,\n principal: BridgePrincipal,\n transport: BridgeTransport,\n state: BridgeSessionState,\n openedAtMs: Schema.NonNegativeInt,\n});\nexport type BridgeSessionRecord = Schema.Schema.Type<typeof BridgeSessionRecord>;\n\nexport const BridgeCommandEnvelope = Schema.Struct({\n envelopeId: Schema.String,\n bridgeId: Schema.String,\n sessionId: Schema.String,\n type: Schema.String,\n payload: Schema.Record({ key: Schema.String, value: Schema.Unknown }),\n sentAtMs: Schema.NonNegativeInt,\n});\nexport type BridgeCommandEnvelope = Schema.Schema.Type<typeof BridgeCommandEnvelope>;\n\nexport const BridgeEventEnvelope = Schema.Struct({\n envelopeId: Schema.String,\n bridgeId: Schema.String,\n sessionId: Schema.String,\n type: Schema.String,\n payload: Schema.Record({ key: Schema.String, value: Schema.Unknown }),\n observedAtMs: Schema.NonNegativeInt,\n});\nexport type BridgeEventEnvelope = Schema.Schema.Type<typeof BridgeEventEnvelope>;\n\nexport const BridgeSessionResponse = Schema.Struct({\n owner: Schema.Literal('daemon/kernel'),\n session: BridgeSessionRecord,\n events: Schema.Array(BridgeEventEnvelope),\n});\nexport type BridgeSessionResponse = Schema.Schema.Type<typeof BridgeSessionResponse>;\n\nexport const BridgeCommandResponse = Schema.Struct({\n owner: Schema.Literal('daemon/kernel'),\n accepted: Schema.Boolean,\n command: BridgeCommandEnvelope,\n event: BridgeEventEnvelope,\n});\nexport type BridgeCommandResponse = Schema.Schema.Type<typeof BridgeCommandResponse>;\n\nexport const decodeBridgeDeclaration = Schema.decodeUnknownSync(BridgeDeclaration);\nexport const encodeBridgeDeclaration = Schema.encodeSync(BridgeDeclaration);\nexport const decodeBridgePairingRequest = Schema.decodeUnknownSync(BridgePairingRequest);\nexport const encodeBridgePairingRequest = Schema.encodeSync(BridgePairingRequest);\nexport const decodeBridgeSessionResponse = Schema.decodeUnknownSync(BridgeSessionResponse);\nexport const encodeBridgeSessionResponse = Schema.encodeSync(BridgeSessionResponse);\nexport const decodeBridgeCommandEnvelope = Schema.decodeUnknownSync(BridgeCommandEnvelope);\nexport const encodeBridgeCommandEnvelope = Schema.encodeSync(BridgeCommandEnvelope);\nexport const decodeBridgeEventEnvelope = Schema.decodeUnknownSync(BridgeEventEnvelope);\nexport const encodeBridgeEventEnvelope = Schema.encodeSync(BridgeEventEnvelope);\nexport const decodeBridgeCommandResponse = Schema.decodeUnknownSync(BridgeCommandResponse);\nexport const encodeBridgeCommandResponse = Schema.encodeSync(BridgeCommandResponse);\n","import { Schema } from 'effect';\nimport { HostCapabilityId } from '../host/capabilities.js';\nimport { KernelPrincipalKind } from './registry.js';\n\nexport const SidecarDeclaration = Schema.Struct({\n sidecarId: Schema.String,\n displayName: Schema.String,\n pluginId: Schema.optional(Schema.String),\n transport: Schema.Literal('stdio', 'http', 'websocket'),\n requestedHostCapabilities: Schema.Array(HostCapabilityId),\n});\nexport type SidecarDeclaration = Schema.Schema.Type<typeof SidecarDeclaration>;\n\nexport const SidecarGrantPrincipal = Schema.Struct({\n kind: KernelPrincipalKind,\n id: Schema.String,\n});\nexport type SidecarGrantPrincipal = Schema.Schema.Type<typeof SidecarGrantPrincipal>;\n\nexport const SidecarGrantRequest = Schema.Struct({\n principal: SidecarGrantPrincipal,\n sidecarId: Schema.String,\n requestedHostCapabilities: Schema.Array(HostCapabilityId),\n requestedAtMs: Schema.NonNegativeInt,\n});\nexport type SidecarGrantRequest = Schema.Schema.Type<typeof SidecarGrantRequest>;\n\nexport const SidecarCapabilityGrantDecision = Schema.Struct({\n capability: HostCapabilityId,\n decision: Schema.Literal('granted', 'denied'),\n reason: Schema.String,\n});\nexport type SidecarCapabilityGrantDecision = Schema.Schema.Type<\n typeof SidecarCapabilityGrantDecision\n>;\n\nexport const SidecarGrantRecord = Schema.Struct({\n grantId: Schema.String,\n sidecarId: Schema.String,\n principal: SidecarGrantPrincipal,\n capabilities: Schema.Array(HostCapabilityId),\n capabilityDecisions: Schema.Array(SidecarCapabilityGrantDecision),\n issuedAtMs: Schema.NonNegativeInt,\n});\nexport type SidecarGrantRecord = Schema.Schema.Type<typeof SidecarGrantRecord>;\n\nexport const SidecarGrantResponse = Schema.Struct({\n owner: Schema.Literal('daemon/kernel'),\n decision: Schema.Literal('granted', 'denied'),\n grant: SidecarGrantRecord,\n});\nexport type SidecarGrantResponse = Schema.Schema.Type<typeof SidecarGrantResponse>;\n\nexport const decodeSidecarDeclaration = Schema.decodeUnknownSync(SidecarDeclaration);\nexport const encodeSidecarDeclaration = Schema.encodeSync(SidecarDeclaration);\nexport const decodeSidecarGrantRequest = Schema.decodeUnknownSync(SidecarGrantRequest);\nexport const encodeSidecarGrantRequest = Schema.encodeSync(SidecarGrantRequest);\nexport const decodeSidecarGrantResponse = Schema.decodeUnknownSync(SidecarGrantResponse);\nexport const encodeSidecarGrantResponse = Schema.encodeSync(SidecarGrantResponse);\n","// KYB-209 — the `outboundOrigins` declaration primitive (docs/80 §5).\n//\n// Path C gives an iframe extension one declared surface for the origins its OWN\n// backend lives at, feeding TWO enforcement points from ONE list:\n// • Lane A (direct): the per-frame CSP `connect-src` on the kyber-ext://\n// document (desktop main stamps it).\n// • Lane B (brokered): the daemon broker's outbound allowlist.\n// Both MUST share these exact semantics or the declaration would mean two\n// different things — so validation (authoring/generation time) and matching\n// (enforcement time) live here, once.\n//\n// Shape (docs/80 §5): exact origins — scheme + host + explicit port — plus the\n// single CSP-style port wildcard `scheme://host:*` (dev/loopback). No path,\n// query, fragment, userinfo, or subdomain wildcard; no trailing slash. Hosts are\n// NOT normalised — `http://localhost` ≠ `http://127.0.0.1`, `http` ≠ `https` —\n// exactly as a CSP connect-src treats origins.\n\n/** Schemes a `connect-src` allowlist may carry. `ws(s)` is included because\n * connect-src governs WebSockets too (docs/80 §4 — AngelEye's live socket). */\nconst ALLOWED_SCHEMES = ['https', 'http', 'wss', 'ws'] as const;\n\nconst PORT_WILDCARD_SUFFIX = ':*';\n\n/**\n * Validate ONE declared outbound origin. Returns a human-readable error string,\n * or `null` when the entry is well-formed. Deliberately string-based (not a\n * throw) so callers can collect every offending entry (SDK validation) or map\n * to a typed error (the broker).\n */\nexport function validateOutboundOrigin(entry: string): string | null {\n if (typeof entry !== 'string' || entry.trim() !== entry || entry === '') {\n return `outboundOrigins entry ${JSON.stringify(entry)} must be a non-empty, untrimmed origin string`;\n }\n const portWildcard = entry.endsWith(PORT_WILDCARD_SUFFIX);\n // Reduce the port-wildcard form to a parseable URL by swapping `:*` for a\n // placeholder port, then assert the rest of the origin is exact.\n const probe = portWildcard ? `${entry.slice(0, -PORT_WILDCARD_SUFFIX.length)}:1` : entry;\n let url: URL;\n try {\n url = new URL(probe);\n } catch {\n return `outboundOrigins entry ${JSON.stringify(entry)} is not a valid origin`;\n }\n const scheme = url.protocol.replace(/:$/, '');\n if (!(ALLOWED_SCHEMES as readonly string[]).includes(scheme)) {\n return `outboundOrigins entry ${JSON.stringify(entry)}: scheme must be one of ${ALLOWED_SCHEMES.join('/')}`;\n }\n if (url.username || url.password) {\n return `outboundOrigins entry ${JSON.stringify(entry)} must not include userinfo`;\n }\n if (url.pathname !== '/' && url.pathname !== '') {\n return `outboundOrigins entry ${JSON.stringify(entry)} must be an origin only — no path`;\n }\n if (url.search || url.hash) {\n return `outboundOrigins entry ${JSON.stringify(entry)} must be an origin only — no query or fragment`;\n }\n if (url.hostname.startsWith('*')) {\n return `outboundOrigins entry ${JSON.stringify(entry)} must not use a subdomain wildcard`;\n }\n // An exact (non-wildcard) entry must reconstruct to exactly what was declared,\n // via the canonical origin — this rejects trailing slashes and stray syntax.\n if (!portWildcard && url.origin !== entry) {\n return `outboundOrigins entry ${JSON.stringify(entry)} must be a bare origin (got canonical ${url.origin})`;\n }\n return null;\n}\n\n/**\n * Does `origin` (a bare `scheme://host[:port]`) match the extension's DECLARED\n * allowlist? Exact origin match, plus the CSP-style port wildcard\n * `scheme://host:*`. No host normalisation — the same semantics CSP applies, and\n * the same the daemon broker enforces before opening a socket.\n */\nexport function outboundOriginMatches(declared: readonly string[], origin: string): boolean {\n return declared.some((entry) => {\n if (entry === origin) return true;\n if (entry.endsWith(PORT_WILDCARD_SUFFIX)) {\n const prefix = entry.slice(0, -1); // keep the trailing ':'\n const rest = origin.startsWith(prefix) ? origin.slice(prefix.length) : '';\n return rest !== '' && /^\\d+$/.test(rest);\n }\n return false;\n });\n}\n","import { Schema } from 'effect';\nimport { BridgePrincipal } from './bridges.js';\nimport { KernelPrincipalKind } from './registry.js';\n\n// ─── Branded active-agent identity — closes DIV-6 (agent propagation) ──────────\n// The recurring agent-scoping bug (≥5×) was ONE missing type guarantee: ctx.agent\n// was an OPTIONAL unbranded string, so every dispatch path re-established it and any\n// path could silently forget it. A branded, REQUIRED AgentId makes \"forgotten agent\"\n// unrepresentable at the gate rather than a valid `undefined`. The SDK already carried\n// this shape (extension-sdk/src/seam-ports.ts); KYB-228 promotes it into production.\n\n/** A host-attested active-agent name. Branded so an unvalidated string can't\n * masquerade as the active agent — mint it only via {@link makeAgentId} (or the\n * wire decode, which the route stamps host-side; never trust a payload value). */\nexport const AgentId = Schema.String.pipe(Schema.brand('AgentId'));\nexport type AgentId = Schema.Schema.Type<typeof AgentId>;\n\n/** Mint an {@link AgentId} from a host-attested name. Throws on blank — the brand is\n * not a licence to thread an empty name. Lowercased to match the agent-registry key\n * convention (the route + proxy already lowercase). */\nexport function makeAgentId(attestedName: string): AgentId {\n const trimmed = attestedName.trim().toLowerCase();\n if (!trimmed) throw new Error('makeAgentId: agent name must be a non-empty host-attested string');\n return trimmed as unknown as AgentId;\n}\n\n/** Mint an {@link AgentId} for a host-attested name ONLY if it is a REGISTERED agent\n * (KYB-177 slice C / HOST-N3). Unlike {@link makeAgentId} (which rejects only blanks),\n * this rejects any name absent from the agent registry — so an active-agent identity\n * cannot be minted for an agent the daemon does not know, flipping the phase-5\n * `agentId-registry` conformance check `pending → enforced`. Trust then rests one level\n * up — on WHO may write the registry / how agents are enrolled — a separate concern\n * (KYB-233; enrollment is a deliberate act through the desktop app, docs/66/§83). */\nexport function mintAttestedAgent(attestedName: string, registry: ReadonlySet<string>): AgentId {\n const id = makeAgentId(attestedName); // trims + lowercases + rejects blank\n if (!registry.has(id as unknown as string)) {\n throw new Error(`mintAttestedAgent: \"${attestedName}\" is not a registered agent`);\n }\n return id;\n}\n\n/** The reserved sentinel meaning \"no specific agent — machine/global scope\". Explicit\n * and NAMED so \"no agent\" is representable WITHOUT an optional/undefined a dispatch\n * path could drop (DIV-6/F3): the iframe events path gates here today, but visibly. */\nexport const MACHINE_AGENT: AgentId = makeAgentId('__machine__');\n\n/** True when the ctx is machine/global scope (the old `agent === undefined` case). */\nexport const isMachineAgent = (id: AgentId): boolean => id === MACHINE_AGENT;\n\n// ─── Branded addressed-extension identity — closes DIV-5 (identity self-assertion) ─\n// KYB-177 (the door): `extensionId` used to be a TOP-LEVEL field of the SeamRequest\n// PAYLOAD — the daemon routed + gated on `request.extensionId`, a string any caller\n// could self-assert. It now rides host-attested inside the branded {@link SeamContext}\n// ({@link SeamContext.extensionId}), minted only via {@link mintSeamContext} (host\n// paths) or re-stamped at the dispatch route from what the trusted host attested\n// (frame-origin for a sandboxed iframe, per-process trust for an in-proc surface).\n// Branding makes \"route on an un-stamped extension id\" a compile error rather than a\n// reviewer's discipline; the wire un-forgeability is the frame-origin stamp + the door.\n\n/** A host-attested extension identity (e.g. `plugin.seam-probe`) — the addressed\n * extension a seam op routes + gates against. Branded so an unvalidated payload\n * string cannot masquerade as it; mint only via {@link makeExtensionId} (the daemon\n * does so at the trusted choke points, never from the request payload). */\nexport const ExtensionId = Schema.String.pipe(Schema.brand('ExtensionId'));\nexport type ExtensionId = Schema.Schema.Type<typeof ExtensionId>;\n\n/** Mint an {@link ExtensionId} from a host-attested id. Throws on blank — the brand is\n * not a licence to route an empty id. NOT lowercased: extension ids are already the\n * canonical `plugin.<name>` form the frame origin + registry use verbatim. */\nexport function makeExtensionId(attestedId: string): ExtensionId {\n const trimmed = attestedId.trim();\n if (!trimmed) throw new Error('makeExtensionId: extension id must be a non-empty host-attested string');\n return trimmed as unknown as ExtensionId;\n}\n\n/** Back-compat bridge for handlers that treated absent-agent as \"default/all\": returns\n * the string agent, or `undefined` for {@link MACHINE_AGENT}, so `?? default` logic\n * keeps working after the field became required+branded. */\nexport const activeAgentOrUndefined = (id: AgentId): string | undefined =>\n isMachineAgent(id) ? undefined : (id as unknown as string);\n\n/** How a principal's identity was attested (DIV-5). `frame-origin` = a sandboxed\n * kyber-ext:// iframe, stamped host-side from the frame origin; `session` = an open\n * bridge session over the loopback route; `host` = the in-process daemon dispatching\n * on its own behalf (trusted by locality). Absence of a known source ⇒ untrusted.\n * (Enum completeness incl. a remote source is the open decision D3, docs/61.) */\nexport const SeamAttestation = Schema.Literal('frame-origin', 'session', 'host');\nexport type SeamAttestation = Schema.Schema.Type<typeof SeamAttestation>;\n\n/** The host-attested seam principal: the bridge principal (`kind` + `id`) PLUS how it\n * was attested. Carrying `attestedBy` in the type makes the stamp point auditable and\n * is the production twin of the SDK's `VerifiedPrincipal`. */\nexport const SeamPrincipal = Schema.Struct({\n ...BridgePrincipal.fields,\n attestedBy: SeamAttestation,\n});\nexport type SeamPrincipal = Schema.Schema.Type<typeof SeamPrincipal>;\n\n// ─── Extension SDK seam contract ───────────────────────────────────────────────\n// The seam is the SEMANTIC request/response layer the host and extensions speak.\n// It rides the existing bridge transport (BridgeCommandEnvelope is the carrier);\n// it is NOT a parallel transport. The bridge answers \"is the session open?\"; the\n// seam answers \"what op, addressed to which contribution, and what data came\n// back?\". M0.1 = these shapes. M0.2 = the bridge `command()` lifts a\n// BridgeCommandEnvelope.payload into a SeamRequest, dispatches, and returns a\n// SeamResponse. See docs/32–35.\n\n/** The operation a seam request invokes. Extensible; M2.3 adds `describe`, M3 `invoke`. */\nexport const SeamOp = Schema.Literal('echo', 'query', 'describe', 'invoke');\nexport type SeamOp = Schema.Schema.Type<typeof SeamOp>;\n\n/**\n * The caller context carried with every seam request — who is asking, from\n * which host, and when. Reuses the bridge principal so the seam does not fork a\n * second notion of identity.\n */\nexport const SeamContext = Schema.Struct({\n principal: SeamPrincipal,\n // The addressed extension this op routes + gates against (was a top-level, self-\n // assertable SeamRequest field pre-KYB-177). REQUIRED + branded: the daemon stamps\n // it host-side — from the open-session route (from what the trusted host attested)\n // or via {@link mintSeamContext} for a host-internal dispatch — so a payload-supplied\n // extension id can never reach a handler. For an extension-ORIGINATED call it equals\n // {@link SeamPrincipal.id} (the extension is the principal); for a host-internal call\n // the principal is the host but this still names the addressed extension.\n extensionId: ExtensionId,\n hostId: Schema.optional(Schema.String),\n requestedAtMs: Schema.NonNegativeInt,\n // The active agent the request is scoped to, as the host attested it (the\n // X-Kyberagent-Agent header the desktop host sets from the user's selection),\n // threaded by the dispatch route so a handler answers for the active agent\n // (e.g. host.context) without re-deriving it. REQUIRED + branded (KYB-228):\n // \"no specific agent\" is the explicit {@link MACHINE_AGENT} sentinel, never a\n // dropped/undefined field — that is the structural fix for DIV-6.\n activeAgent: AgentId,\n});\nexport type SeamContext = Schema.Schema.Type<typeof SeamContext>;\n\n/**\n * The SINGLE sanctioned constructor for a host-built {@link SeamContext} (DIV-5 +\n * DIV-6). Host code (dispatchHost, tests) must go through here rather than\n * assembling a ctx literal, so identity gets its `attestedBy` stamp and the active\n * agent is minted (or defaulted to {@link MACHINE_AGENT}) — never forgotten. The wire\n * path has its own mint: the dispatch route stamps `activeAgent`/`attestedBy` onto the\n * raw body from the host-attested header BEFORE {@link decodeSeamRequest}, so a\n * payload-supplied value can never reach a handler.\n */\nexport function mintSeamContext(parts: {\n principal: { kind: SeamPrincipal['kind']; id: string };\n attestedBy: SeamAttestation;\n // The addressed extension (KYB-177). REQUIRED — folding it into the mint makes a\n // \"forgotten extension\" a compile error, not a runtime hole, and keeps it off a\n // parallel header (which would re-introduce DIV-6, the per-path re-derivation\n // KYB-228 just killed for the agent).\n extensionId: string | ExtensionId;\n agent?: string | AgentId | null;\n hostId?: string;\n requestedAtMs: number;\n}): SeamContext {\n const raw = parts.agent == null ? '' : String(parts.agent).trim();\n return {\n principal: { kind: parts.principal.kind, id: parts.principal.id, attestedBy: parts.attestedBy },\n extensionId: makeExtensionId(String(parts.extensionId)),\n ...(parts.hostId ? { hostId: parts.hostId } : {}),\n requestedAtMs: parts.requestedAtMs,\n activeAgent: raw ? makeAgentId(raw) : MACHINE_AGENT,\n };\n}\n\n/**\n * A logical request addressed to a single extension contribution. `op` selects\n * the verb; `payload` is the op-specific argument bag (e.g. `{ filter, limit }`\n * for `query`); `ctx` is the caller context.\n */\nexport const SeamRequest = Schema.Struct({\n // NO top-level `extensionId` (removed KYB-177): the addressed extension is carried\n // host-attested in {@link SeamContext.extensionId} — read it via {@link seamExtensionId},\n // never a payload field, so a self-asserted id can't reach the router or the gate.\n contributionId: Schema.String,\n op: SeamOp,\n payload: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n ctx: SeamContext,\n});\nexport type SeamRequest = Schema.Schema.Type<typeof SeamRequest>;\n\n/** The addressed extension for a decoded {@link SeamRequest} — the SINGLE sanctioned\n * read of \"which extension\", from the host-attested {@link SeamContext}, never a\n * payload field. Every daemon route/gate/grants lookup goes through here so no path\n * can regress to trusting a self-asserted id (KYB-177). */\nexport const seamExtensionId = (request: SeamRequest): string =>\n request.ctx.extensionId as unknown as string;\n\n/**\n * The typed argument bag for `op:'query'` — carried in `SeamRequest.payload`.\n * `filter` is an op-specific predicate bag (extension-interpreted); `limit`\n * caps the row count. The runtime validates this before dispatching a query, so\n * a malformed query is a typed `seam.invalid_query`, not a handler surprise.\n */\nexport const SeamQueryPayload = Schema.Struct({\n filter: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n limit: Schema.optional(Schema.NonNegativeInt),\n});\nexport type SeamQueryPayload = Schema.Schema.Type<typeof SeamQueryPayload>;\n\n/**\n * The typed argument bag for `op:'describe'` — flow ⑤ config cadence. The host\n * pushes its current config state (model / mode) and the extension returns the\n * contributions valid for that state. Read at init and on config CHANGE, not per\n * keystroke — a cadence, not a stream. The runtime validates this before\n * dispatch, so a malformed describe is a typed `seam.invalid_describe`.\n */\nexport const SeamDescribePayload = Schema.Struct({\n model: Schema.optional(Schema.String),\n mode: Schema.optional(Schema.String),\n});\nexport type SeamDescribePayload = Schema.Schema.Type<typeof SeamDescribePayload>;\n\n/**\n * The typed argument bag for `op:'invoke'` — flow ① composer dispatch. The host\n * invokes a named command an extension declared (mirroring the skill path\n * `/skills/:name/invoke`, but routed over the seam): `commandId` selects which\n * declared command, `args` is the invocation bag. The runtime validates this\n * before dispatch, so a malformed invoke is a typed `seam.invalid_invoke`.\n */\nexport const SeamInvokePayload = Schema.Struct({\n commandId: Schema.String,\n args: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n});\nexport type SeamInvokePayload = Schema.Schema.Type<typeof SeamInvokePayload>;\n\n/**\n * The canonical set of seam error codes. `SeamError.code` stays an open string\n * (a handler may surface its own), but the codes the SEAM ITSELF mints are named\n * here once, so daemon and host reference a constant instead of a magic string\n * and an author has a single list to read.\n *\n * `outbound_denied` (KYB-209, docs/80 §5): a brokered Path-C egress whose target\n * origin is not in the extension's declared `outboundOrigins` — refused BEFORE a\n * socket opens. Distinct from `handler_error` (a generic thrown handler): egress\n * denial is a declared-capability boundary, so it gets its own code a caller can\n * branch on. The direct-lane twin is a per-frame CSP `connect-src` violation,\n * enforced by Chromium, not surfaced as a seam error.\n */\nexport const SEAM_ERROR_CODES = {\n invalidRequest: 'seam.invalid_request',\n invalidQuery: 'seam.invalid_query',\n invalidDescribe: 'seam.invalid_describe',\n invalidInvoke: 'seam.invalid_invoke',\n sessionNotOpen: 'seam.session_not_open',\n contributionNotFound: 'seam.contribution_not_found',\n extensionInactive: 'seam.extension_inactive',\n permissionDenied: 'seam.permission_denied',\n handlerError: 'seam.handler_error',\n subscriptionNotFound: 'seam.subscription_not_found',\n outboundDenied: 'seam.outbound_denied',\n} as const;\nexport type SeamErrorCode = (typeof SEAM_ERROR_CODES)[keyof typeof SEAM_ERROR_CODES];\n\n/** A structured failure returned when an op cannot be satisfied. */\nexport const SeamError = Schema.Struct({\n code: Schema.String,\n message: Schema.String,\n details: Schema.optional(Schema.Unknown),\n});\nexport type SeamError = Schema.Schema.Type<typeof SeamError>;\n\n/**\n * The result-bearing response — the piece BridgeCommandResponse lacks. A\n * discriminated union on `ok`: success carries `data`, failure carries `error`.\n */\nexport const SeamResponse = Schema.Union(\n Schema.Struct({ ok: Schema.Literal(true), data: Schema.Unknown }),\n Schema.Struct({ ok: Schema.Literal(false), error: SeamError }),\n);\nexport type SeamResponse = Schema.Schema.Type<typeof SeamResponse>;\n\n/**\n * A push event emitted by a contribution (flow ④). Distinct from the transport's\n * BridgeEventEnvelope: this is addressed at the seam level (extension +\n * contribution), not the bridge level.\n */\nexport const SeamEvent = Schema.Struct({\n extensionId: Schema.String,\n contributionId: Schema.String,\n type: Schema.String,\n payload: Schema.Record({ key: Schema.String, value: Schema.Unknown }),\n observedAtMs: Schema.NonNegativeInt,\n});\nexport type SeamEvent = Schema.Schema.Type<typeof SeamEvent>;\n\n/**\n * A standing subscription to a contribution's events — the filter the host\n * registers so only matching SeamEvents are pushed to it.\n */\nexport const Subscription = Schema.Struct({\n subscriptionId: Schema.String,\n extensionId: Schema.String,\n contributionId: Schema.String,\n eventTypes: Schema.optional(Schema.Array(Schema.String)),\n});\nexport type Subscription = Schema.Schema.Type<typeof Subscription>;\n\nexport const decodeSeamRequest = Schema.decodeUnknownSync(SeamRequest);\nexport const encodeSeamRequest = Schema.encodeSync(SeamRequest);\nexport const decodeSeamQueryPayload = Schema.decodeUnknownSync(SeamQueryPayload);\nexport const encodeSeamQueryPayload = Schema.encodeSync(SeamQueryPayload);\nexport const decodeSeamDescribePayload = Schema.decodeUnknownSync(SeamDescribePayload);\nexport const encodeSeamDescribePayload = Schema.encodeSync(SeamDescribePayload);\nexport const decodeSeamInvokePayload = Schema.decodeUnknownSync(SeamInvokePayload);\nexport const encodeSeamInvokePayload = Schema.encodeSync(SeamInvokePayload);\nexport const decodeSeamResponse = Schema.decodeUnknownSync(SeamResponse);\nexport const encodeSeamResponse = Schema.encodeSync(SeamResponse);\nexport const decodeSeamEvent = Schema.decodeUnknownSync(SeamEvent);\nexport const encodeSeamEvent = Schema.encodeSync(SeamEvent);\nexport const decodeSubscription = Schema.decodeUnknownSync(Subscription);\nexport const encodeSubscription = Schema.encodeSync(Subscription);\n","import type { PluginContributionKind } from '@kyberagent/extension-contracts';\n\n// SPEC 2 Stage 2 — the deprecation surface for the raw-string contributionId path.\n// Kept in its OWN module (not re-exported from index.ts) so the capabilities\n// generator — which reflects only index.ts's exports as the authoring DSL — does\n// not surface these test/diagnostic hooks as SDK \"helpers\". Internal concern.\n\n/** Raw-string contributionIds seen by a builder. One entry per unique id (the\n * warning fires once). Lets tests assert the bridge is signalling and tooling\n * report what Stage 3 still has to migrate. */\nconst rawContributionIdUsageSet = new Set<string>();\n\n/** Record a raw-string contributionId usage and emit a one-time, NON-FATAL\n * deprecation warning naming the typed replacement. */\nexport function recordRawContributionId(id: string, kind: PluginContributionKind): void {\n if (rawContributionIdUsageSet.has(id)) return; // one-time per id\n rawContributionIdUsageSet.add(id);\n console.warn(\n `[extension-sdk] contributionId \"${id}\" was passed as a raw string. Pass typed fields ` +\n `instead — { ext, name? } for kind \"${kind}\" — and the SDK derives the id. The raw-string ` +\n `path is deprecated and will be removed in SPEC 2 Stage 4.`,\n );\n}\n\n/** Diagnostic/test hook: the raw-string contributionIds that took the deprecated path. */\nexport function rawContributionIdUsages(): readonly string[] {\n return [...rawContributionIdUsageSet];\n}\n\n/** Test hook: forget recorded usages (so the one-time signal can be re-observed). */\nexport function clearRawContributionIdUsages(): void {\n rawContributionIdUsageSet.clear();\n}\n","/**\n * The host↔extension seam, as interfaces — the Phase-2 spine of the SDK-coherence\n * program (docs/61). This is the GROWN contract that docs/62 (HOST port), docs/63\n * (EXT port) and docs/64 (responsibility map) describe; this file is the real,\n * compiler-checked TypeScript those docs annotate. The markdown explains the WHY;\n * THIS is the deliverable.\n *\n * FREEZE STATUS (ADR-5 + ADR-6): this module is the contract — mostly type-only\n * (the port interfaces, SeamCallContext, BlockedReason). It also holds a SMALL,\n * SANCTIONED runtime core: the shared gate factory `gatedHostPort`, the branded\n * construction helpers `makeAgentId`/`makeSeamCallContext`, and `SeamPermissionDenied`.\n * Per ADR-6 these live HERE deliberately so the Phase-5 production host and the\n * InMemoryHost import the IDENTICAL gate — the \"same gate\" guarantee is structural,\n * not a doc claim. That is the only runtime here; the conforming IMPLEMENTATIONS (the\n * production host adapter, per-extension answering ports) still land in **Phase 5**.\n *\n * TRANSITION NOTE: the canonical host port lives here as `HostPort`, and the brain\n * port types are now defined HERE (the canonical home). The narrow 1-channel\n * `ExtensionHostPort` in `./testing/host-port.ts` re-exports these and is the seed\n * `InMemoryHost` still implements for back-compat; Phase 5 retires it once the\n * grown `HostPort` path is the only one.\n */\n\nimport type {\n AgentId,\n HostCapabilityId,\n KernelPermissionId,\n KernelPrincipalKind,\n SeamDescribePayload,\n SeamEvent,\n SeamInvokePayload,\n SeamQueryPayload,\n SeamResponse,\n Subscription,\n} from '@kyberagent/extension-contracts';\nimport { makeAgentId } from '@kyberagent/extension-contracts';\n\n// KYB-228 slice 4 — the branded active-agent identity now has a SINGLE definition,\n// owned by the production contract (`@kyberagent/extension-contracts`). The SDK re-exports it so\n// there is ONE `AgentId` brand + one `makeAgentId` across the codebase, not two\n// structurally-identical copies that could drift. The production seam contract and the\n// conformance harness now speak the same branded type.\nexport type { AgentId };\nexport { makeAgentId };\n\n// ─── Brain read surface (canonical home; testing/host-port.ts re-exports) ──────\n\nexport type BrainStatsView = { entities: number; notes: number };\nexport type BrainHit = { id: string; title: string; score: number };\n\n/** The read surface an extension receives for the brain channel (host-owned). */\nexport interface BrainReadPort {\n stats(): Promise<BrainStatsView>;\n query(text: string, opts?: { limit?: number }): Promise<BrainHit[]>;\n}\n\n// ─── Cross-cutting call context — closes DIV-5 (identity) + DIV-6 (agent) ──────\n\n/** The host-attested principal. Carries HOW it was attested; it is stamped host-side\n * (frame origin / session) and NEVER read from a request payload (DIV-5). */\nexport interface VerifiedPrincipal {\n readonly kind: KernelPrincipalKind;\n readonly id: string;\n /** The trust source. Absence of a known source ⇒ untrusted. */\n readonly attestedBy: 'frame-origin' | 'session';\n}\n\n/** Injected with every host port and passed into every EXT-port call. The active\n * agent rides HERE (ambient), not as a per-method argument — so no dispatch path\n * can forget or forge it. */\nexport interface SeamCallContext {\n readonly principal: VerifiedPrincipal;\n readonly activeAgent: AgentId;\n readonly hostId?: string;\n readonly requestedAtMs: number;\n}\n\n// ─── HOST port (driven) — what the host EXPOSES to an extension (docs/62) ──────\n\n/** The host-context snapshot an extension may READ over the gated seam (host stays\n * the holder; the extension only ever gets a serialized snapshot). */\nexport interface HostContextSnapshot {\n readonly activeAgent: AgentId;\n readonly [key: string]: unknown;\n}\n\n/** host.context.read — a gated read of the serialized host context. */\nexport interface HostContextPort {\n snapshot(): Promise<HostContextSnapshot>;\n}\n\n/** A command the host advertises as invokable-by-name (the allowlist entry). */\nexport interface HostCommandDescriptor {\n readonly commandId: string;\n readonly displayName: string;\n}\n\n/** host.command.invoke — the extension ASKS the host to run an allowlisted command\n * by name; the host authorizes + runs it. The extension never acts directly. */\nexport interface HostCommandPort {\n describe(): Promise<readonly HostCommandDescriptor[]>;\n invoke(commandId: string, args?: Record<string, unknown>): Promise<SeamResponse>;\n}\n\n/** Events the host pushes to a subscribing extension (host→ext leg of the Events\n * contract). Optional on the host port pending the docs/63 D6 ownership call. */\nexport interface HostEventPort {\n subscribe(sub: Subscription, emit: (event: SeamEvent) => void): () => void;\n}\n\n/** The grown HOST port. One interface carrying the host-owned contracts; the active\n * agent + principal ride on `ctx`. Both the production host AND `InMemoryHost`\n * implement this (Phase 5). Supersedes the narrow `ExtensionHostPort` seed. */\nexport interface HostPort {\n readonly ctx: SeamCallContext;\n readonly brain: BrainReadPort; // gate: brain.read (host-owned, agent-keyed via ctx.activeAgent)\n readonly context: HostContextPort; // gate: host.context.read\n readonly command: HostCommandPort; // gate: host.command.invoke\n readonly events?: HostEventPort; // gate: none (ext-emitted) — see docs/63 D6\n}\n\n/** The shared gate (declaration is NOT the grant — DIV-2). BOTH adapters wrap their\n * raw port in this single factory, so `InMemoryHost` enforces the SAME gate as\n * production and a unit test can't pass where prod would deny (SDK-N3). The\n * implementation (`gatedHostPort`, below) lives in THIS shared, non-testing module\n * precisely so the production host can import the SAME factory — the \"same gate\"\n * guarantee is structural, not a doc claim. */\nexport type GatedHostPortFactory = (\n inner: HostPort,\n grants: ReadonlySet<KernelPermissionId>,\n) => HostPort;\n\n// ─── Activation — a guard BEFORE the port (docs/62 §4) — closes DIV-1/3/7 ──────\n\n/** Why a port was withheld. A discriminated union, replacing the single opaque\n * `'blocked'` runtime state (DIV-3); `inactive.scope` makes the per-agent vs\n * machine question explicit (DIV-7). */\nexport type BlockedReason =\n | { readonly cause: 'inactive'; readonly scope: 'agent' | 'machine' }\n | { readonly cause: 'missing-host-capability'; readonly missing: readonly HostCapabilityId[] }\n | { readonly cause: 'denied-permission'; readonly denied: readonly KernelPermissionId[] }\n // The audit re-ranked DIV-3 to >=4 causes: remote daemon URL/token missing, dependency\n // install failure, and connector auth — none of which is a capability or permission. They\n // were collapsing to a raw 'blocked'. One discriminated variant, keyed by the unmet need.\n | {\n readonly cause: 'unmet-requirement';\n readonly requirement: 'remote-config' | 'dependency-install' | 'connector-auth';\n readonly detail?: string;\n };\n\n/** The activation authority's verdict (docs/64 §4): hand over a gated port, or\n * withhold it with a typed cause. The runner calls this BEFORE injecting a port. */\nexport type PortInjectionResult =\n | { readonly ok: true; readonly port: HostPort }\n | { readonly ok: false; readonly blocked: BlockedReason };\n\n// ─── EXT port (driving) — what a contribution IMPLEMENTS (docs/63) ─────────────\n\n/** kind: dataEndpoint — Data contract. Headless; answers a query with its OWN rows. */\nexport interface DataEndpointPort {\n query(\n payload: SeamQueryPayload,\n ctx: SeamCallContext,\n ): Promise<ReadonlyArray<Record<string, unknown>>>;\n}\n\n/** What a composer capability advertises as valid for a given host config. */\nexport interface ComposerDescriptor {\n readonly commands: readonly { readonly commandId: string; readonly displayName: string }[];\n}\n\n/** kind: composerCapability — Composer contract. Describe valid commands, then run one. */\nexport interface ComposerCapabilityPort {\n describe(payload: SeamDescribePayload, ctx: SeamCallContext): Promise<ComposerDescriptor>;\n invoke(payload: SeamInvokePayload, ctx: SeamCallContext): Promise<SeamResponse>;\n}\n\n/** kind: contextualAction / chat source — Chat contract. A single invoke round-trip. */\nexport interface InvokablePort {\n invoke(payload: SeamInvokePayload, ctx: SeamCallContext): Promise<SeamResponse>;\n}\n\n/** Events contract — the ext emits; the host subscribes with a filter. subscribe +\n * push are two methods of ONE port (resolves the docs/56 \"two-directions\" flag). */\nexport interface EventSourcePort {\n subscribe(sub: Subscription, emit: (event: SeamEvent) => void, ctx: SeamCallContext): () => void;\n}\n\n/** Any contribution the host may call into. RENDERING kinds (surface, settingsPanel)\n * implement none of these — they render and CONSUME the host port instead. */\nexport type AnsweringPort =\n | DataEndpointPort\n | ComposerCapabilityPort\n | InvokablePort\n | EventSourcePort;\n\n// ─── The whole extension at runtime (docs/63 §4) ──────────────────────────────\n\n/** What the runner (production host, or `InMemoryHost` in tests) gives and gets for\n * one extension: the injected, already-gated HOST port it consumes, and the\n * answering EXT ports — keyed by contributionId — the host may call. */\nexport interface ExtensionRuntime {\n readonly host: HostPort;\n readonly contributions: ReadonlyMap<string, AnsweringPort>;\n}\n\n// ─── Construction helpers — the ONLY sanctioned way to mint branded values ─────\n// Without these a branded AgentId / SeamCallContext can't be built except by an\n// unchecked cast (red-team A4). The validation that the agent EXISTS is the host's\n// attestation job (HOST-N3); these helpers mint the type from an already-trusted\n// name, so the brand marks \"this came through attestation\", not \"any string\".\n\n/** Assemble a SeamCallContext from already-attested parts. */\nexport function makeSeamCallContext(parts: {\n principal: VerifiedPrincipal;\n activeAgent: AgentId;\n hostId?: string;\n requestedAtMs: number;\n}): SeamCallContext {\n return parts;\n}\n\n/** Thrown by a gated host port when a host-owned capability is reached without its\n * grant (C5). Carries the missing permission so callers can map it to a typed\n * `seam.permission_denied` SeamError. */\nexport class SeamPermissionDenied extends Error {\n readonly code = 'seam.permission_denied' as const;\n constructor(readonly permission: KernelPermissionId) {\n super(`seam.permission_denied: missing grant for ${permission}`);\n this.name = 'SeamPermissionDenied';\n }\n}\n\n/**\n * The shared permission gate. BOTH the production host (Phase 5) and `InMemoryHost`\n * wrap their raw `HostPort` in THIS one factory, so the in-memory harness enforces\n * the SAME gate as production (SDK-N3 / docs/62 §3). Access to a host-owned\n * capability without its grant throws a typed `SeamPermissionDenied` (C5). Events\n * are ext-owned and ungated (docs/63 D6). Lives in this shared, non-testing module\n * so the production host can import it directly — no test-module dependency.\n */\nexport const gatedHostPort: GatedHostPortFactory = (inner, grants) => ({\n ctx: inner.ctx,\n get brain() {\n if (!grants.has('brain.read')) throw new SeamPermissionDenied('brain.read');\n return inner.brain;\n },\n get context() {\n if (!grants.has('host.context.read')) throw new SeamPermissionDenied('host.context.read');\n return inner.context;\n },\n get command() {\n if (!grants.has('host.command.invoke')) throw new SeamPermissionDenied('host.command.invoke');\n return inner.command;\n },\n events: inner.events,\n});\n","import type {\n BridgeDeclaration,\n ExtensionHostSlot,\n HostCapabilityId,\n KernelPermissionId,\n NormalizedPluginExtensionContributionSet,\n PluginContributionKind,\n PluginManifestContribution,\n PluginShipsState,\n PluginThemeTokenSet,\n ProviderRuntimeProjectionDescriptor,\n SidecarDeclaration,\n WorkspaceTabContributionMetadata,\n} from '@kyberagent/extension-contracts';\nimport {\n contributionId as deriveContributionId,\n HostCapabilityId as HostCapabilityIdSchema,\n KernelPermissionId as KernelPermissionIdSchema,\n validateContributionId,\n validateOutboundOrigin,\n} from '@kyberagent/extension-contracts';\nimport { recordRawContributionId } from './contribution-id-deprecation.js';\n\n// The grown seam-port interfaces — the Phase-2 SDK-coherence deliverable (docs/61–64).\n// Type-only; nothing implements it yet (implementations land in Phase 5). ADR-5.\nexport * from './seam-ports.js';\n\nexport const EXTENSION_HOST_SLOTS = [\n 'nav.sidebar',\n 'workspace.surface',\n 'settings.extensions',\n 'chat.visual',\n 'thread.tab.contextMenu',\n 'companion.overlay',\n 'background.sidecar',\n] as const satisfies readonly ExtensionHostSlot[];\n\nexport type ExtensionSurfaceDefinition = PluginManifestContribution & {\n kind: 'surface';\n};\n\nexport type ExtensionWorkspaceTabDefinition = WorkspaceTabContributionMetadata;\n\nexport type ExtensionSettingsPanelDefinition = PluginManifestContribution & {\n kind: 'settingsPanel';\n};\n\nexport type ExtensionComposerCapabilityDefinition = PluginManifestContribution & {\n kind: 'composerCapability';\n};\n\nexport type ExtensionContextualActionDefinition = PluginManifestContribution & {\n kind: 'contextualAction';\n};\n\nexport type ExtensionSidecarContributionDefinition = PluginManifestContribution & {\n kind: 'sidecar';\n};\n\nexport type ExtensionBridgeContributionDefinition = PluginManifestContribution & {\n kind: 'bridge';\n};\n\n/**\n * A headless, queryable data source addressed by the seam `query` op. Distinct\n * from a surface (which renders): a data endpoint *answers* queries and may have\n * no UI at all (e.g. agent-only data, or a remote agent with no renderer). One\n * endpoint can back many surfaces — they query it, they don't own its data.\n */\nexport type ExtensionDataEndpointDefinition = PluginManifestContribution & {\n kind: 'dataEndpoint';\n};\n\nexport type ExtensionContributionDefinition =\n | ExtensionSurfaceDefinition\n | ExtensionSettingsPanelDefinition\n | ExtensionComposerCapabilityDefinition\n | ExtensionContextualActionDefinition\n | ExtensionSidecarContributionDefinition\n | ExtensionBridgeContributionDefinition\n | ExtensionDataEndpointDefinition\n | PluginManifestContribution;\n\nexport type ExtensionDefinition = {\n pluginId: string;\n displayName: string;\n version?: string;\n // KYB-202 (ADR-0060 §5): the DECLARED default-activation state. `active` = ships\n // auto-activated on a fresh install (the core surfaces — home/projects/theme/pets);\n // omitted/`inactive` = arrives inactive under default-deny (KYB-192). This is the\n // manifest field that replaces the hardcoded `CORE_ACTIVE_EXTENSIONS` allowlist.\n // Only ever honored for BUNDLED first-party extensions — an installed package\n // (`source: 'user'`) can never ship active (ADR-0060 §4/§5), enforced at boot.\n ships?: PluginShipsState;\n contributions?: readonly ExtensionContributionDefinition[];\n surfaces?: readonly ExtensionSurfaceDefinition[];\n settingsPanels?: readonly ExtensionSettingsPanelDefinition[];\n composerCapabilities?: readonly ExtensionComposerCapabilityDefinition[];\n contextualActions?: readonly ExtensionContextualActionDefinition[];\n sidecarContributions?: readonly ExtensionSidecarContributionDefinition[];\n bridgeContributions?: readonly ExtensionBridgeContributionDefinition[];\n dataEndpoints?: readonly ExtensionDataEndpointDefinition[];\n sidecars?: readonly SidecarDeclaration[];\n bridges?: readonly BridgeDeclaration[];\n themeTokens?: readonly PluginThemeTokenSet[];\n hostCapabilities?: readonly HostCapabilityId[];\n providerProjections?: readonly ProviderRuntimeProjectionDescriptor[];\n permissions?: readonly KernelPermissionId[];\n deniedPermissions?: readonly KernelPermissionId[];\n // Path C (docs/80 §5, KYB-209): the origins this extension's OWN backend lives\n // at — a plain array of bare origins (exact `scheme://host[:port]` or the\n // CSP-style port wildcard `scheme://host:*`). Validated by\n // validateExtensionDefinition; feeds the per-frame CSP and the daemon broker.\n outboundOrigins?: readonly string[];\n};\n\n// ---------------------------------------------------------------------------\n// SPEC 2 Stage 2 — define* builders DERIVE the contributionId (dual-accept bridge).\n// An author supplies typed `{ ext, name? }` and the builder (which already knows\n// its `kind`) derives the id via the contracts deriver — so the id can't be\n// hand-typed wrong. The legacy raw `contributionId` string still works (Hyrum-safe\n// for a multi-dev repo) but emits a one-time, NON-FATAL deprecation signal. The\n// raw-string path is REMOVED in Stage 4 (the dated demolition), not here.\n// ---------------------------------------------------------------------------\n\n/** The contributionId half of a builder input: EITHER typed key fields (derived)\n * OR a legacy raw string (deprecated). The XOR keeps authors from supplying both. */\nexport type ContributionKeyInput =\n | { ext: string; name?: string; contributionId?: undefined }\n | { contributionId: string; ext?: undefined; name?: undefined };\n\n/** A builder input = the contribution's own fields (minus kind + the id) plus the\n * id supplied as typed fields or a legacy string. */\ntype BuilderInput<T extends PluginManifestContribution> = Omit<T, 'kind' | 'contributionId'> &\n ContributionKeyInput;\n\n/** Resolve a builder's contributionId: derive it from typed fields, or accept (and\n * deprecation-signal) a legacy raw string. The single place both paths converge.\n * The deprecation registry is a separate internal module so it is NOT reflected as\n * an authoring helper in the capabilities artifact. */\nfunction resolveContributionId(\n kind: PluginContributionKind,\n input: { ext?: string; name?: string; contributionId?: string },\n): string {\n if (input.ext !== undefined) {\n return deriveContributionId({ owner: 'ext', kind, ext: input.ext, name: input.name });\n }\n if (input.contributionId !== undefined) {\n recordRawContributionId(input.contributionId, kind);\n return input.contributionId;\n }\n throw new Error(`define(${kind}): provide typed { ext, name? } or a legacy contributionId string`);\n}\n\nexport function defineSurface(\n surface: BuilderInput<ExtensionSurfaceDefinition>,\n): ExtensionSurfaceDefinition {\n const { ext, name, contributionId, ...rest } = surface;\n return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId('surface', { ext, name, contributionId }), kind: 'surface' };\n}\n\nexport function defineSettingsPanel(\n panel: BuilderInput<ExtensionSettingsPanelDefinition>,\n): ExtensionSettingsPanelDefinition {\n const { ext, name, contributionId, ...rest } = panel;\n return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId('settingsPanel', { ext, name, contributionId }), kind: 'settingsPanel' };\n}\n\nexport function defineComposerCapability(\n capability: BuilderInput<ExtensionComposerCapabilityDefinition>,\n): ExtensionComposerCapabilityDefinition {\n const { ext, name, contributionId, ...rest } = capability;\n return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId('composerCapability', { ext, name, contributionId }), kind: 'composerCapability' };\n}\n\nexport function defineContextualAction(\n action: BuilderInput<ExtensionContextualActionDefinition>,\n): ExtensionContextualActionDefinition {\n const { ext, name, contributionId, ...rest } = action;\n return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId('contextualAction', { ext, name, contributionId }), kind: 'contextualAction' };\n}\n\nexport function defineSidecarContribution(\n sidecar: BuilderInput<ExtensionSidecarContributionDefinition>,\n): ExtensionSidecarContributionDefinition {\n const { ext, name, contributionId, ...rest } = sidecar;\n return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId('sidecar', { ext, name, contributionId }), kind: 'sidecar' };\n}\n\nexport function defineBridgeContribution(\n bridge: BuilderInput<ExtensionBridgeContributionDefinition>,\n): ExtensionBridgeContributionDefinition {\n const { ext, name, contributionId, ...rest } = bridge;\n return { ...rest, requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities), contributionId: resolveContributionId('bridge', { ext, name, contributionId }), kind: 'bridge' };\n}\n\nexport function defineDataEndpoint(\n endpoint: Omit<BuilderInput<ExtensionDataEndpointDefinition>, 'requiredHostCapabilities'> & {\n requiredHostCapabilities?: ExtensionDataEndpointDefinition['requiredHostCapabilities'];\n },\n): ExtensionDataEndpointDefinition {\n // A data endpoint is headless — it answers queries, it doesn't touch the host.\n // Default to no host capabilities so authors needn't declare an empty array;\n // the manifest schema still requires the field to be present.\n const { ext, name, contributionId, ...rest } = endpoint;\n return {\n ...rest,\n requiredHostCapabilities: canonicalHostCapabilities(rest.requiredHostCapabilities),\n contributionId: resolveContributionId('dataEndpoint', { ext, name, contributionId }),\n kind: 'dataEndpoint',\n };\n}\n\nexport function defineSidecar(sidecar: SidecarDeclaration): SidecarDeclaration {\n return sidecar;\n}\n\nexport function defineBridge(bridge: BridgeDeclaration): BridgeDeclaration {\n return bridge;\n}\n\nexport function defineThemeTokens(themeTokens: PluginThemeTokenSet): PluginThemeTokenSet {\n return themeTokens;\n}\n\nexport function defineProviderRuntimeProjection(\n projection: ProviderRuntimeProjectionDescriptor,\n): ProviderRuntimeProjectionDescriptor {\n return projection;\n}\n\nexport function defineExtension(definition: ExtensionDefinition): ExtensionDefinition {\n return definition;\n}\n\nexport function emitExtensionContributionSet(\n definition: ExtensionDefinition,\n): NormalizedPluginExtensionContributionSet {\n const surfaces = [...(definition.surfaces ?? [])];\n const settingsPanels = [...(definition.settingsPanels ?? [])];\n const composerCapabilities = [...(definition.composerCapabilities ?? [])];\n const contextualActions = [...(definition.contextualActions ?? [])];\n const sidecarContributions = [...(definition.sidecarContributions ?? [])];\n const bridgeContributions = [...(definition.bridgeContributions ?? [])];\n const dataEndpoints = [...(definition.dataEndpoints ?? [])];\n return {\n surfaces,\n settingsPanels,\n contributions: [...(definition.contributions ?? [\n ...surfaces,\n ...settingsPanels,\n ...composerCapabilities,\n ...contextualActions,\n ...sidecarContributions,\n ...bridgeContributions,\n ...dataEndpoints,\n ])],\n sidecars: [...(definition.sidecars ?? [])],\n bridges: [...(definition.bridges ?? [])],\n permissions: [...(definition.permissions ?? [])],\n deniedPermissions: [...(definition.deniedPermissions ?? [])],\n themeTokens: [...(definition.themeTokens ?? [])],\n hostCapabilities: [...(definition.hostCapabilities ?? [])],\n providerProjections: [...(definition.providerProjections ?? [])],\n outboundOrigins: [...(definition.outboundOrigins ?? [])],\n ...(definition.ships ? { ships: definition.ships } : {}),\n };\n}\n\n// The canonical id sets, derived from the contracts Schema literals — NOT a second\n// hand-maintained list (one canonical home). Lets the builders VALIDATE at runtime,\n// closing the no-op-validator hole (red-team SDK-N1): a JS author or a cast that\n// passes an unknown id now fails loudly instead of silently entering the manifest.\nconst VALID_HOST_CAPABILITY_IDS: ReadonlySet<string> = new Set(HostCapabilityIdSchema.literals);\nconst VALID_KERNEL_PERMISSION_IDS: ReadonlySet<string> = new Set(KernelPermissionIdSchema.literals);\n\nexport function requiresHostCapabilities(\n ...capabilities: HostCapabilityId[]\n): HostCapabilityId[] {\n for (const capability of capabilities) {\n if (!VALID_HOST_CAPABILITY_IDS.has(capability)) {\n throw new Error(`requiresHostCapabilities: unknown host capability id \"${capability}\"`);\n }\n }\n return capabilities;\n}\n\n/**\n * The ONE canonical \"no host capability\" form (C14 / NEW-E5). \"None\" was expressed\n * three ways — `requiresHostCapabilities()` (empty call), `[]`, and omitted — which\n * drifted across plugins. This collapses all three to a single value: `undefined`/`[]`\n * → `[]`. Duplicates are removed but DECLARED ORDER IS PRESERVED, so normalizing an\n * existing non-empty declaration never reorders a generated manifest (no drift).\n */\nexport function canonicalHostCapabilities(\n value?: readonly HostCapabilityId[],\n): readonly HostCapabilityId[] {\n if (!value || value.length === 0) return [];\n return value.filter((capability, index) => value.indexOf(capability) === index);\n}\n\nexport function requiresKernelPermissions(\n ...permissions: KernelPermissionId[]\n): KernelPermissionId[] {\n for (const permission of permissions) {\n if (!VALID_KERNEL_PERMISSION_IDS.has(permission)) {\n throw new Error(`requiresKernelPermissions: unknown kernel permission id \"${permission}\"`);\n }\n }\n return permissions;\n}\n\nexport function hostSlots(...slots: ExtensionHostSlot[]): ExtensionHostSlot[] {\n return slots;\n}\n\nexport function workspaceTab(\n tab: ExtensionWorkspaceTabDefinition = {},\n): ExtensionWorkspaceTabDefinition {\n return {\n defaultVisible: tab.defaultVisible ?? true,\n ...(tab.defaultLabel ? { defaultLabel: tab.defaultLabel } : {}),\n allowRename: tab.allowRename ?? true,\n };\n}\n\nexport function validateExtensionDefinition(definition: ExtensionDefinition): string[] {\n const errors: string[] = [];\n if (!definition.pluginId.trim()) errors.push('pluginId is required');\n if (!definition.displayName.trim()) errors.push('displayName is required');\n // Path C (docs/80 §5): every declared outbound origin must be a bare, exact\n // origin (or a CSP-style port wildcard). A malformed entry would mean two\n // different things to the CSP and the broker, so it fails generation here.\n for (const origin of definition.outboundOrigins ?? []) {\n const err = validateOutboundOrigin(origin);\n if (err) errors.push(err);\n }\n const contributionIds = new Set<string>();\n const sidecarIds = new Set((definition.sidecars ?? []).map((sidecar) => sidecar.sidecarId));\n const bridgeIds = new Set((definition.bridges ?? []).map((bridge) => bridge.bridgeId));\n for (const contribution of allContributionDefinitions(definition)) {\n validateContributionBase(contribution, errors, contributionIds);\n }\n for (const surface of definition.surfaces ?? []) {\n if (!surface.contributionId.trim()) errors.push('surface contributionId is required');\n if (!surface.mount?.trim()) errors.push(`surface ${surface.contributionId || '<missing>'} mount is required`);\n }\n for (const panel of definition.settingsPanels ?? []) {\n if (!panel.contributionId.trim()) errors.push('settings panel contributionId is required');\n if (!panel.mount?.trim()) errors.push(`settings panel ${panel.contributionId || '<missing>'} mount is required`);\n }\n for (const sidecarContribution of definition.sidecarContributions ?? []) {\n if (!sidecarIds.has(sidecarContribution.contributionId)) {\n errors.push(`sidecar contribution ${sidecarContribution.contributionId} must have a matching sidecar declaration`);\n }\n }\n for (const bridgeContribution of definition.bridgeContributions ?? []) {\n if (!bridgeIds.has(bridgeContribution.contributionId)) {\n errors.push(`bridge contribution ${bridgeContribution.contributionId} must have a matching bridge declaration`);\n }\n }\n for (const sidecar of definition.sidecars ?? []) {\n if (!sidecar.sidecarId.trim()) errors.push('sidecar sidecarId is required');\n if (sidecar.pluginId !== definition.pluginId) errors.push(`sidecar ${sidecar.sidecarId} pluginId must match ${definition.pluginId}`);\n }\n for (const bridge of definition.bridges ?? []) {\n if (!bridge.bridgeId.trim()) errors.push('bridge bridgeId is required');\n if (bridge.pluginId !== definition.pluginId) errors.push(`bridge ${bridge.bridgeId} pluginId must match ${definition.pluginId}`);\n }\n errors.push(...validateDefinitionCrossRefs(definition));\n return errors;\n}\n\n/**\n * Cross-reference invariant (C15 / SDK-N2): contribution ⊆ extension — for KERNEL\n * PERMISSIONS. A contribution may only require a kernel permission the extension\n * DECLARES at the top level. \"Declared\" = `permissions` ∪ `deniedPermissions`: the\n * extension must own the permission in its manifest, but it may be in the DENIED bucket\n * — the gate decides grant-vs-deny at runtime (the default-deny model, KYB-176). A\n * contribution requiring a permission the extension declares NOWHERE (neither granted\n * nor denied) is the real breach, because the extension never owned it. Returns one\n * error per breach.\n *\n * HOST CAPABILITIES are deliberately NOT subset-checked (DIV-8, 2026-06-30): the\n * codebase models them as contribution-scoped — 16 of 17 first-party plugins declare\n * host capabilities only at the contribution level, and the real host-capability\n * invariant (\"can this surface render on this host?\") is checked host-side per\n * contribution (KernelSurfaceAvailability), not as a subset of an extension-level list.\n * `deriveExtensionHostCapabilities` exposes the union for reporting if a caller wants\n * the extension's total host-capability footprint.\n */\nexport function validateDefinitionCrossRefs(definition: ExtensionDefinition): string[] {\n const errors: string[] = [];\n const declaredPermissions = new Set<KernelPermissionId>([\n ...(definition.permissions ?? []),\n ...(definition.deniedPermissions ?? []),\n ]);\n for (const contribution of allContributionDefinitions(definition)) {\n const id = contribution.contributionId || '<missing>';\n for (const permission of contribution.requiredKernelPermissions ?? []) {\n if (!declaredPermissions.has(permission)) {\n errors.push(\n `contribution ${id} requires kernel permission \"${permission}\" the extension declares nowhere (neither granted nor denied — contribution ⊆ extension)`,\n );\n }\n }\n }\n return errors;\n}\n\n/**\n * The extension's total host-capability footprint: the union of every contribution's\n * `requiredHostCapabilities` plus any declared at the extension level (DIV-8). Derived,\n * not hand-authored — so it can't drift from what the contributions actually need.\n */\nexport function deriveExtensionHostCapabilities(\n definition: ExtensionDefinition,\n): readonly HostCapabilityId[] {\n const union: HostCapabilityId[] = [...(definition.hostCapabilities ?? [])];\n for (const contribution of allContributionDefinitions(definition)) {\n for (const capability of contribution.requiredHostCapabilities ?? []) union.push(capability);\n }\n return canonicalHostCapabilities(union);\n}\n\nfunction allContributionDefinitions(definition: ExtensionDefinition): ExtensionContributionDefinition[] {\n return [\n ...(definition.contributions ?? []),\n ...(definition.surfaces ?? []),\n ...(definition.settingsPanels ?? []),\n ...(definition.composerCapabilities ?? []),\n ...(definition.contextualActions ?? []),\n ...(definition.sidecarContributions ?? []),\n ...(definition.bridgeContributions ?? []),\n ...(definition.dataEndpoints ?? []),\n ];\n}\n\nfunction validateContributionBase(\n contribution: ExtensionContributionDefinition,\n errors: string[],\n contributionIds: Set<string>,\n) {\n const id = contribution.contributionId?.trim();\n if (!id) {\n errors.push('contributionId is required');\n return;\n }\n if (contributionIds.has(id)) errors.push(`duplicate contributionId ${id}`);\n contributionIds.add(id);\n // Convention-over-configuration: the id prefix must match the contribution kind,\n // and an extension may not claim a host-owned namespace. Grandfathered exceptions\n // (see contracts/contribution-convention.ts) keep this from breaking pre-existing ids.\n const conventionVerdict = validateContributionId(id, contribution.kind);\n if (!conventionVerdict.ok) errors.push(conventionVerdict.error);\n if (!contribution.displayName?.trim()) errors.push(`contribution ${id} displayName is required`);\n for (const slot of contribution.hostSlots ?? []) {\n if (!EXTENSION_HOST_SLOTS.includes(slot)) errors.push(`contribution ${id} has unknown host slot ${slot}`);\n }\n if (contribution.workspaceTab && !contribution.hostSlots?.includes('workspace.surface')) {\n errors.push(`contribution ${id} declares workspaceTab without workspace.surface`);\n }\n}\n\nexport type {\n BridgeDeclaration,\n ExtensionHostSlot,\n HostCapabilityId,\n KernelPermissionId,\n KernelPluginRegistryEntry,\n KernelRegistrySnapshot,\n NormalizedPluginExtensionContributionSet,\n PluginManifestContribution,\n PluginShipsState,\n PluginThemeTokenSet,\n ProviderRuntimeProjectionDescriptor,\n SidecarDeclaration,\n WorkspaceTabContributionMetadata,\n} from '@kyberagent/extension-contracts';\n"],"mappings":";AAAA,SAAS,UAAAA,eAAc;;;ACAvB,SAAS,cAAc;AAEhB,IAAM,+BAA+B,OAAO;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,iCAAiC,OAAO;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,2BAA2B,OAAO,OAAO;AAAA,EACpD,cAAc,OAAO;AAAA,EACrB,UAAU,OAAO;AAAA,EACjB,MAAM;AAAA,EACN,SAAS,OAAO,SAAS,OAAO,MAAM;AAAA,EACtC,aAAa,OAAO,SAAS,OAAO,MAAM;AAAA,EAC1C,UAAU,OAAO,SAAS,OAAO,MAAM;AAAA,EACvC,aAAa,OAAO,SAAS,OAAO,MAAM;AAAA,EAC1C,WAAW,OAAO,SAAS,OAAO,MAAM;AAAA,EACxC,UAAU,OAAO,SAAS,OAAO,MAAM;AAAA,EACvC,iBAAiB,OAAO,SAAS,OAAO,MAAM;AAAA,EAC9C,OAAO,OAAO;AAAA,EACd,YAAY,OAAO;AAAA,EACnB,cAAc,OAAO;AAAA,EACrB,QAAQ;AAAA,EACR,gBAAgB,OAAO,SAAS,OAAO,MAAM;AAC/C,CAAC;AAGM,IAAM,iCAAiC,OAAO,kBAAkB,wBAAwB;AACxF,IAAM,iCAAiC,OAAO,WAAW,wBAAwB;;;ADpCjF,IAAM,6BAA6BC,QAAO,QAAQ,SAAS,QAAQ;AAGnE,IAAM,wBAAwBA,QAAO,OAAO;AAAA,EACjD,WAAWA,QAAO;AAAA,EAClB,aAAaA,QAAO,SAASA,QAAO,MAAM;AAC5C,CAAC;AAGM,IAAM,sBAAsBA,QAAO,OAAO;AAAA,EAC/C,SAASA,QAAO;AAAA,EAChB,aAAaA,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AAI,EAAE;AAItB,QAAM,oBAAoB,uBAAuB,IAAI,aAAa,IAAI;AACtE,MAAI,CAAC,kBAAkB,GAAI,QAAO,KAAK,kBAAkB,KAAK;AAC9D,MAAI,CAAC,aAAa,aAAa,KAAK,EAAG,QAAO,KAAK,gBAAgB,EAAE,0BAA0B;AAC/F,aAAW,QAAQ,aAAa,aAAa,CAAC,GAAG;AAC/C,QAAI,CAAC,qBAAqB,SAAS,IAAI,EAAG,QAAO,KAAK,gBAAgB,EAAE,0BAA0B,IAAI,EAAE;AAAA,EAC1G;AACA,MAAI,aAAa,gBAAgB,CAAC,aAAa,WAAW,SAAS,mBAAmB,GAAG;AACvF,WAAO,KAAK,gBAAgB,EAAE,kDAAkD;AAAA,EAClF;AACF;","names":["Schema","Schema","Schema","Schema","Schema","Schema","Schema","contributionId","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","Schema","contributionId"]}