@promptbook/cli 0.112.0-125 → 0.112.0-127

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.
Files changed (190) hide show
  1. package/README.md +5 -5
  2. package/apps/agents-server/README.md +3 -0
  3. package/apps/agents-server/playwright.config.ts +1 -0
  4. package/apps/agents-server/public/promptbook-logo-blue.png +0 -0
  5. package/apps/agents-server/public/promptbook-logo-white.png +0 -0
  6. package/apps/agents-server/src/app/[agentName]/layout.tsx +1 -0
  7. package/apps/agents-server/src/app/actions.ts +2 -2
  8. package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +68 -36
  9. package/apps/agents-server/src/app/agents/[agentName]/ActiveAgentBreadcrumbBinder.tsx +30 -0
  10. package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +2 -0
  11. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistoryPayloadState.ts +38 -4
  12. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistorySyncOperations.ts +4 -1
  13. package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +19 -15
  14. package/apps/agents-server/src/app/agents/[agentName]/chat/useCanonicalAgentChatPanelState.ts +58 -7
  15. package/apps/agents-server/src/app/agents/[agentName]/layout.tsx +47 -1
  16. package/apps/agents-server/src/app/api/chat/citation-label/route.ts +133 -0
  17. package/apps/agents-server/src/app/globals.css +78 -0
  18. package/apps/agents-server/src/components/Header/ActiveAgentBreadcrumbContext.tsx +82 -0
  19. package/apps/agents-server/src/components/Header/useHeaderActiveAgent.ts +26 -7
  20. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +35 -32
  21. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/ManGoNewAgentWizard.tsx +151 -0
  22. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/ManGoOnboardingNavigation.tsx +50 -0
  23. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/BookLanguagePanel.tsx +125 -0
  24. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/DropZone.tsx +83 -0
  25. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/EmailTestRun.tsx +216 -0
  26. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/KnowledgeList.tsx +79 -0
  27. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/Logo.tsx +20 -0
  28. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownBookEditor.tsx +154 -0
  29. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownPreview.tsx +188 -0
  30. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/RailStepper.tsx +115 -0
  31. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/StepFrame.tsx +47 -0
  32. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/TestChat.tsx +159 -0
  33. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/WizardShell.tsx +114 -0
  34. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/brand/RailArtwork.tsx +60 -0
  35. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/BookStep.tsx +135 -0
  36. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/DoneStep.tsx +215 -0
  37. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/KnowledgeStep.tsx +152 -0
  38. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/TestStep.tsx +262 -0
  39. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/ZadaniStep.tsx +64 -0
  40. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Badge.tsx +41 -0
  41. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Banner.tsx +69 -0
  42. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Button.tsx +77 -0
  43. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Card.tsx +33 -0
  44. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Field.tsx +103 -0
  45. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/IconButton.tsx +40 -0
  46. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/Spinner.tsx +14 -0
  47. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ui/tokens.ts +37 -0
  48. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/bookSections.ts +62 -0
  49. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/emailScenarios.ts +22 -0
  50. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/steps.ts +46 -0
  51. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/index.ts +11 -0
  52. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/cn.ts +4 -0
  53. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/format.ts +9 -0
  54. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/id.ts +11 -0
  55. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/agentEvalService.ts +30 -0
  56. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/agentTestService.ts +69 -0
  57. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/bookService.ts +21 -0
  58. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoAgentSource.ts +107 -0
  59. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/draftService.ts +45 -0
  60. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/uploadService.ts +27 -0
  61. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/state/OnboardingProvider.tsx +121 -0
  62. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/types.ts +52 -0
  63. package/apps/agents-server/src/components/NewAgentDialog/createNewAgentWizardSource.ts +1 -1
  64. package/apps/agents-server/src/components/NewAgentDialog/trackNewAgentCreationEvent.ts +1 -1
  65. package/apps/agents-server/src/components/NewAgentDialog/useNewAgentDialog.tsx +76 -0
  66. package/apps/agents-server/src/constants/newAgentWizard.ts +17 -8
  67. package/apps/agents-server/src/database/getMetadata.ts +37 -1
  68. package/apps/agents-server/src/database/metadataDefaults.ts +18 -7
  69. package/apps/agents-server/src/database/migrations/2026-06-2200-new-agent-wizard-metadata-key.sql +27 -0
  70. package/apps/agents-server/src/database/migrations/2026-06-2201-new-agent-wizard-mango-default.sql +11 -0
  71. package/apps/agents-server/src/generated/reservedPaths.ts +2 -0
  72. package/apps/agents-server/src/languages/translations/english.yaml +1 -1
  73. package/apps/agents-server/src/tools/createChatAttachmentToolFunctions.ts +8 -4
  74. package/apps/agents-server/src/utils/chat/resolveAgentsServerCitationLabel.ts +130 -0
  75. package/apps/agents-server/src/utils/chat/resolveCitationSourceLabel.ts +436 -0
  76. package/apps/agents-server/src/utils/knowledge/resolveWebsiteKnowledgeSourcesForServer.ts +10 -1
  77. package/apps/agents-server/src/utils/session.ts +62 -5
  78. package/apps/agents-server/src/utils/transpilers/resolveTranspiledTeamExport.ts +10 -10
  79. package/apps/agents-server/src/utils/userChat/userChatProgressCard.ts +198 -63
  80. package/apps/agents-server/src/utils/vpsConfiguration.ts +1 -0
  81. package/apps/agents-server/src/utils/vpsSelfUpdate.ts +81 -8
  82. package/esm/index.es.js +1052 -455
  83. package/esm/index.es.js.map +1 -1
  84. package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
  85. package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -2
  86. package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +50 -0
  87. package/esm/scripts/run-codex-prompts/server/buildCoderServerRunState.d.ts +23 -0
  88. package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
  89. package/esm/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +13 -1
  90. package/esm/scripts/run-codex-prompts/server/updatePromptSection.d.ts +1 -1
  91. package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -0
  92. package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +4 -0
  93. package/esm/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +1 -0
  94. package/esm/src/_packages/components.index.d.ts +2 -0
  95. package/esm/src/_packages/types.index.d.ts +2 -0
  96. package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  97. package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  98. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  99. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  100. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  101. package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  102. package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  103. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  104. package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  105. package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  106. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  107. package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  108. package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  109. package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  110. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  111. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  112. package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  113. package/esm/src/version.d.ts +1 -1
  114. package/package.json +1 -1
  115. package/src/_packages/components.index.ts +2 -0
  116. package/src/_packages/types.index.ts +2 -0
  117. package/src/avatars/avatarAnimationScheduler.ts +61 -20
  118. package/src/avatars/visuals/octopus3d2AvatarVisual.ts +106 -21
  119. package/src/avatars/visuals/octopus3d3AvatarVisual.ts +131 -28
  120. package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments/augmentAgentModelRequirementsFromSource.ts +18 -2
  121. package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +7 -1
  122. package/src/book-components/Chat/Chat/Chat.tsx +4 -0
  123. package/src/book-components/Chat/Chat/ChatCitationModal.tsx +17 -3
  124. package/src/book-components/Chat/Chat/ChatMessageItem.tsx +22 -2
  125. package/src/book-components/Chat/Chat/ChatMessageList.tsx +6 -0
  126. package/src/book-components/Chat/Chat/ChatProps.tsx +6 -0
  127. package/src/book-components/Chat/Chat/ChatToolCallModal.tsx +4 -0
  128. package/src/book-components/Chat/Chat/ChatToolCallModalContent.tsx +4 -0
  129. package/src/book-components/Chat/Chat/TeamToolCallModalContent.tsx +16 -3
  130. package/src/book-components/Chat/Chat/useChatPostprocessedMessages.ts +13 -2
  131. package/src/book-components/Chat/SourceChip/SourceChip.module.css +8 -0
  132. package/src/book-components/Chat/SourceChip/SourceChip.tsx +19 -5
  133. package/src/book-components/Chat/hooks/useResolvedCitationLabel.ts +65 -0
  134. package/src/book-components/Chat/save/html/htmlSaveFormatDefinition.ts +315 -88
  135. package/src/book-components/Chat/save/react/reactSaveFormatDefinition.ts +7 -1
  136. package/src/book-components/Chat/types/ChatMessage.ts +5 -0
  137. package/src/book-components/Chat/types/ChatParticipant.ts +1 -1
  138. package/src/book-components/Chat/types/CitationLabelResolver.ts +9 -0
  139. package/src/book-components/Chat/utils/citationHelpers.ts +90 -2
  140. package/src/book-components/Chat/utils/createCitationFootnoteRenderModel.ts +3 -0
  141. package/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.ts +178 -0
  142. package/src/book-components/Chat/utils/parseCitationsFromContent.ts +6 -0
  143. package/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.ts +13 -2
  144. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +1 -1
  145. package/src/cli/cli-commands/coder/run.ts +17 -20
  146. package/src/cli/cli-commands/coder/server.ts +13 -16
  147. package/src/cli/common/$deprecateCliCommand.ts +10 -1
  148. package/src/commitments/GOAL/GOAL.ts +7 -2
  149. package/src/commitments/LANGUAGE/LANGUAGE.ts +7 -2
  150. package/src/commitments/TEAM/TEAM.ts +12 -1
  151. package/src/commitments/USE_PROJECT/createUseProjectToolFunctions.ts +8 -1
  152. package/src/import-plugins/JsonFileImportPlugin.ts +15 -2
  153. package/src/import-plugins/TextFileImportPlugin.ts +8 -1
  154. package/src/llm-providers/_common/register/$registeredLlmToolsMessage.ts +6 -1
  155. package/src/other/templates/getTemplatesPipelineCollection.ts +696 -941
  156. package/src/utils/chat/chatAttachments/resolveChatAttachmentContent.ts +8 -1
  157. package/src/version.ts +2 -2
  158. package/src/versions.txt +2 -1
  159. package/umd/index.umd.js +1055 -458
  160. package/umd/index.umd.js.map +1 -1
  161. package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
  162. package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -2
  163. package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +50 -0
  164. package/umd/scripts/run-codex-prompts/server/buildCoderServerRunState.d.ts +23 -0
  165. package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
  166. package/umd/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +13 -1
  167. package/umd/scripts/run-codex-prompts/server/updatePromptSection.d.ts +1 -1
  168. package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -0
  169. package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +4 -0
  170. package/umd/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +1 -0
  171. package/umd/src/_packages/components.index.d.ts +2 -0
  172. package/umd/src/_packages/types.index.d.ts +2 -0
  173. package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  174. package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  175. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  176. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  177. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  178. package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  179. package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  180. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  181. package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  182. package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  183. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  184. package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  185. package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  186. package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  187. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  188. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  189. package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  190. package/umd/src/version.d.ts +1 -1
@@ -0,0 +1,133 @@
1
+ import { serializeError } from '@promptbook-local/utils';
2
+ import type { NextRequest } from 'next/server';
3
+ import { NextResponse } from 'next/server';
4
+ import { assertsError } from '../../../../../../../src/errors/assertsError';
5
+ import { assertSafeUrl } from '../../../../utils/assertSafeUrl';
6
+ import {
7
+ resolveCitationLabelTargetUrl,
8
+ resolveCitationSourceLabel,
9
+ type CitationSourceLabelPayload,
10
+ } from '../../../../utils/chat/resolveCitationSourceLabel';
11
+ import { getCurrentUser } from '../../../../utils/getCurrentUser';
12
+
13
+ /**
14
+ * Maximum accepted citation field length in the label resolver endpoint.
15
+ *
16
+ * @private API route constant
17
+ */
18
+ const MAX_CITATION_LABEL_FIELD_LENGTH = 2_000;
19
+
20
+ /**
21
+ * Raw request body accepted by citation label resolver endpoint.
22
+ *
23
+ * @private API route type
24
+ */
25
+ type CitationLabelRequestBody = {
26
+ /**
27
+ * Raw citation source.
28
+ */
29
+ readonly source?: unknown;
30
+
31
+ /**
32
+ * Optional source URL.
33
+ */
34
+ readonly url?: unknown;
35
+
36
+ /**
37
+ * Optional source title.
38
+ */
39
+ readonly title?: unknown;
40
+ };
41
+
42
+ /**
43
+ * Resolves nicer labels for chat source citations.
44
+ *
45
+ * Requires authentication because the endpoint fetches user-provided URLs.
46
+ *
47
+ * @route POST /api/chat/citation-label
48
+ */
49
+ export async function POST(request: NextRequest): Promise<NextResponse> {
50
+ const currentUser = await getCurrentUser();
51
+ if (!currentUser) {
52
+ return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
53
+ }
54
+
55
+ try {
56
+ const body = (await request.json()) as CitationLabelRequestBody;
57
+ const citation = parseCitationLabelRequestBody(body);
58
+ const targetUrl = resolveCitationLabelTargetUrl(citation);
59
+
60
+ if (targetUrl) {
61
+ try {
62
+ assertSafeUrl(targetUrl);
63
+ } catch (error) {
64
+ assertsError(error);
65
+ return NextResponse.json({ error: error.message, label: null }, { status: 400 });
66
+ }
67
+ }
68
+
69
+ const label = await resolveCitationSourceLabel(citation);
70
+
71
+ return NextResponse.json({ label });
72
+ } catch (error) {
73
+ assertsError(error);
74
+ const status = error.name === 'SyntaxError' || error.message.startsWith('Invalid ') ? 400 : 500;
75
+
76
+ return NextResponse.json(
77
+ {
78
+ error: status === 400 ? error.message : serializeError(error),
79
+ label: null,
80
+ },
81
+ { status },
82
+ );
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Parses and validates one label resolver request body.
88
+ *
89
+ * @param body - Raw request body.
90
+ * @returns Validated citation payload.
91
+ *
92
+ * @private API route helper
93
+ */
94
+ function parseCitationLabelRequestBody(body: CitationLabelRequestBody): CitationSourceLabelPayload {
95
+ const source = parseOptionalString(body.source, 'source');
96
+ if (!source) {
97
+ throw new Error('Invalid source: expected a non-empty string.');
98
+ }
99
+
100
+ return {
101
+ source,
102
+ url: parseOptionalString(body.url, 'url'),
103
+ title: parseOptionalString(body.title, 'title'),
104
+ };
105
+ }
106
+
107
+ /**
108
+ * Parses an optional request body string field.
109
+ *
110
+ * @param value - Raw field value.
111
+ * @param fieldName - Field name used in validation messages.
112
+ * @returns Trimmed string or undefined.
113
+ *
114
+ * @private API route helper
115
+ */
116
+ function parseOptionalString(value: unknown, fieldName: string): string | undefined {
117
+ if (value === undefined || value === null) {
118
+ return undefined;
119
+ }
120
+
121
+ if (typeof value !== 'string') {
122
+ throw new Error(`Invalid ${fieldName}: expected a string.`);
123
+ }
124
+
125
+ const trimmedValue = value.trim();
126
+ if (trimmedValue.length > MAX_CITATION_LABEL_FIELD_LENGTH) {
127
+ throw new Error(`Invalid ${fieldName}: value is too long.`);
128
+ }
129
+
130
+ return trimmedValue || undefined;
131
+ }
132
+
133
+ // Note: [🟢] Code for Agents Server citation label API route should never be published into packages that could be imported into browser environment
@@ -2,6 +2,66 @@
2
2
  @import 'tailwindcss/components';
3
3
  @import 'tailwindcss/utilities';
4
4
  @import '@xterm/xterm/css/xterm.css';
5
+ @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');
6
+
7
+ /**
8
+ * Scoped design tokens for the imported manGo onboarding wizard.
9
+ */
10
+ [data-onboarding-ui] {
11
+ --ob-font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
12
+ --ob-font-display: 'Outfit', 'Inter', ui-sans-serif, system-ui, sans-serif;
13
+ --ob-brand-blue: #7aebff;
14
+ --ob-brand-blue-dark: #30a8bd;
15
+ --ob-brand-green: #7affeb;
16
+ --ob-brand-green-dark: #30bda8;
17
+ --ob-ink: #111827;
18
+ --ob-mist: #f3f4f6;
19
+ --ob-accent-50: #ecfdff;
20
+ --ob-accent-100: #d2f8ff;
21
+ --ob-accent-200: #a8f1fd;
22
+ --ob-accent-300: #7aebff;
23
+ --ob-accent-400: #43d3e6;
24
+ --ob-accent-500: #30a8bd;
25
+ --ob-accent-600: #2491a4;
26
+ --ob-accent-700: #1d7686;
27
+ --ob-accent-800: #1a5e6b;
28
+ --ob-accent-900: #164a55;
29
+ --ob-shadow-xs: 0 1px 2px 0 rgb(17 24 39 / 0.04);
30
+ --ob-shadow-sm: 0 1px 2px 0 rgb(17 24 39 / 0.05), 0 1px 3px 0 rgb(17 24 39 / 0.05);
31
+ --ob-shadow-md: 0 2px 4px -1px rgb(17 24 39 / 0.05), 0 4px 12px -2px rgb(17 24 39 / 0.08);
32
+ --ob-shadow-lg: 0 4px 8px -2px rgb(17 24 39 / 0.06), 0 12px 28px -6px rgb(17 24 39 / 0.12);
33
+ --ob-shadow-accent: 0 1px 2px 0 rgb(48 168 189 / 0.2), 0 6px 16px -4px rgb(48 168 189 / 0.32);
34
+ --ob-grad-primary: linear-gradient(135deg, var(--ob-brand-blue) 0%, var(--ob-brand-green) 100%);
35
+ --ob-grad-ink: linear-gradient(160deg, #1b2435 0%, #111827 55%, #0b0f19 100%);
36
+ --ob-ring: rgb(48 168 189 / 0.5);
37
+ font-family: var(--ob-font-sans);
38
+ }
39
+
40
+ [data-onboarding-ui] .ob-display {
41
+ font-family: var(--ob-font-display);
42
+ letter-spacing: 0;
43
+ }
44
+
45
+ @keyframes ob-rise {
46
+ from {
47
+ opacity: 0;
48
+ transform: translateY(8px);
49
+ }
50
+ to {
51
+ opacity: 1;
52
+ transform: translateY(0);
53
+ }
54
+ }
55
+
56
+ [data-onboarding-ui] .ob-animate-rise {
57
+ animation: ob-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
58
+ }
59
+
60
+ @media (prefers-reduced-motion: reduce) {
61
+ [data-onboarding-ui] .ob-animate-rise {
62
+ animation: none;
63
+ }
64
+ }
5
65
 
6
66
  /**
7
67
  * OpenMoji black and white CSS
@@ -1037,6 +1097,24 @@ html.dark [data-chat-modal='tool-call'][data-chat-theme='dark'] button {
1037
1097
  color: inherit;
1038
1098
  }
1039
1099
 
1100
+ html.dark [data-onboarding-ui] .bg-white,
1101
+ html.dark [data-onboarding-ui] .bg-white\/80 {
1102
+ background-color: #ffffff !important;
1103
+ }
1104
+
1105
+ html.dark [data-onboarding-ui] input:not([type='checkbox']):not([type='radio']):not([type='range']),
1106
+ html.dark [data-onboarding-ui] textarea,
1107
+ html.dark [data-onboarding-ui] select {
1108
+ background-color: #ffffff;
1109
+ color: #18181b;
1110
+ border-color: #d4d4d8;
1111
+ }
1112
+
1113
+ html.dark [data-onboarding-ui] input:not([type='checkbox']):not([type='radio']):not([type='range'])::placeholder,
1114
+ html.dark [data-onboarding-ui] textarea::placeholder {
1115
+ color: #a1a1aa;
1116
+ }
1117
+
1040
1118
  /* Print styles */
1041
1119
  @media print {
1042
1120
  @page {
@@ -0,0 +1,82 @@
1
+ 'use client';
2
+
3
+ import { createContext, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';
4
+ import type { AgentBasicInformation } from '../../../../../src/book-2.0/agent-source/AgentBasicInformation';
5
+
6
+ /**
7
+ * Subset of agent information that the Header breadcrumb needs to render an agent's name (and avatar)
8
+ * even when the active agent is not part of the loaded organization list.
9
+ *
10
+ * @private mechanism of Agents Server header
11
+ */
12
+ export type ActiveAgentBreadcrumbInfo = Pick<
13
+ AgentBasicInformation,
14
+ 'agentName' | 'agentHash' | 'permanentId' | 'meta'
15
+ >;
16
+
17
+ /**
18
+ * Internal shape of the active-agent breadcrumb context.
19
+ *
20
+ * @private type of Header
21
+ */
22
+ type ActiveAgentBreadcrumbContextValue = {
23
+ readonly activeAgentBreadcrumbInfo: ActiveAgentBreadcrumbInfo | null;
24
+ readonly setActiveAgentBreadcrumbInfo: (info: ActiveAgentBreadcrumbInfo | null) => void;
25
+ };
26
+
27
+ /**
28
+ * Context that lets agent pages share the active agent's display info with the Header.
29
+ *
30
+ * @private mechanism of Agents Server header
31
+ */
32
+ const ActiveAgentBreadcrumbContext = createContext<ActiveAgentBreadcrumbContextValue | null>(null);
33
+
34
+ /**
35
+ * Provides storage for the active agent's breadcrumb info to the Header.
36
+ *
37
+ * @private function of Header
38
+ */
39
+ export function ActiveAgentBreadcrumbProvider({ children }: { readonly children: ReactNode }) {
40
+ const [activeAgentBreadcrumbInfo, setActiveAgentBreadcrumbInfo] = useState<ActiveAgentBreadcrumbInfo | null>(null);
41
+
42
+ const value = useMemo<ActiveAgentBreadcrumbContextValue>(
43
+ () => ({ activeAgentBreadcrumbInfo, setActiveAgentBreadcrumbInfo }),
44
+ [activeAgentBreadcrumbInfo],
45
+ );
46
+
47
+ return <ActiveAgentBreadcrumbContext.Provider value={value}>{children}</ActiveAgentBreadcrumbContext.Provider>;
48
+ }
49
+
50
+ /**
51
+ * Reads the active agent's breadcrumb info, used by the Header to render the agent's name in
52
+ * the breadcrumb whenever the agent is not present in the loaded organization list.
53
+ *
54
+ * @private function of Header
55
+ */
56
+ export function useActiveAgentBreadcrumbInfo(): ActiveAgentBreadcrumbInfo | null {
57
+ return useContext(ActiveAgentBreadcrumbContext)?.activeAgentBreadcrumbInfo ?? null;
58
+ }
59
+
60
+ /**
61
+ * Registers the active agent's breadcrumb info while the calling component is mounted.
62
+ * Pages that have loaded the agent profile call this hook so the Header breadcrumb can show
63
+ * the agent's name instead of falling back to its identifier.
64
+ *
65
+ * @private function of Header
66
+ */
67
+ export function useRegisterActiveAgentBreadcrumbInfo(info: ActiveAgentBreadcrumbInfo | null): void {
68
+ const context = useContext(ActiveAgentBreadcrumbContext);
69
+ const setter = context?.setActiveAgentBreadcrumbInfo;
70
+
71
+ useEffect(() => {
72
+ if (!setter) {
73
+ return;
74
+ }
75
+
76
+ setter(info);
77
+
78
+ return () => {
79
+ setter(null);
80
+ };
81
+ }, [info, setter]);
82
+ }
@@ -5,6 +5,7 @@ import { buildAgentFolderContext, type AgentFolderContext } from '../../utils/ag
5
5
  import type { AgentOrganizationAgent } from '../../utils/agentOrganization/types';
6
6
  import { buildAgentProfileHref, buildFreshAgentChatHref } from '../../utils/agentRouting/agentRouteHrefs';
7
7
  import type { ServerTranslationKey } from '../../languages/ServerTranslationKeys';
8
+ import { useActiveAgentBreadcrumbInfo, type ActiveAgentBreadcrumbInfo } from './ActiveAgentBreadcrumbContext';
8
9
  import type { HeaderAgentMenuFolder } from './AgentMenuStructure';
9
10
  import { buildAgentMenuStructure } from './buildAgentMenuStructure';
10
11
  import { createAgentViewLabel } from './createAgentViewLabel';
@@ -137,11 +138,17 @@ function createActiveAgentHref(activeAgentNavigationId: string | null): string {
137
138
  /**
138
139
  * Resolves the breadcrumb label shown for the active agent.
139
140
  *
141
+ * The agent's identifier (its `agentName` or `permanentId`) must never leak into the breadcrumb
142
+ * because the URL form is opaque to the user. When the agent cannot be resolved from the loaded
143
+ * organization list (typical for anonymous users browsing a public agent), the Header falls back
144
+ * to the breadcrumb info registered by the agent page; if that is also missing, a generic label
145
+ * is shown instead of the raw identifier.
146
+ *
140
147
  * @private function of Header
141
148
  */
142
149
  function createActiveAgentLabel(
143
150
  activeAgent: AgentOrganizationAgent | null,
144
- activeAgentIdentifier: string | null,
151
+ activeAgentBreadcrumbInfo: ActiveAgentBreadcrumbInfo | null,
145
152
  agentFolderById: Map<number, HeaderAgentMenuFolder>,
146
153
  namingPlural: string,
147
154
  translate: HeaderTranslate,
@@ -150,7 +157,11 @@ function createActiveAgentLabel(
150
157
  return createAgentHierarchyLabel(activeAgent, agentFolderById);
151
158
  }
152
159
 
153
- return activeAgentIdentifier || translate('header.agentsLabelFallback', { agentsPlural: namingPlural });
160
+ if (activeAgentBreadcrumbInfo) {
161
+ return activeAgentBreadcrumbInfo.meta?.fullname || activeAgentBreadcrumbInfo.agentName;
162
+ }
163
+
164
+ return translate('header.agentsLabelFallback', { agentsPlural: namingPlural });
154
165
  }
155
166
 
156
167
  /**
@@ -218,11 +229,12 @@ export function useHeaderActiveAgent({
218
229
  () => resolveActiveAgent(activeAgentNavigation, agentByIdentifier),
219
230
  [activeAgentNavigation, agentByIdentifier],
220
231
  );
232
+ const activeAgentBreadcrumbInfo = useActiveAgentBreadcrumbInfo();
221
233
  const activeAgentNavigationId = resolveActiveAgentNavigationId(activeAgent, activeAgentNavigation.agentIdentifier);
222
234
  const activeAgentHref = createActiveAgentHref(activeAgentNavigationId);
223
235
  const activeAgentLabel = createActiveAgentLabel(
224
236
  activeAgent,
225
- activeAgentNavigation.agentIdentifier,
237
+ activeAgentBreadcrumbInfo,
226
238
  agentFolderById,
227
239
  namingPlural,
228
240
  translate,
@@ -239,10 +251,17 @@ export function useHeaderActiveAgent({
239
251
  [activeAgentMenuAgent.folderId, activeAgentMenuAgent.visibility, agentFolderById],
240
252
  );
241
253
  const { origin, hostname } = readWindowLocationState();
242
- const activeAgentAvatarUrl = useMemo(
243
- () => (activeAgent ? resolveAgentAvatarImageUrl({ agent: activeAgent }) : null),
244
- [activeAgent],
245
- );
254
+ const activeAgentAvatarUrl = useMemo(() => {
255
+ if (activeAgent) {
256
+ return resolveAgentAvatarImageUrl({ agent: activeAgent });
257
+ }
258
+
259
+ if (activeAgentBreadcrumbInfo) {
260
+ return resolveAgentAvatarImageUrl({ agent: activeAgentBreadcrumbInfo });
261
+ }
262
+
263
+ return null;
264
+ }, [activeAgent, activeAgentBreadcrumbInfo]);
246
265
 
247
266
  return {
248
267
  activeAgent,
@@ -18,6 +18,7 @@ import { ChatEnterBehaviorPreferencesProvider } from '../ChatEnterBehavior/ChatE
18
18
  import { HomepageOptimisticNavigation } from '../Homepage/HomepageOptimisticNavigation';
19
19
  import { FileUploadAvailabilityProvider } from '../FileUploadAvailability/FileUploadAvailabilityContext';
20
20
  import { Footer, type FooterLink } from '../Footer/Footer';
21
+ import { ActiveAgentBreadcrumbProvider } from '../Header/ActiveAgentBreadcrumbContext';
21
22
  import { Header } from '../Header/Header';
22
23
  import { MobileMenuHoistingProvider } from '../Header/MobileMenuHoistingContext';
23
24
  import { MetadataFlagsProvider } from '../MetadataFlags/MetadataFlagsContext';
@@ -165,39 +166,41 @@ export function LayoutWrapper({
165
166
  controlPanelOptionAvailability,
166
167
  }}
167
168
  >
168
- {shouldRenderMinimalShell ? (
169
- <main className={minimalMainClassName}>
170
- {children}
171
- </main>
172
- ) : (
173
- <div className="agents-server-app-shell flex flex-col">
174
- <Header
175
- isAdmin={isAdmin}
176
- isGlobalAdmin={isGlobalAdmin}
177
- currentUser={currentUser}
178
- serverName={serverName}
179
- serverLogoUrl={serverLogoUrl}
180
- agents={agents}
181
- agentFolders={agentFolders}
182
- federatedServers={federatedServers}
183
- isExperimental={isExperimental}
184
- feedbackMode={feedbackMode}
185
- shibbolethAuthenticationStatus={
186
- shibbolethAuthenticationStatus
187
- }
188
- />
189
- <main className={mainClassName}>
190
- <HomepageOptimisticNavigation
191
- pathname={pathname}
192
- >
193
- {children}
194
- </HomepageOptimisticNavigation>
169
+ <ActiveAgentBreadcrumbProvider>
170
+ {shouldRenderMinimalShell ? (
171
+ <main className={minimalMainClassName}>
172
+ {children}
195
173
  </main>
196
- {isFooterShown && !isFooterHiddenOnPage && (
197
- <Footer extraLinks={footerLinks} />
198
- )}
199
- </div>
200
- )}
174
+ ) : (
175
+ <div className="agents-server-app-shell flex flex-col">
176
+ <Header
177
+ isAdmin={isAdmin}
178
+ isGlobalAdmin={isGlobalAdmin}
179
+ currentUser={currentUser}
180
+ serverName={serverName}
181
+ serverLogoUrl={serverLogoUrl}
182
+ agents={agents}
183
+ agentFolders={agentFolders}
184
+ federatedServers={federatedServers}
185
+ isExperimental={isExperimental}
186
+ feedbackMode={feedbackMode}
187
+ shibbolethAuthenticationStatus={
188
+ shibbolethAuthenticationStatus
189
+ }
190
+ />
191
+ <main className={mainClassName}>
192
+ <HomepageOptimisticNavigation
193
+ pathname={pathname}
194
+ >
195
+ {children}
196
+ </HomepageOptimisticNavigation>
197
+ </main>
198
+ {isFooterShown && !isFooterHiddenOnPage && (
199
+ <Footer extraLinks={footerLinks} />
200
+ )}
201
+ </div>
202
+ )}
203
+ </ActiveAgentBreadcrumbProvider>
201
204
  </MetadataFlagsProvider>
202
205
  </MobileMenuHoistingProvider>
203
206
  </MenuHoistingProvider>
@@ -0,0 +1,151 @@
1
+ 'use client';
2
+
3
+ import type { string_book } from '@promptbook-local/types';
4
+ import { useCallback, useMemo, useState } from 'react';
5
+ import type { NewAgentWizardMode } from '../../../constants/newAgentWizard';
6
+ import type { AgentVisibility } from '../../../utils/agentVisibility';
7
+ import { Dialog } from '../../Portal/Dialog';
8
+ import { ONBOARDING_ENTRY_PATH, ONBOARDING_STEPS } from './config/steps';
9
+ import { ManGoOnboardingNavigationContext } from './ManGoOnboardingNavigation';
10
+ import { OnboardingProvider } from './state/OnboardingProvider';
11
+ import { WizardShell } from './components/WizardShell';
12
+ import { BookStep } from './components/steps/BookStep';
13
+ import { DoneStep, type ManGoCreatedAgentPayload } from './components/steps/DoneStep';
14
+ import { KnowledgeStep } from './components/steps/KnowledgeStep';
15
+ import { TestStep } from './components/steps/TestStep';
16
+ import { ZadaniStep } from './components/steps/ZadaniStep';
17
+
18
+ /**
19
+ * Props accepted by the imported manGo new-agent wizard.
20
+ */
21
+ type ManGoNewAgentWizardProps = {
22
+ /**
23
+ * Metadata-driven flow assignment used for analytics.
24
+ */
25
+ readonly mode: NewAgentWizardMode;
26
+
27
+ /**
28
+ * Default visibility resolved from server metadata.
29
+ */
30
+ readonly defaultVisibility: AgentVisibility;
31
+
32
+ /**
33
+ * Folder scope where the flow was opened.
34
+ */
35
+ readonly folderId?: number | null;
36
+
37
+ /**
38
+ * Requests closing the fullscreen wizard.
39
+ */
40
+ readonly onClose: () => void;
41
+
42
+ /**
43
+ * Persists the synthesized agent source using the existing create-agent endpoint.
44
+ */
45
+ readonly onCreate: (request: ManGoNewAgentWizardCreateRequest) => Promise<ManGoCreatedAgentPayload>;
46
+
47
+ /**
48
+ * Opens the created agent route after the completion screen.
49
+ */
50
+ readonly onOpenCreatedAgent: (targetPath: string) => void;
51
+ };
52
+
53
+ /**
54
+ * Payload submitted when the manGo wizard creates an agent.
55
+ */
56
+ export type ManGoNewAgentWizardCreateRequest = {
57
+ /**
58
+ * Book source synthesized from the wizard session.
59
+ */
60
+ readonly agentSource: string_book;
61
+
62
+ /**
63
+ * Explicit visibility used for the created agent.
64
+ */
65
+ readonly visibility: AgentVisibility;
66
+
67
+ /**
68
+ * Number of ready knowledge sources included in the final source.
69
+ */
70
+ readonly knowledgeCount: number;
71
+ };
72
+
73
+ /**
74
+ * Renders the current local route from the imported manGo wizard.
75
+ *
76
+ * @param props - Current route and create-agent callbacks.
77
+ * @returns Step component for the current route.
78
+ */
79
+ function renderManGoWizardStep(props: {
80
+ readonly currentPath: string;
81
+ readonly defaultVisibility: AgentVisibility;
82
+ readonly onCreate: ManGoNewAgentWizardProps['onCreate'];
83
+ readonly onOpenCreatedAgent: ManGoNewAgentWizardProps['onOpenCreatedAgent'];
84
+ }) {
85
+ const { currentPath, defaultVisibility, onCreate, onOpenCreatedAgent } = props;
86
+
87
+ switch (currentPath) {
88
+ case ONBOARDING_STEPS[0].path:
89
+ return <BookStep />;
90
+ case ONBOARDING_STEPS[1].path:
91
+ return <KnowledgeStep />;
92
+ case ONBOARDING_STEPS[2].path:
93
+ return <TestStep />;
94
+ case ONBOARDING_STEPS[3].path:
95
+ return (
96
+ <DoneStep
97
+ defaultVisibility={defaultVisibility}
98
+ onCreate={onCreate}
99
+ onOpenCreatedAgent={onOpenCreatedAgent}
100
+ />
101
+ );
102
+ case ONBOARDING_ENTRY_PATH:
103
+ default:
104
+ return <ZadaniStep />;
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Renders the imported manGo fullscreen new-agent wizard.
110
+ *
111
+ * @param props - Wizard callbacks and metadata-backed defaults.
112
+ * @returns Fullscreen create-agent wizard dialog.
113
+ */
114
+ export function ManGoNewAgentWizard(props: ManGoNewAgentWizardProps) {
115
+ const { defaultVisibility, onClose, onCreate, onOpenCreatedAgent } = props;
116
+ const [currentPath, setCurrentPath] = useState(ONBOARDING_ENTRY_PATH);
117
+ const navigateToPath = useCallback((path: string) => {
118
+ setCurrentPath(path);
119
+ }, []);
120
+ const navigationContextValue = useMemo(
121
+ () => ({
122
+ currentPath,
123
+ navigateToPath,
124
+ requestClose: onClose,
125
+ }),
126
+ [currentPath, navigateToPath, onClose],
127
+ );
128
+
129
+ return (
130
+ <Dialog
131
+ onClose={onClose}
132
+ ariaLabel="manGo wizard"
133
+ isBackdropDismissible={false}
134
+ backdropClassName="items-stretch justify-stretch bg-slate-950/80 p-0 backdrop-blur-0"
135
+ className="!h-[100dvh] !w-screen !max-w-none !overflow-hidden !rounded-none !border-0 !bg-transparent !p-0 !shadow-none"
136
+ >
137
+ <ManGoOnboardingNavigationContext.Provider value={navigationContextValue}>
138
+ <OnboardingProvider>
139
+ <WizardShell>
140
+ {renderManGoWizardStep({
141
+ currentPath,
142
+ defaultVisibility,
143
+ onCreate,
144
+ onOpenCreatedAgent,
145
+ })}
146
+ </WizardShell>
147
+ </OnboardingProvider>
148
+ </ManGoOnboardingNavigationContext.Provider>
149
+ </Dialog>
150
+ );
151
+ }
@@ -0,0 +1,50 @@
1
+ 'use client';
2
+
3
+ import { createContext, useContext } from 'react';
4
+ import { NotAllowed } from '../../../../../../src/errors/NotAllowed';
5
+
6
+ /**
7
+ * In-dialog navigation context used by the imported manGo onboarding wizard.
8
+ *
9
+ * @private internal context of <ManGoNewAgentWizard/>.
10
+ */
11
+ type ManGoOnboardingNavigationContextValue = {
12
+ /**
13
+ * Current wizard path mirrored from the original route-based onboarding flow.
14
+ */
15
+ readonly currentPath: string;
16
+
17
+ /**
18
+ * Moves the fullscreen wizard to another original onboarding path.
19
+ */
20
+ readonly navigateToPath: (path: string) => void;
21
+
22
+ /**
23
+ * Requests closing the fullscreen wizard.
24
+ */
25
+ readonly requestClose: () => void;
26
+ };
27
+
28
+ /**
29
+ * React context carrying the local wizard navigation state.
30
+ *
31
+ * @private internal context of <ManGoNewAgentWizard/>.
32
+ */
33
+ export const ManGoOnboardingNavigationContext = createContext<ManGoOnboardingNavigationContextValue | null>(null);
34
+
35
+ /**
36
+ * Reads the current in-dialog manGo onboarding navigation state.
37
+ *
38
+ * @returns Navigation helpers scoped to the current wizard.
39
+ *
40
+ * @private internal hook of <ManGoNewAgentWizard/>.
41
+ */
42
+ export function useManGoOnboardingNavigation(): ManGoOnboardingNavigationContextValue {
43
+ const context = useContext(ManGoOnboardingNavigationContext);
44
+
45
+ if (!context) {
46
+ throw new NotAllowed('useManGoOnboardingNavigation must be used within <ManGoOnboardingNavigationContext>.');
47
+ }
48
+
49
+ return context;
50
+ }