@xnetjs/plugins 2.3.0 → 2.5.0

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.
package/dist/index.d.ts CHANGED
@@ -322,6 +322,21 @@ interface ViewContribution {
322
322
  /** Schema IRIs this view supports (empty = all) */
323
323
  supportedSchemas?: string[];
324
324
  }
325
+ /**
326
+ * A frame source renderer (0346): how a node of some schema renders as
327
+ * a frame (document embeds, dashboard frame widgets, frame tabs). The
328
+ * capability rule mirrors slots: a plugin registers renderers only under
329
+ * its OWN id namespace and never replaces another provider's renderer —
330
+ * enforced by `PluginContext.registerFrameRenderer`.
331
+ */
332
+ interface FrameRendererContribution {
333
+ /** Renderer id — namespaced `${pluginId}:${name}` by the context. */
334
+ id: string;
335
+ /** Schema IRIs this renderer can frame ('*' = any). */
336
+ supportedSchemas: string[] | '*';
337
+ /** Component receiving the host's NodeFrameProps contract. */
338
+ component: ComponentType<never>;
339
+ }
325
340
  interface ViewProps {
326
341
  nodeId: string;
327
342
  schemaId: string;
@@ -783,6 +798,7 @@ declare class ContributionRegistry {
783
798
  readonly mentionProviders: TypedRegistry<MentionProviderContribution>;
784
799
  readonly agentTools: TypedRegistry<AgentToolContribution>;
785
800
  readonly slots: TypedRegistry<SlotContribution>;
801
+ readonly frameRenderers: TypedRegistry<FrameRendererContribution>;
786
802
  /** @deprecated Since 0280 — the dock registry is the slot registry. */
787
803
  get surfaceDock(): TypedRegistry<SlotContribution>;
788
804
  /**
@@ -1023,6 +1039,13 @@ interface ExtensionContext {
1023
1039
  registerSchema(schema: unknown): Disposable$1;
1024
1040
  /** Register a custom view type */
1025
1041
  registerView(view: ViewContribution): Disposable$1;
1042
+ /**
1043
+ * Register a frame source renderer (0346). Own-views-only rule: the
1044
+ * renderer id is namespaced under this plugin's id, so a plugin can
1045
+ * add frames for its own schemas but never replace another provider's
1046
+ * renderer.
1047
+ */
1048
+ registerFrameRenderer(renderer: FrameRendererContribution): Disposable$1;
1026
1049
  /** Register a dashboard widget (trust tier assigned by the host) */
1027
1050
  registerWidget(widget: WidgetContribution): Disposable$1;
1028
1051
  /** Register a property type handler */
@@ -2163,6 +2186,14 @@ declare class AiSurfaceService {
2163
2186
  private readPageMarkdown;
2164
2187
  private readPageOutline;
2165
2188
  private planPagePatch;
2189
+ /**
2190
+ * Compose a page of frames (0346, Phase 5): create the Page node, then
2191
+ * plan + apply its markdown content (intro + frame directives) through
2192
+ * the standard page pipeline — one audited step, rollbackable via the
2193
+ * page-markdown rollback handle (the created page itself is reported
2194
+ * so a rejected compose can be cleaned up).
2195
+ */
2196
+ private composePage;
2166
2197
  private applyPageMarkdown;
2167
2198
  private finalizeAppliedPageMarkdown;
2168
2199
  private getAuditLog;
@@ -7170,4 +7201,4 @@ declare function buildCommunityRegistryEntry(source: PluginSourceNode, options:
7170
7201
  */
7171
7202
  declare function exportPluginSourceAsRepoFiles(source: PluginSourceNode): Record<string, string>;
7172
7203
 
7173
- export { type AIComplexityLevel, type AICostModel, type AIGenerateRequest, type AIGenerateResponse, AIGenerationError, type AIMessage, type AIMessageRole, type AIModelCapabilities, type AIModelQuality, type AIPrivacyLevel, type AIProvider, type AIProviderConfig, type AIProviderOptions, AIProviderRouter, type AIProviderRouterOptions, type AIProviderType, type AIProviderUsage, AIRTABLE_CONNECTOR_ID, type AIRiskLevel, type AIScriptRequest, type AIScriptResponse, type AIStreamChunk, type AIToolCall, type AIToolSpec, type AIUsage, AI_GENERATED_PROVENANCE, AI_RISK_LEVELS, AI_SCOPES, AI_TARGET_KINDS, ALLOWED_PLUGIN_LICENSES, type ActionContext, type ActionDefinition, ActionDefinitionError, ActionDispatchError, type ActionEvent, ActionSsrfError, type ActionTrigger, type AgentAuditContext, AgentAuditRecorder, type AgentAuditRecorderConfig, type AgentAuditSurface, type AgentCallOutcome, type AgentExecutedResult, type AgentNotificationToolsOptions, type AgentPendingApproval, type AgentToolContribution, type AgentToolInputSchema, type AiAgentApproval, type AiAgentApprovalRequestInput, type AiAgentApprovalResolveInput, type AiAgentApprovalStatus, type AiAgentBackgroundJob, type AiAgentBackgroundJobInput, type AiAgentBackgroundJobRunner, type AiAgentBackgroundJobStatus, type AiAgentDisplayState, type AiAgentDisplayStateKind, type AiAgentEvent, type AiAgentEventType, type AiAgentOrchestratorMode, type AiAgentRunSelectionTurnInput, type AiAgentRunTurnInput, type AiAgentRunTurnResult, AiAgentRuntime, type AiAgentRuntimeConfig, type AiAgentRuntimeListener, type AiAgentRuntimeSnapshot, type AiAgentRuntimeStorage, type AiAgentSelectionContext, type AiAgentSelectionKind, type AiAgentTelemetrySnapshot, type AiAgentThread, type AiAgentThreadCreateInput, type AiAgentThreadStatus, type AiAgentTurn, type AiAgentTurnRole, type AiAgentTurnStatus, type AiAssistMode, type AiAuditEvent, type AiAuthoredPlugin, AiAuthoringError, AiBudgetError, type AiCallableTool, type AiChangeSet, type AiCommandExposure, type AiContextPack, type AiContextPackResource, type AiContextRetriever, type AiContextSeed, type AiDatabaseMutationApplyResult, type AiExtraTool, type AiJsonSchema, type AiJsonSchemaType, type AiMutationPlan, type AiMutationPlanStatus, type AiOperation, type AiPageMarkdownApplyAdapter, type AiPageMarkdownApplyAdapterInput, type AiPageMarkdownApplyAdapterResult, type AiPageMarkdownApplyResult, type AiPageMarkdownRollbackResult, type AiPluginPipelineInput, type AiPluginPipelinePorts, type AiPluginPipelineResult, type AiResource, type AiResourceContent, type AiRetrievedNode, type AiRiskLevel, type AiScope, type AiSearchOptions, type AiSearchResult, type AiSurfaceLimits, AiSurfaceService, type AiSurfaceServiceConfig, type AiTargetKind, type AiToolCallResult, type AiToolDefinition, type AiValidationResult, type AirtableConnectorOptions, type AllowedPluginLicense, AnthropicProvider, type ArrayHelpers, type BlockContribution, type BlockNotePageMarkdownAdapterOptions, type BlockProps, CANVAS_PLUGIN_FIXTURES, CHANNEL_SCHEMA, CHAT_MESSAGE_SCHEMA, CONNECTOR_CATEGORY, CONNECTOR_META, CRM_CANVAS_PLUGIN_FIXTURE, type CanvasCardContribution, type CanvasContribution, type CanvasContributionBase, type CanvasContributionPermission, type CanvasEdgeContribution, type CanvasErpPrototypeAuditEntry, type CanvasErpPrototypeAuditOperation, type CanvasErpPrototypeAuditSource, type CanvasErpPrototypeCard, type CanvasErpPrototypeCommand, type CanvasErpPrototypeEdge, type CanvasErpPrototypeEntityKind, type CanvasErpPrototypeLayoutKind, type CanvasErpPrototypeQueryFrame, type CanvasErpPrototypeQueryPredicate, type CanvasErpPrototypeRect, type CanvasErpPrototypeRisk, type CanvasErpPrototypeRiskSummary, type CanvasErpPrototypeScenario, type CanvasErpPrototypeStatus, type CanvasIngestInputKind, type CanvasIngestorContribution, type CanvasInspectorContribution, type CanvasInspectorPlacement, type CanvasLayoutContribution, type CanvasLayoutScope, type CanvasPluginFixture, type CanvasPluginFixtureCardSample, type CanvasPluginFixtureKind, type CanvasPluginPermissionDecisionStatus, type CanvasPluginPermissionGateDecision, type CanvasPluginPermissionGateInput, type CanvasPluginPermissionPrompt, type CanvasPluginPermissionPromptOption, type CanvasPluginPromptMode, type CanvasPluginSandboxDecision, type CanvasPluginSandboxDomAccess, type CanvasPluginSandboxKind, type CanvasPluginSandboxMutationAccess, type CanvasPluginSandboxNetworkAccess, type CanvasPluginSandboxOutput, type CanvasPluginSandboxOutputKind, type CanvasPluginSandboxOutputValidation, type CanvasPluginSandboxPolicy, type CanvasPluginSandboxRequest, type CanvasPluginWorkspacePolicy, type CanvasPreviewTier, type CanvasRendererSandboxContribution, type CanvasTemplateCategory, type CanvasTemplateContribution, type CanvasToolContribution, type CanvasToolGroup, CapabilityError, type ChromePosture, type CommandContext, type CommandContribution, CommandRegistry, type CommandScope, type CommunityRegistryEntry, type ConnectorArtifacts, type ConnectorCadence, type ConnectorDefinition, ConnectorDefinitionError, type ConnectorDetection, type ConnectorEnv, type ConnectorFetch, type ConnectorInstallGate, type ConnectorStore, type ConnectorSyncContext, ConnectorSyncError, type ConnectorSyncResult, type ConnectorSyncSpec, type ConnectorTier, type ConnectorToolDescriptor, type ConsentDecision, type ConsentLine, ContributionRegistry, DEFAULT_PLUGIN_LICENSE, DEFAULT_WORKSPACE_ID, type DefinedAction, type DefinedConnector, type DeleteDayOptions, type DeleteDayResult, type DeliveryResult, DependencyCycleError, type DependencyNode, type Disposable$1 as Disposable, ERP_CANVAS_PLUGIN_FIXTURE, EXTERNAL_ITEM_SCHEMA, type EditorContribution, type EditorSchemaRisk, type EmailActionOptions, type ExtensionContext, type ExtensionStorage, FEED_ITEM_SCHEMA, type FeatureModule, type FeedEntry, type FetchJson, type FetchLike, type FlatNode, type FormatHelpers, GITHUB_CONNECTOR_ID, GOOGLE_CALENDAR_CONNECTOR_ID, type GeneratedScript, type GithubConnectorOptions, type GuardableConnectorStore, type HotReloadEvent, type IProcessManager, type ImporterContribution, type InstallOptions, LEAVE_README, LINEAR_CONNECTOR_ID, type LabRunOutcome, type LadderRuntimeTier, type LanguageModelLike, type LanguageModelMonitor, type LanguageModelSessionLike, type LayoutTree, type LeaveBundle, type LicenseCheckResult, LicenseRequiredError, type LinearConnectorOptions, type LocalAPIConfig, type LocalAPITokenConfig, type LocalAPITokenScope, type LocalAPITokenSummary, type LocalServerProbe, MARKETPLACE_PROVENANCE, type MCPPropertySchema, type MCPRequest, type MCPResource, type MCPResponse, type MCPServerConfig, type MCPTool, MEDIA_PROVIDER_CANVAS_PLUGIN_FIXTURE, type ManagedBudgetSnapshot, ManagedProvider, type ManagedProviderOptions, MarketplaceClient, type MarketplaceClientOptions, type MarketplaceEntry, type MarketplaceSort, type MathHelpers, type MentionProviderContribution, type MentionSuggestion, MiddlewareChain, type MissingDependency, type ModuleCapabilities, NOTION_CONNECTOR_ID, type NodeChangeEvent, type NodeChangeEventData, type NodeData, type NodeStoreAPI, type NodeStoreMiddleware, type NotionConnectorOptions, OllamaProvider, OpenAICompatibleProvider, type OpenAICompatibleProviderOptions, OpenAIProvider, PLUGIN_FRAME_SANDBOX, PLUGIN_SOURCE_SCHEMA_IRI, PLUGIN_STORE_DENYLIST, PRESET_IDS, PRESET_WORKSPACE_ID_PREFIX, type PendingChange, type Platform, type PlatformCapabilities, type PluginBuildDiagnostic, type PluginBuildInput, type PluginContributions, PluginError, type PluginFeedbackEntry, type PluginFileTranspiler, type PluginFrameSession, type PluginFrameToHostMessage, type PluginFrameTransport, type PluginGraphPayload, type PluginHostToFrameMessage, type PluginModuleGraph, type PluginNode, type PluginNodeChangeEvent, type PluginNodeChangeListener, type PluginPermissions, type PluginPricing, type PluginRating, type PluginRegisteredHandlers, PluginRegistry, type PluginRunInput, type PluginRunResult, PluginRuntimeError, type PluginRuntimeLadder, PluginSchema, type PluginSourceDiff, type PluginSourceNode, PluginSourceSchema, type PluginSourceWatcher, type PluginStatus, type PluginStoreRpc, PluginStoreRpcError, type PluginUpdateAssessment, PluginValidationError, type PresetId, type ProcessManagerEvents, type PromptApiAvailability, PromptApiProvider, type PromptApiProviderOptions, type PropertyCellProps, type PropertyEditorProps, type PropertyHandler, type PropertyHandlerContribution, type Provenance, type ProvenanceResult, type ProvenanceVerifier, type PublishConsentRequest, type QueryFilter, REGION_IDS, RSS_CONNECTOR_ID, type RatingSummary, type RecommendOptions, type RegionId, type RegisteredPlugin, type ResolveMentionOptions, type RightToLeavePorts, type RssConnectorOptions, type RunActionPorts, type RunConnectorSyncPorts, type RunPluginCodeInput, SCAFFOLD_SYSTEM_GUARD, SERVICE_IPC_CHANNELS, SLACK_CONNECTOR_ID, SOURCE_SETTLE_DEBOUNCE_MS, type SandboxOptions, ScaffoldError, type ScaffoldResult, type ScaffoldSpec, type ScaffoldTemplate, type SchemaContribution, type SchemaData, type SchemaDefinition, type SchemaProperty, type SchemaRegistryAPI, type ScriptContext, ScriptError, type ScriptExecutionResult, type ScriptExecutor, ScriptGenerationError, ScriptGenerator, type ScriptGeneratorOptions, type ScriptNode, type ScriptNodeChangeEvent, type ScriptOutputType, ScriptRunner, type ScriptRunnerOptions, ScriptSandbox, ScriptSchema, type ScriptStore, ScriptTimeoutError, type ScriptToManifestInput, type ScriptTriggerType, ScriptValidationError, type SemVer, type ServiceClient, type ServiceCommunication, type ServiceDefinition, type ServiceHealthCheck, type ServiceLifecycle, type ServiceOutputEvent, type ServiceProcessConfig, type ServiceProvides, type ServiceState, type ServiceStatus, type ServiceStatusEvent, type SettingContribution, type SettingsPanelProps, ShortcutManager, type SidebarContribution, type SlackConnectorOptions, type SlashCommandContext, type SlashCommandContribution, type SlotContribution, type SlotPlacement, type SlotRegion, type SlotTier, type StatusBarContribution, type SurfaceDockContribution, type SurfaceDockTier, type TelemetryReporter, type TestHarnessOptions, type TestNodeStore, type TestPluginHarness, type TextHelpers, type ToolCallingFidelity, TypedRegistry, type UsageSignal, type ValidationResult, type VendorModuleSources, type VerifyProvenanceInput, type ViewContribution, type ViewProps, WRITING_XNET_PLUGINS_SKILL_MD, type WebLLMEngineLike, WebLLMProvider, type WebLLMProviderOptions, type WebhookConfig, WebhookEmitter, type WebhookOutOptions, type WebhookPayload, type WidgetContribution, type WidgetContributionConfigField, type WidgetContributionProps, type WorkspaceCommand, type WorkspacePayload, type WorkspacePluginAgentToolsOptions, type WorkspacePluginContributionsData, type WorkspacePluginDraftBackend, WorkspacePluginError, type WorkspacePluginHandle, type WorkspacePluginHostDeps, type WorkspacePluginHotReloader, type WorkspacePluginManifestData, type WorkspacePluginPreviewManager, type WorkspacePluginPreviewResult, type WorkspacePluginPublishResult, type WorkspacePluginSourceBackend, type WorkspacePluginStore, type WrapCliConnectorOptions, type WriteMode, XNET_MARKDOWN_DIRECTIVE_SPECS, XNET_PAGE_FRAGMENT_FIELD, XNET_PAGE_LEGACY_FRAGMENT_FIELD, type XNetExtension, type XNetMarkdownDiffLine, type XNetMarkdownDiffLineKind, type XNetMarkdownDirective, type XNetMarkdownDirectiveSpec, type XNetMarkdownReviewDiff, type XNetPageDocResolver, type XNetPageFragmentReadOptions, type XNetPageFragmentWriteOptions, type XNetPageMarkdownFrontmatter, type XNetPageMarkdownValidation, type XNetPageMarkdownValidationOptions, activateWorkspacePlugin, agentToolToExtraTool, agentToolsAsExtraTools, aggregateRatings, assertNetwork, assertPublicUrl, assertSchemaWrite, assertSystemAudio, assessPluginUpdate, assistTurnProvenance, attachAiPlanValidation, blockNoteFragmentToMarkdown, buildAirtableConnector, buildCommunityRegistryEntry, buildDiscordAction, buildEmailAction, buildGithubConnector, buildGoogleCalendarConnector, buildLinearConnector, buildNotionConnector, buildPluginFrameSrcdoc, buildPluginModuleGraph, buildRetryPrompt, buildRssConnector, buildScriptPrompt, buildSlackConnector, buildSlackWebhookAction, buildTelegramAction, buildWebhookOutAction, buildWorkspacePlugin, classifyAiAgentDisplayState, compareVersions, composeAssistSystemPrompt, computePluginSourceHash, connectorAsImporter, connectorMarketplaceEntry, contributionsAsAiTools, createAIProvider, createAIProviderRouter, createAgentCeremonyTools, createAgentNotificationTools, createAiAgentRuntime, createAiChangeSet, createAiOperation, createAiSurfaceService, createAiValidationResult, createBlockNotePageMarkdownAdapter, createCanvasErpPrototypeRiskSummary, createCanvasErpPrototypeScenario, createCanvasPluginFixtureCards, createCanvasPluginFixtureManifests, createCanvasPluginPermissionPrompt, createCanvasPluginSandboxPolicy, createCanvasPreviewSandboxRequest, createCanvasRendererSandboxRequest, createDefaultTree, createExtensionContext, createExtensionStorage, createManagedProvider, createMemoryAiAgentRuntimeStorage, createPluginFrameSession, createPluginSourceWatcher, createPluginStoreRpc, createPresetTree, createPromptApiProvider, createScriptContext, createServiceClient, createTestNodeStore, createTestPluginHarness, createWebLLMProvider, createWebhookEmitter, createWorkspacePluginAgentTools, createWorkspacePluginHotReloader, createWorkspacePluginPreviewManager, defaultLocalServerProbes, defineAction, defineConnector, defineExtension, defineFeatureModule, deleteDay, describeCapabilities, detectConnectors, detectUpcomingMeeting, diffPluginSourceFiles, downloadPromptApiModel, emitConnectorArtifacts, evaluateCanvasPluginPermissionGate, evaluateCanvasPluginSandboxRequest, evaluateConnectorInstall, evaluateInstallConsent, executeScript, exportPluginSourceAsRepoFiles, failClosedVerifier, filterByCategory, findEditorSchemaRisks, findMissingDependencies, framePluginCsp, generateScript, getCanvasErpPrototypeAuditEntriesForCard, getCanvasErpPrototypeCardsForFrame, getCanvasPluginFixture, getCommandRegistry, getPlatformCapabilities, getShortcutManager, getXNetMarkdownDirectiveSpecs, guardStore, guardedActionFetch, guardedFetch, hasUpdate, hashNonce, importerAdapters, insertSlot, installCommandHandler, installShortcutHandler, isAiRiskLevel, isAiScope, isAiTargetKind, isAllowedPluginLicense, isDenylistedSchema, isHostCompatible, isNetworkAllowed, isOllamaAvailable, isPaidPricing, isPresetWorkspaceId, isSchemaDefiningContribution, isSchemaReadAllowed, isSchemaWriteAllowed, isScriptNode, isServiceClientAvailable, isSystemAudioAllowed, ladderTierForTrust, leaveWithEverything, legacyFragmentToMarkdown, listOllamaModels, matchSchemaIri, moveSlot, normalizeCanvasPluginWorkspacePolicy, packageName, parseAiMutationPlan, parseFeed, parseVersion, parseWorkspacePayload, parseXNetPageFrontmatter, pascalCase, permissionsToCapabilities, pickBestConnector, placementOf, pluginLicenseText, presetForWorkspaceId, presetWorkspaceId, probeOpenAiCompatible, promptApiAvailability, quickSafetyCheck, readPluginSourceNode, recommendExtensions, regionOf, renderEvent, renderMarkdownLineDiff, renderMarkdownReviewDiff, renderSelectionPrompt, replaceXNetPageFragmentWithMarkdown, requestWorkspacePluginPublish, resolveImporters, resolveInstallOrder, resolveMentionProviders, reversibilityForTool, riskForTool, runAction, runAiPluginPipeline, runConnectorSync, runPluginCode, satisfiesRange, scaffoldPlugin, scaffoldWorkspacePluginFiles, scriptToPluginManifest, searchMarketplace, serializeAiMutationPlan, serializeWorkspacePayload, setSlotTier, shortSchemaName, shouldDispatch, slotsIn, sortMarketplace, stripXNetPageFrontmatter, summarizeProvenance, validateAiMutationPlan, validateCanvasPluginSandboxOutput, validateManifest, validateScript, validateScriptAST, validateWorkspaceManifest, validateXNetPageMarkdown, verifyProvenance, warnOnEditorSchemaRisks, wrapCliConnector, writeModeFor, xnetPageFragmentToMarkdown };
7204
+ export { type AIComplexityLevel, type AICostModel, type AIGenerateRequest, type AIGenerateResponse, AIGenerationError, type AIMessage, type AIMessageRole, type AIModelCapabilities, type AIModelQuality, type AIPrivacyLevel, type AIProvider, type AIProviderConfig, type AIProviderOptions, AIProviderRouter, type AIProviderRouterOptions, type AIProviderType, type AIProviderUsage, AIRTABLE_CONNECTOR_ID, type AIRiskLevel, type AIScriptRequest, type AIScriptResponse, type AIStreamChunk, type AIToolCall, type AIToolSpec, type AIUsage, AI_GENERATED_PROVENANCE, AI_RISK_LEVELS, AI_SCOPES, AI_TARGET_KINDS, ALLOWED_PLUGIN_LICENSES, type ActionContext, type ActionDefinition, ActionDefinitionError, ActionDispatchError, type ActionEvent, ActionSsrfError, type ActionTrigger, type AgentAuditContext, AgentAuditRecorder, type AgentAuditRecorderConfig, type AgentAuditSurface, type AgentCallOutcome, type AgentExecutedResult, type AgentNotificationToolsOptions, type AgentPendingApproval, type AgentToolContribution, type AgentToolInputSchema, type AiAgentApproval, type AiAgentApprovalRequestInput, type AiAgentApprovalResolveInput, type AiAgentApprovalStatus, type AiAgentBackgroundJob, type AiAgentBackgroundJobInput, type AiAgentBackgroundJobRunner, type AiAgentBackgroundJobStatus, type AiAgentDisplayState, type AiAgentDisplayStateKind, type AiAgentEvent, type AiAgentEventType, type AiAgentOrchestratorMode, type AiAgentRunSelectionTurnInput, type AiAgentRunTurnInput, type AiAgentRunTurnResult, AiAgentRuntime, type AiAgentRuntimeConfig, type AiAgentRuntimeListener, type AiAgentRuntimeSnapshot, type AiAgentRuntimeStorage, type AiAgentSelectionContext, type AiAgentSelectionKind, type AiAgentTelemetrySnapshot, type AiAgentThread, type AiAgentThreadCreateInput, type AiAgentThreadStatus, type AiAgentTurn, type AiAgentTurnRole, type AiAgentTurnStatus, type AiAssistMode, type AiAuditEvent, type AiAuthoredPlugin, AiAuthoringError, AiBudgetError, type AiCallableTool, type AiChangeSet, type AiCommandExposure, type AiContextPack, type AiContextPackResource, type AiContextRetriever, type AiContextSeed, type AiDatabaseMutationApplyResult, type AiExtraTool, type AiJsonSchema, type AiJsonSchemaType, type AiMutationPlan, type AiMutationPlanStatus, type AiOperation, type AiPageMarkdownApplyAdapter, type AiPageMarkdownApplyAdapterInput, type AiPageMarkdownApplyAdapterResult, type AiPageMarkdownApplyResult, type AiPageMarkdownRollbackResult, type AiPluginPipelineInput, type AiPluginPipelinePorts, type AiPluginPipelineResult, type AiResource, type AiResourceContent, type AiRetrievedNode, type AiRiskLevel, type AiScope, type AiSearchOptions, type AiSearchResult, type AiSurfaceLimits, AiSurfaceService, type AiSurfaceServiceConfig, type AiTargetKind, type AiToolCallResult, type AiToolDefinition, type AiValidationResult, type AirtableConnectorOptions, type AllowedPluginLicense, AnthropicProvider, type ArrayHelpers, type BlockContribution, type BlockNotePageMarkdownAdapterOptions, type BlockProps, CANVAS_PLUGIN_FIXTURES, CHANNEL_SCHEMA, CHAT_MESSAGE_SCHEMA, CONNECTOR_CATEGORY, CONNECTOR_META, CRM_CANVAS_PLUGIN_FIXTURE, type CanvasCardContribution, type CanvasContribution, type CanvasContributionBase, type CanvasContributionPermission, type CanvasEdgeContribution, type CanvasErpPrototypeAuditEntry, type CanvasErpPrototypeAuditOperation, type CanvasErpPrototypeAuditSource, type CanvasErpPrototypeCard, type CanvasErpPrototypeCommand, type CanvasErpPrototypeEdge, type CanvasErpPrototypeEntityKind, type CanvasErpPrototypeLayoutKind, type CanvasErpPrototypeQueryFrame, type CanvasErpPrototypeQueryPredicate, type CanvasErpPrototypeRect, type CanvasErpPrototypeRisk, type CanvasErpPrototypeRiskSummary, type CanvasErpPrototypeScenario, type CanvasErpPrototypeStatus, type CanvasIngestInputKind, type CanvasIngestorContribution, type CanvasInspectorContribution, type CanvasInspectorPlacement, type CanvasLayoutContribution, type CanvasLayoutScope, type CanvasPluginFixture, type CanvasPluginFixtureCardSample, type CanvasPluginFixtureKind, type CanvasPluginPermissionDecisionStatus, type CanvasPluginPermissionGateDecision, type CanvasPluginPermissionGateInput, type CanvasPluginPermissionPrompt, type CanvasPluginPermissionPromptOption, type CanvasPluginPromptMode, type CanvasPluginSandboxDecision, type CanvasPluginSandboxDomAccess, type CanvasPluginSandboxKind, type CanvasPluginSandboxMutationAccess, type CanvasPluginSandboxNetworkAccess, type CanvasPluginSandboxOutput, type CanvasPluginSandboxOutputKind, type CanvasPluginSandboxOutputValidation, type CanvasPluginSandboxPolicy, type CanvasPluginSandboxRequest, type CanvasPluginWorkspacePolicy, type CanvasPreviewTier, type CanvasRendererSandboxContribution, type CanvasTemplateCategory, type CanvasTemplateContribution, type CanvasToolContribution, type CanvasToolGroup, CapabilityError, type ChromePosture, type CommandContext, type CommandContribution, CommandRegistry, type CommandScope, type CommunityRegistryEntry, type ConnectorArtifacts, type ConnectorCadence, type ConnectorDefinition, ConnectorDefinitionError, type ConnectorDetection, type ConnectorEnv, type ConnectorFetch, type ConnectorInstallGate, type ConnectorStore, type ConnectorSyncContext, ConnectorSyncError, type ConnectorSyncResult, type ConnectorSyncSpec, type ConnectorTier, type ConnectorToolDescriptor, type ConsentDecision, type ConsentLine, ContributionRegistry, DEFAULT_PLUGIN_LICENSE, DEFAULT_WORKSPACE_ID, type DefinedAction, type DefinedConnector, type DeleteDayOptions, type DeleteDayResult, type DeliveryResult, DependencyCycleError, type DependencyNode, type Disposable$1 as Disposable, ERP_CANVAS_PLUGIN_FIXTURE, EXTERNAL_ITEM_SCHEMA, type EditorContribution, type EditorSchemaRisk, type EmailActionOptions, type ExtensionContext, type ExtensionStorage, FEED_ITEM_SCHEMA, type FeatureModule, type FeedEntry, type FetchJson, type FetchLike, type FlatNode, type FormatHelpers, type FrameRendererContribution, GITHUB_CONNECTOR_ID, GOOGLE_CALENDAR_CONNECTOR_ID, type GeneratedScript, type GithubConnectorOptions, type GuardableConnectorStore, type HotReloadEvent, type IProcessManager, type ImporterContribution, type InstallOptions, LEAVE_README, LINEAR_CONNECTOR_ID, type LabRunOutcome, type LadderRuntimeTier, type LanguageModelLike, type LanguageModelMonitor, type LanguageModelSessionLike, type LayoutTree, type LeaveBundle, type LicenseCheckResult, LicenseRequiredError, type LinearConnectorOptions, type LocalAPIConfig, type LocalAPITokenConfig, type LocalAPITokenScope, type LocalAPITokenSummary, type LocalServerProbe, MARKETPLACE_PROVENANCE, type MCPPropertySchema, type MCPRequest, type MCPResource, type MCPResponse, type MCPServerConfig, type MCPTool, MEDIA_PROVIDER_CANVAS_PLUGIN_FIXTURE, type ManagedBudgetSnapshot, ManagedProvider, type ManagedProviderOptions, MarketplaceClient, type MarketplaceClientOptions, type MarketplaceEntry, type MarketplaceSort, type MathHelpers, type MentionProviderContribution, type MentionSuggestion, MiddlewareChain, type MissingDependency, type ModuleCapabilities, NOTION_CONNECTOR_ID, type NodeChangeEvent, type NodeChangeEventData, type NodeData, type NodeStoreAPI, type NodeStoreMiddleware, type NotionConnectorOptions, OllamaProvider, OpenAICompatibleProvider, type OpenAICompatibleProviderOptions, OpenAIProvider, PLUGIN_FRAME_SANDBOX, PLUGIN_SOURCE_SCHEMA_IRI, PLUGIN_STORE_DENYLIST, PRESET_IDS, PRESET_WORKSPACE_ID_PREFIX, type PendingChange, type Platform, type PlatformCapabilities, type PluginBuildDiagnostic, type PluginBuildInput, type PluginContributions, PluginError, type PluginFeedbackEntry, type PluginFileTranspiler, type PluginFrameSession, type PluginFrameToHostMessage, type PluginFrameTransport, type PluginGraphPayload, type PluginHostToFrameMessage, type PluginModuleGraph, type PluginNode, type PluginNodeChangeEvent, type PluginNodeChangeListener, type PluginPermissions, type PluginPricing, type PluginRating, type PluginRegisteredHandlers, PluginRegistry, type PluginRunInput, type PluginRunResult, PluginRuntimeError, type PluginRuntimeLadder, PluginSchema, type PluginSourceDiff, type PluginSourceNode, PluginSourceSchema, type PluginSourceWatcher, type PluginStatus, type PluginStoreRpc, PluginStoreRpcError, type PluginUpdateAssessment, PluginValidationError, type PresetId, type ProcessManagerEvents, type PromptApiAvailability, PromptApiProvider, type PromptApiProviderOptions, type PropertyCellProps, type PropertyEditorProps, type PropertyHandler, type PropertyHandlerContribution, type Provenance, type ProvenanceResult, type ProvenanceVerifier, type PublishConsentRequest, type QueryFilter, REGION_IDS, RSS_CONNECTOR_ID, type RatingSummary, type RecommendOptions, type RegionId, type RegisteredPlugin, type ResolveMentionOptions, type RightToLeavePorts, type RssConnectorOptions, type RunActionPorts, type RunConnectorSyncPorts, type RunPluginCodeInput, SCAFFOLD_SYSTEM_GUARD, SERVICE_IPC_CHANNELS, SLACK_CONNECTOR_ID, SOURCE_SETTLE_DEBOUNCE_MS, type SandboxOptions, ScaffoldError, type ScaffoldResult, type ScaffoldSpec, type ScaffoldTemplate, type SchemaContribution, type SchemaData, type SchemaDefinition, type SchemaProperty, type SchemaRegistryAPI, type ScriptContext, ScriptError, type ScriptExecutionResult, type ScriptExecutor, ScriptGenerationError, ScriptGenerator, type ScriptGeneratorOptions, type ScriptNode, type ScriptNodeChangeEvent, type ScriptOutputType, ScriptRunner, type ScriptRunnerOptions, ScriptSandbox, ScriptSchema, type ScriptStore, ScriptTimeoutError, type ScriptToManifestInput, type ScriptTriggerType, ScriptValidationError, type SemVer, type ServiceClient, type ServiceCommunication, type ServiceDefinition, type ServiceHealthCheck, type ServiceLifecycle, type ServiceOutputEvent, type ServiceProcessConfig, type ServiceProvides, type ServiceState, type ServiceStatus, type ServiceStatusEvent, type SettingContribution, type SettingsPanelProps, ShortcutManager, type SidebarContribution, type SlackConnectorOptions, type SlashCommandContext, type SlashCommandContribution, type SlotContribution, type SlotPlacement, type SlotRegion, type SlotTier, type StatusBarContribution, type SurfaceDockContribution, type SurfaceDockTier, type TelemetryReporter, type TestHarnessOptions, type TestNodeStore, type TestPluginHarness, type TextHelpers, type ToolCallingFidelity, TypedRegistry, type UsageSignal, type ValidationResult, type VendorModuleSources, type VerifyProvenanceInput, type ViewContribution, type ViewProps, WRITING_XNET_PLUGINS_SKILL_MD, type WebLLMEngineLike, WebLLMProvider, type WebLLMProviderOptions, type WebhookConfig, WebhookEmitter, type WebhookOutOptions, type WebhookPayload, type WidgetContribution, type WidgetContributionConfigField, type WidgetContributionProps, type WorkspaceCommand, type WorkspacePayload, type WorkspacePluginAgentToolsOptions, type WorkspacePluginContributionsData, type WorkspacePluginDraftBackend, WorkspacePluginError, type WorkspacePluginHandle, type WorkspacePluginHostDeps, type WorkspacePluginHotReloader, type WorkspacePluginManifestData, type WorkspacePluginPreviewManager, type WorkspacePluginPreviewResult, type WorkspacePluginPublishResult, type WorkspacePluginSourceBackend, type WorkspacePluginStore, type WrapCliConnectorOptions, type WriteMode, XNET_MARKDOWN_DIRECTIVE_SPECS, XNET_PAGE_FRAGMENT_FIELD, XNET_PAGE_LEGACY_FRAGMENT_FIELD, type XNetExtension, type XNetMarkdownDiffLine, type XNetMarkdownDiffLineKind, type XNetMarkdownDirective, type XNetMarkdownDirectiveSpec, type XNetMarkdownReviewDiff, type XNetPageDocResolver, type XNetPageFragmentReadOptions, type XNetPageFragmentWriteOptions, type XNetPageMarkdownFrontmatter, type XNetPageMarkdownValidation, type XNetPageMarkdownValidationOptions, activateWorkspacePlugin, agentToolToExtraTool, agentToolsAsExtraTools, aggregateRatings, assertNetwork, assertPublicUrl, assertSchemaWrite, assertSystemAudio, assessPluginUpdate, assistTurnProvenance, attachAiPlanValidation, blockNoteFragmentToMarkdown, buildAirtableConnector, buildCommunityRegistryEntry, buildDiscordAction, buildEmailAction, buildGithubConnector, buildGoogleCalendarConnector, buildLinearConnector, buildNotionConnector, buildPluginFrameSrcdoc, buildPluginModuleGraph, buildRetryPrompt, buildRssConnector, buildScriptPrompt, buildSlackConnector, buildSlackWebhookAction, buildTelegramAction, buildWebhookOutAction, buildWorkspacePlugin, classifyAiAgentDisplayState, compareVersions, composeAssistSystemPrompt, computePluginSourceHash, connectorAsImporter, connectorMarketplaceEntry, contributionsAsAiTools, createAIProvider, createAIProviderRouter, createAgentCeremonyTools, createAgentNotificationTools, createAiAgentRuntime, createAiChangeSet, createAiOperation, createAiSurfaceService, createAiValidationResult, createBlockNotePageMarkdownAdapter, createCanvasErpPrototypeRiskSummary, createCanvasErpPrototypeScenario, createCanvasPluginFixtureCards, createCanvasPluginFixtureManifests, createCanvasPluginPermissionPrompt, createCanvasPluginSandboxPolicy, createCanvasPreviewSandboxRequest, createCanvasRendererSandboxRequest, createDefaultTree, createExtensionContext, createExtensionStorage, createManagedProvider, createMemoryAiAgentRuntimeStorage, createPluginFrameSession, createPluginSourceWatcher, createPluginStoreRpc, createPresetTree, createPromptApiProvider, createScriptContext, createServiceClient, createTestNodeStore, createTestPluginHarness, createWebLLMProvider, createWebhookEmitter, createWorkspacePluginAgentTools, createWorkspacePluginHotReloader, createWorkspacePluginPreviewManager, defaultLocalServerProbes, defineAction, defineConnector, defineExtension, defineFeatureModule, deleteDay, describeCapabilities, detectConnectors, detectUpcomingMeeting, diffPluginSourceFiles, downloadPromptApiModel, emitConnectorArtifacts, evaluateCanvasPluginPermissionGate, evaluateCanvasPluginSandboxRequest, evaluateConnectorInstall, evaluateInstallConsent, executeScript, exportPluginSourceAsRepoFiles, failClosedVerifier, filterByCategory, findEditorSchemaRisks, findMissingDependencies, framePluginCsp, generateScript, getCanvasErpPrototypeAuditEntriesForCard, getCanvasErpPrototypeCardsForFrame, getCanvasPluginFixture, getCommandRegistry, getPlatformCapabilities, getShortcutManager, getXNetMarkdownDirectiveSpecs, guardStore, guardedActionFetch, guardedFetch, hasUpdate, hashNonce, importerAdapters, insertSlot, installCommandHandler, installShortcutHandler, isAiRiskLevel, isAiScope, isAiTargetKind, isAllowedPluginLicense, isDenylistedSchema, isHostCompatible, isNetworkAllowed, isOllamaAvailable, isPaidPricing, isPresetWorkspaceId, isSchemaDefiningContribution, isSchemaReadAllowed, isSchemaWriteAllowed, isScriptNode, isServiceClientAvailable, isSystemAudioAllowed, ladderTierForTrust, leaveWithEverything, legacyFragmentToMarkdown, listOllamaModels, matchSchemaIri, moveSlot, normalizeCanvasPluginWorkspacePolicy, packageName, parseAiMutationPlan, parseFeed, parseVersion, parseWorkspacePayload, parseXNetPageFrontmatter, pascalCase, permissionsToCapabilities, pickBestConnector, placementOf, pluginLicenseText, presetForWorkspaceId, presetWorkspaceId, probeOpenAiCompatible, promptApiAvailability, quickSafetyCheck, readPluginSourceNode, recommendExtensions, regionOf, renderEvent, renderMarkdownLineDiff, renderMarkdownReviewDiff, renderSelectionPrompt, replaceXNetPageFragmentWithMarkdown, requestWorkspacePluginPublish, resolveImporters, resolveInstallOrder, resolveMentionProviders, reversibilityForTool, riskForTool, runAction, runAiPluginPipeline, runConnectorSync, runPluginCode, satisfiesRange, scaffoldPlugin, scaffoldWorkspacePluginFiles, scriptToPluginManifest, searchMarketplace, serializeAiMutationPlan, serializeWorkspacePayload, setSlotTier, shortSchemaName, shouldDispatch, slotsIn, sortMarketplace, stripXNetPageFrontmatter, summarizeProvenance, validateAiMutationPlan, validateCanvasPluginSandboxOutput, validateManifest, validateScript, validateScriptAST, validateWorkspaceManifest, validateXNetPageMarkdown, verifyProvenance, warnOnEditorSchemaRisks, wrapCliConnector, writeModeFor, xnetPageFragmentToMarkdown };
package/dist/index.js CHANGED
@@ -517,6 +517,7 @@ var ContributionRegistry = class {
517
517
  mentionProviders = new TypedRegistry();
518
518
  agentTools = new TypedRegistry();
519
519
  slots = new TypedRegistry();
520
+ frameRenderers = new TypedRegistry();
520
521
  /** @deprecated Since 0280 — the dock registry is the slot registry. */
521
522
  get surfaceDock() {
522
523
  return this.slots;
@@ -546,6 +547,7 @@ var ContributionRegistry = class {
546
547
  this.mentionProviders.clear();
547
548
  this.agentTools.clear();
548
549
  this.slots.clear();
550
+ this.frameRenderers.clear();
549
551
  }
550
552
  };
551
553
 
@@ -3473,6 +3475,16 @@ function createExtensionContext(options) {
3473
3475
  disposables.push(d);
3474
3476
  return d;
3475
3477
  },
3478
+ registerFrameRenderer(renderer) {
3479
+ const namespacedId = renderer.id.startsWith(`${pluginId}:`) ? renderer.id : `${pluginId}:${renderer.id}`;
3480
+ const existing = contributions.frameRenderers.getAll().find((entry) => entry.id === namespacedId);
3481
+ if (existing) {
3482
+ throw new Error(`[Plugin ${pluginId}] frame renderer already registered: ${namespacedId}`);
3483
+ }
3484
+ const d = contributions.frameRenderers.register({ ...renderer, id: namespacedId });
3485
+ disposables.push(d);
3486
+ return d;
3487
+ },
3476
3488
  registerWidget(widget) {
3477
3489
  const d = contributions.widgets.register(widget);
3478
3490
  disposables.push(d);
@@ -6348,6 +6360,156 @@ var rollbackPageMarkdownTool = {
6348
6360
  execute: async (host, args) => await host.rollbackPageMarkdown(args)
6349
6361
  };
6350
6362
 
6363
+ // src/ai-surface/tools/frames.ts
6364
+ function readPlacements(args) {
6365
+ const raw = args.placements;
6366
+ if (!Array.isArray(raw) || raw.length === 0) {
6367
+ throw new Error("placements must be a non-empty array");
6368
+ }
6369
+ return raw.map((entry, index) => {
6370
+ if (typeof entry !== "object" || entry === null) {
6371
+ throw new Error(`placements[${index}] must be an object`);
6372
+ }
6373
+ const record = entry;
6374
+ const nodeId = record.nodeId;
6375
+ if (typeof nodeId !== "string" || !nodeId) {
6376
+ throw new Error(`placements[${index}].nodeId is required`);
6377
+ }
6378
+ const kind = record.kind === "page" ? "page" : "database";
6379
+ return {
6380
+ nodeId,
6381
+ kind,
6382
+ viewType: typeof record.viewType === "string" ? record.viewType : void 0,
6383
+ title: typeof record.title === "string" ? record.title : void 0,
6384
+ config: typeof record.config === "object" && record.config !== null ? record.config : void 0
6385
+ };
6386
+ });
6387
+ }
6388
+ function framePlacementDirective(placement) {
6389
+ if (placement.kind === "page") {
6390
+ const payload2 = { nodeId: placement.nodeId, title: placement.title ?? "" };
6391
+ return `:::xnet-page
6392
+ ${JSON.stringify(payload2)}
6393
+ :::`;
6394
+ }
6395
+ const payload = {
6396
+ databaseId: placement.nodeId,
6397
+ viewType: placement.viewType ?? "table",
6398
+ viewConfig: placement.config ?? {}
6399
+ };
6400
+ return `:::xnet-database
6401
+ ${JSON.stringify(payload)}
6402
+ :::`;
6403
+ }
6404
+ function frameMarkdownBody(intro, placements) {
6405
+ const sections = placements.map((p) => framePlacementDirective(p));
6406
+ return [intro?.trim(), ...sections].filter(Boolean).join("\n\n");
6407
+ }
6408
+ var placementsSchema = {
6409
+ type: "array",
6410
+ description: 'Frames to place, in order. kind "database" embeds a live database view (viewType: table | board | list | gallery | calendar | timeline | map | plugin types); kind "page" embeds a live page transclusion.',
6411
+ items: {
6412
+ type: "object",
6413
+ properties: {
6414
+ nodeId: { type: "string", description: "Target node id (database or page)." },
6415
+ kind: { type: "string", enum: ["database", "page"] },
6416
+ viewType: { type: "string", description: "Registry view type for database frames." },
6417
+ title: { type: "string", description: "Display title for page frames." },
6418
+ config: { type: "object", description: "Per-view presentation config." }
6419
+ },
6420
+ required: ["nodeId"]
6421
+ }
6422
+ };
6423
+ var planFramePlacementTool = {
6424
+ definition: {
6425
+ name: "xnet_plan_frame_placement",
6426
+ title: "Plan frame placement",
6427
+ description: "Plan appending live frames (database views, page transclusions) to an existing page. Returns a validated mutation plan with a review diff; apply with xnet_apply_frame_placement.",
6428
+ risk: "medium",
6429
+ requiredScopes: ["page.read", "page.propose"],
6430
+ inputSchema: {
6431
+ type: "object",
6432
+ properties: {
6433
+ pageId: { type: "string", description: "Page to place frames on." },
6434
+ placements: placementsSchema,
6435
+ intent: { type: "string", description: "Why these frames are being placed." }
6436
+ },
6437
+ required: ["pageId", "placements"]
6438
+ }
6439
+ },
6440
+ execute: async (host, args) => {
6441
+ const pageId = readRequiredString(args, "pageId");
6442
+ const placements = readPlacements(args);
6443
+ const current = await host.readPageMarkdown(pageId, true);
6444
+ const markdown = `${current.text.trimEnd()}
6445
+
6446
+ ${frameMarkdownBody(void 0, placements)}
6447
+ `;
6448
+ return host.planPagePatch({
6449
+ pageId,
6450
+ markdown,
6451
+ actor: readOptionalString(args, "actor") ?? "ai-agent",
6452
+ intent: readOptionalString(args, "intent") ?? `Place ${placements.length} frame${placements.length === 1 ? "" : "s"} on the page`
6453
+ });
6454
+ }
6455
+ };
6456
+ var applyFramePlacementTool = {
6457
+ definition: {
6458
+ name: "xnet_apply_frame_placement",
6459
+ title: "Apply frame placement",
6460
+ description: "Apply a validated frame-placement plan (from xnet_plan_frame_placement). Requires confirmApply: true. Audited and rollbackable via xnet_rollback_page_markdown.",
6461
+ risk: "high",
6462
+ requiredScopes: ["page.write"],
6463
+ inputSchema: {
6464
+ type: "object",
6465
+ properties: {
6466
+ plan: { type: "object", description: "The validated mutation plan." },
6467
+ confirmApply: { type: "boolean", description: "Must be true to apply." }
6468
+ },
6469
+ required: ["plan", "confirmApply"]
6470
+ }
6471
+ },
6472
+ execute: async (host, args) => host.applyPageMarkdown(args)
6473
+ };
6474
+ var composePageTool = {
6475
+ definition: {
6476
+ name: "xnet_compose_page",
6477
+ title: "Compose a page of frames",
6478
+ description: "Create a new page and seed it with intro text plus live frames (database views, page transclusions) in one audited step. The result is ordinary editable content \u2014 every frame stays live and human-editable. Requires confirmApply: true.",
6479
+ risk: "high",
6480
+ requiredScopes: ["page.write"],
6481
+ inputSchema: {
6482
+ type: "object",
6483
+ properties: {
6484
+ title: { type: "string", description: "New page title." },
6485
+ intro: { type: "string", description: "Optional intro paragraph (markdown)." },
6486
+ placements: placementsSchema,
6487
+ confirmApply: { type: "boolean", description: "Must be true to create and compose." },
6488
+ intent: { type: "string" }
6489
+ },
6490
+ required: ["title", "placements", "confirmApply"]
6491
+ }
6492
+ },
6493
+ execute: async (host, args) => {
6494
+ const title = readRequiredString(args, "title");
6495
+ const placements = readPlacements(args);
6496
+ const body = frameMarkdownBody(readOptionalString(args, "intro"), placements);
6497
+ return host.composePage({
6498
+ title,
6499
+ markdown: body,
6500
+ confirmApply: args.confirmApply === true,
6501
+ actor: readOptionalString(args, "actor") ?? "ai-agent",
6502
+ intent: readOptionalString(args, "intent") ?? `Compose page "${title}"`,
6503
+ extra: readOptionalRecord(args, "extra") ?? void 0
6504
+ });
6505
+ }
6506
+ };
6507
+ var frameToolEntries = [
6508
+ planFramePlacementTool,
6509
+ applyFramePlacementTool,
6510
+ composePageTool
6511
+ ];
6512
+
6351
6513
  // src/ai-surface/tools/search.ts
6352
6514
  var searchTool4 = {
6353
6515
  definition: {
@@ -6473,7 +6635,9 @@ var BUILT_IN_TOOL_ENTRIES = [
6473
6635
  rollbackPageMarkdownTool,
6474
6636
  ...databaseToolEntries,
6475
6637
  ...canvasToolEntries,
6476
- validateMutationPlanTool
6638
+ validateMutationPlanTool,
6639
+ // Frame placement (0346) — appended last to keep prior positions stable.
6640
+ ...frameToolEntries
6477
6641
  ];
6478
6642
  var BUILT_IN_TOOLS_BY_NAME = new Map(
6479
6643
  BUILT_IN_TOOL_ENTRIES.map((entry) => [entry.definition.name, entry])
@@ -6532,6 +6696,7 @@ var AiSurfaceService = class {
6532
6696
  planPagePatch: (args) => this.planPagePatch(args),
6533
6697
  applyPageMarkdown: (args) => this.applyPageMarkdown(args),
6534
6698
  rollbackPageMarkdown: (args) => this.rollbackPageMarkdown(args),
6699
+ composePage: (args) => this.composePage(args),
6535
6700
  getAuditLog: (options) => this.getAuditLog(options),
6536
6701
  describeDatabase: (databaseId, options) => this.describeDatabase(databaseId, options),
6537
6702
  readDatabaseViews: (databaseId) => this.readDatabaseViews(databaseId),
@@ -6972,6 +7137,42 @@ var AiSurfaceService = class {
6972
7137
  errors: markdownValidation.validation.errors
6973
7138
  });
6974
7139
  }
7140
+ /**
7141
+ * Compose a page of frames (0346, Phase 5): create the Page node, then
7142
+ * plan + apply its markdown content (intro + frame directives) through
7143
+ * the standard page pipeline — one audited step, rollbackable via the
7144
+ * page-markdown rollback handle (the created page itself is reported
7145
+ * so a rejected compose can be cleaned up).
7146
+ */
7147
+ async composePage(args) {
7148
+ if (!args.confirmApply) {
7149
+ throw new Error("confirmApply must be true to compose a page");
7150
+ }
7151
+ const created = await this.config.store.create({
7152
+ schemaId: "xnet://xnet.fyi/Page@1.0.0",
7153
+ properties: { title: args.title, ...args.extra ?? {} }
7154
+ });
7155
+ const frontmatterBody = args.markdown;
7156
+ const plan = await this.planPagePatch({
7157
+ pageId: created.id,
7158
+ markdown: frontmatterBody,
7159
+ actor: args.actor ?? "ai-agent",
7160
+ intent: args.intent ?? `Compose page "${args.title}"`
7161
+ });
7162
+ if (plan.status !== "validated") {
7163
+ return { pageId: created.id, planId: plan.id, applied: false, plan };
7164
+ }
7165
+ const result = await this.applyPageMarkdown({
7166
+ plan,
7167
+ confirmApply: true
7168
+ });
7169
+ return {
7170
+ pageId: created.id,
7171
+ planId: plan.id,
7172
+ applied: result.applied ?? false,
7173
+ result
7174
+ };
7175
+ }
6975
7176
  async applyPageMarkdown(args) {
6976
7177
  const confirmApply = readOptionalBoolean(args, "confirmApply") ?? false;
6977
7178
  if (!confirmApply) {
@@ -379,6 +379,14 @@ declare class AiSurfaceService {
379
379
  private readPageMarkdown;
380
380
  private readPageOutline;
381
381
  private planPagePatch;
382
+ /**
383
+ * Compose a page of frames (0346, Phase 5): create the Page node, then
384
+ * plan + apply its markdown content (intro + frame directives) through
385
+ * the standard page pipeline — one audited step, rollbackable via the
386
+ * page-markdown rollback handle (the created page itself is reported
387
+ * so a rejected compose can be cleaned up).
388
+ */
389
+ private composePage;
382
390
  private applyPageMarkdown;
383
391
  private finalizeAppliedPageMarkdown;
384
392
  private getAuditLog;
@@ -1279,6 +1279,156 @@ var rollbackPageMarkdownTool = {
1279
1279
  execute: async (host, args) => await host.rollbackPageMarkdown(args)
1280
1280
  };
1281
1281
 
1282
+ // src/ai-surface/tools/frames.ts
1283
+ function readPlacements(args) {
1284
+ const raw = args.placements;
1285
+ if (!Array.isArray(raw) || raw.length === 0) {
1286
+ throw new Error("placements must be a non-empty array");
1287
+ }
1288
+ return raw.map((entry, index) => {
1289
+ if (typeof entry !== "object" || entry === null) {
1290
+ throw new Error(`placements[${index}] must be an object`);
1291
+ }
1292
+ const record = entry;
1293
+ const nodeId = record.nodeId;
1294
+ if (typeof nodeId !== "string" || !nodeId) {
1295
+ throw new Error(`placements[${index}].nodeId is required`);
1296
+ }
1297
+ const kind = record.kind === "page" ? "page" : "database";
1298
+ return {
1299
+ nodeId,
1300
+ kind,
1301
+ viewType: typeof record.viewType === "string" ? record.viewType : void 0,
1302
+ title: typeof record.title === "string" ? record.title : void 0,
1303
+ config: typeof record.config === "object" && record.config !== null ? record.config : void 0
1304
+ };
1305
+ });
1306
+ }
1307
+ function framePlacementDirective(placement) {
1308
+ if (placement.kind === "page") {
1309
+ const payload2 = { nodeId: placement.nodeId, title: placement.title ?? "" };
1310
+ return `:::xnet-page
1311
+ ${JSON.stringify(payload2)}
1312
+ :::`;
1313
+ }
1314
+ const payload = {
1315
+ databaseId: placement.nodeId,
1316
+ viewType: placement.viewType ?? "table",
1317
+ viewConfig: placement.config ?? {}
1318
+ };
1319
+ return `:::xnet-database
1320
+ ${JSON.stringify(payload)}
1321
+ :::`;
1322
+ }
1323
+ function frameMarkdownBody(intro, placements) {
1324
+ const sections = placements.map((p) => framePlacementDirective(p));
1325
+ return [intro?.trim(), ...sections].filter(Boolean).join("\n\n");
1326
+ }
1327
+ var placementsSchema = {
1328
+ type: "array",
1329
+ description: 'Frames to place, in order. kind "database" embeds a live database view (viewType: table | board | list | gallery | calendar | timeline | map | plugin types); kind "page" embeds a live page transclusion.',
1330
+ items: {
1331
+ type: "object",
1332
+ properties: {
1333
+ nodeId: { type: "string", description: "Target node id (database or page)." },
1334
+ kind: { type: "string", enum: ["database", "page"] },
1335
+ viewType: { type: "string", description: "Registry view type for database frames." },
1336
+ title: { type: "string", description: "Display title for page frames." },
1337
+ config: { type: "object", description: "Per-view presentation config." }
1338
+ },
1339
+ required: ["nodeId"]
1340
+ }
1341
+ };
1342
+ var planFramePlacementTool = {
1343
+ definition: {
1344
+ name: "xnet_plan_frame_placement",
1345
+ title: "Plan frame placement",
1346
+ description: "Plan appending live frames (database views, page transclusions) to an existing page. Returns a validated mutation plan with a review diff; apply with xnet_apply_frame_placement.",
1347
+ risk: "medium",
1348
+ requiredScopes: ["page.read", "page.propose"],
1349
+ inputSchema: {
1350
+ type: "object",
1351
+ properties: {
1352
+ pageId: { type: "string", description: "Page to place frames on." },
1353
+ placements: placementsSchema,
1354
+ intent: { type: "string", description: "Why these frames are being placed." }
1355
+ },
1356
+ required: ["pageId", "placements"]
1357
+ }
1358
+ },
1359
+ execute: async (host, args) => {
1360
+ const pageId = readRequiredString(args, "pageId");
1361
+ const placements = readPlacements(args);
1362
+ const current = await host.readPageMarkdown(pageId, true);
1363
+ const markdown = `${current.text.trimEnd()}
1364
+
1365
+ ${frameMarkdownBody(void 0, placements)}
1366
+ `;
1367
+ return host.planPagePatch({
1368
+ pageId,
1369
+ markdown,
1370
+ actor: readOptionalString(args, "actor") ?? "ai-agent",
1371
+ intent: readOptionalString(args, "intent") ?? `Place ${placements.length} frame${placements.length === 1 ? "" : "s"} on the page`
1372
+ });
1373
+ }
1374
+ };
1375
+ var applyFramePlacementTool = {
1376
+ definition: {
1377
+ name: "xnet_apply_frame_placement",
1378
+ title: "Apply frame placement",
1379
+ description: "Apply a validated frame-placement plan (from xnet_plan_frame_placement). Requires confirmApply: true. Audited and rollbackable via xnet_rollback_page_markdown.",
1380
+ risk: "high",
1381
+ requiredScopes: ["page.write"],
1382
+ inputSchema: {
1383
+ type: "object",
1384
+ properties: {
1385
+ plan: { type: "object", description: "The validated mutation plan." },
1386
+ confirmApply: { type: "boolean", description: "Must be true to apply." }
1387
+ },
1388
+ required: ["plan", "confirmApply"]
1389
+ }
1390
+ },
1391
+ execute: async (host, args) => host.applyPageMarkdown(args)
1392
+ };
1393
+ var composePageTool = {
1394
+ definition: {
1395
+ name: "xnet_compose_page",
1396
+ title: "Compose a page of frames",
1397
+ description: "Create a new page and seed it with intro text plus live frames (database views, page transclusions) in one audited step. The result is ordinary editable content \u2014 every frame stays live and human-editable. Requires confirmApply: true.",
1398
+ risk: "high",
1399
+ requiredScopes: ["page.write"],
1400
+ inputSchema: {
1401
+ type: "object",
1402
+ properties: {
1403
+ title: { type: "string", description: "New page title." },
1404
+ intro: { type: "string", description: "Optional intro paragraph (markdown)." },
1405
+ placements: placementsSchema,
1406
+ confirmApply: { type: "boolean", description: "Must be true to create and compose." },
1407
+ intent: { type: "string" }
1408
+ },
1409
+ required: ["title", "placements", "confirmApply"]
1410
+ }
1411
+ },
1412
+ execute: async (host, args) => {
1413
+ const title = readRequiredString(args, "title");
1414
+ const placements = readPlacements(args);
1415
+ const body = frameMarkdownBody(readOptionalString(args, "intro"), placements);
1416
+ return host.composePage({
1417
+ title,
1418
+ markdown: body,
1419
+ confirmApply: args.confirmApply === true,
1420
+ actor: readOptionalString(args, "actor") ?? "ai-agent",
1421
+ intent: readOptionalString(args, "intent") ?? `Compose page "${title}"`,
1422
+ extra: readOptionalRecord(args, "extra") ?? void 0
1423
+ });
1424
+ }
1425
+ };
1426
+ var frameToolEntries = [
1427
+ planFramePlacementTool,
1428
+ applyFramePlacementTool,
1429
+ composePageTool
1430
+ ];
1431
+
1282
1432
  // src/ai-surface/tools/search.ts
1283
1433
  var searchTool = {
1284
1434
  definition: {
@@ -1404,7 +1554,9 @@ var BUILT_IN_TOOL_ENTRIES = [
1404
1554
  rollbackPageMarkdownTool,
1405
1555
  ...databaseToolEntries,
1406
1556
  ...canvasToolEntries,
1407
- validateMutationPlanTool
1557
+ validateMutationPlanTool,
1558
+ // Frame placement (0346) — appended last to keep prior positions stable.
1559
+ ...frameToolEntries
1408
1560
  ];
1409
1561
  var BUILT_IN_TOOLS_BY_NAME = new Map(
1410
1562
  BUILT_IN_TOOL_ENTRIES.map((entry) => [entry.definition.name, entry])
@@ -1463,6 +1615,7 @@ var AiSurfaceService = class {
1463
1615
  planPagePatch: (args) => this.planPagePatch(args),
1464
1616
  applyPageMarkdown: (args) => this.applyPageMarkdown(args),
1465
1617
  rollbackPageMarkdown: (args) => this.rollbackPageMarkdown(args),
1618
+ composePage: (args) => this.composePage(args),
1466
1619
  getAuditLog: (options) => this.getAuditLog(options),
1467
1620
  describeDatabase: (databaseId, options) => this.describeDatabase(databaseId, options),
1468
1621
  readDatabaseViews: (databaseId) => this.readDatabaseViews(databaseId),
@@ -1903,6 +2056,42 @@ var AiSurfaceService = class {
1903
2056
  errors: markdownValidation.validation.errors
1904
2057
  });
1905
2058
  }
2059
+ /**
2060
+ * Compose a page of frames (0346, Phase 5): create the Page node, then
2061
+ * plan + apply its markdown content (intro + frame directives) through
2062
+ * the standard page pipeline — one audited step, rollbackable via the
2063
+ * page-markdown rollback handle (the created page itself is reported
2064
+ * so a rejected compose can be cleaned up).
2065
+ */
2066
+ async composePage(args) {
2067
+ if (!args.confirmApply) {
2068
+ throw new Error("confirmApply must be true to compose a page");
2069
+ }
2070
+ const created = await this.config.store.create({
2071
+ schemaId: "xnet://xnet.fyi/Page@1.0.0",
2072
+ properties: { title: args.title, ...args.extra ?? {} }
2073
+ });
2074
+ const frontmatterBody = args.markdown;
2075
+ const plan = await this.planPagePatch({
2076
+ pageId: created.id,
2077
+ markdown: frontmatterBody,
2078
+ actor: args.actor ?? "ai-agent",
2079
+ intent: args.intent ?? `Compose page "${args.title}"`
2080
+ });
2081
+ if (plan.status !== "validated") {
2082
+ return { pageId: created.id, planId: plan.id, applied: false, plan };
2083
+ }
2084
+ const result = await this.applyPageMarkdown({
2085
+ plan,
2086
+ confirmApply: true
2087
+ });
2088
+ return {
2089
+ pageId: created.id,
2090
+ planId: plan.id,
2091
+ applied: result.applied ?? false,
2092
+ result
2093
+ };
2094
+ }
1906
2095
  async applyPageMarkdown(args) {
1907
2096
  const confirmApply = readOptionalBoolean(args, "confirmApply") ?? false;
1908
2097
  if (!confirmApply) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnetjs/plugins",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,11 +31,11 @@
31
31
  "dependencies": {
32
32
  "acorn": "^8.15.0",
33
33
  "yjs": "^13.6.24",
34
- "@xnetjs/abuse": "2.3.0",
35
- "@xnetjs/core": "2.3.0",
36
- "@xnetjs/trust": "0.0.2",
37
- "@xnetjs/data": "2.3.0",
38
- "@xnetjs/slack-compat": "0.0.2"
34
+ "@xnetjs/abuse": "2.5.0",
35
+ "@xnetjs/core": "2.5.0",
36
+ "@xnetjs/data": "2.5.0",
37
+ "@xnetjs/slack-compat": "0.0.2",
38
+ "@xnetjs/trust": "0.0.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.0.0"
@@ -47,7 +47,7 @@
47
47
  "tsup": "^8.0.0",
48
48
  "typescript": "^5.4.0",
49
49
  "vitest": "^4.0.0",
50
- "@xnetjs/licenses": "0.0.22"
50
+ "@xnetjs/licenses": "0.0.24"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsup",