@copilotkit/web-inspector 1.70.3 → 1.71.1

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.
@@ -1,18 +1,5 @@
1
1
 
2
2
  //#region src/lib/home-briefing.ts
3
- /**
4
- * A self-contained handoff for a coding agent. It answers the onboarding
5
- * workflow's session and feedback consent gates up front, while keeping the
6
- * feature guide—not a generic product-onboarding branch—in control of the
7
- * implementation plan.
8
- */
9
- function homeFeatureImplementationPrompt(service, context) {
10
- return `Identify your coding-agent slug (for example, \`codex\` or \`claude-code\`). From the target project root, run \`npx copilotkit@latest onboard start --run ${context.onboardingRunId} --coding-agent <coding-agent-slug>\` and use its output as onboarding context. If it requires a CopilotKit CLI session check, you have permission to run it; never reveal credentials or send optional diagnostic feedback reports.
11
-
12
- This task is specifically to enable ${service.label}, not to re-onboard the application. First inspect the existing CopilotKit runtime, provider, agent, and UI wiring, and confirm that ${service.label} is not already enabled. Then read the ${service.label} guide (${service.docsUrl}) and make a short plan before editing. Preserve the project's framework, package manager, installed CopilotKit version, existing agent IDs, routes, provider layout, and working behavior. Do not create, select, or alter a CopilotKit Intelligence project—or add Intelligence configuration—unless this feature's official guide explicitly requires it or the user asks.
13
-
14
- Implement the smallest complete integration: wire every feature-required client and runtime configuration into the chat-to-agent path people already use, reuse local patterns, and do not invent environment values or hardcode secrets. Add or update focused tests and run the relevant project checks. Finish only after local validation proves ${service.label} works—not merely that the code compiles. Use a feature-specific runtime or Inspector capability check and, when the feature supports one, a representative UI interaction that proves the user-facing result. If the project overrides default rendering (for example, with a wildcard tool renderer), make that override compatible with this feature; a capability flag alone is not success. Summarize the changed files, validation, and any manual setup still required.`;
15
- }
16
3
  const SERVICE_DOCS_URL = {
17
4
  threads: "https://docs.copilotkit.ai/threads",
18
5
  memory: "https://docs.copilotkit.ai/intelligence/intelligence-platform",
@@ -299,6 +286,5 @@ function buildHomeModel(input) {
299
286
 
300
287
  //#endregion
301
288
  exports.buildHomeModel = buildHomeModel;
302
- exports.homeFeatureImplementationPrompt = homeFeatureImplementationPrompt;
303
289
  exports.runtimeConnectionNeedsAttention = runtimeConnectionNeedsAttention;
304
290
  //# sourceMappingURL=home-briefing.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"home-briefing.cjs","names":[],"sources":["../../src/lib/home-briefing.ts"],"sourcesContent":["import type { InspectorMetadataProjection } from \"./inspector-metadata.js\";\n\nexport type HomeHeroActionKind =\n | \"enable_intelligence\"\n | \"manage_plan\"\n | \"renew\";\n\nexport type HomeHeroAction = {\n kind: HomeHeroActionKind;\n url: string;\n label: string;\n};\n\nexport type HomeConnection = \"connected\" | \"disconnected\";\n\nexport type HomeRuntimeConnectionState =\n | \"connected\"\n | \"connecting\"\n | \"disconnected\"\n | \"error\"\n | \"unavailable\";\n\nexport type HomeRuntimeHealthTone = \"success\" | \"active\" | \"error\" | \"muted\";\n\nexport type HomeServiceId =\n | \"threads\"\n | \"memory\"\n | \"a2ui\"\n | \"open-gen-ui\"\n | \"suggestions\"\n | \"audio\"\n | \"websocket\";\n\nexport type HomeServiceTile = {\n id: HomeServiceId;\n label: string;\n enabled: boolean;\n url?: string;\n docsUrl: string;\n};\n\nexport type HomeFeatureImplementationPromptContext = {\n onboardingRunId: string;\n};\n\n/**\n * A self-contained handoff for a coding agent. It answers the onboarding\n * workflow's session and feedback consent gates up front, while keeping the\n * feature guide—not a generic product-onboarding branch—in control of the\n * implementation plan.\n */\nexport function homeFeatureImplementationPrompt(\n service: Pick<HomeServiceTile, \"label\" | \"docsUrl\">,\n context: HomeFeatureImplementationPromptContext,\n): string {\n return `Identify your coding-agent slug (for example, \\`codex\\` or \\`claude-code\\`). From the target project root, run \\`npx copilotkit@latest onboard start --run ${context.onboardingRunId} --coding-agent <coding-agent-slug>\\` and use its output as onboarding context. If it requires a CopilotKit CLI session check, you have permission to run it; never reveal credentials or send optional diagnostic feedback reports.\n\nThis task is specifically to enable ${service.label}, not to re-onboard the application. First inspect the existing CopilotKit runtime, provider, agent, and UI wiring, and confirm that ${service.label} is not already enabled. Then read the ${service.label} guide (${service.docsUrl}) and make a short plan before editing. Preserve the project's framework, package manager, installed CopilotKit version, existing agent IDs, routes, provider layout, and working behavior. Do not create, select, or alter a CopilotKit Intelligence project—or add Intelligence configuration—unless this feature's official guide explicitly requires it or the user asks.\n\nImplement the smallest complete integration: wire every feature-required client and runtime configuration into the chat-to-agent path people already use, reuse local patterns, and do not invent environment values or hardcode secrets. Add or update focused tests and run the relevant project checks. Finish only after local validation proves ${service.label} works—not merely that the code compiles. Use a feature-specific runtime or Inspector capability check and, when the feature supports one, a representative UI interaction that proves the user-facing result. If the project overrides default rendering (for example, with a wildcard tool renderer), make that override compatible with this feature; a capability flag alone is not success. Summarize the changed files, validation, and any manual setup still required.`;\n}\n\nexport type HomeModel = {\n hero: {\n connection: HomeConnection;\n title: string;\n body: string;\n action?: HomeHeroAction;\n };\n project?: {\n organizationName: string;\n projectName: string;\n planLabel?: string;\n license: string;\n usage?: {\n used: number;\n limitLabel: string;\n ratio?: number;\n };\n };\n projectLinked: boolean;\n runtime: {\n url?: string;\n health: {\n state: \"healthy\" | \"checking\" | \"offline\" | \"error\" | \"unavailable\";\n label: string;\n runtime: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n liveUpdates: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n lastEvent: {\n label: string;\n tone: HomeRuntimeHealthTone;\n id?: string;\n agentId?: string;\n type?: string;\n timestamp?: number;\n };\n };\n };\n services: HomeServiceTile[];\n news: {\n title: string;\n previewText: string;\n documentHtml?: string;\n empty: boolean;\n };\n};\n\nexport type HomeBriefingInput = {\n intelligenceConnected: boolean;\n threadsAvailable: boolean;\n metadata: InspectorMetadataProjection;\n runtimeUrl?: string;\n runtimeConnectionState: HomeRuntimeConnectionState;\n lastRuntimeEvent?: {\n id: string;\n agentId: string;\n type: string;\n timestamp: number;\n };\n learningOn: boolean;\n a2uiOn: boolean;\n openGenUiOn: boolean;\n suggestionsOn: boolean;\n audioOn: boolean;\n websocketUrl?: string;\n announcementPreviewText?: string;\n announcementMarkdown?: string;\n announcementHtml?: string;\n intelligenceSignupUrl?: string;\n};\n\nconst SERVICE_DOCS_URL: Record<HomeServiceId, string> = {\n threads: \"https://docs.copilotkit.ai/threads\",\n memory: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n a2ui: \"https://docs.copilotkit.ai/generative-ui/a2ui\",\n \"open-gen-ui\": \"https://docs.copilotkit.ai/generative-ui/open-generative-ui\",\n suggestions:\n \"https://docs.copilotkit.ai/reference/hooks/useConfigureSuggestions\",\n audio: \"https://docs.copilotkit.ai/voice\",\n websocket: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n};\n\n/** Return the Home hero button for a trusted metadata action. */\nexport function homeHeroActionFromMetadata(action: {\n kind: HomeHeroActionKind;\n url: string;\n}): HomeHeroAction {\n if (action.kind === \"manage_plan\") {\n return { kind: action.kind, url: action.url, label: \"Manage plan\" };\n }\n\n if (action.kind === \"renew\") {\n return { kind: action.kind, url: action.url, label: \"Renew plan\" };\n }\n\n return {\n kind: action.kind,\n url: action.url,\n label: \"Setup Intelligence\",\n };\n}\n\n/** Return a short preview from markdown, without links or headings. */\nexport function announcementPreview(markdown: string, maxLength = 140): string {\n const plain = markdown\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\")\n .replace(/[#*_`]/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim();\n if (plain.length <= maxLength) {\n return plain;\n }\n\n return `${plain.slice(0, maxLength).trimEnd()}…`;\n}\n\nfunction connectIntelligenceAction(\n action: HomeHeroAction | undefined,\n connectUrl?: string,\n licenseState?: InspectorMetadataProjection[\"licenseState\"],\n): HomeHeroAction | undefined {\n if (action) {\n return action;\n }\n\n if (connectUrl && (licenseState === \"none\" || licenseState === \"unknown\")) {\n return homeHeroActionFromMetadata({\n kind: \"enable_intelligence\",\n url: connectUrl,\n });\n }\n\n return undefined;\n}\n\nfunction heroForState(args: {\n connected: boolean;\n action?: HomeHeroAction;\n connectUrl?: string;\n licenseState: InspectorMetadataProjection[\"licenseState\"];\n}): HomeModel[\"hero\"] {\n if (!args.connected) {\n const renewing = args.action?.kind === \"renew\";\n return {\n connection: \"disconnected\",\n // Not \"Intelligence is not setup\" — that reads as a defect in the tool,\n // and a defect gets dismissed. The heading names the product; the\n // argument for it is made by the rotating copy on Home, which changes\n // with the picture beside it.\n title: renewing ? \"Renew Intelligence\" : \"CopilotKit Intelligence\",\n // In install mode this is NOT the visible paragraph. The visible copy\n // rotates every few seconds, which would make a screen reader announce a\n // new sentence four times a loop, so the rotating text is hidden from\n // assistive tech and this one stable sentence is exposed instead. It has\n // to carry the whole chain on its own.\n body: renewing\n ? \"Renew Intelligence to restore persistent Threads and Memory.\"\n : \"Intelligence keeps every thread your users have, finds evidence-backed patterns in them, and proposes skills you approve before your agent uses them.\",\n action: connectIntelligenceAction(\n args.action,\n args.connectUrl,\n args.licenseState,\n ),\n };\n }\n\n return {\n connection: \"connected\",\n title: \"Connected to Intelligence\",\n body: \"Use Workbench to inspect threads and memory.\",\n action:\n args.action?.kind === \"enable_intelligence\" ? undefined : args.action,\n };\n}\n\nfunction usageFromMetadata(metadata: InspectorMetadataProjection):\n | {\n used: number;\n limitLabel: string;\n ratio?: number;\n }\n | undefined {\n const usage = metadata.usage;\n if (!usage) {\n return undefined;\n }\n\n if (usage.limit.kind === \"finite\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / ${usage.limit.value}`,\n ratio: usage.limit.value === 0 ? 1 : usage.used / usage.limit.value,\n };\n }\n\n if (usage.limit.kind === \"unlimited\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / unlimited`,\n };\n }\n\n return {\n used: usage.used,\n limitLabel: `${usage.used} used`,\n };\n}\n\nfunction newsFromAnnouncement(args: {\n previewText?: string;\n markdown?: string;\n html?: string;\n}): HomeModel[\"news\"] {\n const markdown = args.markdown?.trim();\n if (markdown && args.html) {\n const heading = markdown.match(/^#{1,3}\\s+(.+)$/m)?.[1]?.trim();\n return {\n title: heading || \"The latest from CopilotKit\",\n previewText:\n args.previewText?.trim() || announcementPreview(markdown, 160),\n documentHtml: args.html,\n empty: false,\n };\n }\n\n return {\n title: \"You're all caught up\",\n previewText: \"Latest CopilotKit updates will appear here.\",\n empty: true,\n };\n}\n\nfunction runtimeEventSignal(\n event: HomeBriefingInput[\"lastRuntimeEvent\"],\n): HomeModel[\"runtime\"][\"health\"][\"lastEvent\"] {\n if (!event) {\n return { label: \"No events yet\", tone: \"muted\" };\n }\n\n const eventDetails = {\n id: event.id,\n agentId: event.agentId,\n type: event.type,\n timestamp: event.timestamp,\n };\n\n if (event.type === \"RUN_ERROR\" || event.type === \"ERROR\") {\n return {\n label: event.type === \"RUN_ERROR\" ? \"Run error\" : \"Error\",\n tone: \"error\",\n ...eventDetails,\n };\n }\n\n if (event.type === \"RUN_FINISHED\") {\n return {\n label: \"Run completed\",\n tone: \"success\",\n ...eventDetails,\n };\n }\n\n if (\n event.type.endsWith(\"_START\") ||\n event.type.endsWith(\"_STARTED\") ||\n event.type.endsWith(\"_CONTENT\") ||\n event.type.endsWith(\"_ARGS\") ||\n event.type.endsWith(\"_DELTA\")\n ) {\n return {\n label: \"Last event is in progress\",\n tone: \"active\",\n ...eventDetails,\n };\n }\n\n return {\n label: \"Last event received\",\n tone: \"success\",\n ...eventDetails,\n };\n}\n\n/**\n * Whether the runtime *connection* needs attention — the single condition\n * shared by System Health and the launcher's error signal, so the two can\n * never disagree about whether the wiring is broken.\n *\n * Exactly one state counts. `disconnected` is also the initial value, so\n * counting it would raise the signal on every page load; `connecting` is a\n * normal startup step; `unavailable` means no Core is attached, which is not\n * a defect of the developer's wiring.\n *\n * Note the deliberate asymmetry with `health.state`: a failed *run* also\n * drives System Health to \"Needs attention\" while the connection is fine.\n * That is an event rather than a state, and it is excluded from the launcher\n * on purpose — see the launcher-signal comments in index.ts.\n */\nexport function runtimeConnectionNeedsAttention(\n state: HomeRuntimeConnectionState,\n): boolean {\n return state === \"error\";\n}\n\nfunction runtimeHealthFromInput(\n input: HomeBriefingInput,\n): HomeModel[\"runtime\"][\"health\"] {\n const lastEvent = runtimeEventSignal(input.lastRuntimeEvent);\n\n if (input.runtimeConnectionState === \"connected\") {\n return {\n state: lastEvent.tone === \"error\" ? \"error\" : \"healthy\",\n label: lastEvent.tone === \"error\" ? \"Needs attention\" : \"Healthy\",\n runtime: { label: \"Available\", tone: \"success\" },\n liveUpdates: { label: \"Ready\", tone: \"success\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"connecting\") {\n return {\n state: \"checking\",\n label: \"Checking\",\n runtime: { label: \"Checking\", tone: \"active\" },\n liveUpdates: { label: \"Connecting\", tone: \"active\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"unavailable\") {\n return {\n state: \"unavailable\",\n label: \"Unavailable\",\n runtime: { label: \"Unavailable\", tone: \"muted\" },\n liveUpdates: { label: \"Not attached\", tone: \"muted\" },\n lastEvent,\n };\n }\n\n const needsAttention = runtimeConnectionNeedsAttention(\n input.runtimeConnectionState,\n );\n return {\n state: needsAttention ? \"error\" : \"offline\",\n label: needsAttention ? \"Runtime error\" : \"Offline\",\n runtime: { label: \"Offline\", tone: \"error\" },\n liveUpdates: {\n label: needsAttention ? \"Error\" : \"Disconnected\",\n tone: \"error\",\n },\n lastEvent,\n };\n}\n\n/** Build the Home briefing from data the Inspector already has. */\nexport function buildHomeModel(input: HomeBriefingInput): HomeModel {\n const metadataAction =\n input.metadata.threadsFooterAction ?? input.metadata.lockedAction;\n const action = metadataAction\n ? homeHeroActionFromMetadata({\n kind: metadataAction.kind,\n url: metadataAction.url,\n })\n : undefined;\n\n const identity = input.metadata.identity;\n const projectLinked = Boolean(identity);\n const intelligenceConnected =\n input.metadata.licenseState === \"valid\" ||\n (input.metadata.licenseState === \"unknown\" && input.intelligenceConnected);\n const usage = usageFromMetadata(input.metadata);\n\n return {\n hero: heroForState({\n connected: intelligenceConnected,\n action,\n connectUrl: input.intelligenceSignupUrl,\n licenseState: input.metadata.licenseState,\n }),\n projectLinked,\n project: identity\n ? {\n organizationName: identity.organizationName,\n projectName: identity.projectName,\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : input.metadata.plan || usage\n ? {\n organizationName: \"Not linked\",\n projectName: \"This runtime is not linked to a project\",\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : undefined,\n runtime: {\n url: input.runtimeUrl,\n health: runtimeHealthFromInput(input),\n },\n services: [\n {\n id: \"threads\",\n label: \"Threads\",\n enabled: intelligenceConnected && input.threadsAvailable,\n url: input.runtimeUrl,\n docsUrl: SERVICE_DOCS_URL.threads,\n },\n {\n id: \"memory\",\n label: \"Learning\",\n enabled: intelligenceConnected && input.learningOn,\n docsUrl: SERVICE_DOCS_URL.memory,\n },\n {\n id: \"a2ui\",\n label: \"A2UI\",\n enabled: input.a2uiOn,\n docsUrl: SERVICE_DOCS_URL.a2ui,\n },\n {\n id: \"open-gen-ui\",\n label: \"Open Gen UI\",\n enabled: input.openGenUiOn,\n docsUrl: SERVICE_DOCS_URL[\"open-gen-ui\"],\n },\n {\n id: \"suggestions\",\n label: \"Suggestions\",\n enabled: input.suggestionsOn,\n docsUrl: SERVICE_DOCS_URL.suggestions,\n },\n {\n id: \"audio\",\n label: \"Voice\",\n enabled: input.audioOn,\n docsUrl: SERVICE_DOCS_URL.audio,\n },\n {\n id: \"websocket\",\n label: \"Websocket\",\n enabled: intelligenceConnected && Boolean(input.websocketUrl),\n url: input.websocketUrl,\n docsUrl: SERVICE_DOCS_URL.websocket,\n },\n ],\n news: newsFromAnnouncement({\n previewText: input.announcementPreviewText,\n markdown: input.announcementMarkdown,\n html: input.announcementHtml ?? undefined,\n }),\n };\n}\n"],"mappings":";;;;;;;;AAmDA,SAAgB,gCACd,SACA,SACQ;AACR,QAAO,8JAA8J,QAAQ,gBAAgB;;sCAEzJ,QAAQ,M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AC/B,MAAM,SAAS,iBAAiB,aAAa,MAAM;CACtD,MAAM,QAAQ,kBAAkB,MAAM,SAAS;AAE/C,QAAO;EACL,MAAM,aAAa;GACjB,WAAW;GACX;GACA,YAAY,MAAM;GAClB,cAAc,MAAM,SAAS;GAC9B,CAAC;EACF;EACA,SAAS,WACL;GACE,kBAAkB,SAAS;GAC3B,aAAa,SAAS;GACtB,WAAW,MAAM,SAAS,MAAM;GAChC,SAAS,MAAM,SAAS;GACxB;GACD,GACD,MAAM,SAAS,QAAQ,QACrB;GACE,kBAAkB;GAClB,aAAa;GACb,WAAW,MAAM,SAAS,MAAM;GAChC,SAAS,MAAM,SAAS;GACxB;GACD,GACD;EACN,SAAS;GACP,KAAK,MAAM;GACX,QAAQ,uBAAuB,MAAM;GACtC;EACD,UAAU;GACR;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,QAAQ,MAAM,aAAa;IAC7D,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACF;EACD,MAAM,qBAAqB;GACzB,aAAa,MAAM;GACnB,UAAU,MAAM;GAChB,MAAM,MAAM,oBAAoB;GACjC,CAAC;EACH"}
1
+ {"version":3,"file":"home-briefing.cjs","names":[],"sources":["../../src/lib/home-briefing.ts"],"sourcesContent":["import type { InspectorMetadataProjection } from \"./inspector-metadata.js\";\n\nexport type HomeHeroActionKind =\n | \"enable_intelligence\"\n | \"manage_plan\"\n | \"renew\";\n\nexport type HomeHeroAction = {\n kind: HomeHeroActionKind;\n url: string;\n label: string;\n};\n\nexport type HomeConnection = \"connected\" | \"disconnected\";\n\nexport type HomeRuntimeConnectionState =\n | \"connected\"\n | \"connecting\"\n | \"disconnected\"\n | \"error\"\n | \"unavailable\";\n\nexport type HomeRuntimeHealthTone = \"success\" | \"active\" | \"error\" | \"muted\";\n\nexport type HomeServiceId =\n | \"threads\"\n | \"memory\"\n | \"a2ui\"\n | \"open-gen-ui\"\n | \"suggestions\"\n | \"audio\"\n | \"websocket\";\n\nexport type HomeServiceTile = {\n id: HomeServiceId;\n label: string;\n enabled: boolean;\n url?: string;\n docsUrl: string;\n};\n\nexport type HomeModel = {\n hero: {\n connection: HomeConnection;\n title: string;\n body: string;\n action?: HomeHeroAction;\n };\n project?: {\n organizationName: string;\n projectName: string;\n planLabel?: string;\n license: string;\n usage?: {\n used: number;\n limitLabel: string;\n ratio?: number;\n };\n };\n projectLinked: boolean;\n runtime: {\n url?: string;\n health: {\n state: \"healthy\" | \"checking\" | \"offline\" | \"error\" | \"unavailable\";\n label: string;\n runtime: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n liveUpdates: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n lastEvent: {\n label: string;\n tone: HomeRuntimeHealthTone;\n id?: string;\n agentId?: string;\n type?: string;\n timestamp?: number;\n };\n };\n };\n services: HomeServiceTile[];\n news: {\n title: string;\n previewText: string;\n documentHtml?: string;\n empty: boolean;\n };\n};\n\nexport type HomeBriefingInput = {\n intelligenceConnected: boolean;\n threadsAvailable: boolean;\n metadata: InspectorMetadataProjection;\n runtimeUrl?: string;\n runtimeConnectionState: HomeRuntimeConnectionState;\n lastRuntimeEvent?: {\n id: string;\n agentId: string;\n type: string;\n timestamp: number;\n };\n learningOn: boolean;\n a2uiOn: boolean;\n openGenUiOn: boolean;\n suggestionsOn: boolean;\n audioOn: boolean;\n websocketUrl?: string;\n announcementPreviewText?: string;\n announcementMarkdown?: string;\n announcementHtml?: string;\n intelligenceSignupUrl?: string;\n};\n\nconst SERVICE_DOCS_URL: Record<HomeServiceId, string> = {\n threads: \"https://docs.copilotkit.ai/threads\",\n memory: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n a2ui: \"https://docs.copilotkit.ai/generative-ui/a2ui\",\n \"open-gen-ui\": \"https://docs.copilotkit.ai/generative-ui/open-generative-ui\",\n suggestions:\n \"https://docs.copilotkit.ai/reference/hooks/useConfigureSuggestions\",\n audio: \"https://docs.copilotkit.ai/voice\",\n websocket: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n};\n\n/** Return the Home hero button for a trusted metadata action. */\nexport function homeHeroActionFromMetadata(action: {\n kind: HomeHeroActionKind;\n url: string;\n}): HomeHeroAction {\n if (action.kind === \"manage_plan\") {\n return { kind: action.kind, url: action.url, label: \"Manage plan\" };\n }\n\n if (action.kind === \"renew\") {\n return { kind: action.kind, url: action.url, label: \"Renew plan\" };\n }\n\n return {\n kind: action.kind,\n url: action.url,\n label: \"Setup Intelligence\",\n };\n}\n\n/** Return a short preview from markdown, without links or headings. */\nexport function announcementPreview(markdown: string, maxLength = 140): string {\n const plain = markdown\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\")\n .replace(/[#*_`]/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim();\n if (plain.length <= maxLength) {\n return plain;\n }\n\n return `${plain.slice(0, maxLength).trimEnd()}…`;\n}\n\nfunction connectIntelligenceAction(\n action: HomeHeroAction | undefined,\n connectUrl?: string,\n licenseState?: InspectorMetadataProjection[\"licenseState\"],\n): HomeHeroAction | undefined {\n if (action) {\n return action;\n }\n\n if (connectUrl && (licenseState === \"none\" || licenseState === \"unknown\")) {\n return homeHeroActionFromMetadata({\n kind: \"enable_intelligence\",\n url: connectUrl,\n });\n }\n\n return undefined;\n}\n\nfunction heroForState(args: {\n connected: boolean;\n action?: HomeHeroAction;\n connectUrl?: string;\n licenseState: InspectorMetadataProjection[\"licenseState\"];\n}): HomeModel[\"hero\"] {\n if (!args.connected) {\n const renewing = args.action?.kind === \"renew\";\n return {\n connection: \"disconnected\",\n // Not \"Intelligence is not setup\" — that reads as a defect in the tool,\n // and a defect gets dismissed. The heading names the product; the\n // argument for it is made by the rotating copy on Home, which changes\n // with the picture beside it.\n title: renewing ? \"Renew Intelligence\" : \"CopilotKit Intelligence\",\n // In install mode this is NOT the visible paragraph. The visible copy\n // rotates every few seconds, which would make a screen reader announce a\n // new sentence four times a loop, so the rotating text is hidden from\n // assistive tech and this one stable sentence is exposed instead. It has\n // to carry the whole chain on its own.\n body: renewing\n ? \"Renew Intelligence to restore persistent Threads and Memory.\"\n : \"Intelligence keeps every thread your users have, finds evidence-backed patterns in them, and proposes skills you approve before your agent uses them.\",\n action: connectIntelligenceAction(\n args.action,\n args.connectUrl,\n args.licenseState,\n ),\n };\n }\n\n return {\n connection: \"connected\",\n title: \"Connected to Intelligence\",\n body: \"Use Workbench to inspect threads and memory.\",\n action:\n args.action?.kind === \"enable_intelligence\" ? undefined : args.action,\n };\n}\n\nfunction usageFromMetadata(metadata: InspectorMetadataProjection):\n | {\n used: number;\n limitLabel: string;\n ratio?: number;\n }\n | undefined {\n const usage = metadata.usage;\n if (!usage) {\n return undefined;\n }\n\n if (usage.limit.kind === \"finite\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / ${usage.limit.value}`,\n ratio: usage.limit.value === 0 ? 1 : usage.used / usage.limit.value,\n };\n }\n\n if (usage.limit.kind === \"unlimited\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / unlimited`,\n };\n }\n\n return {\n used: usage.used,\n limitLabel: `${usage.used} used`,\n };\n}\n\nfunction newsFromAnnouncement(args: {\n previewText?: string;\n markdown?: string;\n html?: string;\n}): HomeModel[\"news\"] {\n const markdown = args.markdown?.trim();\n if (markdown && args.html) {\n const heading = markdown.match(/^#{1,3}\\s+(.+)$/m)?.[1]?.trim();\n return {\n title: heading || \"The latest from CopilotKit\",\n previewText:\n args.previewText?.trim() || announcementPreview(markdown, 160),\n documentHtml: args.html,\n empty: false,\n };\n }\n\n return {\n title: \"You're all caught up\",\n previewText: \"Latest CopilotKit updates will appear here.\",\n empty: true,\n };\n}\n\nfunction runtimeEventSignal(\n event: HomeBriefingInput[\"lastRuntimeEvent\"],\n): HomeModel[\"runtime\"][\"health\"][\"lastEvent\"] {\n if (!event) {\n return { label: \"No events yet\", tone: \"muted\" };\n }\n\n const eventDetails = {\n id: event.id,\n agentId: event.agentId,\n type: event.type,\n timestamp: event.timestamp,\n };\n\n if (event.type === \"RUN_ERROR\" || event.type === \"ERROR\") {\n return {\n label: event.type === \"RUN_ERROR\" ? \"Run error\" : \"Error\",\n tone: \"error\",\n ...eventDetails,\n };\n }\n\n if (event.type === \"RUN_FINISHED\") {\n return {\n label: \"Run completed\",\n tone: \"success\",\n ...eventDetails,\n };\n }\n\n if (\n event.type.endsWith(\"_START\") ||\n event.type.endsWith(\"_STARTED\") ||\n event.type.endsWith(\"_CONTENT\") ||\n event.type.endsWith(\"_ARGS\") ||\n event.type.endsWith(\"_DELTA\")\n ) {\n return {\n label: \"Last event is in progress\",\n tone: \"active\",\n ...eventDetails,\n };\n }\n\n return {\n label: \"Last event received\",\n tone: \"success\",\n ...eventDetails,\n };\n}\n\n/**\n * Whether the runtime *connection* needs attention — the single condition\n * shared by System Health and the launcher's error signal, so the two can\n * never disagree about whether the wiring is broken.\n *\n * Exactly one state counts. `disconnected` is also the initial value, so\n * counting it would raise the signal on every page load; `connecting` is a\n * normal startup step; `unavailable` means no Core is attached, which is not\n * a defect of the developer's wiring.\n *\n * Note the deliberate asymmetry with `health.state`: a failed *run* also\n * drives System Health to \"Needs attention\" while the connection is fine.\n * That is an event rather than a state, and it is excluded from the launcher\n * on purpose — see the launcher-signal comments in index.ts.\n */\nexport function runtimeConnectionNeedsAttention(\n state: HomeRuntimeConnectionState,\n): boolean {\n return state === \"error\";\n}\n\nfunction runtimeHealthFromInput(\n input: HomeBriefingInput,\n): HomeModel[\"runtime\"][\"health\"] {\n const lastEvent = runtimeEventSignal(input.lastRuntimeEvent);\n\n if (input.runtimeConnectionState === \"connected\") {\n return {\n state: lastEvent.tone === \"error\" ? \"error\" : \"healthy\",\n label: lastEvent.tone === \"error\" ? \"Needs attention\" : \"Healthy\",\n runtime: { label: \"Available\", tone: \"success\" },\n liveUpdates: { label: \"Ready\", tone: \"success\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"connecting\") {\n return {\n state: \"checking\",\n label: \"Checking\",\n runtime: { label: \"Checking\", tone: \"active\" },\n liveUpdates: { label: \"Connecting\", tone: \"active\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"unavailable\") {\n return {\n state: \"unavailable\",\n label: \"Unavailable\",\n runtime: { label: \"Unavailable\", tone: \"muted\" },\n liveUpdates: { label: \"Not attached\", tone: \"muted\" },\n lastEvent,\n };\n }\n\n const needsAttention = runtimeConnectionNeedsAttention(\n input.runtimeConnectionState,\n );\n return {\n state: needsAttention ? \"error\" : \"offline\",\n label: needsAttention ? \"Runtime error\" : \"Offline\",\n runtime: { label: \"Offline\", tone: \"error\" },\n liveUpdates: {\n label: needsAttention ? \"Error\" : \"Disconnected\",\n tone: \"error\",\n },\n lastEvent,\n };\n}\n\n/** Build the Home briefing from data the Inspector already has. */\nexport function buildHomeModel(input: HomeBriefingInput): HomeModel {\n const metadataAction =\n input.metadata.threadsFooterAction ?? input.metadata.lockedAction;\n const action = metadataAction\n ? homeHeroActionFromMetadata({\n kind: metadataAction.kind,\n url: metadataAction.url,\n })\n : undefined;\n\n const identity = input.metadata.identity;\n const projectLinked = Boolean(identity);\n const intelligenceConnected =\n input.metadata.licenseState === \"valid\" ||\n (input.metadata.licenseState === \"unknown\" && input.intelligenceConnected);\n const usage = usageFromMetadata(input.metadata);\n\n return {\n hero: heroForState({\n connected: intelligenceConnected,\n action,\n connectUrl: input.intelligenceSignupUrl,\n licenseState: input.metadata.licenseState,\n }),\n projectLinked,\n project: identity\n ? {\n organizationName: identity.organizationName,\n projectName: identity.projectName,\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : input.metadata.plan || usage\n ? {\n organizationName: \"Not linked\",\n projectName: \"This runtime is not linked to a project\",\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : undefined,\n runtime: {\n url: input.runtimeUrl,\n health: runtimeHealthFromInput(input),\n },\n services: [\n {\n id: \"threads\",\n label: \"Threads\",\n enabled: intelligenceConnected && input.threadsAvailable,\n url: input.runtimeUrl,\n docsUrl: SERVICE_DOCS_URL.threads,\n },\n {\n id: \"memory\",\n label: \"Learning\",\n enabled: intelligenceConnected && input.learningOn,\n docsUrl: SERVICE_DOCS_URL.memory,\n },\n {\n id: \"a2ui\",\n label: \"A2UI\",\n enabled: input.a2uiOn,\n docsUrl: SERVICE_DOCS_URL.a2ui,\n },\n {\n id: \"open-gen-ui\",\n label: \"Open Gen UI\",\n enabled: input.openGenUiOn,\n docsUrl: SERVICE_DOCS_URL[\"open-gen-ui\"],\n },\n {\n id: \"suggestions\",\n label: \"Suggestions\",\n enabled: input.suggestionsOn,\n docsUrl: SERVICE_DOCS_URL.suggestions,\n },\n {\n id: \"audio\",\n label: \"Voice\",\n enabled: input.audioOn,\n docsUrl: SERVICE_DOCS_URL.audio,\n },\n {\n id: \"websocket\",\n label: \"Websocket\",\n enabled: intelligenceConnected && Boolean(input.websocketUrl),\n url: input.websocketUrl,\n docsUrl: SERVICE_DOCS_URL.websocket,\n },\n ],\n news: newsFromAnnouncement({\n previewText: input.announcementPreviewText,\n markdown: input.announcementMarkdown,\n html: input.announcementHtml ?? undefined,\n }),\n };\n}\n"],"mappings":";;AAoHA,MAAM,mBAAkD;CACtD,SAAS;CACT,QAAQ;CACR,MAA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cAAc,MAAM,SAAS;GAC9B,CAAC;EACF;EACA,SAAS,WACL;GACE,kBAAkB,SAAS;GAC3B,aAAa,SAAS;GACtB,WAAW,MAAM,SAAS,MAAM;GAChC,SAAS,MAAM,SAAS;GACxB;GACD,GACD,MAAM,SAAS,QAAQ,QACrB;GACE,kBAAkB;GAClB,aAAa;GACb,WAAW,MAAM,SAAS,MAAM;GAChC,SAAS,MAAM,SAAS;GACxB;GACD,GACD;EACN,SAAS;GACP,KAAK,MAAM;GACX,QAAQ,uBAAuB,MAAM;GACtC;EACD,UAAU;GACR;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,QAAQ,MAAM,aAAa;IAC7D,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACF;EACD,MAAM,qBAAqB;GACzB,aAAa,MAAM;GACnB,UAAU,MAAM;GAChB,MAAM,MAAM,oBAAoB;GACjC,CAAC;EACH"}
@@ -1,17 +1,4 @@
1
1
  //#region src/lib/home-briefing.ts
2
- /**
3
- * A self-contained handoff for a coding agent. It answers the onboarding
4
- * workflow's session and feedback consent gates up front, while keeping the
5
- * feature guide—not a generic product-onboarding branch—in control of the
6
- * implementation plan.
7
- */
8
- function homeFeatureImplementationPrompt(service, context) {
9
- return `Identify your coding-agent slug (for example, \`codex\` or \`claude-code\`). From the target project root, run \`npx copilotkit@latest onboard start --run ${context.onboardingRunId} --coding-agent <coding-agent-slug>\` and use its output as onboarding context. If it requires a CopilotKit CLI session check, you have permission to run it; never reveal credentials or send optional diagnostic feedback reports.
10
-
11
- This task is specifically to enable ${service.label}, not to re-onboard the application. First inspect the existing CopilotKit runtime, provider, agent, and UI wiring, and confirm that ${service.label} is not already enabled. Then read the ${service.label} guide (${service.docsUrl}) and make a short plan before editing. Preserve the project's framework, package manager, installed CopilotKit version, existing agent IDs, routes, provider layout, and working behavior. Do not create, select, or alter a CopilotKit Intelligence project—or add Intelligence configuration—unless this feature's official guide explicitly requires it or the user asks.
12
-
13
- Implement the smallest complete integration: wire every feature-required client and runtime configuration into the chat-to-agent path people already use, reuse local patterns, and do not invent environment values or hardcode secrets. Add or update focused tests and run the relevant project checks. Finish only after local validation proves ${service.label} works—not merely that the code compiles. Use a feature-specific runtime or Inspector capability check and, when the feature supports one, a representative UI interaction that proves the user-facing result. If the project overrides default rendering (for example, with a wildcard tool renderer), make that override compatible with this feature; a capability flag alone is not success. Summarize the changed files, validation, and any manual setup still required.`;
14
- }
15
2
  const SERVICE_DOCS_URL = {
16
3
  threads: "https://docs.copilotkit.ai/threads",
17
4
  memory: "https://docs.copilotkit.ai/intelligence/intelligence-platform",
@@ -297,5 +284,5 @@ function buildHomeModel(input) {
297
284
  }
298
285
 
299
286
  //#endregion
300
- export { buildHomeModel, homeFeatureImplementationPrompt, runtimeConnectionNeedsAttention };
287
+ export { buildHomeModel, runtimeConnectionNeedsAttention };
301
288
  //# sourceMappingURL=home-briefing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"home-briefing.mjs","names":[],"sources":["../../src/lib/home-briefing.ts"],"sourcesContent":["import type { InspectorMetadataProjection } from \"./inspector-metadata.js\";\n\nexport type HomeHeroActionKind =\n | \"enable_intelligence\"\n | \"manage_plan\"\n | \"renew\";\n\nexport type HomeHeroAction = {\n kind: HomeHeroActionKind;\n url: string;\n label: string;\n};\n\nexport type HomeConnection = \"connected\" | \"disconnected\";\n\nexport type HomeRuntimeConnectionState =\n | \"connected\"\n | \"connecting\"\n | \"disconnected\"\n | \"error\"\n | \"unavailable\";\n\nexport type HomeRuntimeHealthTone = \"success\" | \"active\" | \"error\" | \"muted\";\n\nexport type HomeServiceId =\n | \"threads\"\n | \"memory\"\n | \"a2ui\"\n | \"open-gen-ui\"\n | \"suggestions\"\n | \"audio\"\n | \"websocket\";\n\nexport type HomeServiceTile = {\n id: HomeServiceId;\n label: string;\n enabled: boolean;\n url?: string;\n docsUrl: string;\n};\n\nexport type HomeFeatureImplementationPromptContext = {\n onboardingRunId: string;\n};\n\n/**\n * A self-contained handoff for a coding agent. It answers the onboarding\n * workflow's session and feedback consent gates up front, while keeping the\n * feature guide—not a generic product-onboarding branch—in control of the\n * implementation plan.\n */\nexport function homeFeatureImplementationPrompt(\n service: Pick<HomeServiceTile, \"label\" | \"docsUrl\">,\n context: HomeFeatureImplementationPromptContext,\n): string {\n return `Identify your coding-agent slug (for example, \\`codex\\` or \\`claude-code\\`). From the target project root, run \\`npx copilotkit@latest onboard start --run ${context.onboardingRunId} --coding-agent <coding-agent-slug>\\` and use its output as onboarding context. If it requires a CopilotKit CLI session check, you have permission to run it; never reveal credentials or send optional diagnostic feedback reports.\n\nThis task is specifically to enable ${service.label}, not to re-onboard the application. First inspect the existing CopilotKit runtime, provider, agent, and UI wiring, and confirm that ${service.label} is not already enabled. Then read the ${service.label} guide (${service.docsUrl}) and make a short plan before editing. Preserve the project's framework, package manager, installed CopilotKit version, existing agent IDs, routes, provider layout, and working behavior. Do not create, select, or alter a CopilotKit Intelligence project—or add Intelligence configuration—unless this feature's official guide explicitly requires it or the user asks.\n\nImplement the smallest complete integration: wire every feature-required client and runtime configuration into the chat-to-agent path people already use, reuse local patterns, and do not invent environment values or hardcode secrets. Add or update focused tests and run the relevant project checks. Finish only after local validation proves ${service.label} works—not merely that the code compiles. Use a feature-specific runtime or Inspector capability check and, when the feature supports one, a representative UI interaction that proves the user-facing result. If the project overrides default rendering (for example, with a wildcard tool renderer), make that override compatible with this feature; a capability flag alone is not success. Summarize the changed files, validation, and any manual setup still required.`;\n}\n\nexport type HomeModel = {\n hero: {\n connection: HomeConnection;\n title: string;\n body: string;\n action?: HomeHeroAction;\n };\n project?: {\n organizationName: string;\n projectName: string;\n planLabel?: string;\n license: string;\n usage?: {\n used: number;\n limitLabel: string;\n ratio?: number;\n };\n };\n projectLinked: boolean;\n runtime: {\n url?: string;\n health: {\n state: \"healthy\" | \"checking\" | \"offline\" | \"error\" | \"unavailable\";\n label: string;\n runtime: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n liveUpdates: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n lastEvent: {\n label: string;\n tone: HomeRuntimeHealthTone;\n id?: string;\n agentId?: string;\n type?: string;\n timestamp?: number;\n };\n };\n };\n services: HomeServiceTile[];\n news: {\n title: string;\n previewText: string;\n documentHtml?: string;\n empty: boolean;\n };\n};\n\nexport type HomeBriefingInput = {\n intelligenceConnected: boolean;\n threadsAvailable: boolean;\n metadata: InspectorMetadataProjection;\n runtimeUrl?: string;\n runtimeConnectionState: HomeRuntimeConnectionState;\n lastRuntimeEvent?: {\n id: string;\n agentId: string;\n type: string;\n timestamp: number;\n };\n learningOn: boolean;\n a2uiOn: boolean;\n openGenUiOn: boolean;\n suggestionsOn: boolean;\n audioOn: boolean;\n websocketUrl?: string;\n announcementPreviewText?: string;\n announcementMarkdown?: string;\n announcementHtml?: string;\n intelligenceSignupUrl?: string;\n};\n\nconst SERVICE_DOCS_URL: Record<HomeServiceId, string> = {\n threads: \"https://docs.copilotkit.ai/threads\",\n memory: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n a2ui: \"https://docs.copilotkit.ai/generative-ui/a2ui\",\n \"open-gen-ui\": \"https://docs.copilotkit.ai/generative-ui/open-generative-ui\",\n suggestions:\n \"https://docs.copilotkit.ai/reference/hooks/useConfigureSuggestions\",\n audio: \"https://docs.copilotkit.ai/voice\",\n websocket: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n};\n\n/** Return the Home hero button for a trusted metadata action. */\nexport function homeHeroActionFromMetadata(action: {\n kind: HomeHeroActionKind;\n url: string;\n}): HomeHeroAction {\n if (action.kind === \"manage_plan\") {\n return { kind: action.kind, url: action.url, label: \"Manage plan\" };\n }\n\n if (action.kind === \"renew\") {\n return { kind: action.kind, url: action.url, label: \"Renew plan\" };\n }\n\n return {\n kind: action.kind,\n url: action.url,\n label: \"Setup Intelligence\",\n };\n}\n\n/** Return a short preview from markdown, without links or headings. */\nexport function announcementPreview(markdown: string, maxLength = 140): string {\n const plain = markdown\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\")\n .replace(/[#*_`]/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim();\n if (plain.length <= maxLength) {\n return plain;\n }\n\n return `${plain.slice(0, maxLength).trimEnd()}…`;\n}\n\nfunction connectIntelligenceAction(\n action: HomeHeroAction | undefined,\n connectUrl?: string,\n licenseState?: InspectorMetadataProjection[\"licenseState\"],\n): HomeHeroAction | undefined {\n if (action) {\n return action;\n }\n\n if (connectUrl && (licenseState === \"none\" || licenseState === \"unknown\")) {\n return homeHeroActionFromMetadata({\n kind: \"enable_intelligence\",\n url: connectUrl,\n });\n }\n\n return undefined;\n}\n\nfunction heroForState(args: {\n connected: boolean;\n action?: HomeHeroAction;\n connectUrl?: string;\n licenseState: InspectorMetadataProjection[\"licenseState\"];\n}): HomeModel[\"hero\"] {\n if (!args.connected) {\n const renewing = args.action?.kind === \"renew\";\n return {\n connection: \"disconnected\",\n // Not \"Intelligence is not setup\" — that reads as a defect in the tool,\n // and a defect gets dismissed. The heading names the product; the\n // argument for it is made by the rotating copy on Home, which changes\n // with the picture beside it.\n title: renewing ? \"Renew Intelligence\" : \"CopilotKit Intelligence\",\n // In install mode this is NOT the visible paragraph. The visible copy\n // rotates every few seconds, which would make a screen reader announce a\n // new sentence four times a loop, so the rotating text is hidden from\n // assistive tech and this one stable sentence is exposed instead. It has\n // to carry the whole chain on its own.\n body: renewing\n ? \"Renew Intelligence to restore persistent Threads and Memory.\"\n : \"Intelligence keeps every thread your users have, finds evidence-backed patterns in them, and proposes skills you approve before your agent uses them.\",\n action: connectIntelligenceAction(\n args.action,\n args.connectUrl,\n args.licenseState,\n ),\n };\n }\n\n return {\n connection: \"connected\",\n title: \"Connected to Intelligence\",\n body: \"Use Workbench to inspect threads and memory.\",\n action:\n args.action?.kind === \"enable_intelligence\" ? undefined : args.action,\n };\n}\n\nfunction usageFromMetadata(metadata: InspectorMetadataProjection):\n | {\n used: number;\n limitLabel: string;\n ratio?: number;\n }\n | undefined {\n const usage = metadata.usage;\n if (!usage) {\n return undefined;\n }\n\n if (usage.limit.kind === \"finite\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / ${usage.limit.value}`,\n ratio: usage.limit.value === 0 ? 1 : usage.used / usage.limit.value,\n };\n }\n\n if (usage.limit.kind === \"unlimited\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / unlimited`,\n };\n }\n\n return {\n used: usage.used,\n limitLabel: `${usage.used} used`,\n };\n}\n\nfunction newsFromAnnouncement(args: {\n previewText?: string;\n markdown?: string;\n html?: string;\n}): HomeModel[\"news\"] {\n const markdown = args.markdown?.trim();\n if (markdown && args.html) {\n const heading = markdown.match(/^#{1,3}\\s+(.+)$/m)?.[1]?.trim();\n return {\n title: heading || \"The latest from CopilotKit\",\n previewText:\n args.previewText?.trim() || announcementPreview(markdown, 160),\n documentHtml: args.html,\n empty: false,\n };\n }\n\n return {\n title: \"You're all caught up\",\n previewText: \"Latest CopilotKit updates will appear here.\",\n empty: true,\n };\n}\n\nfunction runtimeEventSignal(\n event: HomeBriefingInput[\"lastRuntimeEvent\"],\n): HomeModel[\"runtime\"][\"health\"][\"lastEvent\"] {\n if (!event) {\n return { label: \"No events yet\", tone: \"muted\" };\n }\n\n const eventDetails = {\n id: event.id,\n agentId: event.agentId,\n type: event.type,\n timestamp: event.timestamp,\n };\n\n if (event.type === \"RUN_ERROR\" || event.type === \"ERROR\") {\n return {\n label: event.type === \"RUN_ERROR\" ? \"Run error\" : \"Error\",\n tone: \"error\",\n ...eventDetails,\n };\n }\n\n if (event.type === \"RUN_FINISHED\") {\n return {\n label: \"Run completed\",\n tone: \"success\",\n ...eventDetails,\n };\n }\n\n if (\n event.type.endsWith(\"_START\") ||\n event.type.endsWith(\"_STARTED\") ||\n event.type.endsWith(\"_CONTENT\") ||\n event.type.endsWith(\"_ARGS\") ||\n event.type.endsWith(\"_DELTA\")\n ) {\n return {\n label: \"Last event is in progress\",\n tone: \"active\",\n ...eventDetails,\n };\n }\n\n return {\n label: \"Last event received\",\n tone: \"success\",\n ...eventDetails,\n };\n}\n\n/**\n * Whether the runtime *connection* needs attention — the single condition\n * shared by System Health and the launcher's error signal, so the two can\n * never disagree about whether the wiring is broken.\n *\n * Exactly one state counts. `disconnected` is also the initial value, so\n * counting it would raise the signal on every page load; `connecting` is a\n * normal startup step; `unavailable` means no Core is attached, which is not\n * a defect of the developer's wiring.\n *\n * Note the deliberate asymmetry with `health.state`: a failed *run* also\n * drives System Health to \"Needs attention\" while the connection is fine.\n * That is an event rather than a state, and it is excluded from the launcher\n * on purpose — see the launcher-signal comments in index.ts.\n */\nexport function runtimeConnectionNeedsAttention(\n state: HomeRuntimeConnectionState,\n): boolean {\n return state === \"error\";\n}\n\nfunction runtimeHealthFromInput(\n input: HomeBriefingInput,\n): HomeModel[\"runtime\"][\"health\"] {\n const lastEvent = runtimeEventSignal(input.lastRuntimeEvent);\n\n if (input.runtimeConnectionState === \"connected\") {\n return {\n state: lastEvent.tone === \"error\" ? \"error\" : \"healthy\",\n label: lastEvent.tone === \"error\" ? \"Needs attention\" : \"Healthy\",\n runtime: { label: \"Available\", tone: \"success\" },\n liveUpdates: { label: \"Ready\", tone: \"success\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"connecting\") {\n return {\n state: \"checking\",\n label: \"Checking\",\n runtime: { label: \"Checking\", tone: \"active\" },\n liveUpdates: { label: \"Connecting\", tone: \"active\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"unavailable\") {\n return {\n state: \"unavailable\",\n label: \"Unavailable\",\n runtime: { label: \"Unavailable\", tone: \"muted\" },\n liveUpdates: { label: \"Not attached\", tone: \"muted\" },\n lastEvent,\n };\n }\n\n const needsAttention = runtimeConnectionNeedsAttention(\n input.runtimeConnectionState,\n );\n return {\n state: needsAttention ? \"error\" : \"offline\",\n label: needsAttention ? \"Runtime error\" : \"Offline\",\n runtime: { label: \"Offline\", tone: \"error\" },\n liveUpdates: {\n label: needsAttention ? \"Error\" : \"Disconnected\",\n tone: \"error\",\n },\n lastEvent,\n };\n}\n\n/** Build the Home briefing from data the Inspector already has. */\nexport function buildHomeModel(input: HomeBriefingInput): HomeModel {\n const metadataAction =\n input.metadata.threadsFooterAction ?? input.metadata.lockedAction;\n const action = metadataAction\n ? homeHeroActionFromMetadata({\n kind: metadataAction.kind,\n url: metadataAction.url,\n })\n : undefined;\n\n const identity = input.metadata.identity;\n const projectLinked = Boolean(identity);\n const intelligenceConnected =\n input.metadata.licenseState === \"valid\" ||\n (input.metadata.licenseState === \"unknown\" && input.intelligenceConnected);\n const usage = usageFromMetadata(input.metadata);\n\n return {\n hero: heroForState({\n connected: intelligenceConnected,\n action,\n connectUrl: input.intelligenceSignupUrl,\n licenseState: input.metadata.licenseState,\n }),\n projectLinked,\n project: identity\n ? {\n organizationName: identity.organizationName,\n projectName: identity.projectName,\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : input.metadata.plan || usage\n ? {\n organizationName: \"Not linked\",\n projectName: \"This runtime is not linked to a project\",\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : undefined,\n runtime: {\n url: input.runtimeUrl,\n health: runtimeHealthFromInput(input),\n },\n services: [\n {\n id: \"threads\",\n label: \"Threads\",\n enabled: intelligenceConnected && input.threadsAvailable,\n url: input.runtimeUrl,\n docsUrl: SERVICE_DOCS_URL.threads,\n },\n {\n id: \"memory\",\n label: \"Learning\",\n enabled: intelligenceConnected && input.learningOn,\n docsUrl: SERVICE_DOCS_URL.memory,\n },\n {\n id: \"a2ui\",\n label: \"A2UI\",\n enabled: input.a2uiOn,\n docsUrl: SERVICE_DOCS_URL.a2ui,\n },\n {\n id: \"open-gen-ui\",\n label: \"Open Gen UI\",\n enabled: input.openGenUiOn,\n docsUrl: SERVICE_DOCS_URL[\"open-gen-ui\"],\n },\n {\n id: \"suggestions\",\n label: \"Suggestions\",\n enabled: input.suggestionsOn,\n docsUrl: SERVICE_DOCS_URL.suggestions,\n },\n {\n id: \"audio\",\n label: \"Voice\",\n enabled: input.audioOn,\n docsUrl: SERVICE_DOCS_URL.audio,\n },\n {\n id: \"websocket\",\n label: \"Websocket\",\n enabled: intelligenceConnected && Boolean(input.websocketUrl),\n url: input.websocketUrl,\n docsUrl: SERVICE_DOCS_URL.websocket,\n },\n ],\n news: newsFromAnnouncement({\n previewText: input.announcementPreviewText,\n markdown: input.announcementMarkdown,\n html: input.announcementHtml ?? undefined,\n }),\n };\n}\n"],"mappings":";;;;;;;AAmDA,SAAgB,gCACd,SACA,SACQ;AACR,QAAO,8JAA8J,QAAQ,gBAAgB;;sCAEzJ,QAAQ,MAAM,uIAAuI,QAAQ,MAAM,yCAAyC,QAAQ,MAAM,UAAU,QAAQ,QAAQ;;uVAE6D,QAAQ,MAAM;;AA8ErW,MAAM,mBAAkD;CACtD,SAAS;CACT,QAAQ;CACR,MAAM;CACN,eAAe;CACf,aACE;CACF,OAAO;CACP,WAAW;CACZ;;AAGD,SAAgB,2BAA2B,QAGxB;AACjB,KAAI,OAAO,SAAS,cAClB,QAAO;EAAE,MAAM,OAAO;EAAM,KAAK,OAAO;EAAK,OAAO;EAAe;AAGrE,KAAI,OAAO,SAAS,QAClB,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B,aAAa;GACb,WAAW,MAAM,SAAS,MAAM;GAChC,SAAS,MAAM,SAAS;GACxB;GACD,GACD;EACN,SAAS;GACP,KAAK,MAAM;GACX,QAAQ,uBAAuB,MAAM;GACtC;EACD,UAAU;GACR;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,QAAQ,MAAM,aAAa;IAC7D,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACF;EACD,MAAM,qBAAqB;GACzB,aAAa,MAAM;GACnB,UAAU,MAAM;GAChB,MAAM,MAAM,oBAAoB;GACjC,CAAC;EACH"}
1
+ {"version":3,"file":"home-briefing.mjs","names":[],"sources":["../../src/lib/home-briefing.ts"],"sourcesContent":["import type { InspectorMetadataProjection } from \"./inspector-metadata.js\";\n\nexport type HomeHeroActionKind =\n | \"enable_intelligence\"\n | \"manage_plan\"\n | \"renew\";\n\nexport type HomeHeroAction = {\n kind: HomeHeroActionKind;\n url: string;\n label: string;\n};\n\nexport type HomeConnection = \"connected\" | \"disconnected\";\n\nexport type HomeRuntimeConnectionState =\n | \"connected\"\n | \"connecting\"\n | \"disconnected\"\n | \"error\"\n | \"unavailable\";\n\nexport type HomeRuntimeHealthTone = \"success\" | \"active\" | \"error\" | \"muted\";\n\nexport type HomeServiceId =\n | \"threads\"\n | \"memory\"\n | \"a2ui\"\n | \"open-gen-ui\"\n | \"suggestions\"\n | \"audio\"\n | \"websocket\";\n\nexport type HomeServiceTile = {\n id: HomeServiceId;\n label: string;\n enabled: boolean;\n url?: string;\n docsUrl: string;\n};\n\nexport type HomeModel = {\n hero: {\n connection: HomeConnection;\n title: string;\n body: string;\n action?: HomeHeroAction;\n };\n project?: {\n organizationName: string;\n projectName: string;\n planLabel?: string;\n license: string;\n usage?: {\n used: number;\n limitLabel: string;\n ratio?: number;\n };\n };\n projectLinked: boolean;\n runtime: {\n url?: string;\n health: {\n state: \"healthy\" | \"checking\" | \"offline\" | \"error\" | \"unavailable\";\n label: string;\n runtime: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n liveUpdates: {\n label: string;\n tone: HomeRuntimeHealthTone;\n };\n lastEvent: {\n label: string;\n tone: HomeRuntimeHealthTone;\n id?: string;\n agentId?: string;\n type?: string;\n timestamp?: number;\n };\n };\n };\n services: HomeServiceTile[];\n news: {\n title: string;\n previewText: string;\n documentHtml?: string;\n empty: boolean;\n };\n};\n\nexport type HomeBriefingInput = {\n intelligenceConnected: boolean;\n threadsAvailable: boolean;\n metadata: InspectorMetadataProjection;\n runtimeUrl?: string;\n runtimeConnectionState: HomeRuntimeConnectionState;\n lastRuntimeEvent?: {\n id: string;\n agentId: string;\n type: string;\n timestamp: number;\n };\n learningOn: boolean;\n a2uiOn: boolean;\n openGenUiOn: boolean;\n suggestionsOn: boolean;\n audioOn: boolean;\n websocketUrl?: string;\n announcementPreviewText?: string;\n announcementMarkdown?: string;\n announcementHtml?: string;\n intelligenceSignupUrl?: string;\n};\n\nconst SERVICE_DOCS_URL: Record<HomeServiceId, string> = {\n threads: \"https://docs.copilotkit.ai/threads\",\n memory: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n a2ui: \"https://docs.copilotkit.ai/generative-ui/a2ui\",\n \"open-gen-ui\": \"https://docs.copilotkit.ai/generative-ui/open-generative-ui\",\n suggestions:\n \"https://docs.copilotkit.ai/reference/hooks/useConfigureSuggestions\",\n audio: \"https://docs.copilotkit.ai/voice\",\n websocket: \"https://docs.copilotkit.ai/intelligence/intelligence-platform\",\n};\n\n/** Return the Home hero button for a trusted metadata action. */\nexport function homeHeroActionFromMetadata(action: {\n kind: HomeHeroActionKind;\n url: string;\n}): HomeHeroAction {\n if (action.kind === \"manage_plan\") {\n return { kind: action.kind, url: action.url, label: \"Manage plan\" };\n }\n\n if (action.kind === \"renew\") {\n return { kind: action.kind, url: action.url, label: \"Renew plan\" };\n }\n\n return {\n kind: action.kind,\n url: action.url,\n label: \"Setup Intelligence\",\n };\n}\n\n/** Return a short preview from markdown, without links or headings. */\nexport function announcementPreview(markdown: string, maxLength = 140): string {\n const plain = markdown\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\")\n .replace(/[#*_`]/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim();\n if (plain.length <= maxLength) {\n return plain;\n }\n\n return `${plain.slice(0, maxLength).trimEnd()}…`;\n}\n\nfunction connectIntelligenceAction(\n action: HomeHeroAction | undefined,\n connectUrl?: string,\n licenseState?: InspectorMetadataProjection[\"licenseState\"],\n): HomeHeroAction | undefined {\n if (action) {\n return action;\n }\n\n if (connectUrl && (licenseState === \"none\" || licenseState === \"unknown\")) {\n return homeHeroActionFromMetadata({\n kind: \"enable_intelligence\",\n url: connectUrl,\n });\n }\n\n return undefined;\n}\n\nfunction heroForState(args: {\n connected: boolean;\n action?: HomeHeroAction;\n connectUrl?: string;\n licenseState: InspectorMetadataProjection[\"licenseState\"];\n}): HomeModel[\"hero\"] {\n if (!args.connected) {\n const renewing = args.action?.kind === \"renew\";\n return {\n connection: \"disconnected\",\n // Not \"Intelligence is not setup\" — that reads as a defect in the tool,\n // and a defect gets dismissed. The heading names the product; the\n // argument for it is made by the rotating copy on Home, which changes\n // with the picture beside it.\n title: renewing ? \"Renew Intelligence\" : \"CopilotKit Intelligence\",\n // In install mode this is NOT the visible paragraph. The visible copy\n // rotates every few seconds, which would make a screen reader announce a\n // new sentence four times a loop, so the rotating text is hidden from\n // assistive tech and this one stable sentence is exposed instead. It has\n // to carry the whole chain on its own.\n body: renewing\n ? \"Renew Intelligence to restore persistent Threads and Memory.\"\n : \"Intelligence keeps every thread your users have, finds evidence-backed patterns in them, and proposes skills you approve before your agent uses them.\",\n action: connectIntelligenceAction(\n args.action,\n args.connectUrl,\n args.licenseState,\n ),\n };\n }\n\n return {\n connection: \"connected\",\n title: \"Connected to Intelligence\",\n body: \"Use Workbench to inspect threads and memory.\",\n action:\n args.action?.kind === \"enable_intelligence\" ? undefined : args.action,\n };\n}\n\nfunction usageFromMetadata(metadata: InspectorMetadataProjection):\n | {\n used: number;\n limitLabel: string;\n ratio?: number;\n }\n | undefined {\n const usage = metadata.usage;\n if (!usage) {\n return undefined;\n }\n\n if (usage.limit.kind === \"finite\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / ${usage.limit.value}`,\n ratio: usage.limit.value === 0 ? 1 : usage.used / usage.limit.value,\n };\n }\n\n if (usage.limit.kind === \"unlimited\") {\n return {\n used: usage.used,\n limitLabel: `${usage.used} / unlimited`,\n };\n }\n\n return {\n used: usage.used,\n limitLabel: `${usage.used} used`,\n };\n}\n\nfunction newsFromAnnouncement(args: {\n previewText?: string;\n markdown?: string;\n html?: string;\n}): HomeModel[\"news\"] {\n const markdown = args.markdown?.trim();\n if (markdown && args.html) {\n const heading = markdown.match(/^#{1,3}\\s+(.+)$/m)?.[1]?.trim();\n return {\n title: heading || \"The latest from CopilotKit\",\n previewText:\n args.previewText?.trim() || announcementPreview(markdown, 160),\n documentHtml: args.html,\n empty: false,\n };\n }\n\n return {\n title: \"You're all caught up\",\n previewText: \"Latest CopilotKit updates will appear here.\",\n empty: true,\n };\n}\n\nfunction runtimeEventSignal(\n event: HomeBriefingInput[\"lastRuntimeEvent\"],\n): HomeModel[\"runtime\"][\"health\"][\"lastEvent\"] {\n if (!event) {\n return { label: \"No events yet\", tone: \"muted\" };\n }\n\n const eventDetails = {\n id: event.id,\n agentId: event.agentId,\n type: event.type,\n timestamp: event.timestamp,\n };\n\n if (event.type === \"RUN_ERROR\" || event.type === \"ERROR\") {\n return {\n label: event.type === \"RUN_ERROR\" ? \"Run error\" : \"Error\",\n tone: \"error\",\n ...eventDetails,\n };\n }\n\n if (event.type === \"RUN_FINISHED\") {\n return {\n label: \"Run completed\",\n tone: \"success\",\n ...eventDetails,\n };\n }\n\n if (\n event.type.endsWith(\"_START\") ||\n event.type.endsWith(\"_STARTED\") ||\n event.type.endsWith(\"_CONTENT\") ||\n event.type.endsWith(\"_ARGS\") ||\n event.type.endsWith(\"_DELTA\")\n ) {\n return {\n label: \"Last event is in progress\",\n tone: \"active\",\n ...eventDetails,\n };\n }\n\n return {\n label: \"Last event received\",\n tone: \"success\",\n ...eventDetails,\n };\n}\n\n/**\n * Whether the runtime *connection* needs attention — the single condition\n * shared by System Health and the launcher's error signal, so the two can\n * never disagree about whether the wiring is broken.\n *\n * Exactly one state counts. `disconnected` is also the initial value, so\n * counting it would raise the signal on every page load; `connecting` is a\n * normal startup step; `unavailable` means no Core is attached, which is not\n * a defect of the developer's wiring.\n *\n * Note the deliberate asymmetry with `health.state`: a failed *run* also\n * drives System Health to \"Needs attention\" while the connection is fine.\n * That is an event rather than a state, and it is excluded from the launcher\n * on purpose — see the launcher-signal comments in index.ts.\n */\nexport function runtimeConnectionNeedsAttention(\n state: HomeRuntimeConnectionState,\n): boolean {\n return state === \"error\";\n}\n\nfunction runtimeHealthFromInput(\n input: HomeBriefingInput,\n): HomeModel[\"runtime\"][\"health\"] {\n const lastEvent = runtimeEventSignal(input.lastRuntimeEvent);\n\n if (input.runtimeConnectionState === \"connected\") {\n return {\n state: lastEvent.tone === \"error\" ? \"error\" : \"healthy\",\n label: lastEvent.tone === \"error\" ? \"Needs attention\" : \"Healthy\",\n runtime: { label: \"Available\", tone: \"success\" },\n liveUpdates: { label: \"Ready\", tone: \"success\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"connecting\") {\n return {\n state: \"checking\",\n label: \"Checking\",\n runtime: { label: \"Checking\", tone: \"active\" },\n liveUpdates: { label: \"Connecting\", tone: \"active\" },\n lastEvent,\n };\n }\n\n if (input.runtimeConnectionState === \"unavailable\") {\n return {\n state: \"unavailable\",\n label: \"Unavailable\",\n runtime: { label: \"Unavailable\", tone: \"muted\" },\n liveUpdates: { label: \"Not attached\", tone: \"muted\" },\n lastEvent,\n };\n }\n\n const needsAttention = runtimeConnectionNeedsAttention(\n input.runtimeConnectionState,\n );\n return {\n state: needsAttention ? \"error\" : \"offline\",\n label: needsAttention ? \"Runtime error\" : \"Offline\",\n runtime: { label: \"Offline\", tone: \"error\" },\n liveUpdates: {\n label: needsAttention ? \"Error\" : \"Disconnected\",\n tone: \"error\",\n },\n lastEvent,\n };\n}\n\n/** Build the Home briefing from data the Inspector already has. */\nexport function buildHomeModel(input: HomeBriefingInput): HomeModel {\n const metadataAction =\n input.metadata.threadsFooterAction ?? input.metadata.lockedAction;\n const action = metadataAction\n ? homeHeroActionFromMetadata({\n kind: metadataAction.kind,\n url: metadataAction.url,\n })\n : undefined;\n\n const identity = input.metadata.identity;\n const projectLinked = Boolean(identity);\n const intelligenceConnected =\n input.metadata.licenseState === \"valid\" ||\n (input.metadata.licenseState === \"unknown\" && input.intelligenceConnected);\n const usage = usageFromMetadata(input.metadata);\n\n return {\n hero: heroForState({\n connected: intelligenceConnected,\n action,\n connectUrl: input.intelligenceSignupUrl,\n licenseState: input.metadata.licenseState,\n }),\n projectLinked,\n project: identity\n ? {\n organizationName: identity.organizationName,\n projectName: identity.projectName,\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : input.metadata.plan || usage\n ? {\n organizationName: \"Not linked\",\n projectName: \"This runtime is not linked to a project\",\n planLabel: input.metadata.plan?.label,\n license: input.metadata.licenseState,\n usage,\n }\n : undefined,\n runtime: {\n url: input.runtimeUrl,\n health: runtimeHealthFromInput(input),\n },\n services: [\n {\n id: \"threads\",\n label: \"Threads\",\n enabled: intelligenceConnected && input.threadsAvailable,\n url: input.runtimeUrl,\n docsUrl: SERVICE_DOCS_URL.threads,\n },\n {\n id: \"memory\",\n label: \"Learning\",\n enabled: intelligenceConnected && input.learningOn,\n docsUrl: SERVICE_DOCS_URL.memory,\n },\n {\n id: \"a2ui\",\n label: \"A2UI\",\n enabled: input.a2uiOn,\n docsUrl: SERVICE_DOCS_URL.a2ui,\n },\n {\n id: \"open-gen-ui\",\n label: \"Open Gen UI\",\n enabled: input.openGenUiOn,\n docsUrl: SERVICE_DOCS_URL[\"open-gen-ui\"],\n },\n {\n id: \"suggestions\",\n label: \"Suggestions\",\n enabled: input.suggestionsOn,\n docsUrl: SERVICE_DOCS_URL.suggestions,\n },\n {\n id: \"audio\",\n label: \"Voice\",\n enabled: input.audioOn,\n docsUrl: SERVICE_DOCS_URL.audio,\n },\n {\n id: \"websocket\",\n label: \"Websocket\",\n enabled: intelligenceConnected && Boolean(input.websocketUrl),\n url: input.websocketUrl,\n docsUrl: SERVICE_DOCS_URL.websocket,\n },\n ],\n news: newsFromAnnouncement({\n previewText: input.announcementPreviewText,\n markdown: input.announcementMarkdown,\n html: input.announcementHtml ?? undefined,\n }),\n };\n}\n"],"mappings":";AAoHA,MAAM,mBAAkD;CACtD,SAAS;CACT,QAAQ;CACR,MAAM;CACN,eAAe;CACf,aACE;CACF,OAAO;CACP,WAAW;CACZ;;AAGD,SAAgB,2BAA2B,QAGxB;AACjB,KAAI,OAAO,SAAS,cAClB,QAAO;EAAE,MAAM,OAAO;EAAM,KAAK,OAAO;EAAK,OAAO;EAAe;AAGrE,KAAI,OAAO,SAAS,QAClB,QAAO;EAAE,MAAM,OAAO;EAAM,KAAK,OAAO;EAAK,OAAO;EAAc;AAGpE,QAAO;EACL,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,OAAO;EACR;;;AAIH,SAAgB,oBAAoB,U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ACR;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,MAAM;IACxC,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,MAAM;IACf,SAAS,iBAAiB;IAC3B;GACD;IACE,IAAI;IACJ,OAAO;IACP,SAAS,yBAAyB,QAAQ,MAAM,aAAa;IAC7D,KAAK,MAAM;IACX,SAAS,iBAAiB;IAC3B;GACF;EACD,MAAM,qBAAqB;GACzB,aAAa,MAAM;GACnB,UAAU,MAAM;GAChB,MAAM,MAAM,oBAAoB;GACjC,CAAC;EACH"}
@@ -12,9 +12,26 @@
12
12
  * Intelligence app (`apps/app-frontend/react-shell/src/home/intelligence-home.tsx`).
13
13
  * The CLI resolves `onboard start` against a prompt graph, so the two surfaces
14
14
  * must not drift — if the CLI's entry point changes, both change together.
15
+ *
16
+ * Two lines, and deliberately nothing else. It used to open by telling the
17
+ * agent to identify itself and pass the slug as a flag -- two sentences of
18
+ * instruction to a machine, in the one piece of text a human reads, decides on
19
+ * and pastes. The graph asks for the slug itself now, with `onboard identify`,
20
+ * which is the surface that talks to the agent for the rest of the run
21
+ * (Intelligence OSS-1157).
22
+ *
23
+ * This one stays generic, and so do the docs and Intelligence web-app copies
24
+ * of it (OSS-1150). Those three are entry points for a developer with no
25
+ * CopilotKit app yet, and every `--intent` route requires an existing app: it
26
+ * inspects for one first and reads `feature/stop` when it is missing. The
27
+ * feature buttons on Home are the surface that knows which feature the
28
+ * developer is looking at, so they are the surface that names an intent — see
29
+ * `FEATURE_ONBOARDING_PROMPT_TEMPLATE` below.
15
30
  */
16
31
  const RUN_ID_PLACEHOLDER = "<run-id>";
17
- const ONBOARDING_PROMPT_TEMPLATE = `Identify which coding-agent product you are, using a short slug such as \`codex\` or \`claude-code\`. From the root of the project where you want CopilotKit, run \`npx --yes copilotkit@latest onboard start --run ${RUN_ID_PLACEHOLDER} --coding-agent <coding-agent-slug>\`. Follow the Markdown instructions it prints until onboarding is complete.`;
32
+ const ONBOARDING_PROMPT_TEMPLATE = `Help me get started with CopilotKit. Run this command and follow the instructions:
33
+
34
+ npx --yes copilotkit@latest onboard start --run ${RUN_ID_PLACEHOLDER}`;
18
35
  /** Length and alphabet are the CLI's, so a run id copied here resolves there. */
19
36
  const RUN_ID_LENGTH = 12;
20
37
  /**
@@ -41,8 +58,56 @@ function createOnboardingRunId() {
41
58
  function createOnboardingPrompt(runId) {
42
59
  return ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId);
43
60
  }
61
+ /**
62
+ * Which feature outcome each Home tile asks the CLI for.
63
+ *
64
+ * The two vocabularies stay separate on purpose. A `HomeServiceId` names a
65
+ * tile and the pane behind it, so `websocket` and `audio` are the right words
66
+ * for it; an intent names the work to be done, so `add-realtime-sync` and
67
+ * `add-voice` are the right words for that. One table maps between them, and
68
+ * `Record<HomeServiceId, OnboardingIntent>` makes a new tile or a renamed
69
+ * slug a type error rather than a missing button.
70
+ *
71
+ * `memory` maps to `add-learning` because the tile is the Learning tile: it is
72
+ * enabled by a *configured Learning container* (see `learningOn` in
73
+ * `index.ts`), which is exactly what `feature/learning` sets up. The tile id
74
+ * and the `memories` menu key are older names for that same pane.
75
+ */
76
+ const FEATURE_ONBOARDING_INTENT = {
77
+ threads: "add-rich-threads",
78
+ memory: "add-learning",
79
+ a2ui: "add-a2ui",
80
+ "open-gen-ui": "add-open-generative-ui",
81
+ suggestions: "add-chat-suggestions",
82
+ audio: "add-voice",
83
+ websocket: "add-realtime-sync"
84
+ };
85
+ const INTENT_PLACEHOLDER = "<intent>";
86
+ /**
87
+ * The prompt a Home feature button copies.
88
+ *
89
+ * It carries no feature-specific instruction, and it must not gain any. The
90
+ * `--intent` route owns the plan, the guide links, the per-phase check-ins,
91
+ * the refusal when a prerequisite is missing, and the proof step; prose copied
92
+ * here would duplicate all of that and then drift from it the next time the
93
+ * underlying API changes.
94
+ *
95
+ * What is left is the caller's own business: identify yourself, run this
96
+ * command, and the standing permission for the session check that the
97
+ * developer granted by copying the prompt.
98
+ */
99
+ const FEATURE_ONBOARDING_PROMPT_TEMPLATE = `Help me set this up in my CopilotKit app. Run this command and follow the instructions:
100
+
101
+ npx --yes copilotkit@latest onboard start --run ${RUN_ID_PLACEHOLDER} --intent ${INTENT_PLACEHOLDER}
102
+
103
+ If it requires a CopilotKit CLI session check, you have permission to run it. Never reveal credentials or send optional diagnostic feedback reports.`;
104
+ /** Bind one run id and one tile's feature outcome into the copied prompt. */
105
+ function createFeatureOnboardingPrompt(serviceId, runId) {
106
+ return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);
107
+ }
44
108
 
45
109
  //#endregion
110
+ exports.createFeatureOnboardingPrompt = createFeatureOnboardingPrompt;
46
111
  exports.createOnboardingPrompt = createOnboardingPrompt;
47
112
  exports.createOnboardingRunId = createOnboardingRunId;
48
113
  //# sourceMappingURL=onboarding-prompt.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"onboarding-prompt.cjs","names":[],"sources":["../../src/lib/onboarding-prompt.ts"],"sourcesContent":["/**\n * The Intelligence install prompt the Inspector hands to a coding agent.\n *\n * Every other Intelligence call to action in the Inspector opens a page in a\n * new tab, which is where developers drop out: they leave the editor, meet a\n * signup form, and never come back. This prompt lets the install happen where\n * they already are.\n *\n * The wording is kept byte-identical to `INTELLIGENCE_ONBOARDING_PROMPT` in the\n * Intelligence app (`apps/app-frontend/react-shell/src/home/intelligence-home.tsx`).\n * The CLI resolves `onboard start` against a prompt graph, so the two surfaces\n * must not drift — if the CLI's entry point changes, both change together.\n */\nconst RUN_ID_PLACEHOLDER = \"<run-id>\";\n\nexport const ONBOARDING_PROMPT_TEMPLATE =\n \"Identify which coding-agent product you are, using a short slug such as \" +\n \"`codex` or `claude-code`. From the root of the project where you want \" +\n \"CopilotKit, run `npx --yes copilotkit@latest onboard start --run \" +\n `${RUN_ID_PLACEHOLDER}` +\n \" --coding-agent <coding-agent-slug>`. Follow the Markdown instructions it \" +\n \"prints until onboarding is complete.\";\n\n/** Length and alphabet are the CLI's, so a run id copied here resolves there. */\nconst RUN_ID_LENGTH = 12;\n\n/**\n * Mint the identifier that joins this copy to the CLI run it starts.\n *\n * The Intelligence app derives it from `crypto.randomUUID()`. The Inspector\n * runs inside whatever page embeds it, so neither `randomUUID` nor a secure\n * context is guaranteed; the two fallbacks keep the id present rather than\n * letting the button fail. Collision risk is irrelevant — this correlates\n * telemetry, it does not authorise anything.\n */\nexport function createOnboardingRunId(): string {\n const webCrypto = globalThis.crypto;\n\n if (typeof webCrypto?.randomUUID === \"function\") {\n return webCrypto.randomUUID().replaceAll(\"-\", \"\").slice(0, RUN_ID_LENGTH);\n }\n\n if (typeof webCrypto?.getRandomValues === \"function\") {\n const bytes = webCrypto.getRandomValues(new Uint8Array(RUN_ID_LENGTH / 2));\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\n \"\",\n );\n }\n\n let id = \"\";\n while (id.length < RUN_ID_LENGTH) {\n id += Math.floor(Math.random() * 16).toString(16);\n }\n return id.slice(0, RUN_ID_LENGTH);\n}\n\n/** Bind one run id into the prompt text that gets copied. */\nexport function createOnboardingPrompt(runId: string): string {\n return ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,qBAAqB;AAE3B,MAAa,6BACX,uNAGG;;AAKL,MAAM,gBAAgB;;;;;;;;;;AAWtB,SAAgB,wBAAgC;CAC9C,MAAM,YAAY,WAAW;AAE7B,KAAI,OAAO,WAAW,eAAe,WACnC,QAAO,UAAU,YAAY,CAAC,WAAW,KAAK,GAAG,CAAC,MAAM,GAAG,cAAc;AAG3E,KAAI,OAAO,WAAW,oBAAoB,YAAY;EACpD,MAAM,QAAQ,UAAU,gBAAgB,IAAI,WAAW,gBAAgB,EAAE,CAAC;AAC1E,SAAO,MAAM,KAAK,QAAQ,SAAS,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,KACrE,GACD;;CAGH,IAAI,KAAK;AACT,QAAO,GAAG,SAAS,cACjB,OAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,GAAG,CAAC,SAAS,GAAG;AAEnD,QAAO,GAAG,MAAM,GAAG,cAAc;;;AAInC,SAAgB,uBAAuB,OAAuB;AAC5D,QAAO,2BAA2B,QAAQ,oBAAoB,MAAM"}
1
+ {"version":3,"file":"onboarding-prompt.cjs","names":[],"sources":["../../src/lib/onboarding-prompt.ts"],"sourcesContent":["import type { HomeServiceId } from \"./home-briefing.js\";\n\n/**\n * The Intelligence install prompt the Inspector hands to a coding agent.\n *\n * Every other Intelligence call to action in the Inspector opens a page in a\n * new tab, which is where developers drop out: they leave the editor, meet a\n * signup form, and never come back. This prompt lets the install happen where\n * they already are.\n *\n * The wording is kept byte-identical to `INTELLIGENCE_ONBOARDING_PROMPT` in the\n * Intelligence app (`apps/app-frontend/react-shell/src/home/intelligence-home.tsx`).\n * The CLI resolves `onboard start` against a prompt graph, so the two surfaces\n * must not drift — if the CLI's entry point changes, both change together.\n *\n * Two lines, and deliberately nothing else. It used to open by telling the\n * agent to identify itself and pass the slug as a flag -- two sentences of\n * instruction to a machine, in the one piece of text a human reads, decides on\n * and pastes. The graph asks for the slug itself now, with `onboard identify`,\n * which is the surface that talks to the agent for the rest of the run\n * (Intelligence OSS-1157).\n *\n * This one stays generic, and so do the docs and Intelligence web-app copies\n * of it (OSS-1150). Those three are entry points for a developer with no\n * CopilotKit app yet, and every `--intent` route requires an existing app: it\n * inspects for one first and reads `feature/stop` when it is missing. The\n * feature buttons on Home are the surface that knows which feature the\n * developer is looking at, so they are the surface that names an intent — see\n * `FEATURE_ONBOARDING_PROMPT_TEMPLATE` below.\n */\nconst RUN_ID_PLACEHOLDER = \"<run-id>\";\n\nexport const ONBOARDING_PROMPT_TEMPLATE =\n \"Help me get started with CopilotKit. Run this command and follow the \" +\n \"instructions:\\n\\nnpx --yes copilotkit@latest onboard start --run \" +\n `${RUN_ID_PLACEHOLDER}`;\n\n/** Length and alphabet are the CLI's, so a run id copied here resolves there. */\nconst RUN_ID_LENGTH = 12;\n\n/**\n * Mint the identifier that joins this copy to the CLI run it starts.\n *\n * The Intelligence app derives it from `crypto.randomUUID()`. The Inspector\n * runs inside whatever page embeds it, so neither `randomUUID` nor a secure\n * context is guaranteed; the two fallbacks keep the id present rather than\n * letting the button fail. Collision risk is irrelevant — this correlates\n * telemetry, it does not authorise anything.\n */\nexport function createOnboardingRunId(): string {\n const webCrypto = globalThis.crypto;\n\n if (typeof webCrypto?.randomUUID === \"function\") {\n return webCrypto.randomUUID().replaceAll(\"-\", \"\").slice(0, RUN_ID_LENGTH);\n }\n\n if (typeof webCrypto?.getRandomValues === \"function\") {\n const bytes = webCrypto.getRandomValues(new Uint8Array(RUN_ID_LENGTH / 2));\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\n \"\",\n );\n }\n\n let id = \"\";\n while (id.length < RUN_ID_LENGTH) {\n id += Math.floor(Math.random() * 16).toString(16);\n }\n return id.slice(0, RUN_ID_LENGTH);\n}\n\n/** Bind one run id into the prompt text that gets copied. */\nexport function createOnboardingPrompt(runId: string): string {\n return ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId);\n}\n\n/**\n * The closed set of feature outcomes the CLI prompt graph can start at.\n *\n * Kept equal to `ONBOARDING_INTENT_ROOTS` in Intelligence's\n * `apps/cli/onboarding-intents.cjs`, which is the build-time source of truth.\n * The two repositories cannot import each other, so the agreement is held by\n * this list plus the CLI's own `onboarding-intents.spec.ts`. Drift is loud\n * rather than silent: `onboard start` refuses an unknown `--intent` before it\n * persists a run, so a stale slug fails on the first command instead of\n * quietly onboarding the wrong feature.\n */\nexport const ONBOARDING_INTENTS = [\n \"add-a2ui\",\n \"add-chat-suggestions\",\n \"add-learning\",\n \"add-open-generative-ui\",\n \"add-realtime-sync\",\n \"add-rich-threads\",\n \"add-voice\",\n] as const;\n\nexport type OnboardingIntent = (typeof ONBOARDING_INTENTS)[number];\n\n/**\n * Which feature outcome each Home tile asks the CLI for.\n *\n * The two vocabularies stay separate on purpose. A `HomeServiceId` names a\n * tile and the pane behind it, so `websocket` and `audio` are the right words\n * for it; an intent names the work to be done, so `add-realtime-sync` and\n * `add-voice` are the right words for that. One table maps between them, and\n * `Record<HomeServiceId, OnboardingIntent>` makes a new tile or a renamed\n * slug a type error rather than a missing button.\n *\n * `memory` maps to `add-learning` because the tile is the Learning tile: it is\n * enabled by a *configured Learning container* (see `learningOn` in\n * `index.ts`), which is exactly what `feature/learning` sets up. The tile id\n * and the `memories` menu key are older names for that same pane.\n */\nexport const FEATURE_ONBOARDING_INTENT: Record<\n HomeServiceId,\n OnboardingIntent\n> = {\n threads: \"add-rich-threads\",\n memory: \"add-learning\",\n a2ui: \"add-a2ui\",\n \"open-gen-ui\": \"add-open-generative-ui\",\n suggestions: \"add-chat-suggestions\",\n audio: \"add-voice\",\n websocket: \"add-realtime-sync\",\n};\n\nconst INTENT_PLACEHOLDER = \"<intent>\";\n\n/**\n * The prompt a Home feature button copies.\n *\n * It carries no feature-specific instruction, and it must not gain any. The\n * `--intent` route owns the plan, the guide links, the per-phase check-ins,\n * the refusal when a prerequisite is missing, and the proof step; prose copied\n * here would duplicate all of that and then drift from it the next time the\n * underlying API changes.\n *\n * What is left is the caller's own business: identify yourself, run this\n * command, and the standing permission for the session check that the\n * developer granted by copying the prompt.\n */\nexport const FEATURE_ONBOARDING_PROMPT_TEMPLATE =\n \"Help me set this up in my CopilotKit app. Run this command and follow the \" +\n \"instructions:\\n\\nnpx --yes copilotkit@latest onboard start --run \" +\n `${RUN_ID_PLACEHOLDER} --intent ${INTENT_PLACEHOLDER}` +\n \"\\n\\nIf it requires a CopilotKit CLI session check, you have permission to \" +\n \"run it. Never reveal credentials or send optional diagnostic feedback \" +\n \"reports.\";\n\n/** Bind one run id and one tile's feature outcome into the copied prompt. */\nexport function createFeatureOnboardingPrompt(\n serviceId: HomeServiceId,\n runId: string,\n): string {\n return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(\n RUN_ID_PLACEHOLDER,\n runId,\n ).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,qBAAqB;AAE3B,MAAa,6BACX;;kDAEG;;AAGL,MAAM,gBAAgB;;;;;;;;;;AAWtB,SAAgB,wBAAgC;CAC9C,MAAM,YAAY,WAAW;AAE7B,KAAI,OAAO,WAAW,eAAe,WACnC,QAAO,UAAU,YAAY,CAAC,WAAW,KAAK,GAAG,CAAC,MAAM,GAAG,cAAc;AAG3E,KAAI,OAAO,WAAW,oBAAoB,YAAY;EACpD,MAAM,QAAQ,UAAU,gBAAgB,IAAI,WAAW,gBAAgB,EAAE,CAAC;AAC1E,SAAO,MAAM,KAAK,QAAQ,SAAS,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,KACrE,GACD;;CAGH,IAAI,KAAK;AACT,QAAO,GAAG,SAAS,cACjB,OAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,GAAG,CAAC,SAAS,GAAG;AAEnD,QAAO,GAAG,MAAM,GAAG,cAAc;;;AAInC,SAAgB,uBAAuB,OAAuB;AAC5D,QAAO,2BAA2B,QAAQ,oBAAoB,MAAM;;;;;;;;;;;;;;;;;AAyCtE,MAAa,4BAGT;CACF,SAAS;CACT,QAAQ;CACR,MAAM;CACN,eAAe;CACf,aAAa;CACb,OAAO;CACP,WAAW;CACZ;AAED,MAAM,qBAAqB;;;;;;;;;;;;;;AAe3B,MAAa,qCACX;;kDAEG,mBAAmB,YAAY;;;;AAMpC,SAAgB,8BACd,WACA,OACQ;AACR,QAAO,mCAAmC,QACxC,oBACA,MACD,CAAC,QAAQ,oBAAoB,0BAA0B,WAAW"}
@@ -11,9 +11,26 @@
11
11
  * Intelligence app (`apps/app-frontend/react-shell/src/home/intelligence-home.tsx`).
12
12
  * The CLI resolves `onboard start` against a prompt graph, so the two surfaces
13
13
  * must not drift — if the CLI's entry point changes, both change together.
14
+ *
15
+ * Two lines, and deliberately nothing else. It used to open by telling the
16
+ * agent to identify itself and pass the slug as a flag -- two sentences of
17
+ * instruction to a machine, in the one piece of text a human reads, decides on
18
+ * and pastes. The graph asks for the slug itself now, with `onboard identify`,
19
+ * which is the surface that talks to the agent for the rest of the run
20
+ * (Intelligence OSS-1157).
21
+ *
22
+ * This one stays generic, and so do the docs and Intelligence web-app copies
23
+ * of it (OSS-1150). Those three are entry points for a developer with no
24
+ * CopilotKit app yet, and every `--intent` route requires an existing app: it
25
+ * inspects for one first and reads `feature/stop` when it is missing. The
26
+ * feature buttons on Home are the surface that knows which feature the
27
+ * developer is looking at, so they are the surface that names an intent — see
28
+ * `FEATURE_ONBOARDING_PROMPT_TEMPLATE` below.
14
29
  */
15
30
  const RUN_ID_PLACEHOLDER = "<run-id>";
16
- const ONBOARDING_PROMPT_TEMPLATE = `Identify which coding-agent product you are, using a short slug such as \`codex\` or \`claude-code\`. From the root of the project where you want CopilotKit, run \`npx --yes copilotkit@latest onboard start --run ${RUN_ID_PLACEHOLDER} --coding-agent <coding-agent-slug>\`. Follow the Markdown instructions it prints until onboarding is complete.`;
31
+ const ONBOARDING_PROMPT_TEMPLATE = `Help me get started with CopilotKit. Run this command and follow the instructions:
32
+
33
+ npx --yes copilotkit@latest onboard start --run ${RUN_ID_PLACEHOLDER}`;
17
34
  /** Length and alphabet are the CLI's, so a run id copied here resolves there. */
18
35
  const RUN_ID_LENGTH = 12;
19
36
  /**
@@ -40,7 +57,54 @@ function createOnboardingRunId() {
40
57
  function createOnboardingPrompt(runId) {
41
58
  return ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId);
42
59
  }
60
+ /**
61
+ * Which feature outcome each Home tile asks the CLI for.
62
+ *
63
+ * The two vocabularies stay separate on purpose. A `HomeServiceId` names a
64
+ * tile and the pane behind it, so `websocket` and `audio` are the right words
65
+ * for it; an intent names the work to be done, so `add-realtime-sync` and
66
+ * `add-voice` are the right words for that. One table maps between them, and
67
+ * `Record<HomeServiceId, OnboardingIntent>` makes a new tile or a renamed
68
+ * slug a type error rather than a missing button.
69
+ *
70
+ * `memory` maps to `add-learning` because the tile is the Learning tile: it is
71
+ * enabled by a *configured Learning container* (see `learningOn` in
72
+ * `index.ts`), which is exactly what `feature/learning` sets up. The tile id
73
+ * and the `memories` menu key are older names for that same pane.
74
+ */
75
+ const FEATURE_ONBOARDING_INTENT = {
76
+ threads: "add-rich-threads",
77
+ memory: "add-learning",
78
+ a2ui: "add-a2ui",
79
+ "open-gen-ui": "add-open-generative-ui",
80
+ suggestions: "add-chat-suggestions",
81
+ audio: "add-voice",
82
+ websocket: "add-realtime-sync"
83
+ };
84
+ const INTENT_PLACEHOLDER = "<intent>";
85
+ /**
86
+ * The prompt a Home feature button copies.
87
+ *
88
+ * It carries no feature-specific instruction, and it must not gain any. The
89
+ * `--intent` route owns the plan, the guide links, the per-phase check-ins,
90
+ * the refusal when a prerequisite is missing, and the proof step; prose copied
91
+ * here would duplicate all of that and then drift from it the next time the
92
+ * underlying API changes.
93
+ *
94
+ * What is left is the caller's own business: identify yourself, run this
95
+ * command, and the standing permission for the session check that the
96
+ * developer granted by copying the prompt.
97
+ */
98
+ const FEATURE_ONBOARDING_PROMPT_TEMPLATE = `Help me set this up in my CopilotKit app. Run this command and follow the instructions:
99
+
100
+ npx --yes copilotkit@latest onboard start --run ${RUN_ID_PLACEHOLDER} --intent ${INTENT_PLACEHOLDER}
101
+
102
+ If it requires a CopilotKit CLI session check, you have permission to run it. Never reveal credentials or send optional diagnostic feedback reports.`;
103
+ /** Bind one run id and one tile's feature outcome into the copied prompt. */
104
+ function createFeatureOnboardingPrompt(serviceId, runId) {
105
+ return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);
106
+ }
43
107
 
44
108
  //#endregion
45
- export { createOnboardingPrompt, createOnboardingRunId };
109
+ export { createFeatureOnboardingPrompt, createOnboardingPrompt, createOnboardingRunId };
46
110
  //# sourceMappingURL=onboarding-prompt.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"onboarding-prompt.mjs","names":[],"sources":["../../src/lib/onboarding-prompt.ts"],"sourcesContent":["/**\n * The Intelligence install prompt the Inspector hands to a coding agent.\n *\n * Every other Intelligence call to action in the Inspector opens a page in a\n * new tab, which is where developers drop out: they leave the editor, meet a\n * signup form, and never come back. This prompt lets the install happen where\n * they already are.\n *\n * The wording is kept byte-identical to `INTELLIGENCE_ONBOARDING_PROMPT` in the\n * Intelligence app (`apps/app-frontend/react-shell/src/home/intelligence-home.tsx`).\n * The CLI resolves `onboard start` against a prompt graph, so the two surfaces\n * must not drift — if the CLI's entry point changes, both change together.\n */\nconst RUN_ID_PLACEHOLDER = \"<run-id>\";\n\nexport const ONBOARDING_PROMPT_TEMPLATE =\n \"Identify which coding-agent product you are, using a short slug such as \" +\n \"`codex` or `claude-code`. From the root of the project where you want \" +\n \"CopilotKit, run `npx --yes copilotkit@latest onboard start --run \" +\n `${RUN_ID_PLACEHOLDER}` +\n \" --coding-agent <coding-agent-slug>`. Follow the Markdown instructions it \" +\n \"prints until onboarding is complete.\";\n\n/** Length and alphabet are the CLI's, so a run id copied here resolves there. */\nconst RUN_ID_LENGTH = 12;\n\n/**\n * Mint the identifier that joins this copy to the CLI run it starts.\n *\n * The Intelligence app derives it from `crypto.randomUUID()`. The Inspector\n * runs inside whatever page embeds it, so neither `randomUUID` nor a secure\n * context is guaranteed; the two fallbacks keep the id present rather than\n * letting the button fail. Collision risk is irrelevant — this correlates\n * telemetry, it does not authorise anything.\n */\nexport function createOnboardingRunId(): string {\n const webCrypto = globalThis.crypto;\n\n if (typeof webCrypto?.randomUUID === \"function\") {\n return webCrypto.randomUUID().replaceAll(\"-\", \"\").slice(0, RUN_ID_LENGTH);\n }\n\n if (typeof webCrypto?.getRandomValues === \"function\") {\n const bytes = webCrypto.getRandomValues(new Uint8Array(RUN_ID_LENGTH / 2));\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\n \"\",\n );\n }\n\n let id = \"\";\n while (id.length < RUN_ID_LENGTH) {\n id += Math.floor(Math.random() * 16).toString(16);\n }\n return id.slice(0, RUN_ID_LENGTH);\n}\n\n/** Bind one run id into the prompt text that gets copied. */\nexport function createOnboardingPrompt(runId: string): string {\n return ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId);\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,qBAAqB;AAE3B,MAAa,6BACX,uNAGG;;AAKL,MAAM,gBAAgB;;;;;;;;;;AAWtB,SAAgB,wBAAgC;CAC9C,MAAM,YAAY,WAAW;AAE7B,KAAI,OAAO,WAAW,eAAe,WACnC,QAAO,UAAU,YAAY,CAAC,WAAW,KAAK,GAAG,CAAC,MAAM,GAAG,cAAc;AAG3E,KAAI,OAAO,WAAW,oBAAoB,YAAY;EACpD,MAAM,QAAQ,UAAU,gBAAgB,IAAI,WAAW,gBAAgB,EAAE,CAAC;AAC1E,SAAO,MAAM,KAAK,QAAQ,SAAS,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,KACrE,GACD;;CAGH,IAAI,KAAK;AACT,QAAO,GAAG,SAAS,cACjB,OAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,GAAG,CAAC,SAAS,GAAG;AAEnD,QAAO,GAAG,MAAM,GAAG,cAAc;;;AAInC,SAAgB,uBAAuB,OAAuB;AAC5D,QAAO,2BAA2B,QAAQ,oBAAoB,MAAM"}
1
+ {"version":3,"file":"onboarding-prompt.mjs","names":[],"sources":["../../src/lib/onboarding-prompt.ts"],"sourcesContent":["import type { HomeServiceId } from \"./home-briefing.js\";\n\n/**\n * The Intelligence install prompt the Inspector hands to a coding agent.\n *\n * Every other Intelligence call to action in the Inspector opens a page in a\n * new tab, which is where developers drop out: they leave the editor, meet a\n * signup form, and never come back. This prompt lets the install happen where\n * they already are.\n *\n * The wording is kept byte-identical to `INTELLIGENCE_ONBOARDING_PROMPT` in the\n * Intelligence app (`apps/app-frontend/react-shell/src/home/intelligence-home.tsx`).\n * The CLI resolves `onboard start` against a prompt graph, so the two surfaces\n * must not drift — if the CLI's entry point changes, both change together.\n *\n * Two lines, and deliberately nothing else. It used to open by telling the\n * agent to identify itself and pass the slug as a flag -- two sentences of\n * instruction to a machine, in the one piece of text a human reads, decides on\n * and pastes. The graph asks for the slug itself now, with `onboard identify`,\n * which is the surface that talks to the agent for the rest of the run\n * (Intelligence OSS-1157).\n *\n * This one stays generic, and so do the docs and Intelligence web-app copies\n * of it (OSS-1150). Those three are entry points for a developer with no\n * CopilotKit app yet, and every `--intent` route requires an existing app: it\n * inspects for one first and reads `feature/stop` when it is missing. The\n * feature buttons on Home are the surface that knows which feature the\n * developer is looking at, so they are the surface that names an intent — see\n * `FEATURE_ONBOARDING_PROMPT_TEMPLATE` below.\n */\nconst RUN_ID_PLACEHOLDER = \"<run-id>\";\n\nexport const ONBOARDING_PROMPT_TEMPLATE =\n \"Help me get started with CopilotKit. Run this command and follow the \" +\n \"instructions:\\n\\nnpx --yes copilotkit@latest onboard start --run \" +\n `${RUN_ID_PLACEHOLDER}`;\n\n/** Length and alphabet are the CLI's, so a run id copied here resolves there. */\nconst RUN_ID_LENGTH = 12;\n\n/**\n * Mint the identifier that joins this copy to the CLI run it starts.\n *\n * The Intelligence app derives it from `crypto.randomUUID()`. The Inspector\n * runs inside whatever page embeds it, so neither `randomUUID` nor a secure\n * context is guaranteed; the two fallbacks keep the id present rather than\n * letting the button fail. Collision risk is irrelevant — this correlates\n * telemetry, it does not authorise anything.\n */\nexport function createOnboardingRunId(): string {\n const webCrypto = globalThis.crypto;\n\n if (typeof webCrypto?.randomUUID === \"function\") {\n return webCrypto.randomUUID().replaceAll(\"-\", \"\").slice(0, RUN_ID_LENGTH);\n }\n\n if (typeof webCrypto?.getRandomValues === \"function\") {\n const bytes = webCrypto.getRandomValues(new Uint8Array(RUN_ID_LENGTH / 2));\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\n \"\",\n );\n }\n\n let id = \"\";\n while (id.length < RUN_ID_LENGTH) {\n id += Math.floor(Math.random() * 16).toString(16);\n }\n return id.slice(0, RUN_ID_LENGTH);\n}\n\n/** Bind one run id into the prompt text that gets copied. */\nexport function createOnboardingPrompt(runId: string): string {\n return ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId);\n}\n\n/**\n * The closed set of feature outcomes the CLI prompt graph can start at.\n *\n * Kept equal to `ONBOARDING_INTENT_ROOTS` in Intelligence's\n * `apps/cli/onboarding-intents.cjs`, which is the build-time source of truth.\n * The two repositories cannot import each other, so the agreement is held by\n * this list plus the CLI's own `onboarding-intents.spec.ts`. Drift is loud\n * rather than silent: `onboard start` refuses an unknown `--intent` before it\n * persists a run, so a stale slug fails on the first command instead of\n * quietly onboarding the wrong feature.\n */\nexport const ONBOARDING_INTENTS = [\n \"add-a2ui\",\n \"add-chat-suggestions\",\n \"add-learning\",\n \"add-open-generative-ui\",\n \"add-realtime-sync\",\n \"add-rich-threads\",\n \"add-voice\",\n] as const;\n\nexport type OnboardingIntent = (typeof ONBOARDING_INTENTS)[number];\n\n/**\n * Which feature outcome each Home tile asks the CLI for.\n *\n * The two vocabularies stay separate on purpose. A `HomeServiceId` names a\n * tile and the pane behind it, so `websocket` and `audio` are the right words\n * for it; an intent names the work to be done, so `add-realtime-sync` and\n * `add-voice` are the right words for that. One table maps between them, and\n * `Record<HomeServiceId, OnboardingIntent>` makes a new tile or a renamed\n * slug a type error rather than a missing button.\n *\n * `memory` maps to `add-learning` because the tile is the Learning tile: it is\n * enabled by a *configured Learning container* (see `learningOn` in\n * `index.ts`), which is exactly what `feature/learning` sets up. The tile id\n * and the `memories` menu key are older names for that same pane.\n */\nexport const FEATURE_ONBOARDING_INTENT: Record<\n HomeServiceId,\n OnboardingIntent\n> = {\n threads: \"add-rich-threads\",\n memory: \"add-learning\",\n a2ui: \"add-a2ui\",\n \"open-gen-ui\": \"add-open-generative-ui\",\n suggestions: \"add-chat-suggestions\",\n audio: \"add-voice\",\n websocket: \"add-realtime-sync\",\n};\n\nconst INTENT_PLACEHOLDER = \"<intent>\";\n\n/**\n * The prompt a Home feature button copies.\n *\n * It carries no feature-specific instruction, and it must not gain any. The\n * `--intent` route owns the plan, the guide links, the per-phase check-ins,\n * the refusal when a prerequisite is missing, and the proof step; prose copied\n * here would duplicate all of that and then drift from it the next time the\n * underlying API changes.\n *\n * What is left is the caller's own business: identify yourself, run this\n * command, and the standing permission for the session check that the\n * developer granted by copying the prompt.\n */\nexport const FEATURE_ONBOARDING_PROMPT_TEMPLATE =\n \"Help me set this up in my CopilotKit app. Run this command and follow the \" +\n \"instructions:\\n\\nnpx --yes copilotkit@latest onboard start --run \" +\n `${RUN_ID_PLACEHOLDER} --intent ${INTENT_PLACEHOLDER}` +\n \"\\n\\nIf it requires a CopilotKit CLI session check, you have permission to \" +\n \"run it. Never reveal credentials or send optional diagnostic feedback \" +\n \"reports.\";\n\n/** Bind one run id and one tile's feature outcome into the copied prompt. */\nexport function createFeatureOnboardingPrompt(\n serviceId: HomeServiceId,\n runId: string,\n): string {\n return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(\n RUN_ID_PLACEHOLDER,\n runId,\n ).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,qBAAqB;AAE3B,MAAa,6BACX;;kDAEG;;AAGL,MAAM,gBAAgB;;;;;;;;;;AAWtB,SAAgB,wBAAgC;CAC9C,MAAM,YAAY,WAAW;AAE7B,KAAI,OAAO,WAAW,eAAe,WACnC,QAAO,UAAU,YAAY,CAAC,WAAW,KAAK,GAAG,CAAC,MAAM,GAAG,cAAc;AAG3E,KAAI,OAAO,WAAW,oBAAoB,YAAY;EACpD,MAAM,QAAQ,UAAU,gBAAgB,IAAI,WAAW,gBAAgB,EAAE,CAAC;AAC1E,SAAO,MAAM,KAAK,QAAQ,SAAS,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,KACrE,GACD;;CAGH,IAAI,KAAK;AACT,QAAO,GAAG,SAAS,cACjB,OAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,GAAG,CAAC,SAAS,GAAG;AAEnD,QAAO,GAAG,MAAM,GAAG,cAAc;;;AAInC,SAAgB,uBAAuB,OAAuB;AAC5D,QAAO,2BAA2B,QAAQ,oBAAoB,MAAM;;;;;;;;;;;;;;;;;AAyCtE,MAAa,4BAGT;CACF,SAAS;CACT,QAAQ;CACR,MAAM;CACN,eAAe;CACf,aAAa;CACb,OAAO;CACP,WAAW;CACZ;AAED,MAAM,qBAAqB;;;;;;;;;;;;;;AAe3B,MAAa,qCACX;;kDAEG,mBAAmB,YAAY;;;;AAMpC,SAAgB,8BACd,WACA,OACQ;AACR,QAAO,mCAAmC,QACxC,oBACA,MACD,CAAC,QAAQ,oBAAoB,0BAA0B,WAAW"}
package/dist/package.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region package.json
3
- var version = "1.70.3";
3
+ var version = "1.71.1";
4
4
 
5
5
  //#endregion
6
6
  Object.defineProperty(exports, 'version', {
package/dist/package.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.70.3";
2
+ var version = "1.71.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/web-inspector",
3
- "version": "1.70.3",
3
+ "version": "1.71.1",
4
4
  "description": "Lit-based web component for the CopilotKit web inspector",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,8 +31,8 @@
31
31
  "lit": "^3.2.0",
32
32
  "lucide": "^0.525.0",
33
33
  "marked": "^12.0.2",
34
- "@copilotkit/core": "1.70.3",
35
- "@copilotkit/shared": "1.70.3"
34
+ "@copilotkit/core": "1.71.1",
35
+ "@copilotkit/shared": "1.71.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@playwright/test": "^1.59.1",