@newheap/platform-ai-chat 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/newheap-platform-ai-chat-admin.mjs +6 -2
- package/fesm2022/newheap-platform-ai-chat-admin.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat-testing.mjs +49 -8
- package/fesm2022/newheap-platform-ai-chat-testing.mjs.map +1 -1
- package/fesm2022/newheap-platform-ai-chat.mjs +19 -2
- package/fesm2022/newheap-platform-ai-chat.mjs.map +1 -1
- package/i18n/en.json +5 -0
- package/i18n/nl.json +5 -0
- package/index.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newheap-platform-ai-chat.mjs","sources":["../../../projects/nh-ai-chat/src/lib/models/assistant-api.models.ts","../../../projects/nh-ai-chat/src/lib/models/assistant-sse.models.ts","../../../projects/nh-ai-chat/src/lib/models/assistant-agent-run.models.ts","../../../projects/nh-ai-chat/src/lib/models/assistant-agent-package.models.ts","../../../projects/nh-ai-chat/src/lib/nh-assistant.config.ts","../../../projects/nh-ai-chat/src/lib/i18n/nh-assistant-translations.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-sse-parser.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-transport.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-api.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-admin-api.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-agent-run-api.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-live.service.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-errors.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-mcp-authorization.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-mcp-connect.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-push.service.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-files.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-reducer.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-page-context.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-ui-state.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant.store.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-panel.service.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-agent-work.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-subject-summary.service.ts","../../../projects/nh-ai-chat/src/lib/provide-nh-assistant.ts","../../../projects/nh-ai-chat/src/lib/i18n/nh-assistant-error-codes.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-share-link.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-icon.component.ts","../../../projects/nh-ai-chat/src/lib/components/launcher/nh-assistant-launcher.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-translate.pipe.ts","../../../projects/nh-ai-chat/src/lib/components/activity/nh-assistant-activity.component.ts","../../../projects/nh-ai-chat/src/lib/components/agent-picker/nh-assistant-agent-picker.component.ts","../../../projects/nh-ai-chat/src/lib/components/composer/nh-assistant-composer.component.ts","../../../projects/nh-ai-chat/src/lib/components/composer/nh-assistant-composer.component.html","../../../projects/nh-ai-chat/src/lib/components/conversation-list/nh-assistant-conversation-list.component.ts","../../../projects/nh-ai-chat/src/lib/components/conversation-list/nh-assistant-conversation-list.component.html","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-mcp-connections.component.ts","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-mcp-connections.component.html","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-preferences.component.ts","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-preferences.component.html","../../../projects/nh-ai-chat/src/lib/components/share/nh-assistant-share.component.ts","../../../projects/nh-ai-chat/src/lib/components/share/nh-assistant-share.component.html","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-markdown.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-markdown.pipe.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-subject-link.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-message-link.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-part-groups.ts","../../../projects/nh-ai-chat/src/lib/components/proposal-feedback/nh-assistant-proposal-feedback.component.ts","../../../projects/nh-ai-chat/src/lib/components/proposal-feedback/nh-assistant-proposal-feedback.component.html","../../../projects/nh-ai-chat/src/lib/components/approval-card/nh-assistant-approval-card.component.ts","../../../projects/nh-ai-chat/src/lib/components/approval-card/nh-assistant-approval-card.component.html","../../../projects/nh-ai-chat/src/lib/components/connection-required/nh-assistant-connection-required.component.ts","../../../projects/nh-ai-chat/src/lib/components/connection-required/nh-assistant-connection-required.component.html","../../../projects/nh-ai-chat/src/lib/components/question-card/nh-assistant-question-card.component.ts","../../../projects/nh-ai-chat/src/lib/components/question-card/nh-assistant-question-card.component.html","../../../projects/nh-ai-chat/src/lib/components/tool-call-card/nh-assistant-tool-call-card.component.ts","../../../projects/nh-ai-chat/src/lib/components/tool-call-card/nh-assistant-tool-call-card.component.html","../../../projects/nh-ai-chat/src/lib/components/tool-call-group/nh-assistant-tool-call-group.component.ts","../../../projects/nh-ai-chat/src/lib/components/tool-call-group/nh-assistant-tool-call-group.component.html","../../../projects/nh-ai-chat/src/lib/components/thread/nh-assistant-thread.component.ts","../../../projects/nh-ai-chat/src/lib/components/thread/nh-assistant-thread.component.html","../../../projects/nh-ai-chat/src/lib/components/panel/nh-assistant-panel.component.ts","../../../projects/nh-ai-chat/src/lib/components/panel/nh-assistant-panel.component.html","../../../projects/nh-ai-chat/src/lib/components/subject-badge/nh-assistant-subject-badge.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-document-markdown.ts","../../../projects/nh-ai-chat/src/lib/components/document/nh-assistant-document-diagram.component.ts","../../../projects/nh-ai-chat/src/lib/components/document/nh-assistant-document.component.ts","../../../projects/nh-ai-chat/src/lib/components/document/nh-assistant-document.component.html","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-picker.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-picker.component.html","../../../projects/nh-ai-chat/src/public-api.ts","../../../projects/nh-ai-chat/src/newheap-platform-ai-chat.ts"],"sourcesContent":["/*\n * Wire models of the NewHeap assistant HTTP API.\n *\n * These interfaces are a literal translation of the assistant API contract. Keep the\n * field names identical to the JSON the server returns (camelCase, ISO-8601 UTC dates,\n * GUID strings for ids).\n */\n\nimport type { AgentSubjectRole } from './assistant-agent-run.models';\n\nexport interface AssistantStatus {\n enabled: boolean;\n agents: AgentSummary[];\n limits: {\n maxMessageChars: number;\n maxToolCallsPerTurn: number;\n };\n /** True when the caller also passes the admin policy and may use the `admin/*` endpoints. */\n canAdminister: boolean;\n /** Sharing, live update and notification features; missing on servers without them. */\n collaboration?: AssistantCollaboration | null;\n}\n\nexport interface AssistantCollaboration {\n /** Owners can invite colleagues directly through the application's directory. */\n directory: boolean;\n /** Path of the SignalR hub for live updates, for example `/hub/assistant`; `null` when off. */\n hubPath: string | null;\n /** Web Push notifications are configured on the server. */\n push: boolean;\n /** Maximum participants per conversation, not counting the owner. */\n maxParticipants: number;\n}\n\n/** The caller's relation to a conversation. */\nexport type ConversationRole = 'owner' | 'participant';\n\nexport interface AgentSummary {\n id: string;\n version: number;\n displayNameKey: string;\n descriptionKey: string;\n canMutate: boolean;\n /**\n * What people may attach to a message to this agent; `null` or missing when they can attach\n * nothing: the application keeps no files for the assistant, accepts no uploads, or the agent\n * accepts no files.\n */\n uploads?: AgentUploads | null;\n}\n\n/** What people may upload with `POST conversations/{id}/files` and attach to one message to an agent. */\nexport interface AgentUploads {\n /** Lowercase media types, for example `application/pdf`. */\n acceptedMediaTypes: string[];\n /** The largest file in bytes. */\n maxFileBytes: number;\n /** The most files of one message. */\n maxFiles: number;\n /**\n * The file name extensions the application mapped to one of `acceptedMediaTypes`\n * (`NhAssistantUploadOptions.MapExtension` on the server). A file without a usable type takes the\n * type of its extension from them before the platform's table, as on the server, and the file picker\n * offers them. Empty, or missing from an older server, when the application maps none.\n */\n mappedExtensions?: AgentUploadExtension[] | null;\n}\n\n/** A file name extension the application mapped to an accepted media type for uploads. */\nexport interface AgentUploadExtension {\n /** The extension in lowercase with its dot, for example `.dwg`. */\n extension: string;\n /** The accepted media type it names, for example `application/acad`. */\n mediaType: string;\n}\n\n/**\n * A file the application keeps, as the upload endpoint returns it and a message names it in\n * `files`. It never carries content.\n */\nexport interface FileReference {\n id: string;\n name: string;\n mediaType: string;\n size: number;\n /** The application's hash of the content, when it keeps one. */\n hash?: string | null;\n}\n\nexport interface ConversationSummary {\n id: string;\n agentId: string;\n title: string | null;\n status: ConversationStatus;\n createdAt: string;\n updatedAt: string;\n /** Default `owner` for servers without sharing. */\n role?: ConversationRole;\n /** People the owner shared the conversation with. */\n participantCount?: number;\n /** Sequence of the latest message. */\n lastMessageSequence?: number;\n /** The caller's read position; the conversation is unread while it is lower than `lastMessageSequence`. */\n lastReadSequence?: number;\n /** The owner or participant whose turn runs or waits for approval. */\n activeActorId?: string | null;\n}\n\nexport interface Conversation extends ConversationSummary {\n agentVersion: number;\n messages: Message[];\n pendingApproval: ApprovalPart | null;\n /**\n * The question the waiting turn asked with `ask_question` and waits for (`run.AllowQuestions()` on\n * the server); missing when the conversation waits for no question and on older servers.\n */\n pendingQuestion?: QuestionPart | null;\n /** The owner followed by the participants; empty while the conversation is not shared. */\n members?: ConversationMember[];\n /** The current invitation-link token; only for the owner. */\n shareToken?: string | null;\n /** The caller's actor id, to recognize the caller's own messages. */\n currentActorId?: string | null;\n /** Default `chat` for servers without agent runs. */\n kind?: ConversationKind;\n /**\n * The subject of an agent thread and the caller's standing in it, including who may decide its\n * open proposals; `null` for a chat.\n */\n thread?: ConversationThread | null;\n}\n\n/** `chat` for a conversation people start; `thread` for the durable thread of an agent about one subject. */\nexport type ConversationKind = 'chat' | 'thread';\n\n/**\n * The subject of an agent thread as the caller sees it. In a thread the subject's approvers decide\n * the agent's proposals, not the author of a turn. The server checks the role on every request.\n */\nexport interface ConversationThread {\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n /** The caller's live role on the subject. */\n role: AgentSubjectRole;\n /** Each open proposal of the thread and whether the caller may decide it now, oldest first. */\n decisions: ConversationThreadDecision[];\n /** The name of the subject type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n /** Where the application shows the subject, when the type has a link template. */\n subjectLink?: string | null;\n}\n\n/**\n * The caller's right to decide one open proposal of an agent thread, checked like the decision\n * itself: the approval policy, four-eyes and the tool's approve policy.\n */\nexport interface ConversationThreadDecision {\n approvalId: string;\n /**\n * The run that proposed it; such a proposal is decided with `POST approvals/{id}/decisions`.\n * `null` for a proposal of a person's turn in the thread, decided in the conversation.\n */\n runId: string | null;\n canDecide: boolean;\n /** Why the caller may not decide, for example `assistant-four-eyes-required`; `null` when they may. */\n reasonCode: string | null;\n}\n\nexport type ConversationStatus = 'idle' | 'running' | 'waiting-for-approval' | 'failed' | 'archived';\n\n/** The owner or a participant of a shared conversation. */\nexport interface ConversationMember {\n actorId: string;\n /** `null` when the application provides no name. */\n displayName: string | null;\n role: ConversationRole;\n joinedAt: string;\n}\n\nexport interface Message {\n id: string;\n /** `application` for a message the application posted into the conversation. */\n role: 'user' | 'assistant' | 'tool' | 'application';\n createdAt: string;\n parts: MessagePart[];\n /** Position in the conversation; missing on optimistic messages and old servers. */\n sequence?: number;\n /** The writer of a user message. */\n authorActorId?: string | null;\n /**\n * Who wrote the message: a person or a trigger of an agent for user messages, `rule` for the\n * summary an agent's rules wrote instead of the model, `application` for a message the\n * application posted; missing on old servers.\n */\n authorKind?: MessageAuthorKind | null;\n /** The title, sender, link and trusted flag of a message the application posted; missing for other messages. */\n application?: ApplicationMessageDetails | null;\n /**\n * The skill an agent message of a person's chat worked in at its end (`run.SkillsInChat()` on the\n * server); missing for a message without a skill.\n */\n skillId?: string | null;\n}\n\n/**\n * `person` for a message a person wrote; `trigger` for one a trigger wrote into an agent thread;\n * `rule` for an assistant message the agent's rules wrote without a model; `application` for a\n * message the application posted into the conversation.\n */\nexport type MessageAuthorKind = 'person' | 'trigger' | 'rule' | 'application';\n\n/**\n * What the application said about a message it posted, besides its text: an optional heading, who in\n * the application posted it, where people continue and whether the assistant follows it. The text is\n * the message's `text` part.\n */\nexport interface ApplicationMessageDetails {\n title: string | null;\n senderName: string | null;\n link: ApplicationMessageLink | null;\n /**\n * The assistant follows the message as the application's instruction (`Trusted` on the server);\n * `false` for a message the assistant reads as information. The thread labels a trusted message.\n */\n trusted: boolean;\n}\n\n/** A path within the application, which the chat opens through the router, or an `https` address. */\nexport interface ApplicationMessageLink {\n url: string;\n /** The text of the link; the chat shows its own text without one. */\n label: string | null;\n}\n\nexport type MessagePart = TextPart | ToolCallPart | ApprovalPart | ConnectionRequiredPart | FilePart | QuestionPart;\n\n/**\n * `pending` while the turn waits for the answer; `answered` once the addressee chose; `expired` when\n * nobody answered within the turn's wait limit; `cancelled` when the turn was stopped.\n */\nexport type QuestionStatus = 'pending' | 'answered' | 'expired' | 'cancelled';\n\n/**\n * A question the agent asked with `ask_question` in a person's chat. Only the addressee answers it,\n * with `NhAssistantApiService.answerQuestion`; the turn waits for the answer as for an approval and\n * continues with it. Everyone else sees it read-only.\n */\nexport interface QuestionPart {\n type: 'question';\n questionId: string;\n question: string;\n /** Two to six answers, in order; the answer names the index of one. */\n choices: string[];\n /** The person who answers: by default the person whose turn asked. */\n addresseeActorId: string;\n /** After this moment an answer is refused with `assistant-question-expired`. */\n expiresAt: string;\n status: QuestionStatus;\n /** The zero-based index of the chosen answer; only sent once it was answered. */\n answerIndex?: number | null;\n /** When it was answered, expired or cancelled; only sent then. */\n closedAt?: string | null;\n}\n\n/** Body of `POST conversations/{id}/questions/{questionId}/answer`. */\nexport interface AnswerQuestionRequest {\n /** The zero-based index of the chosen answer. */\n choice: number;\n}\n\n/**\n * A file a person attached to a message: its name, media type and size in bytes, never its content.\n * The application keeps the file; a later turn opens it again with the rights of that turn.\n */\nexport interface FilePart {\n type: 'file';\n name: string;\n mediaType: string;\n size: number;\n}\n\n/**\n * Why a turn asks the person to connect an MCP server: never connected, the connection ended, or\n * the server asked for permissions the connection lacks.\n */\nexport type ConnectionRequiredReason = 'not-connected' | 'reauthorization-required' | 'insufficient-scope';\n\n/**\n * An MCP server, which each person connects to with their own account, that the person who asked had\n * to connect before the agent could use it. The turn went on without its tools; the card connects\n * the viewer's own account.\n */\nexport interface ConnectionRequiredPart {\n type: 'connection-required';\n serverId: string;\n displayName: string;\n reason: ConnectionRequiredReason;\n}\n\nexport interface TextPart {\n type: 'text';\n text: string;\n}\n\n/**\n * `awaiting-approval` waits for a person. A call whose agent proposal closed without running ends\n * as `rejected`, as `not-executed` when the proposal expired, was withdrawn or became stale, or as\n * `failed` when its execution failed before it started; its `resultCode` is then\n * `assistant-proposal-<approval status>`, for example `assistant-proposal-expired`. An `ask_question`\n * call waits as `awaiting-answer` for the person it asked.\n */\nexport type ToolCallStatus = 'running' | 'succeeded' | 'failed' | 'awaiting-approval' | 'awaiting-answer' | 'rejected' | 'not-executed';\n\nexport interface ToolCallPart {\n type: 'tool-call';\n invocationId: string;\n toolId: string;\n toolVersion: number;\n displayName: string;\n status: ToolCallStatus;\n argumentsPreview: string | null;\n resultPreview: string | null;\n resultCode: string | null;\n /**\n * `delegated`, `agent` or `delegated-read` when an agent used rights beyond the caller's own:\n * the initiator's, its own grant, or a person's through a gateway read.\n */\n grantSource?: 'delegated' | 'agent' | 'delegated-read' | 'accountable' | null;\n /** The result came from rights this viewer does not have and is shielded from them. */\n restricted?: boolean;\n}\n\n/**\n * Chat approvals are `pending`, `approved`, `rejected` or `expired`; proposals of agents that run on\n * their own continue through execution (`executing`, `executed`, `execution-failed`,\n * `execution-unknown`, `resolved`, and `awaiting-application` while the application executes the\n * proposal of a tool it declared with `ExecuteInApplication`) or end as `withdrawn`, `stale` or `shadow`;\n * a shadow proposal that a newer one for the same objects replaced is `shadow-superseded`.\n */\nexport type ApprovalStatus =\n | 'pending'\n | 'approved'\n | 'rejected'\n | 'expired'\n | 'withdrawn'\n | 'stale'\n | 'executing'\n | 'awaiting-application'\n | 'executed'\n | 'execution-failed'\n | 'execution-unknown'\n | 'resolved'\n | 'shadow'\n | 'shadow-superseded';\n\nexport interface ApprovalPresentationField {\n label: string;\n value: string;\n}\n\nexport interface ApprovalPresentation {\n toolDisplayName: string;\n summary: string;\n fields: ApprovalPresentationField[];\n notice: string | null;\n}\n\n/**\n * Why a stale proposal no longer fits: the work was already done another way, what it was based on\n * changed, or it no longer applies.\n */\nexport type StaleKind = 'already-done' | 'changed' | 'not-applicable';\n\nexport interface ApprovalPart {\n type: 'approval';\n approvalId: string;\n proposalId: string;\n proposalHash: string;\n toolId: string;\n summary: string;\n /** Trusted server-side presentation. Missing on old events and when no presenter handled the tool. */\n presentation?: ApprovalPresentation | null;\n argumentsPreview: string;\n targets: string[];\n expiresAt: string;\n status: ApprovalStatus;\n /** Why a stale proposal no longer fits. Only sent for stale proposals; missing on older servers. */\n staleKind?: StaleKind;\n /** The application's explanation of a stale proposal in the reader's language, such as who did the work. */\n staleExplanation?: string;\n /** Why the agent's rules proposed it, in the reader's language. Only sent for rule proposals. */\n rationale?: string;\n /** The newer proposal for the same objects that replaced this withdrawn one. Only sent then. */\n supersededByApprovalId?: string;\n /**\n * The consultation that proposed it, when the conversation's assistant consulted another agent and\n * the person who asked decides that agent's proposal here (`asker-decides`). Approving executes it\n * in the person's own request with their own rights. Missing for the conversation's own proposals.\n */\n consultation?: ApprovalConsultation | null;\n /**\n * The result of the execution, such as the application's code or `report-overdue`. Only sent once the\n * proposal executed or was handed to the application; missing on older servers.\n */\n executionResultCode?: string;\n /** Until when the application's report is due, for a proposal handed to the application. Only sent then. */\n executionReportDueAt?: string;\n /**\n * `true` when the current user may resolve this uncertain execution in the chat (`resolveApproval`):\n * they approved it here, it was handed to the application and its outcome is unknown. Only sent then.\n */\n canResolve?: boolean;\n}\n\n/**\n * How the person who approved a proposal in their chat resolves its uncertain hand-off: hand it to the\n * application again, with a new attempt and report deadline, or confirm its outcome without running it.\n */\nexport type ApprovalResolution = 'hand-to-application' | 'mark-resolved';\n\n/** Body of `POST conversations/{id}/approvals/{approvalId}/resolve`. */\nexport interface ResolveApprovalRequest {\n action: ApprovalResolution;\n /** Why, at most 500 characters. */\n reason?: string;\n}\n\n/**\n * How a consulted agent's proposal is decided and whose rights execute it: `asker-decides`, the person\n * who asked decides it in their own chat and it runs with their own rights; `subject-agent-rights`, the\n * subject's approvers other than the asker decide it and it runs with the agent's own rights;\n * `subject-asker-rights`, the subject's approvers decide it and it runs with the asker's rights.\n */\nexport type NhAssistantConsultationRoute = 'asker-decides' | 'subject-agent-rights' | 'subject-asker-rights';\n\n/** The routes at the subject a person may leave a consulted agent's proposal for (`decision: 'leave'`). */\nexport type NhAssistantConsultationLeaveRoute = Exclude<NhAssistantConsultationRoute, 'asker-decides'>;\n\n/** Where a proposal the person who asked decides in their own conversation comes from. */\nexport interface ApprovalConsultation {\n /** The consultation record in the consulted agent's thread. */\n consultationId: string;\n /** The consulted agent that proposed it. */\n agentId: string;\n subjectType: string;\n subjectId: string;\n /** The subject's name as the consulted agent's thread knows it; `null` when unknown. */\n subjectDisplayName: string | null;\n /**\n * The route at the subject the person may leave the pending proposal for with the decision `leave`;\n * `null` when they can only approve or reject it.\n */\n leaveRoute: NhAssistantConsultationLeaveRoute | null;\n /** The consulted agent's answer, bounded, when the consultation's classification allows a preview. */\n answer: string | null;\n /** The proposal that waits at the subject since the person left this one for its approvers. */\n movedToApprovalId: string | null;\n}\n\n/** Response of `GET conversations?page=&itemsPerPage=`. */\nexport interface ConversationPage {\n items: ConversationSummary[];\n total: number;\n}\n\n/** Body of `POST conversations`. */\nexport interface CreateConversationRequest {\n agentId: string;\n title?: string;\n}\n\n/** An entity the user has open, for example `{ type: 'project', id: 'AA09027', label: 'Project AA09027' }`. */\nexport interface ClientContextEntity {\n /** Dash-case, for example `order-group`. */\n type: string;\n /** At most 64 characters. */\n id: string;\n /** At most 120 characters. */\n label?: string | null;\n}\n\n/**\n * What the user has open when sending a message. Untrusted page data for the model:\n * entity ids are search hints only and never grant access.\n */\nexport interface ClientContext {\n /** For example `/order-group/123`; at most 200 characters. */\n route: string;\n /** Page title; at most 120 characters. */\n title?: string | null;\n /** At most 5 entities. */\n entities?: ClientContextEntity[];\n}\n\n/** Library name of the contract's `ClientContext`. */\nexport type NhAssistantClientContext = ClientContext;\n\n/** Body of `POST conversations/{id}/messages`. */\nexport interface SendMessageRequest {\n text: string;\n clientMessageId: string;\n /** Page context of this message; `null` when the user left it out. */\n clientContext?: ClientContext | null;\n /** Files the person attaches, as `POST conversations/{id}/files` returned them. */\n files?: FileReference[];\n}\n\n/**\n * `approve` or `reject`; for a consulted agent's proposal with a `consultation.leaveRoute` also\n * `leave`, which leaves it for the subject's approvers instead of deciding it.\n */\nexport type ApprovalDecision = 'approve' | 'reject' | 'leave';\n\n/** Body of `POST conversations/{id}/approvals/{approvalId}/decide`. */\nexport interface DecideApprovalRequest {\n decision: ApprovalDecision;\n expectedProposalHash: string;\n reason?: string;\n}\n\n/** Response of `POST conversations/{id}/share-link`. */\nexport interface ShareLink {\n token: string;\n}\n\n/** A person the owner may invite, from the application's directory. */\nexport interface DirectoryEntry {\n actorId: string;\n displayName: string;\n detail: string | null;\n}\n\n/** Response of `GET` and `PUT notifications`. */\nexport interface NotificationSettings {\n /** The caller's choice; on by default. */\n pushEnabled: boolean;\n /** The server has Web Push configured. */\n pushAvailable: boolean;\n /** The VAPID key browsers subscribe with. */\n publicKey: string | null;\n}\n\n/** Body of `PUT notifications/push-subscription`: `PushSubscription.toJSON()` plus the text language. */\nexport interface PushSubscriptionRequest {\n endpoint: string;\n keys: { p256dh: string; auth: string };\n language?: string;\n}\n","import { AgentTriggerReceipt } from './assistant-agent-run.models';\nimport { ApprovalPart, ConnectionRequiredReason, QuestionPart } from './assistant-api.models';\n\n/*\n * Server-sent events of an assistant turn.\n *\n * Every event arrives as `event: <name>` plus `data: <JSON>` followed by an empty line.\n * The stream closes after `turn.completed` or `error`.\n */\n\nexport interface TurnStartedEvent {\n turnId: string;\n userMessageId: string;\n assistantMessageId: string;\n}\n\nexport interface MessageDeltaEvent {\n messageId: string;\n text: string;\n}\n\nexport interface ToolStartedEvent {\n invocationId: string;\n toolId: string;\n toolVersion: number;\n displayName: string;\n argumentsPreview: string | null;\n}\n\nexport interface ToolCompletedEvent {\n invocationId: string;\n status: 'succeeded' | 'failed';\n resultCode: string | null;\n resultPreview: string | null;\n}\n\nexport type ApprovalRequiredEvent = ApprovalPart;\n\n/** The agent asked a person of the conversation a question; the turn waits for the answer. */\nexport type QuestionAskedEvent = QuestionPart;\n\n/** The addressee answered the question; the turn continues with the answer. */\nexport type QuestionAnsweredEvent = QuestionPart;\n\n/** The person who asked has to connect an MCP server before the agent can use it. */\nexport interface ConnectionRequiredEvent {\n serverId: string;\n displayName: string;\n reason: ConnectionRequiredReason;\n}\n\nexport type TurnCompletionStatus = 'completed' | 'waiting-for-approval' | 'cancelled' | 'failed';\n\nexport interface TurnUsage {\n inputTokens: number;\n outputTokens: number;\n toolCalls: number;\n}\n\nexport interface TurnCompletedEvent {\n turnId: string;\n status: TurnCompletionStatus;\n usage: TurnUsage;\n errorCode: string | null;\n}\n\nexport interface AssistantErrorEvent {\n code: string;\n messageKey: string;\n}\n\n/**\n * The server accepted a message for the next run of the agent that works in the thread, with its\n * files, instead of starting a turn: it answered `202` with the trigger receipt. The client emits it\n * in place of a stream, which then ends; a server never streams it.\n */\nexport type MessageQueuedEvent = AgentTriggerReceipt;\n\n/** Map from SSE event name to its data payload. */\nexport interface NhAssistantSseEventMap {\n 'turn.started': TurnStartedEvent;\n 'message.delta': MessageDeltaEvent;\n 'tool.started': ToolStartedEvent;\n 'tool.completed': ToolCompletedEvent;\n 'approval.required': ApprovalRequiredEvent;\n 'question.asked': QuestionAskedEvent;\n 'question.answered': QuestionAnsweredEvent;\n 'connection.required': ConnectionRequiredEvent;\n 'turn.completed': TurnCompletedEvent;\n 'error': AssistantErrorEvent;\n}\n\nexport type NhAssistantSseEventType = keyof NhAssistantSseEventMap;\n\n/** One parsed assistant event, discriminated by its SSE event name. */\nexport type NhAssistantSseEvent = {\n [K in NhAssistantSseEventType]: { type: K; data: NhAssistantSseEventMap[K] };\n}[NhAssistantSseEventType];\n\n/**\n * What `NhAssistantApiService.sendMessage` emits: the events of the turn it started, or, when the\n * message waits for the next run of the agent working in the thread, one `message.queued` event.\n */\nexport type NhAssistantMessageEvent = NhAssistantSseEvent | { type: 'message.queued'; data: MessageQueuedEvent };\n\nexport const NH_ASSISTANT_SSE_EVENT_TYPES: readonly NhAssistantSseEventType[] = [\n 'turn.started',\n 'message.delta',\n 'tool.started',\n 'tool.completed',\n 'approval.required',\n 'question.asked',\n 'question.answered',\n 'connection.required',\n 'turn.completed',\n 'error'\n];\n\n/**\n * Stable client-side failure codes. The client emits these as `error` events when the\n * transport fails before the server could send its own `error` event.\n */\nexport const NhAssistantClientErrorCodes = {\n network: 'assistant-network',\n unauthenticated: 'assistant-unauthenticated',\n forbidden: 'assistant-forbidden',\n notFound: 'assistant-not-found',\n conversationBusy: 'assistant-conversation-busy',\n validation: 'assistant-validation',\n versionConflict: 'assistant-version-conflict',\n invalidResponse: 'assistant-invalid-response',\n streamInterrupted: 'assistant-stream-interrupted',\n server: 'assistant-server',\n /** The open conversation was deleted by its owner, or the user left or was removed. */\n conversationRemoved: 'assistant-conversation-removed',\n /** The person closed the authorization window of an MCP connection before it finished. */\n mcpAuthorizationCancelled: 'assistant-mcp-authorization-cancelled',\n /** The browser blocked the authorization window of an MCP connection. */\n mcpPopupBlocked: 'assistant-mcp-popup-blocked'\n} as const;\n\nexport type NhAssistantClientErrorCode = typeof NhAssistantClientErrorCodes[keyof typeof NhAssistantClientErrorCodes];\n","import { ApprovalPresentation, NhAssistantConsultationRoute, StaleKind } from './assistant-api.models';\n\n/**\n * Contracts of the agent-run endpoints of `NewHeap.Platform.AI.Chat.AspNet`: threads about a\n * subject, runs, proposals, the approval inbox, working memory and artifacts.\n */\n\n/** The caller's role on the subject of a thread. */\nexport type AgentSubjectRole = 'none' | 'reader' | 'participant' | 'approver';\n\nexport type AgentRunStatus = 'queued' | 'running' | 'waiting-for-approval' | 'completed' | 'failed' | 'cancelled';\n\nexport type AgentProposalStatus =\n | 'pending'\n | 'approved'\n | 'rejected'\n | 'expired'\n | 'withdrawn'\n | 'stale'\n | 'executing'\n | 'awaiting-application'\n | 'executed'\n | 'execution-failed'\n | 'execution-unknown'\n | 'resolved'\n | 'shadow'\n | 'shadow-superseded';\n\nexport type AgentGrantSource = 'none' | 'delegated' | 'agent' | 'delegated-read' | 'accountable';\n\n/**\n * How a run worked: `model` through the language model, `rule` through the agent's rules without a\n * model, `rule-then-model` when the rules handed the run over to the model.\n */\nexport type AgentRunKind = 'model' | 'rule' | 'rule-then-model';\n\n/**\n * Who chose the skill a run worked in; `follow-up` continues in the skill of the run whose\n * proposal people decided.\n */\nexport type AgentSkillChooser = 'trigger' | 'rules' | 'triage' | 'model' | 'follow-up';\n\nexport interface AgentRun {\n id: string;\n conversationId: string;\n triggerId: string;\n status: AgentRunStatus;\n failureClass: string | null;\n failureCode: string | null;\n initiatorActorId: string | null;\n accountableOwnerId: string;\n attempt: number;\n agentVersion: number;\n toolCalls: number;\n inputTokens: number;\n outputTokens: number;\n proposalCount: number;\n summary: string | null;\n shadow: boolean;\n createdAt: string;\n startedAt: string | null;\n endedAt: string | null;\n backgroundOperationId: string | null;\n /** How the run worked. Missing on older servers, which only ran the model. */\n kind?: AgentRunKind;\n /** The skill of the agent the run worked in; missing or null for the agent's own tools. */\n skill?: string | null;\n skillChosenBy?: AgentSkillChooser | null;\n /** The version of a skill defined as data the run worked in; absent for a skill in code. */\n skillVersion?: number | null;\n /** The run evaluated a candidate version of its skill in the shadow thread. */\n skillCandidate?: boolean;\n /** The version of the trigger defined as data that started the run; absent for a trigger in code. */\n triggerVersion?: number | null;\n /** The run evaluated a candidate version of its data trigger in the shadow thread. */\n triggerCandidate?: boolean;\n /** The agent that handed the run's work off; missing or null for a run no agent asked for. */\n requestedByAgentId?: string | null;\n /**\n * The thread of the run that handed the work off, only in a thread's run list and only when the\n * reader may open it.\n */\n requestedByConversationId?: string | null;\n /** How many hand-offs led to the run; 0 or missing for a run no agent asked for. */\n handOffDepth?: number;\n}\n\nexport interface AgentRunList {\n items: AgentRun[];\n total: number;\n}\n\nexport interface AgentThread {\n conversationId: string;\n agentId: string;\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n accountability: string;\n accountableOwnerId: string;\n role: AgentSubjectRole;\n activeRun: AgentRun | null;\n waitingInputs: number;\n /**\n * The thread holds the agent's shadow work about the subject: only administrators see it,\n * nobody is notified and nothing proposed in it executes.\n */\n shadow?: boolean;\n /**\n * The name of the subject type in the caller's language, such as \"Project\", when the application\n * named the type; `null` or missing otherwise.\n */\n subjectTypeName?: string | null;\n /**\n * Where the application shows the subject, from the type's link template; `null` or missing\n * without one. `provideNhAssistant({ subjectLinks })` may replace it with a router link.\n */\n subjectLink?: string | null;\n}\n\nexport interface AgentThreadLookup {\n thread: AgentThread | null;\n canStart: boolean;\n role: AgentSubjectRole;\n}\n\n/** The caller's live right to decide one open proposal; the server checks every decision again. */\nexport interface AgentProposalDecisionRight {\n canDecide: boolean;\n /**\n * Why the caller may not decide, for example `assistant-four-eyes-required`,\n * `assistant-approval-policy-denied` or `assistant-consult-asker-decides` for a consultation's\n * proposal that the person who asked decides in their own chat; `null` when they may.\n */\n reasonCode: string | null;\n}\n\n/** One agent on a subject: its thread, `null` before it worked on the subject, and whether the caller may start it. */\nexport interface AgentSubjectWorkAgent {\n agentId: string;\n /**\n * The agent's name: a translation key for an agent in code, the text itself for an agent created in\n * the administration. It names an agent kept out of the chat as well, which the status does not list;\n * missing from servers before it was added.\n */\n displayNameKey?: string | null;\n thread: AgentThread | null;\n canStart: boolean;\n /**\n * For administrators, the agent's shadow thread about the subject while the agent or one of its\n * skills works in shadow; missing or `null` otherwise.\n */\n shadowThread?: AgentThread | null;\n}\n\n/**\n * A proposal on a subject with the caller's live decision right. Only a pending proposal can be\n * decided; for every other status `canDecide` is `false` and `reasonCode` is `null`.\n */\nexport interface AgentSubjectWorkProposal extends AgentProposalDecisionRight {\n proposal: AgentProposal;\n}\n\n/** The most proposals one `POST approvals/lookup` reads. */\nexport const NH_ASSISTANT_MAX_PROPOSAL_LOOKUP = 100;\n\n/**\n * Response of `POST approvals/lookup`: the requested proposals the caller may see, in the order of\n * the request. Ids the caller may not see, or that do not exist, are left out.\n */\nexport interface AgentProposalLookup {\n items: AgentSubjectWorkProposal[];\n}\n\n/**\n * All agent work on one subject as the caller may see it (`GET subjects/{type}/{id}/work`): every\n * agent with a thread on the subject plus the requested agent, and the pending proposals of all\n * those threads, the earliest expiry first.\n */\nexport interface AgentSubjectWork {\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n /**\n * The name of the subject type in the caller's language, such as \"Project\", when the application\n * named the type; `null` or missing otherwise.\n */\n subjectTypeName?: string | null;\n /**\n * Where the application shows the subject, from the type's link template; `null` or missing\n * without one. `provideNhAssistant({ subjectLinks })` may replace it with a router link.\n */\n subjectLink?: string | null;\n /** The caller's live role. Without a role the server answers `404 assistant-subject-not-found`. */\n role: Exclude<AgentSubjectRole, 'none'>;\n agents: AgentSubjectWorkAgent[];\n openProposals: AgentSubjectWorkProposal[];\n}\n\n/** The agent work on one subject for a list view (`POST subjects/{type}/summary`). */\nexport interface AgentSubjectSummary {\n subjectId: string;\n /** Proposals that wait for a decision on the subject. */\n openProposals: number;\n /** The open proposals the caller may decide, counted like the approval inbox. */\n proposalsToDecide: number;\n /** An agent works on the subject now. */\n runActive: boolean;\n}\n\n/** One summary per requested subject, in request order; subjects without visible work count zero. */\nexport interface AgentSubjectSummaryList {\n subjectType: string;\n items: AgentSubjectSummary[];\n}\n\n/** Maximum number of subjects one `POST subjects/{type}/summary` request accepts. */\nexport const NH_ASSISTANT_MAX_SUBJECT_SUMMARY = 200;\n\n/** One subject a search found (`GET subjects/{type}/search`). */\nexport interface AgentSubjectSearchResult {\n type: string;\n id: string;\n /** The name the application gives the subject; show the id without one. */\n displayName: string | null;\n /** The subject's isolation key: `tenant:…`, `division:…` or `global`. */\n scopeKey: string;\n divisionId: string | null;\n /** Where the application shows the subject; `null` without a link template. */\n link?: string | null;\n}\n\n/** The subjects of one type a search found that the caller may read, in the application's order. */\nexport interface AgentSubjectSearch {\n subjectType: string;\n items: AgentSubjectSearchResult[];\n}\n\n/** The shortest and longest text `searchSubjects` accepts, and the most results it returns. */\nexport const NH_ASSISTANT_SUBJECT_SEARCH = { minQueryLength: 2, maxQueryLength: 100, maxLimit: 50 } as const;\n\n/** The platform's subject type of the whole application, which the server registers itself. */\nexport const NH_ASSISTANT_SYSTEM_SUBJECT_TYPE = 'nh-system';\n\n/** The whole application as one subject, for an agent that works app-wide. */\nexport const NH_ASSISTANT_SYSTEM_GLOBAL_ID = 'global';\n\n/** The most characters of a run's result that `getObjectAgents` returns for its latest run. */\nexport const NH_ASSISTANT_RESULT_PREVIEW_LENGTH = 300;\n\n/** The newest run of an agent on a subject, with the beginning of its result. */\nexport interface AgentLatestRun {\n runId: string;\n conversationId: string;\n triggerId: string;\n status: AgentRunStatus;\n failureCode: string | null;\n /** When the run ended, or started, or was queued. */\n at: string;\n /**\n * The first `NH_ASSISTANT_RESULT_PREVIEW_LENGTH` characters of the run's stored answer: model\n * output, to show as text. For a run without one, such as a run that ended before runs kept their\n * answer, the summary it ended with; `null` while the run has none. `getRunResult` returns all of it.\n */\n result: string | null;\n /** The result is longer than `result`. */\n resultTruncated: boolean;\n /** The run worked in the agent's shadow thread, which only administrators see. */\n shadow: boolean;\n}\n\n/** One agent that works on a subject, as `getObjectAgents` lists it. */\nexport interface AgentObjectAgent {\n agentId: string;\n /** A translation key for an agent in code, the text itself for one created in the administration. */\n displayNameKey: string;\n descriptionKey: string;\n /** Whether the caller may run the agent on the subject now. */\n canStart: boolean;\n /** The agent's thread about the subject that people open; `null` before it worked on it. */\n conversationId: string | null;\n /** The agent's newest run on the subject; `null` before its first. */\n latestRun: AgentLatestRun | null;\n /** The agent's proposals on the subject that wait for a decision. */\n openProposals: number;\n}\n\n/**\n * The agents that work on one subject and that the caller may use (`GET subjects/{type}/{id}/agents`),\n * ordered by id. The subject is an object or the whole application.\n */\nexport interface AgentObjectAgents {\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n subjectTypeName?: string | null;\n subjectLink?: string | null;\n /** The caller's live role. Without a role the server answers `404 assistant-subject-not-found`. */\n role: Exclude<AgentSubjectRole, 'none'>;\n agents: AgentObjectAgent[];\n}\n\n/** The most characters of a run's answer that `getRunResult` returns; a longer answer is cut. */\nexport const NH_ASSISTANT_RUN_RESULT_MAX_LENGTH = 20_000;\n\n/** The most runs one page of a run history holds. */\nexport const NH_ASSISTANT_RUN_HISTORY_MAX_PAGE = 50;\n\n/**\n * Which runs a run history lists. Every part is optional: an agent, a subject type (`nh-system` for\n * the whole application) or one subject of it, a status, and a period by when runs were created\n * (`from` inclusive, `to` exclusive, ISO 8601). `page` starts at 1; `itemsPerPage` is 1 to\n * `NH_ASSISTANT_RUN_HISTORY_MAX_PAGE` (default 20).\n */\nexport interface AgentRunFilter {\n agentId?: string;\n subjectType?: string;\n subjectId?: string;\n status?: AgentRunStatus;\n from?: string;\n to?: string;\n page?: number;\n itemsPerPage?: number;\n}\n\n/**\n * A personal MCP server a background run left out, and why: `assistant-mcp-consent-required` (the\n * person has not allowed background use), `assistant-mcp-connection-required` or\n * `assistant-mcp-reauthorization-required` (the person's connection is missing or ended), or\n * `assistant-mcp-initiator-only` (the run acted for someone other than the person who asked). The\n * person whose consent or connection is missing is told once a day.\n */\nexport interface AgentRunMcpSkip {\n serverId: string;\n /** The server's name when the run left it out. */\n serverDisplayName: string;\n code: string;\n}\n\n/** One run in a run history: its agent, subject, trigger, status, usage, times and result preview. */\nexport interface AgentRunHistoryItem {\n id: string;\n conversationId: string;\n agentId: string;\n /**\n * The agent's name: a translation key for an agent in code, the text itself for one created in the\n * administration; `null` for an agent that no longer exists.\n */\n agentDisplayNameKey?: string | null;\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n subjectTypeName?: string | null;\n subjectLink?: string | null;\n triggerId: string;\n status: AgentRunStatus;\n failureClass: string | null;\n failureCode: string | null;\n kind: AgentRunKind;\n skill: string | null;\n initiatorActorId: string | null;\n toolCalls: number;\n modelCalls: number;\n inputTokens: number;\n outputTokens: number;\n proposalCount: number;\n /**\n * The first `NH_ASSISTANT_RESULT_PREVIEW_LENGTH` characters of the run's answer, model output to\n * show as text; for a run without a stored answer, the summary it ended with.\n */\n result: string | null;\n /** The answer is longer than `result`. */\n resultTruncated: boolean;\n /** The run worked in the agent's shadow thread: nothing it proposed executes. */\n shadow: boolean;\n createdAt: string;\n startedAt: string | null;\n endedAt: string | null;\n /** The personal MCP servers the run left out; missing on older servers. */\n mcpConnectionSkips?: AgentRunMcpSkip[];\n}\n\n/**\n * A page of a run history, newest first (`getRunHistory` for people, the administration's\n * `getAgentRuns` for every run of an agent).\n */\nexport interface AgentRunHistory {\n items: AgentRunHistoryItem[];\n /** The runs that match the filter and that the caller may see. */\n total: number;\n /**\n * People's history considered only the agent threads with the most recent matching runs; a\n * narrower filter, such as one object or a period, reaches older ones.\n */\n limited: boolean;\n}\n\n/** One run with its whole result, its proposals and its files (`getRunResult`). */\nexport interface AgentRunResult {\n run: AgentRunHistoryItem;\n /**\n * The run's whole answer as Markdown, at most `NH_ASSISTANT_RUN_RESULT_MAX_LENGTH` characters:\n * model output, untrusted. Render it only with the assistant's safe Markdown rendering\n * (`nh-assistant-run-result` does), never as HTML. `null` while the run has none.\n */\n result: string | null;\n /** The answer was longer and `result` is its beginning. */\n resultTruncated: boolean;\n /** The bounded summary the run ended with, which the agent's next runs start from. */\n summary: string | null;\n /** The proposals the caller may see: in the run's own thread and placed at objects the caller reads. */\n proposals: AgentProposal[];\n /** The proposals the run placed at objects the caller may not read. */\n hiddenProposals: number;\n /** The files the run saved; `restricted` ones cannot be downloaded by the caller. */\n artifacts: AgentArtifact[];\n /** Whether the caller may open the run's thread conversation. */\n canOpenConversation: boolean;\n}\n\nexport interface StartAgentRequest {\n agentId: string;\n subjectType: string;\n subjectId: string;\n message?: string | null;\n}\n\n/**\n * What became of a start by hand (`POST threads/start`, `POST runs/{id}/retry` with `restart`):\n * `started`, `queued`, `coalesced` with a run about to start, `superseded` the current run,\n * `ignored` or `deduplicated`; `waiting` while the agent or its skill is paused (`reasonCode`\n * `assistant-agent-paused` or `assistant-skill-paused`), so the run starts when it resumes; and\n * `deferred` until the application's transaction commits, without a run or thread yet. A refused\n * start is an HTTP error with its code, never a receipt.\n */\nexport type AgentTriggerOutcome =\n | 'started'\n | 'queued'\n | 'coalesced'\n | 'superseded'\n | 'ignored'\n | 'deduplicated'\n | 'waiting'\n | 'deferred';\n\nexport interface AgentTriggerReceipt {\n triggerId: string;\n outcome: AgentTriggerOutcome;\n runId: string | null;\n conversationId: string | null;\n /** Why the run did not start yet, such as `assistant-agent-paused` with `waiting`; `null` otherwise. */\n reasonCode: string | null;\n}\n\nexport interface AgentProposal {\n approvalId: string;\n proposalId: string;\n proposalHash: string;\n conversationId: string;\n runId: string | null;\n agentId: string;\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n /**\n * The name of the subject type in the caller's language, such as \"Project\", when the application\n * named the type; `null` or missing otherwise.\n */\n subjectTypeName?: string | null;\n /**\n * Where the application shows the subject, from the type's link template; `null` or missing\n * without one. `provideNhAssistant({ subjectLinks })` may replace it with a router link.\n */\n subjectLink?: string | null;\n toolId: string;\n summary: string;\n /**\n * The application's localized explanation, written when the proposal was recorded. Show it\n * instead of `argumentsPreview`; `null` when no presenter handled the tool.\n */\n presentation: ApprovalPresentation | null;\n argumentsPreview: string;\n targets: string[];\n status: AgentProposalStatus;\n mode: 'inline' | 'deferred';\n policyId: string | null;\n grantSource: AgentGrantSource;\n createdAt: string;\n expiresAt: string;\n initiatorActorId: string | null;\n decidedByActorId: string | null;\n /**\n * The name of `decidedByActorId` from the subject's member snapshot; `null` when the snapshot\n * does not know the person. Show `decidedByActorId` then. Missing on older servers.\n */\n decidedByDisplayName?: string | null;\n decidedAt: string | null;\n executionResultCode: string | null;\n executedAt: string | null;\n /**\n * For a proposal the application executes (`ExecuteInApplication`), until when its report of the\n * latest hand-off is due: while it is `awaiting-application` the moment it becomes\n * `execution-unknown`, afterwards the sign that an approver resolves it with `hand-to-application`\n * instead of `re-execute`. `null` for a proposal never handed to the application; missing on older\n * servers.\n */\n executionReportDueAt?: string | null;\n /**\n * The consultation that proposed it, when another assistant consulted the agent for\n * `initiatorActorId`; `consultationRoute` says who decides it and whose rights execute it.\n */\n consultationId?: string | null;\n /**\n * How a consultation's proposal is decided and whose rights execute it: `asker-decides`, the person\n * who asked (`initiatorActorId`) decides it in their own chat, nobody decides it here;\n * `subject-asker-rights`, the subject's approvers decide it and it runs with the asker's rights;\n * `subject-agent-rights`, the subject's approvers other than the asker decide it and it runs with the\n * agent's own rights (`grantSource`). `null` for a run's proposal; missing on older servers.\n */\n consultationRoute?: NhAssistantConsultationRoute | null;\n /** The caller's own feedback on the proposal; `null` when they gave none. Missing on older servers. */\n feedback?: AgentProposalFeedback | null;\n /**\n * Whether the caller may give or change feedback: the proposal was rejected, expired, withdrawn or\n * closed as stale, and the caller decided it or is an approver of the subject. Missing on older servers.\n */\n canGiveFeedback?: boolean;\n /**\n * Why a stale proposal no longer fits; `null` for other statuses. Its reason code is\n * `executionResultCode`. Missing on older servers.\n */\n staleKind?: StaleKind | null;\n /**\n * The application's explanation of a stale proposal in the caller's language, such as who already\n * did the work; `null` when it gave none. Missing on older servers.\n */\n staleExplanation?: string | null;\n /**\n * Who made the proposal stale, when the application's guard named them; `null` otherwise.\n * Missing on older servers.\n */\n staleByActorId?: string | null;\n /** The name of `staleByActorId` from the subject's member snapshot; `null` when unknown. */\n staleByDisplayName?: string | null;\n /**\n * The application objects the proposal changes, as its guards named them, so lists can group\n * proposals by object. `targets` holds execution scopes instead. Missing on older servers.\n */\n objects?: AgentProposalObject[];\n /**\n * The newer proposal for the same objects that replaced this withdrawn one; `null` otherwise.\n * Missing on older servers.\n */\n supersededByApprovalId?: string | null;\n /**\n * Why the agent's rules proposed it, in the caller's language; `null` for proposals of the model.\n * Missing on older servers.\n */\n rationale?: string | null;\n /**\n * The run that placed this proposal here from another subject, such as a run for the whole\n * application; `null` for a proposal made in this thread. Missing on older servers.\n */\n placedBy?: AgentProposalOrigin | null;\n /**\n * The subject the proposal's subject belonged to when the proposal was made, such as the project of\n * a task, as the application described it; `null` without one. The grouped inbox groups by it.\n * Missing on older servers.\n */\n parent?: AgentProposalParent | null;\n}\n\n/**\n * The subject a proposal's subject belonged to when the proposal was made. The name is the one recorded\n * then; the type's name and the link follow the application's registration of the type.\n */\nexport interface AgentProposalParent {\n subjectType: string;\n subjectId: string;\n displayName: string | null;\n /** The name of the parent's type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n /** Where the application shows the parent; `null` without a link template. */\n subjectLink?: string | null;\n}\n\n/**\n * The run that placed a proposal at another object than its own, and the thread it ran in. Its subject\n * is named only for the whole application (`subjectType` `nh-system`); for another object only its kind\n * is known, because a reader of this object may not read that one.\n */\nexport interface AgentProposalOrigin {\n /** The thread of the run that placed the proposal; opening it checks the reader's access. */\n conversationId: string;\n runId: string | null;\n /** The run's subject type; `null` when its thread no longer exists. */\n subjectType: string | null;\n /** The run's subject id for the whole application (`global` or `division-…`); `null` otherwise. */\n subjectId?: string | null;\n /** The name of the whole application or its division in the caller's language; `null` otherwise. */\n subjectDisplayName?: string | null;\n /** The name of the run's subject type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n}\n\n/** An application object a proposal changes, such as `{ type: 'project-task', id: '4711' }`. */\nexport interface AgentProposalObject {\n type: string;\n id: string;\n}\n\n/**\n * Why a person rejected a proposal. `incorrect`, `wrong-value` and `not-needed` say the agent was\n * wrong; `not-now` and `already-done` say it was right but not at this moment; `not-allowed` says\n * it went beyond what the agent should do; `other` leaves the explanation to the text.\n */\nexport type AgentProposalFeedbackCategory =\n | 'incorrect'\n | 'wrong-value'\n | 'not-needed'\n | 'not-now'\n | 'already-done'\n | 'not-allowed'\n | 'other';\n\n/** The group of a feedback category. `right-but-not-now` never counts as \"the agent was wrong\". */\nexport type AgentProposalFeedbackGroup = 'wrong' | 'right-but-not-now' | 'not-allowed' | 'other';\n\n/** The feedback categories in the order people choose them. */\nexport const NH_ASSISTANT_FEEDBACK_CATEGORIES: readonly AgentProposalFeedbackCategory[] = [\n 'incorrect',\n 'wrong-value',\n 'not-needed',\n 'not-now',\n 'already-done',\n 'not-allowed',\n 'other'\n];\n\n/** The group of each feedback category, as the server reports it. */\nexport const NH_ASSISTANT_FEEDBACK_GROUPS: Readonly<Record<AgentProposalFeedbackCategory, AgentProposalFeedbackGroup>> = {\n incorrect: 'wrong',\n 'wrong-value': 'wrong',\n 'not-needed': 'wrong',\n 'not-now': 'right-but-not-now',\n 'already-done': 'right-but-not-now',\n 'not-allowed': 'not-allowed',\n other: 'other'\n};\n\n/** Maximum length of the text of a feedback. */\nexport const NH_ASSISTANT_MAX_FEEDBACK_TEXT = 1_000;\n\n/** Maximum number of proposals one `POST approvals/feedback` request accepts. */\nexport const NH_ASSISTANT_MAX_BULK_FEEDBACK = 50;\n\n/**\n * One person's feedback on a rejected or otherwise closed proposal. It is separate from the\n * decision's reason, arrives after the decision and can be changed by its author.\n */\nexport interface AgentProposalFeedback {\n approvalId: string;\n category: AgentProposalFeedbackCategory;\n group: AgentProposalFeedbackGroup;\n text: string | null;\n /** Given once for several proposals that were rejected together. */\n bulk: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\n/** The outcome of the feedback on one proposal of `POST approvals/feedback`. */\nexport interface AgentFeedbackOutcome {\n approvalId: string;\n succeeded: boolean;\n /** For example `assistant-feedback-not-accepted`; `null` when it succeeded. */\n code: string | null;\n}\n\nexport type AgentConsultationStatus = 'running' | 'completed' | 'failed';\n\n/**\n * One consultation of a thread's agent by another assistant. It names who asked and through which\n * assistant; the question and the answer stay in the asking conversation.\n */\nexport interface AgentConsultation {\n id: string;\n askerActorId: string;\n /** The asker's name from the subject's members, when known. */\n askerDisplayName: string | null;\n askingAgentId: string | null;\n depth: number;\n status: AgentConsultationStatus;\n failureCode: string | null;\n toolCalls: number;\n inputTokens: number;\n outputTokens: number;\n proposalCount: number;\n createdAt: string;\n endedAt: string | null;\n /**\n * The proposals the consultation left per route, such as `{ 'asker-decides': 1 }`; routes without\n * proposals are left out. Missing on older servers.\n */\n proposalsByRoute?: Partial<Record<NhAssistantConsultationRoute, number>>;\n}\n\nexport interface AgentConsultationList {\n items: AgentConsultation[];\n total: number;\n}\n\nexport interface AgentInbox {\n items: AgentProposal[];\n total: number;\n /** The status the page lists. Missing on older servers, which list pending proposals only. */\n status?: AgentInboxStatus;\n /**\n * The scope whose visits mark what is new: `global`, or `division:{id}` for an inbox filtered on a\n * division. Missing on older servers.\n */\n scopeKey?: string;\n /**\n * When the caller last looked at the inbox in this scope (`visitInbox`), before this read; `null`\n * before the first visit. Missing on older servers.\n */\n lastVisitedAt?: string | null;\n /**\n * The proposals on this page made after `lastVisitedAt`; before the first visit all of them.\n * Missing on older servers, which mark nothing as new.\n */\n newApprovalIds?: string[];\n /**\n * With `grouped: true`, the groups on this page in order. The items are contiguous per group and\n * subject: the first `count` items belong to the first group, and so on. `null` or missing for the\n * flat inbox.\n */\n groups?: AgentInboxGroup[] | null;\n}\n\n/**\n * One group on a page of the grouped inbox: the parent its proposals recorded, or the subject of\n * proposals without a parent, which holds that subject's own proposals and those of its children.\n */\nexport interface AgentInboxGroup {\n subjectType: string;\n subjectId: string;\n /** The group's name: its subject's own name, or the name its proposals recorded for the parent. */\n displayName: string | null;\n /** The name of the group's type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n /** Where the application shows the group's subject; `null` without a link template. */\n subjectLink?: string | null;\n /** How many of the page's items belong to the group. */\n count: number;\n /** How many proposals of the inbox, with its filters, belong to the group. */\n total: number;\n /** The group started on the page before. */\n continuesFromPreviousPage: boolean;\n /** The group goes on on the page after. */\n continuesOnNextPage: boolean;\n /** The group's subjects on this page in order, the group's own subject first. */\n subjects: AgentInboxSubjectGroup[];\n}\n\n/** One subject within a group on a page of the grouped inbox; its name and link are those of its items. */\nexport interface AgentInboxSubjectGroup {\n subjectType: string;\n subjectId: string;\n count: number;\n total: number;\n continuesFromPreviousPage: boolean;\n continuesOnNextPage: boolean;\n}\n\n/**\n * What the approval inbox lists (`AgentInboxFilter.status`): proposals that wait for a decision\n * (the default), approved proposals of tools the application executes that wait for its report, and\n * proposals whose execution is uncertain until an approver resolves it.\n */\nexport type AgentInboxStatus = 'pending' | 'awaiting-application' | 'execution-unknown';\n\nexport interface AgentInboxFilter {\n /**\n * The status the inbox lists, with the same visibility: `pending` by expiry (the default),\n * `awaiting-application` by report deadline, `execution-unknown` by decision.\n */\n status?: AgentInboxStatus;\n subjectType?: string;\n agentId?: string;\n /** Only proposals on subjects of this division; the inbox's visits are then those of the division. */\n divisionId?: string;\n runId?: string;\n /** Groups the proposals by parent and subject (`AgentInbox.groups`) instead of by expiry alone. */\n grouped?: boolean;\n page?: number;\n itemsPerPage?: number;\n}\n\n/** A recorded visit of the inbox in one scope (`visitInbox`). */\nexport interface AgentInboxVisit {\n /** `global`, or `division:{id}` for the inbox of one division. */\n scopeKey: string;\n visitedAt: string;\n}\n\nexport type AgentProposalDecision = 'approve' | 'reject';\n\nexport interface AgentDecisionOutcome {\n approvalId: string;\n succeeded: boolean;\n code: string | null;\n status: AgentProposalStatus | null;\n}\n\nexport interface AgentThreadMemory {\n configured: boolean;\n schemaVersion: number;\n memory: unknown;\n updatedAt: string | null;\n}\n\nexport interface AgentArtifact {\n id: string;\n name: string;\n version: number;\n contentType: string;\n sizeBytes: number;\n createdAt: string;\n runId: string | null;\n restricted: boolean;\n}\n\n/** `resume` continues the run from its last checkpoint; `restart` starts a new run in the thread. */\nexport type AgentRunRetryMode = 'resume' | 'restart';\n\n/**\n * `re-execute` runs the proposal again; `hand-to-application` hands a proposal the application\n * executes (one with `executionReportDueAt`) to the application again; `mark-resolved` confirms its\n * outcome without running it.\n */\nexport type AgentExecutionResolution = 're-execute' | 'hand-to-application' | 'mark-resolved';\n\n/** A board of a group of agents the caller may open (`getBoards`). */\nexport interface AgentBoardSummary {\n /** The group id, such as `project-management`. */\n id: string;\n /** The group's name in the request's language. */\n name: string;\n /** What the group's agents do, when the application described it. */\n description: string | null;\n /** How many of the group's agents the caller sees on its board. */\n agentCount: number;\n}\n\n/** The boards the caller may open, ordered by name. */\nexport interface AgentBoardList {\n items: AgentBoardSummary[];\n}\n\n/** A kind of object as a board names it. */\nexport interface AgentBoardSubjectType {\n id: string;\n /** The name of one object in the request's language; the id without a name. */\n name: string;\n /** The name of several objects, when the application gave one. */\n pluralName: string | null;\n}\n\n/** What an agent on a board works on. */\nexport interface AgentBoardWorksOn {\n /** Every kind of object. */\n allObjects: boolean;\n /** The whole application. */\n application: boolean;\n /** Per division instead of app-wide. */\n perDivision: boolean;\n /** The kinds of objects it names, by id. */\n subjectTypes: AgentBoardSubjectType[];\n}\n\n/** One agent on a board. */\nexport interface AgentBoardAgent {\n agentId: string;\n /** A translation key for an agent in code, the text itself for one created in the administration. */\n displayNameKey: string;\n descriptionKey: string;\n worksOn: AgentBoardWorksOn;\n /**\n * `nh-system` when the agent works on the whole application in the board's scope; `null` for an\n * agent without such work there, which the board shows without a result or a start.\n */\n subjectType: string | null;\n /** `global` for an app-wide agent, `division-…` for a per-division agent on a division's board. */\n subjectId: string | null;\n /** The name of that subject in the request's language. */\n subjectDisplayName: string | null;\n /** Whether the caller may run the agent for that subject now. */\n canStart: boolean;\n /** The agent's thread of that subject, when the caller may open it. */\n conversationId: string | null;\n /** The agent's newest run for that subject; `null` before its first. */\n latestRun: AgentLatestRun | null;\n /** The open proposals of that thread. */\n openProposals: number;\n /**\n * Whether the latest run ended, or a proposal was made, after the caller's last visit of the board\n * in this scope; before the first visit everything shown is new.\n */\n isNew: boolean;\n}\n\n/** The board of one group in one scope (`getBoard`). */\nexport interface AgentBoard {\n id: string;\n name: string;\n description: string | null;\n /** `global`, or `division:{id}` for the board of one division. */\n scopeKey: string;\n divisionId: string | null;\n /** When the caller last looked at this board in this scope, before this read; `null` before the first visit. */\n lastVisitedAt: string | null;\n /** The group's agents the caller sees, ordered by id. */\n agents: AgentBoardAgent[];\n}\n\n/** A recorded visit of a board (`visitBoard`). */\nexport interface AgentBoardVisit {\n groupId: string;\n scopeKey: string;\n visitedAt: string;\n}\n","/**\n * Agent packages (S7-2): several agents with their configuration as data in one versioned package,\n * exported with `POST admin/agent-packages/export`, previewed and imported on another host with\n * `POST admin/agent-packages/preview` and `.../import` through the same validators as saving, and\n * parts the package locks against local changes until an administrator unlinks them with\n * `POST admin/agents/{id}/package/unlink`. The names are those of the server's JSON (camelCase).\n */\nimport {\n AgentAccountability,\n AgentElevatedReads,\n AssistantAutonomy,\n AssistantDataClassification,\n ConsultationSubjectRole,\n InstructionAssetReference,\n SkillApplyMode,\n TriggerConflict\n} from './assistant-admin.models';\nimport { NhAssistantConsultationRoute } from './assistant-api.models';\n\n/** The `format` of every agent package. */\nexport const NH_ASSISTANT_AGENT_PACKAGE_FORMAT = 'newheap.assistant.agent-package';\n\n/** The format version this library reads and writes; a newer one is refused. */\nexport const NH_ASSISTANT_AGENT_PACKAGE_FORMAT_VERSION = 1;\n\n/** The largest package in bytes of its UTF-8 JSON: 1 MB (`assistant-package-too-large` above). */\nexport const NH_ASSISTANT_AGENT_PACKAGE_MAX_BYTES = 1_048_576;\n\n/** The most agents of one package. */\nexport const NH_ASSISTANT_AGENT_PACKAGE_MAX_AGENTS = 20;\n\n/**\n * The kinds of part of an agent in a package. A part key is `agent`, `runSettings`, or\n * `{kind}:{id}` for a skill or trigger id, the subject type of a consultation or hand-off and the\n * name of an entry of agent metadata, such as `skill:triage`.\n */\nexport type AgentPackagePartKind = 'agent' | 'runSettings' | 'skill' | 'trigger' | 'consultation' | 'handOff' | 'metadata';\n\n/** The lock of a whole part, instead of a list of its fields. */\nexport const NH_ASSISTANT_PACKAGE_LOCK_ALL = '*';\n\n/**\n * The fields a package may lock per part kind (`NhAssistantPackageLockFields`). A save that changes a\n * locked field is refused with the field error `{field}: locked`, named as here; `worksOn`,\n * `dailyBudget`, `files` and `limits` each stand for the fields the forms show together. An agent in\n * code carries only the first six fields of `agent`.\n */\nexport const NH_ASSISTANT_PACKAGE_LOCK_FIELDS: Readonly<Record<AgentPackagePartKind, readonly string[]>> = {\n agent: ['displayName', 'description', 'instructions', 'toolSelectors', 'requiredPolicy', 'autonomy', 'offeredInChat', 'worksOn', 'profile', 'dataClassification'],\n runSettings: [\n 'accountability', 'delegateFromInitiator', 'allowGatewayReads', 'elevatedReads', 'approvalPolicy', 'retryCount', 'dailyBudget',\n 'maxConcurrentRuns', 'maxRunsPerSubjectPerDay', 'maxTokensPerRun', 'triageProfile', 'ruleHandler', 'files'\n ],\n skill: ['description', 'instructions', 'tools', 'profile', 'ruleHandler', 'maxTokensPerRun', 'dailyBudget', 'approvalPolicy', 'dataClassification', 'files'],\n trigger: ['skill', 'source', 'event', 'filters', 'cron', 'timeZone', 'subjectSet', 'message', 'conflict', 'debounceSeconds'],\n consultation: [\n 'description', 'instructions', 'minimumRole', 'askerPolicy', 'routes', 'proposalRole', 'proposalPolicy', 'toolSelectors', 'limits',\n 'allowRequests', 'exposeToMcp', 'dataClassification'\n ],\n handOff: ['sources', 'description', 'notifySource', 'maxPerSubjectPerDay'],\n metadata: ['value']\n};\n\n/**\n * A versioned agent package: several agents with what belongs to each of them as data. It never holds\n * history, candidates, runs, feedback, run state, shadow overrides, MCP server definitions, the\n * technical account or secrets; references travel as names. The server reads it strictly: an unknown\n * property, a missing required one, another `format` or a newer `formatVersion` is refused with\n * `assistant-package-format-unsupported`.\n */\nexport interface AgentPackage {\n /** Always `newheap.assistant.agent-package`. */\n format: string;\n formatVersion: number;\n package: AgentPackageInfo;\n /** 1 to 20 agents, each id once. */\n agents: PackageAgent[];\n}\n\n/** The identity of an agent package. */\nexport interface AgentPackageInfo {\n /** A dash-case id, at most 128 characters; by default the first agent's id. */\n id: string;\n /** 1 or higher; an upgrade of a linked package has a higher version. */\n version: number;\n /** What the package is for, at most 500 characters. */\n description?: string | null;\n}\n\n/**\n * One agent in a package: an agent created in the administration travels whole, an agent in code as\n * an overlay of what data may change on it, which the import applies to the same agent in code.\n */\nexport interface PackageAgent {\n /** The agent's id, kept on import. */\n id: string;\n /** `admin` for an agent created in the administration, `code` for an overlay of an agent in code. */\n source: 'admin' | 'code';\n /** The definition of an agent created here, or the overrides of an agent in code (part `agent`). */\n definition?: PackageAgentDefinition | null;\n /** The run settings of an agent created here, without the technical account (part `runSettings`). */\n runSettings?: PackageRunSettings | null;\n skills?: PackageSkill[] | null;\n triggers?: PackageTrigger[] | null;\n consultations?: PackageConsultation[] | null;\n /** The hand-offs defined as data that the agent accepts. */\n handOffs?: PackageHandOff[] | null;\n /** Its values of entries of agent metadata by name; for an agent in code only overrides of editable entries. */\n metadata?: Record<string, unknown> | null;\n /** The groups of agents it is in, by id. */\n groups?: string[] | null;\n /** The locked fields per part key, each `['*']` or fields of `NH_ASSISTANT_PACKAGE_LOCK_FIELDS`. */\n locks?: Record<string, string[]> | null;\n /** The SHA-256 of each part's canonical JSON by part key, lowercase hex; optional for a package a tool writes. */\n hashes?: Record<string, string> | null;\n}\n\n/**\n * The definition of an agent. For an agent in code only `displayName`, `description`, `instructions`,\n * `toolSelectors`, `requiredPolicy` and `autonomy` apply; a missing value keeps the code's.\n */\nexport interface PackageAgentDefinition {\n displayName?: string | null;\n description?: string | null;\n instructions?: string | null;\n instructionsAsset?: InstructionAssetReference | null;\n toolSelectors?: string[] | null;\n requiredPolicy?: string | null;\n autonomy?: AssistantAutonomy | null;\n offeredInChat?: boolean | null;\n worksOnSubjectTypes?: string[] | null;\n worksOnAllSubjects?: boolean | null;\n worksOnApplication?: boolean | null;\n perDivision?: boolean | null;\n runPolicy?: string | null;\n viewPolicy?: string | null;\n profile?: string | null;\n dataClassification?: AssistantDataClassification | null;\n /** For a new agent: it starts off. */\n startsOff?: boolean | null;\n /** For a new agent: it starts in shadow. */\n startsInShadow?: boolean | null;\n /** The live agent a data shadow variant belongs to: another agent of the package or one the host has. */\n shadowOf?: string | null;\n}\n\n/** The run settings of an agent created in the administration; the technical account never travels. */\nexport interface PackageRunSettings {\n accountability: AgentAccountability;\n delegateFromInitiator?: boolean;\n allowGatewayReads?: boolean;\n elevatedReads?: AgentElevatedReads | null;\n approvalPolicy?: string | null;\n retryCount?: number | null;\n dailyToolCalls?: number | null;\n dailyTokens?: number | null;\n maxConcurrentRuns?: number | null;\n maxRunsPerSubjectPerDay?: number | null;\n maxTokensPerRun?: number | null;\n triageProfile?: string | null;\n ruleHandler?: string | null;\n acceptsFiles?: boolean;\n maxFileBytes?: number | null;\n maxFilePages?: number | null;\n maxFilesPerTurn?: number | null;\n maxFileTokensPerTurn?: number | null;\n}\n\n/** The live version of a data skill. */\nexport interface PackageSkill {\n id: string;\n description: string;\n instructions?: string | null;\n instructionsAsset?: InstructionAssetReference | null;\n tools?: string[] | null;\n profile?: string | null;\n ruleHandler?: string | null;\n maxTokensPerRun?: number | null;\n dailyToolCalls?: number | null;\n dailyTokens?: number | null;\n approvalPolicy?: string | null;\n dataClassification?: AssistantDataClassification | null;\n acceptsFiles?: boolean;\n maxFileBytes?: number | null;\n maxFilePages?: number | null;\n maxFilesPerTurn?: number | null;\n maxFileTokensPerTurn?: number | null;\n /** For a new skill: it starts off. */\n startsOff?: boolean | null;\n}\n\n/** The live version of a data trigger; its id stays on import. */\nexport interface PackageTrigger {\n id: string;\n source: 'event' | 'schedule';\n skill?: string | null;\n event?: string | null;\n filters?: string[] | null;\n cron?: string | null;\n timeZone?: string | null;\n subjectSet?: string | null;\n message?: string | null;\n conflict?: TriggerConflict | null;\n debounceSeconds?: number | null;\n}\n\n/** A consultation defined as data. */\nexport interface PackageConsultation {\n subjectType: string;\n description: string;\n instructions?: string | null;\n minimumRole?: ConsultationSubjectRole | null;\n askerPolicy?: string | null;\n routes?: NhAssistantConsultationRoute[] | null;\n proposalRole?: ConsultationSubjectRole | null;\n proposalPolicy?: string | null;\n toolSelectors?: string[] | null;\n maxToolCalls?: number | null;\n timeoutSeconds?: number | null;\n maxAnswerChars?: number | null;\n maxHistoryMessages?: number | null;\n allowRequests?: boolean;\n exposeToMcp?: boolean;\n dataClassification?: AssistantDataClassification | null;\n /** For a new consultation: it starts off. */\n startsOff?: boolean | null;\n}\n\n/** A hand-off defined as data that the agent accepts; a source may be another agent of the package. */\nexport interface PackageHandOff {\n subjectType: string;\n sources: string[];\n description?: string | null;\n notifySource?: boolean;\n maxPerSubjectPerDay?: number | null;\n}\n\n/** How an export builds its package. */\nexport interface AgentPackageExportOptions {\n /** By default the id of the package the first agent is linked to, otherwise the first agent's id. */\n packageId?: string | null;\n /** By default the next version after the linked package's, otherwise 1. */\n version?: number | null;\n /** At most 500 characters. */\n description?: string | null;\n /** Per agent id, the locked fields per part key, each `['*']` or lockable fields of the part's kind. */\n locks?: Record<string, Record<string, string[]>> | null;\n}\n\n/** Body of `POST admin/agent-packages/export`. */\nexport interface AgentPackageExportRequest {\n /** The agents to export, 1 to 20; exactly these. */\n agentIds: string[];\n options?: AgentPackageExportOptions | null;\n}\n\n/** What a reference to an agent outside the exported selection is. */\nexport type AgentPackageWarningCode = 'hand-off-source' | 'shadow-of' | 'consultation-asker' | 'shadow-variant' | (string & {});\n\n/** A reference of an exported agent to an agent outside the selection, which must exist where the package is imported. */\nexport interface AgentPackageWarning {\n /** The exported agent. */\n agentId: string;\n /** The part that makes the reference, such as `handOff:project`. */\n part: string;\n code: AgentPackageWarningCode;\n /** The agent outside the selection. */\n referencedAgentId: string;\n}\n\n/**\n * An exported package as `exportAgentPackage` answers it: the package, its JSON exactly as the server\n * wrote it for the download, and the references to agents outside the selection.\n */\nexport interface AgentPackageExport {\n package: AgentPackage;\n /** The JSON of the download, `agent-package-{packageId}.json`. */\n json: string;\n /** Every reference to an agent outside the selection (header `X-NewHeap-Package-Warnings`). */\n warnings: AgentPackageWarning[];\n}\n\n/** A part of an agent; without `part` every part of the agent. */\nexport interface PackagePartReference {\n agentId: string;\n part?: string | null;\n}\n\n/** How an import applies a package. */\nexport interface AgentPackageImportOptions {\n /**\n * Per agent id, the technical account on this host for run settings that answer to one; without it\n * such run settings are refused with `serviceAccountActorId: required`.\n */\n serviceAccounts?: Record<string, string> | null;\n /**\n * `live` (default): a changed skill or trigger becomes its new live version; `shadow`: its candidate\n * next to the live version. New skills and triggers start in shadow either way.\n */\n apply?: SkillApplyMode | null;\n /** Unlinked parts that take the package's version again instead of staying `kept-local`. */\n relink?: PackagePartReference[] | null;\n}\n\n/** Body of `POST admin/agent-packages/preview` and `POST admin/agent-packages/import`. */\nexport interface AgentPackageImportRequest {\n /** The package as JSON; the server reads it strictly. */\n package: AgentPackage;\n options?: AgentPackageImportOptions | null;\n}\n\n/** What an import does or did with one part. */\nexport type AgentPackagePartOutcome = 'created' | 'changed' | 'unchanged' | 'kept-local' | 'left-behind' | 'refused';\n\n/** The outcome of one part in a preview or an import. */\nexport interface AgentPackagePart {\n agentId: string;\n /** The part key, such as `agent` or `skill:triage`. */\n part: string;\n outcome: AgentPackagePartOutcome;\n /** The host's part changed after the last import: the import overwrites its unlocked fields. */\n changedLocally: boolean;\n /** For a refused part without field errors: its failure code, such as `assistant-agent-exists`. */\n code: string | null;\n /** For a refused part: the field errors of the save validators, by field. */\n errors: Record<string, string[]> | null;\n /** The fields the package locks on the part, `['*']` for all. */\n lockedFields: string[];\n /** For a skill or trigger an import makes a candidate of (`apply: shadow`): the candidate's version. */\n candidateVersion?: number | null;\n}\n\n/** What an import would do: the parts per agent in dependency order, left-behind agents and parts last. */\nexport interface AgentPackagePreview {\n packageId: string;\n packageVersion: number;\n /** The version of the package the host has; `null` for a package it does not have. */\n installedVersion: number | null;\n /** No part is refused. */\n importable: boolean;\n parts: AgentPackagePart[];\n}\n\n/** What an import did: every part's outcome, as the preview showed it. */\nexport interface AgentPackageImport {\n packageId: string;\n packageVersion: number;\n /** The SHA-256 of the package's canonical JSON, lowercase hex, as audited. */\n hash: string;\n parts: AgentPackagePart[];\n}\n\n/** Body of `POST admin/agents/{id}/package/unlink`. */\nexport interface AgentPackageUnlinkRequest {\n /** The part key to unlink; `null` or missing unlinks the whole agent. */\n part?: string | null;\n /** At most 500 characters. */\n reason?: string | null;\n}\n\n/** The parts an unlink took out of their package. */\nexport interface AgentPackageUnlink {\n agentId: string;\n packageId: string;\n /** The part keys that are now local. */\n parts: string[];\n}\n\n/**\n * The package link of one part, as the administration shows it next to the part: the package it came\n * from and the fields that stay read-only.\n */\nexport interface PackagePartLink {\n part: string;\n packageId: string;\n /** The version of the package the part was imported from. */\n packageVersion: number;\n /** The locked fields, `['*']` for all; empty when the package locks none. */\n lockedFields: string[];\n /** The SHA-256 of the part's canonical JSON at import. */\n hash: string;\n /** The part changed after its import; the next upgrade overwrites its unlocked fields. */\n changedLocally: boolean;\n linkedAt: string;\n linkedBy: string;\n}\n\n/** The package an agent belongs to, with the link of every part that is still linked. */\nexport interface AgentPackageLink {\n packageId: string;\n /** The version of the package the host has. */\n packageVersion: number;\n /** The linked parts, ordered by part key. */\n parts: PackagePartLink[];\n}\n","import { InjectionToken, Type } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { ClientContext } from './models/assistant-api.models';\n\n/** Decides whether the current user may see and use the assistant. */\nexport interface NhAssistantAccessPolicy {\n canUse(): boolean | Observable<boolean>;\n}\n\nexport interface NhAssistantConfig {\n /** Base URL of the assistant endpoints, for example `environment.api.baseUrl + '/assistant'`. */\n apiBaseUrl: string;\n /**\n * Returns the caller's bearer token, or null when the request should be anonymous. It runs\n * in the injection context of the assistant scope before every request, so it may call\n * `inject(...)`, for example `() => inject(MyAuthService).getAuthorization()?.token ?? null`.\n */\n getAccessToken: () => string | null | Promise<string | null>;\n /**\n * Returns extra headers for every assistant request, for example the NewHeap active division:\n * `() => ({ 'X-NH-ActiveDivisionId': inject(MyAuthService).getAuthorization()?.activeDivision?.id ?? '' })`.\n * Runs in the assistant's injection context before every request, like `getAccessToken`, and\n * when the live-update connection starts. `Authorization`, `Accept`, `Accept-Language` and\n * `Content-Type` stay under the library's control, and empty values are left out. Browsers send\n * no custom headers with the WebSocket and server-sent event transports of the live connection;\n * pass what the hub needs with `getHubQueryParameters`. Default: none.\n */\n getRequestHeaders?: () => Record<string, string> | null | Promise<Record<string, string> | null>;\n /**\n * Returns query parameters for the live-update hub URL: the values the hub needs that browsers\n * cannot send as headers, because the WebSocket and server-sent event transports carry none.\n * Without them a hub that requires such a value refuses those transports and the connection\n * falls back to long polling. For example the NewHeap active division, which the platform's JWT\n * handler copies from `divisionId` to `X-NH-ActiveDivisionId` on `/hub` paths:\n * `() => ({ divisionId: inject(MyAuthService).getAuthorization()?.activeDivision?.id ?? '' })`.\n * Runs in the assistant's injection context each time the connection starts. `access_token`,\n * `id` and `negotiateVersion` stay under the control of the library and SignalR, empty values\n * are left out and a failing getter only leaves the parameters out. Never return a secret: URLs\n * appear in server and proxy logs. Default: none.\n */\n getHubQueryParameters?: () => Record<string, string> | null | Promise<Record<string, string> | null>;\n /**\n * Returns what the user has open, sent with each message as untrusted page context.\n * Runs in the assistant's injection context when the panel opens and before every\n * message, like `getAccessToken`. The library validates and truncates the result; a\n * failing getter or an invalid shape only leaves the context out. Default: none.\n */\n getPageContext?: () => ClientContext | null | Promise<ClientContext | null>;\n /**\n * Stable, non-secret identity for browser UI state (for example a user id plus tenant id).\n * Runs in the assistant injection context. Return null on sign-out. Without this callback\n * the assistant keeps UI state in memory only. Never return an access token.\n */\n getStateScope?: () => string | null | Promise<string | null>;\n /** Injectable access policy. Default: always allowed. */\n accessPolicy?: Type<NhAssistantAccessPolicy>;\n /** Agent selected when the user has not chosen one. Default: the first agent the server lists. */\n defaultAgentId?: string;\n /** `'bundled'` merges the library's `en` and `nl` texts into `TranslateService`; `'host'` leaves translations to the host. Default `'bundled'`. */\n translations?: 'bundled' | 'host';\n /**\n * Router link of the host's assistant administration page. The panel shows a link to it\n * only when the server reports `canAdminister`. Default: no link.\n */\n adminRoute?: string | any[];\n /** Renders assistant text as sanitized Markdown. Default `{ enabled: true }`. */\n markdown?: { enabled: boolean };\n /**\n * Live updates of shared and parallel conversations through the server's SignalR hub, which\n * `GET status` reports. Uses `@microsoft/signalr`, loaded on first use. Default `true`; when off\n * or unavailable the assistant reloads snapshots instead.\n */\n liveUpdates?: boolean;\n /**\n * Base the server's hub path is appended to, for example `'/api'` when a proxy serves the API\n * below a prefix, as for the NewHeap background operation hub. Default: the origin of `apiBaseUrl`.\n */\n hubBaseUrl?: string;\n /**\n * Web Push notifications for people who are away. Copy the bundled worker from\n * `node_modules/@newheap/platform-ai-chat/push` into the application's assets and point\n * `serviceWorkerUrl` to it. Without this setting the assistant never subscribes the browser.\n */\n push?: NhAssistantPushConfig;\n /**\n * Builds the invitation link an owner copies. Default: the current page with\n * `#nh-assistant-join=<conversationId>.<token>`; the panel joins when the page opens with it.\n */\n buildShareLink?: (conversationId: string, token: string) => string;\n /**\n * Replaces the server's links to subjects, which come from the link template of the subject type\n * (`AddSubjectType(...).OpenAt(\"/projects/{id}\")`), with the host's own routes, per subject type:\n * for example `{ project: subject => ['/projects', subject.id] }`. Return router commands or a URL\n * within the application, `null` to show no link, or `undefined` to keep the server's link.\n * Runs in the assistant's injection context. Default: the server's links.\n */\n subjectLinks?: Record<string, NhAssistantSubjectLinkBuilder>;\n /**\n * How MCP authorizations open. `popup` (default) opens a window from the click and stays on the\n * page. `redirect` sends the page to the authorization server and back to `mcpConnectReturnUrl`,\n * where the assistant completes the connection; its origin must be in\n * `NewHeap:AI:Assistant:Mcp:OAuth:ReturnOrigins`.\n */\n mcpConnectMode?: 'popup' | 'redirect';\n /** The page a redirect-mode authorization returns to. Default: the current address without its fragment. */\n mcpConnectReturnUrl?: () => string;\n}\n\n/** A subject an agent works on, by its type and id. */\nexport interface NhAssistantSubjectRef {\n type: string;\n id: string;\n}\n\n/**\n * Builds the link to one subject in the host application: router commands such as\n * `['/projects', subject.id]`, a URL such as `/projects/7`, `null` for no link, or `undefined` to keep\n * the server's link.\n */\nexport type NhAssistantSubjectLinkBuilder = (subject: NhAssistantSubjectRef) => readonly unknown[] | string | null | undefined;\n\nexport interface NhAssistantPushConfig {\n /** URL of the bundled worker, for example `/nh-assistant/nh-assistant-push-worker.js`. */\n serviceWorkerUrl: string;\n /**\n * Scope of the worker. Default: the worker's folder. Keep it apart from an application service\n * worker; the assistant worker only shows notifications and never controls pages.\n */\n scope?: string;\n /** Page a notification opens when no window of the application is open. Default `/`. */\n openUrl?: string;\n /** Icon URL of the notifications. */\n icon?: string;\n}\n\nexport const NH_ASSISTANT_CONFIG = new InjectionToken<NhAssistantConfig>('NH_ASSISTANT_CONFIG');\n\nexport const NH_ASSISTANT_ACCESS_POLICY = new InjectionToken<NhAssistantAccessPolicy>('NH_ASSISTANT_ACCESS_POLICY');\n\n/** The `fetch` function type the assistant client uses. */\nexport type NhAssistantFetch = (input: string, init: RequestInit) => Promise<Response>;\n\n/**\n * Transport used by the assistant client. It is deliberately independent of the host's\n * `HttpClient` and interceptors, because streaming responses need `fetch` and the access\n * token comes from `NhAssistantConfig.getAccessToken`. Tests and the mock API from\n * `@newheap/platform-ai-chat/testing` replace it.\n */\nexport const NH_ASSISTANT_FETCH = new InjectionToken<NhAssistantFetch>('NH_ASSISTANT_FETCH', {\n providedIn: 'root',\n factory: () => (input: string, init: RequestInit) => globalThis.fetch(input, init)\n});\n\n/** One file upload of the assistant client, which reports how much of the body was sent. */\nexport interface NhAssistantUploadRequest {\n url: string;\n /** The request headers; never `Content-Type`, which the browser sets with the multipart boundary. */\n headers: Record<string, string>;\n body: FormData;\n signal: AbortSignal;\n /** Called while the body is sent, with the bytes sent so far and the total. */\n onProgress: (loaded: number, total: number) => void;\n}\n\n/** Sends an upload and resolves with the server's response; rejects when the request did not reach the server. */\nexport type NhAssistantUpload = (request: NhAssistantUploadRequest) => Promise<Response>;\n\n/**\n * Sends the uploads of the assistant client. The default uses `XMLHttpRequest`, because `fetch` does\n * not report upload progress. The mock API from `@newheap/platform-ai-chat/testing` replaces it.\n */\nexport const NH_ASSISTANT_UPLOAD = new InjectionToken<NhAssistantUpload>('NH_ASSISTANT_UPLOAD', {\n providedIn: 'root',\n factory: () => nhAssistantXhrUpload\n});\n\n/** The default upload: `XMLHttpRequest` with upload progress, answered as a `Response`. */\nexport function nhAssistantXhrUpload(request: NhAssistantUploadRequest): Promise<Response> {\n return new Promise<Response>((resolve, reject) => {\n if (request.signal.aborted) {\n reject(new DOMException('The upload was aborted.', 'AbortError'));\n return;\n }\n\n const xhr = new XMLHttpRequest();\n const abort = () => xhr.abort();\n request.signal.addEventListener('abort', abort, { once: true });\n const finish = () => request.signal.removeEventListener('abort', abort);\n\n xhr.open('POST', request.url);\n for (const [name, value] of Object.entries(request.headers)) {\n xhr.setRequestHeader(name, value);\n }\n xhr.upload.onprogress = event => {\n if (event.lengthComputable) {\n request.onProgress(event.loaded, event.total);\n }\n };\n xhr.onload = () => {\n finish();\n const contentType = xhr.getResponseHeader('content-type');\n resolve(new Response(xhr.status === 204 ? null : xhr.responseText, {\n status: xhr.status,\n headers: contentType ? { 'content-type': contentType } : {}\n }));\n };\n xhr.onerror = () => {\n finish();\n reject(new TypeError('The upload did not reach the server.'));\n };\n xhr.onabort = () => {\n finish();\n reject(new DOMException('The upload was aborted.', 'AbortError'));\n };\n xhr.send(request.body);\n });\n}\n\n/** Default policy: every user who can reach the host may use the assistant. */\nexport class NhAssistantAllowAllAccessPolicy implements NhAssistantAccessPolicy {\n canUse(): boolean {\n return true;\n }\n}\n","import { DestroyRef, Injectable, inject } from '@angular/core';\nimport { TranslateService, TranslationObject } from '@ngx-translate/core';\nimport { merge } from 'rxjs';\nimport en from './en.json';\nimport nl from './nl.json';\n\n/** Translation bundles of one entry point, keyed by language. All keys live under `nh-assistant.`. */\ntype NhAssistantTranslationBundles = Readonly<Record<'en' | 'nl', TranslationObject>>;\n\n/**\n * The library's own translation bundles, keyed by language. All keys live under `nh-assistant.`.\n * The administration's `nh-assistant.admin.` texts come with `@newheap/platform-ai-chat/admin` as\n * `NH_ASSISTANT_ADMIN_TRANSLATIONS`, so they load with the administration instead of with the panel.\n */\nexport const NH_ASSISTANT_TRANSLATIONS: NhAssistantTranslationBundles = { en, nl };\n\ntype TranslationTree = { [key: string]: unknown };\n\nconst rootKey = 'nh-assistant';\n\nfunction isTree(value: unknown): value is TranslationTree {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** Deep merge where values of `override` win. */\nfunction mergeTrees(base: TranslationTree, override: TranslationTree): TranslationTree {\n const result: TranslationTree = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const current = result[key];\n result[key] = isTree(current) && isTree(value) ? mergeTrees(current, value) : value;\n }\n return result;\n}\n\n/**\n * The bundle of a language: its own, else that of its base language, so a regional tag such as\n * `nl-NL`, `nl_BE` or `en-GB` gets the `nl` or `en` texts, else English.\n */\nfunction bundleOf(bundles: NhAssistantTranslationBundles, language: string): TranslationTree {\n for (const candidate of [language, language.split(/[-_]/)[0]].map(tag => tag.toLowerCase())) {\n if (Object.hasOwn(bundles, candidate)) {\n return bundles[candidate as keyof NhAssistantTranslationBundles] as TranslationTree;\n }\n }\n return bundles.en as TranslationTree;\n}\n\nfunction hasAllKeys(bundle: TranslationTree, candidate: unknown): boolean {\n if (!isTree(candidate)) {\n return false;\n }\n\n return Object.entries(bundle).every(([key, value]) =>\n isTree(value) ? hasAllKeys(value, candidate[key]) : key in candidate\n );\n}\n\nfunction ensure(translate: TranslateService, bundles: NhAssistantTranslationBundles, language: string, existing: unknown): void {\n const bundleRoot = bundleOf(bundles, language)[rootKey] as TranslationTree;\n if (hasAllKeys(bundleRoot, existing)) {\n return;\n }\n\n const merged = mergeTrees(bundleRoot, isTree(existing) ? existing : {});\n translate.setTranslation(language, { [rootKey]: merged } as TranslationObject, true);\n}\n\n/**\n * Merges `bundles` into `TranslateService` whenever the host loads or replaces a language, and\n * into the current language at once, until `destroyRef` is destroyed. Keys the host defines under\n * `nh-assistant.` win. Shared with the secondary entry points that bring texts of their own.\n */\nexport function nhAssistantMergeTranslations(\n translate: TranslateService,\n bundles: NhAssistantTranslationBundles,\n destroyRef: DestroyRef\n): void {\n const subscription = merge(translate.onTranslationChange, translate.onLangChange).subscribe(event => {\n if (event.lang && isTree(event.translations)) {\n ensure(translate, bundles, event.lang, event.translations[rootKey]);\n }\n });\n destroyRef.onDestroy(() => subscription.unsubscribe());\n\n // The current language is loaded or already requested by the host, so merging into it\n // never pre-empts the host loader; a later load triggers a new merge.\n const current = translate.getCurrentLang();\n if (current) {\n ensure(translate, bundles, current, translate.instant(rootKey));\n }\n}\n\n/**\n * Merges the bundled texts into `TranslateService` whenever the host loads or replaces a\n * language. Host loaders never lose the library texts, the library never pre-empts the\n * host loader, and keys the host defines under `nh-assistant.` (agent names, overrides)\n * win over the bundle. A regional language such as `nl-NL` receives the texts of its base\n * language; languages without a bundle receive the English texts.\n */\n@Injectable({ providedIn: 'root' })\nexport class NhAssistantTranslationMerger {\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n private started = false;\n\n start(): void {\n const translate = this.translate;\n if (this.started || !translate) {\n return;\n }\n this.started = true;\n\n nhAssistantMergeTranslations(translate, NH_ASSISTANT_TRANSLATIONS, this.destroyRef);\n }\n}\n","/** One raw server-sent event before its data is interpreted. */\nexport interface NhAssistantRawSseMessage {\n event: string;\n data: string;\n}\n\n/**\n * Incremental parser for the `text/event-stream` format.\n *\n * Feed decoded text chunks in arrival order. Chunks may split lines, fields and line\n * terminators anywhere. Comment lines (starting with `:`, such as the `: keep-alive`\n * heartbeat) are ignored; `id` and `retry` fields are accepted and ignored. An event is\n * dispatched at the empty line that terminates it. An unterminated event at the end of\n * the stream is discarded, as the SSE specification requires.\n */\nexport class NhAssistantSseParser {\n private buffer = '';\n private eventName = '';\n private dataLines: string[] = [];\n\n push(chunk: string): NhAssistantRawSseMessage[] {\n this.buffer += chunk;\n\n const messages: NhAssistantRawSseMessage[] = [];\n let lineStart = 0;\n\n for (let index = 0; index < this.buffer.length; index++) {\n const character = this.buffer[index];\n if (character !== '\\n' && character !== '\\r') {\n continue;\n }\n\n if (character === '\\r' && index === this.buffer.length - 1) {\n // A trailing CR may be the first half of a CRLF split across chunks.\n break;\n }\n\n const line = this.buffer.slice(lineStart, index);\n if (character === '\\r' && this.buffer[index + 1] === '\\n') {\n index++;\n }\n lineStart = index + 1;\n\n const message = this.processLine(line);\n if (message) {\n messages.push(message);\n }\n }\n\n this.buffer = this.buffer.slice(lineStart);\n return messages;\n }\n\n /** Signals the end of the stream and returns an event that a trailing CR completed. */\n end(): NhAssistantRawSseMessage[] {\n const messages: NhAssistantRawSseMessage[] = [];\n if (this.buffer.endsWith('\\r')) {\n const message = this.processLine(this.buffer.slice(0, -1));\n if (message) {\n messages.push(message);\n }\n }\n\n this.buffer = '';\n this.eventName = '';\n this.dataLines = [];\n return messages;\n }\n\n private processLine(line: string): NhAssistantRawSseMessage | null {\n if (line.length === 0) {\n return this.dispatch();\n }\n\n if (line.startsWith(':')) {\n return null;\n }\n\n const colonIndex = line.indexOf(':');\n const field = colonIndex < 0 ? line : line.slice(0, colonIndex);\n let value = colonIndex < 0 ? '' : line.slice(colonIndex + 1);\n if (value.startsWith(' ')) {\n value = value.slice(1);\n }\n\n if (field === 'event') {\n this.eventName = value;\n } else if (field === 'data') {\n this.dataLines.push(value);\n }\n\n return null;\n }\n\n private dispatch(): NhAssistantRawSseMessage | null {\n const hasData = this.dataLines.length > 0;\n const message: NhAssistantRawSseMessage = {\n event: this.eventName || 'message',\n data: this.dataLines.join('\\n')\n };\n\n this.eventName = '';\n this.dataLines = [];\n\n return hasData ? message : null;\n }\n}\n","import { EnvironmentInjector, Injectable, inject, runInInjectionContext } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { Observable, Subscriber } from 'rxjs';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NH_ASSISTANT_CONFIG, NH_ASSISTANT_FETCH, NH_ASSISTANT_UPLOAD, NhAssistantConfig } from '../nh-assistant.config';\n\n/**\n * The request header every upload carries. A browser cannot send it with a cross-site form, so the\n * upload endpoint keeps the posture of the JSON endpoints.\n */\nexport const NH_ASSISTANT_UPLOAD_HEADER = 'X-NH-Assistant-Upload';\n\n/** A failed JSON request of the assistant API. Carries a stable code, never response text. */\nexport class NhAssistantApiError extends Error {\n constructor(\n readonly status: number,\n readonly code: string,\n readonly messageKey: string,\n /**\n * The field errors of the error body, whatever its code (for example `assistant-validation` or\n * `assistant-run-filter-invalid`): camelCase field names, dotted for nested settings such as\n * `oauth.clientId`, with stable values such as `required`, `invalid`, `too-long` or `not-found`.\n * Empty when the body names none.\n */\n readonly fieldErrors: Readonly<Record<string, readonly string[]>> = {}\n ) {\n super(code);\n this.name = 'NhAssistantApiError';\n }\n}\n\n/** Translation key that belongs to a failure code. */\nexport function nhAssistantErrorMessageKey(code: string): string {\n return `nh-assistant.errors.${code}`;\n}\n\n/** Maps an HTTP status of the assistant API to a stable client failure code. */\nexport function nhAssistantCodeForStatus(status: number): string {\n if (status === 0) {\n return NhAssistantClientErrorCodes.network;\n }\n if (status === 400) {\n return NhAssistantClientErrorCodes.validation;\n }\n if (status === 401) {\n return NhAssistantClientErrorCodes.unauthenticated;\n }\n if (status === 403) {\n return NhAssistantClientErrorCodes.forbidden;\n }\n if (status === 404) {\n return NhAssistantClientErrorCodes.notFound;\n }\n if (status === 409) {\n return NhAssistantClientErrorCodes.conversationBusy;\n }\n\n return NhAssistantClientErrorCodes.server;\n}\n\n/** Status-specific codes that replace the generic mapping for one endpoint. */\nexport type NhAssistantStatusCodes = Partial<Record<number, string>>;\n\n/** A file the assistant API answered, as its text with the response's headers (internal). */\nexport interface NhAssistantFileResponse {\n text: string;\n headers: Headers;\n}\n\nconst safeCode = /^[a-z0-9][a-z0-9.-]{0,79}$/;\nconst safeField = /^[a-zA-Z][a-zA-Z0-9.]{0,63}$/;\n/** A field of one item of a list, such as `readers[0].toolName`. */\nconst safeItemField = /^[a-zA-Z][a-zA-Z0-9]{0,31}\\[\\d{1,4}\\](\\.[a-zA-Z][a-zA-Z0-9]{0,31})?$/;\n\n/**\n * Whether a value the server or a callback page sent is a code the library may show: lowercase\n * letters, digits, dots and dashes, at most 80 characters. Every reader of untrusted codes uses this\n * one check, so a code never carries free text into a translation key.\n */\nexport function nhAssistantIsSafeCode(value: unknown): value is string {\n return typeof value === 'string' && safeCode.test(value);\n}\n\n/**\n * Shared transport of the assistant services: `fetch` with the host's token, the current\n * language and stable failure codes. Internal to the library.\n */\n@Injectable()\nexport class NhAssistantTransport {\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly fetchFn = inject(NH_ASSISTANT_FETCH);\n private readonly uploadFn = inject(NH_ASSISTANT_UPLOAD);\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly injector = inject(EnvironmentInjector);\n\n /** A cold JSON request that aborts on unsubscribe and errors with `NhAssistantApiError`. */\n json<T>(method: string, path: string, body?: unknown, statusCodes: NhAssistantStatusCodes = {}): Observable<T> {\n return new Observable<T>(subscriber => {\n const abort = new AbortController();\n\n void this.executeJson<T>(method, path, body, statusCodes, abort.signal, subscriber);\n\n return () => abort.abort();\n });\n }\n\n /**\n * A cold request with a JSON body that answers the response's text and headers, for an endpoint that\n * answers a file with details in a header, such as the export of an agent package. It aborts on\n * unsubscribe and errors as `json` does: with the code and field errors of a refused request's error\n * body, the endpoint's status mapping without one, and `assistant-network` when the request did not\n * reach the server.\n */\n file(method: string, path: string, body: unknown, accept: string, statusCodes: NhAssistantStatusCodes = {}): Observable<NhAssistantFileResponse> {\n return new Observable<NhAssistantFileResponse>(subscriber => {\n const abort = new AbortController();\n\n void this.executeFile(method, path, body, accept, statusCodes, abort.signal, subscriber);\n\n return () => abort.abort();\n });\n }\n\n async fetch(method: string, path: string, accept: string, body: unknown, signal: AbortSignal): Promise<Response> {\n const init = await this.createInit(method, accept, body, signal);\n return this.fetchFn(this.url(path), init);\n }\n\n /**\n * Uploads `form` with progress and resolves with the parsed JSON answer. Rejects with\n * `NhAssistantApiError`, never with raw text: the code of a refused upload's error body, the\n * generic status mapping without one and `assistant-network` when it did not reach the server.\n * An aborted upload rejects with an `AbortError`.\n */\n async upload<T>(path: string, form: FormData, onProgress: (loaded: number, total: number) => void, signal: AbortSignal): Promise<T> {\n const headers = await this.headers('application/json');\n headers[NH_ASSISTANT_UPLOAD_HEADER] = '1';\n let response: Response;\n try {\n response = await this.uploadFn({ url: this.url(path), headers, body: form, signal, onProgress });\n } catch (error) {\n if (signal.aborted) {\n throw error;\n }\n throw createApiError(0, nhAssistantCodeForStatus(0));\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, {});\n throw createApiError(response.status, failure.code, failure.fieldErrors);\n }\n\n try {\n return JSON.parse(await response.text()) as T;\n } catch {\n throw createApiError(response.status, NhAssistantClientErrorCodes.invalidResponse);\n }\n }\n\n /**\n * Downloads a file of the assistant API. Rejects with `NhAssistantApiError`, never with raw text:\n * the code and field errors of a refused request's error body (whatever its content type), the\n * endpoint's status mapping without one, `assistant-network` when the request did not reach the\n * server and `assistant-stream-interrupted` when the file broke off while it was read.\n */\n async download(path: string, accept: string, statusCodes: NhAssistantStatusCodes = {}): Promise<Blob> {\n let response: Response;\n try {\n response = await this.fetch('GET', path, accept, undefined, new AbortController().signal);\n } catch {\n throw createApiError(0, nhAssistantCodeForStatus(0));\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, statusCodes);\n throw createApiError(response.status, failure.code, failure.fieldErrors);\n }\n\n try {\n return await response.blob();\n } catch {\n throw createApiError(response.status, NhAssistantClientErrorCodes.streamInterrupted);\n }\n }\n\n /**\n * The failure code of a response: a safe `code` field of a JSON error body wins, then the\n * endpoint's status mapping, then the generic mapping. Response text is never used.\n */\n async failureCode(response: Response, statusCodes: NhAssistantStatusCodes = {}): Promise<string> {\n return (await this.failure(response, statusCodes)).code;\n }\n\n /**\n * The failure code of a response and the field errors of its body, both checked against safe\n * patterns. Response text is never used.\n */\n private async failure(\n response: Response,\n statusCodes: NhAssistantStatusCodes\n ): Promise<{ code: string; fieldErrors: Record<string, string[]> }> {\n const fieldErrors: Record<string, string[]> = {};\n try {\n const text = await response.text();\n const body = text.length > 0 ? JSON.parse(text) as unknown : null;\n const record = body && typeof body === 'object' ? body as Record<string, unknown> : null;\n const errors = record?.['errors'];\n if (errors && typeof errors === 'object' && !Array.isArray(errors)) {\n for (const [field, values] of Object.entries(errors as Record<string, unknown>)) {\n const safe = Array.isArray(values) ? values.filter(nhAssistantIsSafeCode) : [];\n if ((safeField.test(field) || safeItemField.test(field)) && safe.length > 0) {\n fieldErrors[field] = safe;\n }\n }\n }\n const code = record?.['code'];\n if (nhAssistantIsSafeCode(code)) {\n return { code, fieldErrors };\n }\n } catch {\n // A non-JSON error body carries no code.\n }\n\n return { code: statusCodes[response.status] ?? nhAssistantCodeForStatus(response.status), fieldErrors };\n }\n\n private async executeFile(\n method: string,\n path: string,\n body: unknown,\n accept: string,\n statusCodes: NhAssistantStatusCodes,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantFileResponse>\n ): Promise<void> {\n let response: Response;\n try {\n response = await this.fetch(method, path, accept, body, signal);\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(0, nhAssistantCodeForStatus(0)));\n }\n return;\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, statusCodes);\n subscriber.error(createApiError(response.status, failure.code, failure.fieldErrors));\n return;\n }\n\n try {\n const text = await response.text();\n subscriber.next({ text, headers: response.headers });\n subscriber.complete();\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(response.status, NhAssistantClientErrorCodes.streamInterrupted));\n }\n }\n }\n\n private async executeJson<T>(\n method: string,\n path: string,\n body: unknown,\n statusCodes: NhAssistantStatusCodes,\n signal: AbortSignal,\n subscriber: Subscriber<T>\n ): Promise<void> {\n let response: Response;\n try {\n response = await this.fetch(method, path, 'application/json', body, signal);\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(0, nhAssistantCodeForStatus(0)));\n }\n return;\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, statusCodes);\n subscriber.error(createApiError(response.status, failure.code, failure.fieldErrors));\n return;\n }\n\n try {\n const text = response.status === 204 ? '' : await response.text();\n subscriber.next((text.length > 0 ? JSON.parse(text) : undefined) as T);\n subscriber.complete();\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(response.status, NhAssistantClientErrorCodes.invalidResponse));\n }\n }\n }\n\n private async createInit(method: string, accept: string, body: unknown, signal: AbortSignal): Promise<RequestInit> {\n const headers = await this.headers(accept);\n if (body !== undefined) {\n headers['Content-Type'] = 'application/json';\n }\n\n return {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal,\n cache: 'no-store'\n };\n }\n\n /** The host's extra headers, `Accept`, the bearer token and the current language. */\n private async headers(accept: string): Promise<Record<string, string>> {\n const headers: Record<string, string> = await nhAssistantRequestHeaders(this.config, this.injector);\n headers['Accept'] = accept;\n\n const token = await runInInjectionContext(this.injector, () => this.config.getAccessToken());\n if (token) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n\n const language = this.translate?.getCurrentLang();\n if (language) {\n headers['Accept-Language'] = language;\n }\n\n return headers;\n }\n\n private url(path: string): string {\n const base = this.config.apiBaseUrl.replace(/\\/+$/, '');\n return `${base}/${path}`;\n }\n}\n\nfunction createApiError(status: number, code: string, fieldErrors: Record<string, string[]> = {}): NhAssistantApiError {\n return new NhAssistantApiError(status, code, nhAssistantErrorMessageKey(code), fieldErrors);\n}\n\nconst reservedRequestHeaders = new Set(['authorization', 'accept', 'accept-language', 'content-type']);\n\n/**\n * The host's extra request headers from `NhAssistantConfig.getRequestHeaders`, without the\n * headers the library sets itself and without empty values.\n */\nexport async function nhAssistantRequestHeaders(\n config: NhAssistantConfig,\n injector: EnvironmentInjector\n): Promise<Record<string, string>> {\n const headers: Record<string, string> = {};\n if (!config.getRequestHeaders) {\n return headers;\n }\n\n const extra = await runInInjectionContext(injector, () => config.getRequestHeaders!());\n for (const [name, value] of Object.entries(extra ?? {})) {\n if (typeof value === 'string' && value.length > 0 && !reservedRequestHeaders.has(name.toLowerCase())) {\n headers[name] = value;\n }\n }\n return headers;\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Observable, Subscriber } from 'rxjs';\nimport {\n AssistantPreferences,\n McpAuthorizationStart,\n McpAuthorizeRequest,\n McpCompleteRequest,\n McpCompletion,\n McpConnection,\n UpdateMcpConnectionRequest\n} from '../models/assistant-admin.models';\nimport { AgentTriggerOutcome, AgentTriggerReceipt } from '../models/assistant-agent-run.models';\nimport {\n AgentSummary,\n AnswerQuestionRequest,\n AssistantStatus,\n Conversation,\n ConversationPage,\n CreateConversationRequest,\n DecideApprovalRequest,\n DirectoryEntry,\n FileReference,\n NotificationSettings,\n PushSubscriptionRequest,\n ResolveApprovalRequest,\n SendMessageRequest,\n ShareLink\n} from '../models/assistant-api.models';\nimport {\n NH_ASSISTANT_SSE_EVENT_TYPES,\n NhAssistantClientErrorCodes,\n NhAssistantMessageEvent,\n NhAssistantSseEvent,\n NhAssistantSseEventType\n} from '../models/assistant-sse.models';\nimport { NhAssistantSseParser } from './nh-assistant-sse-parser';\nimport { NhAssistantTransport, nhAssistantErrorMessageKey, nhAssistantIsSafeCode } from './nh-assistant-transport';\n\nexport {\n NH_ASSISTANT_UPLOAD_HEADER,\n NhAssistantApiError,\n nhAssistantCodeForStatus,\n nhAssistantErrorMessageKey\n} from './nh-assistant-transport';\n\nconst knownEventTypes = new Set<string>(NH_ASSISTANT_SSE_EVENT_TYPES);\n\n/** The outcomes of a trigger receipt with which the next run takes a waiting message. */\nconst queuedOutcomes = new Set<string>(['started', 'queued', 'coalesced', 'superseded', 'waiting', 'deferred'] satisfies AgentTriggerOutcome[]);\n\n/** The progress of one upload, then the file the application stored. */\nexport type NhAssistantUploadEvent =\n | { type: 'progress'; loaded: number; total: number }\n | { type: 'uploaded'; file: FileReference };\n\n/**\n * Client for the assistant HTTP API. JSON endpoints return cold observables that abort\n * their request on unsubscribe. Streaming endpoints emit every contract event and complete\n * after `turn.completed` or `error`; transport failures become an `error` event with a\n * client failure code instead of an observable error.\n */\n@Injectable()\nexport class NhAssistantApiService {\n private readonly transport = inject(NhAssistantTransport);\n\n status(): Observable<AssistantStatus> {\n return this.transport.json<AssistantStatus>('GET', 'status');\n }\n\n agents(): Observable<AgentSummary[]> {\n return this.transport.json<AgentSummary[]>('GET', 'agents');\n }\n\n listConversations(page = 1, itemsPerPage = 20): Observable<ConversationPage> {\n const query = `page=${encodeURIComponent(page)}&itemsPerPage=${encodeURIComponent(itemsPerPage)}`;\n return this.transport.json<ConversationPage>('GET', `conversations?${query}`);\n }\n\n createConversation(request: CreateConversationRequest): Observable<Conversation> {\n return this.transport.json<Conversation>('POST', 'conversations', request);\n }\n\n getConversation(conversationId: string): Observable<Conversation> {\n return this.transport.json<Conversation>('GET', `conversations/${encodeURIComponent(conversationId)}`);\n }\n\n deleteConversation(conversationId: string): Observable<void> {\n return this.transport.json<void>('DELETE', `conversations/${encodeURIComponent(conversationId)}`);\n }\n\n sendMessage(conversationId: string, request: SendMessageRequest): Observable<NhAssistantMessageEvent> {\n return this.requestStream(`conversations/${encodeURIComponent(conversationId)}/messages`, request, true);\n }\n\n /**\n * Uploads one file to a conversation as `multipart/form-data` (`POST conversations/{id}/files`):\n * emits the progress while the file is sent and then the stored file, whose reference a message\n * carries in `files`. Fails with `NhAssistantApiError`; unsubscribing aborts the upload. The\n * media type of `file` is the one the upload declares.\n */\n uploadFile(conversationId: string, file: Blob, name: string): Observable<NhAssistantUploadEvent> {\n return new Observable<NhAssistantUploadEvent>(subscriber => {\n const abort = new AbortController();\n const form = new FormData();\n form.append('file', file, name);\n\n this.transport.upload<FileReference>(\n `conversations/${encodeURIComponent(conversationId)}/files`,\n form,\n (loaded, total) => subscriber.next({ type: 'progress', loaded, total }),\n abort.signal\n ).then(\n reference => {\n subscriber.next({ type: 'uploaded', file: reference });\n subscriber.complete();\n },\n error => {\n if (!abort.signal.aborted) {\n subscriber.error(error);\n }\n }\n );\n\n return () => abort.abort();\n });\n }\n\n decideApproval(conversationId: string, approvalId: string, request: DecideApprovalRequest): Observable<NhAssistantSseEvent> {\n const path = `conversations/${encodeURIComponent(conversationId)}/approvals/${encodeURIComponent(approvalId)}/decide`;\n return this.requestStream(path, request, false);\n }\n\n /**\n * Answers the question the chat's waiting turn asked with `ask_question` with the index of one of\n * its choices, and streams the resumed turn like a decision. Only the question's addressee answers;\n * the server refuses others with `assistant-question-forbidden` and a question whose wait ended with\n * `assistant-question-expired`.\n */\n answerQuestion(conversationId: string, questionId: string, request: AnswerQuestionRequest): Observable<NhAssistantSseEvent> {\n const path = `conversations/${encodeURIComponent(conversationId)}/questions/${encodeURIComponent(questionId)}/answer`;\n return this.requestStream(path, request, false);\n }\n\n /**\n * Resolves an uncertain hand-off of a proposal the caller approved in this chat (`canResolve`):\n * `hand-to-application` hands it to the application again, `mark-resolved` confirms its outcome.\n * Returns the conversation as it is afterwards.\n */\n resolveApproval(conversationId: string, approvalId: string, request: ResolveApprovalRequest): Observable<Conversation> {\n const path = `conversations/${encodeURIComponent(conversationId)}/approvals/${encodeURIComponent(approvalId)}/resolve`;\n return this.transport.json<Conversation>('POST', path, request);\n }\n\n cancel(conversationId: string): Observable<void> {\n return this.transport.json<void>('POST', `conversations/${encodeURIComponent(conversationId)}/cancel`);\n }\n\n /** Raises the caller's read position to `sequence`, or to the latest message when omitted. */\n markRead(conversationId: string, sequence?: number): Observable<void> {\n return this.transport.json<void>(\n 'POST',\n `conversations/${encodeURIComponent(conversationId)}/read`,\n sequence === undefined ? {} : { sequence }\n );\n }\n\n /** Owner only: creates a new invitation link; an earlier link stops working. */\n createShareLink(conversationId: string): Observable<ShareLink> {\n return this.transport.json<ShareLink>('POST', `conversations/${encodeURIComponent(conversationId)}/share-link`);\n }\n\n /** Owner only: the invitation link stops working; people who joined stay. */\n revokeShareLink(conversationId: string): Observable<void> {\n return this.transport.json<void>('DELETE', `conversations/${encodeURIComponent(conversationId)}/share-link`);\n }\n\n /** Joins a shared conversation with the token of its invitation link. */\n joinConversation(conversationId: string, token: string): Observable<Conversation> {\n return this.transport.json<Conversation>('POST', `conversations/${encodeURIComponent(conversationId)}/join`, { token });\n }\n\n /** Owner only: searches the application's directory for people to invite. */\n searchParticipantCandidates(conversationId: string, query: string): Observable<DirectoryEntry[]> {\n const path = `conversations/${encodeURIComponent(conversationId)}/participant-candidates?query=${encodeURIComponent(query)}`;\n return this.transport.json<DirectoryEntry[]>('GET', path);\n }\n\n /** Owner only: invites a person the directory returned. */\n inviteParticipant(conversationId: string, actorId: string): Observable<void> {\n return this.transport.json<void>('POST', `conversations/${encodeURIComponent(conversationId)}/participants`, { actorId });\n }\n\n /** The owner removes a participant, or a participant passes their own id to leave. */\n removeParticipant(conversationId: string, actorId: string): Observable<void> {\n const path = `conversations/${encodeURIComponent(conversationId)}/participants/${encodeURIComponent(actorId)}`;\n return this.transport.json<void>('DELETE', path);\n }\n\n /** The caller's notification choice and the server's Web Push key. */\n getNotificationSettings(): Observable<NotificationSettings> {\n return this.transport.json<NotificationSettings>('GET', 'notifications');\n }\n\n /** Turns push notifications on or off for every browser of the caller. */\n updateNotificationSettings(pushEnabled: boolean): Observable<NotificationSettings> {\n return this.transport.json<NotificationSettings>('PUT', 'notifications', { pushEnabled });\n }\n\n /** Registers this browser's push subscription for the caller. */\n subscribePush(subscription: PushSubscriptionRequest): Observable<void> {\n return this.transport.json<void>('PUT', 'notifications/push-subscription', subscription);\n }\n\n /** Removes this browser's push subscription. */\n unsubscribePush(endpoint: string): Observable<void> {\n return this.transport.json<void>('DELETE', 'notifications/push-subscription', { endpoint });\n }\n\n /** The caller's own assistant preferences. */\n getPreferences(): Observable<AssistantPreferences> {\n return this.transport.json<AssistantPreferences>('GET', 'preferences');\n }\n\n /** Replaces the caller's own assistant preferences and returns the stored values. */\n updatePreferences(preferences: AssistantPreferences): Observable<AssistantPreferences> {\n return this.transport.json<AssistantPreferences>('PUT', 'preferences', preferences);\n }\n\n /** MCP servers that agents may use in background runs with the caller's own account. */\n getMcpConnections(): Observable<McpConnection[]> {\n return this.transport.json<McpConnection[]>('GET', 'mcp-connections');\n }\n\n /** Allows or withdraws background use of an MCP server with the caller's own account. */\n updateMcpConnection(serverId: string, request: UpdateMcpConnectionRequest): Observable<McpConnection> {\n return this.transport.json<McpConnection>('PUT', `mcp-connections/${encodeURIComponent(serverId)}`, request);\n }\n\n /**\n * Starts the caller's authorization of a server each person connects to. Prefer\n * `NhAssistantMcpConnectService.connect`, which opens and completes it.\n */\n authorizeMcpConnection(serverId: string, request: McpAuthorizeRequest = {}): Observable<McpAuthorizationStart> {\n return this.transport.json<McpAuthorizationStart>('POST', `mcp-connections/${encodeURIComponent(serverId)}/authorize`, request);\n }\n\n /** Removes the caller's own connection of a server and revokes its tokens. */\n disconnectMcpConnection(serverId: string): Observable<void> {\n return this.transport.json<void>('DELETE', `mcp-connections/${encodeURIComponent(serverId)}`);\n }\n\n /** Activates the connection of an authorization the caller started, with the callback's completion code. */\n completeMcpAuthorization(request: McpCompleteRequest): Observable<McpCompletion> {\n return this.transport.json<McpCompletion>('POST', 'mcp-connections/complete', request);\n }\n\n /**\n * Streams a turn. With `queuedReceipt` a `202` answer with a trigger receipt becomes\n * `message.queued`; without it, a stream is required.\n */\n private requestStream(path: string, body: unknown, queuedReceipt: true): Observable<NhAssistantMessageEvent>;\n private requestStream(path: string, body: unknown, queuedReceipt: false): Observable<NhAssistantSseEvent>;\n private requestStream(path: string, body: unknown, queuedReceipt: boolean): Observable<NhAssistantMessageEvent> {\n return new Observable<NhAssistantMessageEvent>(subscriber => {\n const abort = new AbortController();\n\n void this.executeStream(path, body, queuedReceipt, abort.signal, subscriber);\n\n return () => abort.abort();\n });\n }\n\n private async executeStream(\n path: string,\n body: unknown,\n queuedReceipt: boolean,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantMessageEvent>\n ): Promise<void> {\n let response: Response;\n try {\n response = await this.transport.fetch('POST', path, 'text/event-stream', body, signal);\n } catch {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.network);\n return;\n }\n\n if (!response.ok) {\n this.emitClientError(subscriber, signal, await this.transport.failureCode(response));\n return;\n }\n if (queuedReceipt && response.status === 202) {\n await this.readQueuedReceipt(response, signal, subscriber);\n return;\n }\n\n const contentType = response.headers.get('content-type') ?? '';\n if (!response.body || !contentType.toLowerCase().startsWith('text/event-stream')) {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.invalidResponse);\n return;\n }\n\n await this.readStream(response.body, signal, subscriber);\n }\n\n /**\n * A message to an agent's thread whose run works waits for the next run: the server answers `202`\n * with the trigger receipt instead of a stream. A receipt the run takes the message with becomes\n * `message.queued`; one that refused it becomes an `error` with its code.\n */\n private async readQueuedReceipt(\n response: Response,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantMessageEvent>\n ): Promise<void> {\n let receipt: AgentTriggerReceipt | null;\n try {\n receipt = JSON.parse(await response.text()) as AgentTriggerReceipt | null;\n } catch {\n receipt = null;\n }\n if (signal.aborted || subscriber.closed) {\n return;\n }\n if (!receipt || typeof receipt.outcome !== 'string') {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.invalidResponse);\n return;\n }\n if (!queuedOutcomes.has(receipt.outcome)) {\n this.emitClientError(\n subscriber,\n signal,\n nhAssistantIsSafeCode(receipt.reasonCode) ? receipt.reasonCode : NhAssistantClientErrorCodes.conversationBusy);\n return;\n }\n\n subscriber.next({ type: 'message.queued', data: receipt });\n subscriber.complete();\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantMessageEvent>\n ): Promise<void> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n const parser = new NhAssistantSseParser();\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n const text = done ? decoder.decode() : decoder.decode(value, { stream: true });\n const messages = done ? [...parser.push(text), ...parser.end()] : parser.push(text);\n\n for (const message of messages) {\n if (!knownEventTypes.has(message.event)) {\n continue;\n }\n\n let data: unknown;\n try {\n data = JSON.parse(message.data);\n } catch {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.invalidResponse);\n return;\n }\n\n const event = { type: message.event as NhAssistantSseEventType, data } as NhAssistantSseEvent;\n subscriber.next(event);\n\n if (event.type === 'turn.completed' || event.type === 'error') {\n subscriber.complete();\n return;\n }\n }\n\n if (done) {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.streamInterrupted);\n return;\n }\n }\n } catch {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.streamInterrupted);\n } finally {\n // Releases the connection once a terminal event arrived or the consumer unsubscribed.\n reader.cancel().catch(() => undefined);\n }\n }\n\n private emitClientError(subscriber: Subscriber<NhAssistantMessageEvent>, signal: AbortSignal, code: string): void {\n if (signal.aborted || subscriber.closed) {\n return;\n }\n\n subscriber.next({ type: 'error', data: { code, messageKey: nhAssistantErrorMessageKey(code) } });\n subscriber.complete();\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Observable, forkJoin, map, of } from 'rxjs';\nimport {\n AdminAgent,\n AdminAgentGroups,\n AgentMetadata,\n AgentMetadataRequest,\n AdminAgentInput,\n AgentRunConfiguration,\n AgentRunSettings,\n AgentRunSettingsRequest,\n AgentEvaluation,\n AgentEvaluationFilter,\n AgentFeedbackExportFilter,\n AgentFeedbackFilter,\n AgentFeedbackList,\n AgentFeedbackListFilter,\n AgentFeedbackSummary,\n AgentReplay,\n AgentReplayList,\n AgentReplayRequest,\n AgentSkillState,\n AgentState,\n ApplicationContext,\n DataSkill,\n DataSkillRequest,\n DataSkillVersion,\n DataConsultation,\n DataConsultationRequest,\n DataConsultationStateRequest,\n DataTrigger,\n DataTriggerRequest,\n DataTriggerShadowRequest,\n DataTriggerVersion,\n ApplicationContextVersion,\n McpAuthorizationStart,\n McpAuthorizeRequest,\n McpCompleteRequest,\n McpCompletion,\n McpConnectionsSummary,\n McpDiscovery,\n McpOrganizationConnection,\n McpCustomAuthMode,\n McpServer,\n McpServerInput,\n McpServerTestResult,\n McpTool,\n AssistantAccount,\n InstructionAssetList,\n InstructionAssetText,\n RunCatalog,\n RunConfigurationRemoval,\n SetAgentConsultationRoutesRequest,\n SetAgentServiceAccountRequest,\n SetAgentShadowRequest,\n SetAgentStateRequest,\n SkillCandidateRequest,\n SkillComparison,\n SkillComparisonFilter,\n ToolCatalogEntry,\n TriggerCandidateRequest,\n TriggerComparison,\n UpdateAdminAgentRequest,\n UpdateApplicationContextRequest,\n UpdateMcpToolRequest\n} from '../models/assistant-admin.models';\nimport {\n AgentPackage,\n AgentPackageExport,\n AgentPackageExportOptions,\n AgentPackageImport,\n AgentPackageImportOptions,\n AgentPackagePreview,\n AgentPackageUnlink,\n AgentPackageUnlinkRequest,\n AgentPackageWarning\n} from '../models/assistant-agent-package.models';\nimport { AgentRunFilter, AgentRunHistory } from '../models/assistant-agent-run.models';\nimport {\n AgentHandOffs,\n AgentShadowVariants,\n DataHandOff,\n DataHandOffRequest,\n ShadowVariantPromotion,\n ShadowVariantPromotionRequest\n} from '../models/assistant-hand-off.models';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantApiService } from './nh-assistant-api.service';\nimport { NhAssistantApiError, NhAssistantStatusCodes, NhAssistantTransport, nhAssistantErrorMessageKey, nhAssistantIsSafeCode } from './nh-assistant-transport';\n\n/** In the admin endpoints a 409 means a stale `expectedVersion` or a forbidden state change. */\nconst adminStatusCodes: NhAssistantStatusCodes = {\n 409: NhAssistantClientErrorCodes.versionConflict\n};\n\n/** The most account ids one `GET admin/accounts?ids=` reads; `getAccounts` asks for more in parts. */\nconst maxAccountIds = 50;\n\n/** The longest account id the server reads; a longer id names no account. */\nconst maxAccountIdLength = 256;\n\n/** The header of the agent package export that lists the references to agents outside the selection. */\nconst packageWarningsHeader = 'X-NewHeap-Package-Warnings';\n\n/**\n * Client for the assistant administration endpoints (`admin/*`). The server requires the\n * access policy and the admin policy; show the administration only when\n * `NhAssistantStore.canAdminister()` is true. Failures error with `NhAssistantApiError`.\n * Secrets are write-only: `McpServer` only reports `hasSecret`.\n */\n@Injectable()\nexport class NhAssistantAdminApiService {\n private readonly transport = inject(NhAssistantTransport);\n private readonly api = inject(NhAssistantApiService);\n\n getContext(): Observable<ApplicationContext> {\n return this.request<ApplicationContext>('GET', 'admin/context');\n }\n\n /** Saves a new context version; fails with `assistant-version-conflict` when `expectedVersion` is stale. */\n updateContext(request: UpdateApplicationContextRequest): Observable<ApplicationContext> {\n return this.request<ApplicationContext>('PUT', 'admin/context', request);\n }\n\n getContextVersions(): Observable<ApplicationContextVersion[]> {\n return this.request<ApplicationContextVersion[]>('GET', 'admin/context/versions');\n }\n\n /** Local, bridge and MCP tools, for choosing tool selectors. */\n getTools(): Observable<ToolCatalogEntry[]> {\n return this.request<ToolCatalogEntry[]>('GET', 'admin/tools');\n }\n\n getAgents(): Observable<AdminAgent[]> {\n return this.request<AdminAgent[]>('GET', 'admin/agents');\n }\n\n createAgent(input: AdminAgentInput): Observable<AdminAgent> {\n return this.request<AdminAgent>('POST', 'admin/agents', input);\n }\n\n /**\n * Saves an agent's definition when `expectedVersion` is current. Omit `mcpServerIds` to keep its MCP\n * assignments, which `assignMcpServer` and `unassignMcpServer` change one by one; `[]` removes them.\n */\n updateAgent(agentId: string, request: UpdateAdminAgentRequest): Observable<AdminAgent> {\n return this.request<AdminAgent>('PUT', `admin/agents/${encodeURIComponent(agentId)}`, request);\n }\n\n /** Restores a code agent to its definition in code. The run state stays as it is. */\n resetAgent(agentId: string): Observable<AdminAgent> {\n return this.request<AdminAgent>('POST', `admin/agents/${encodeURIComponent(agentId)}/reset`);\n }\n\n getAgentState(agentId: string): Observable<AgentState> {\n return this.request<AgentState>('GET', `admin/agents/${encodeURIComponent(agentId)}/state`);\n }\n\n /**\n * Pauses, stops or resumes an agent without changing its definition. A code-disabled agent\n * cannot be resumed (`assistant-agent-configured-off`).\n */\n setAgentState(agentId: string, request: SetAgentStateRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/state`, request);\n }\n\n /**\n * Pauses, stops or resumes one skill of an agent; its other skills keep working.\n */\n setSkillState(agentId: string, skillId: string, request: SetAgentStateRequest): Observable<AgentSkillState> {\n return this.request<AgentSkillState>(\n 'POST',\n `admin/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}/state`,\n request);\n }\n\n /**\n * Puts an agent in shadow, live, or back to the mode in code. A shadow variant cannot change\n * (`assistant-shadow-variant`).\n */\n setAgentShadow(agentId: string, request: SetAgentShadowRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/shadow`, request);\n }\n\n /** Puts one skill of an agent in shadow, live, or back to the mode in code. */\n setSkillShadow(agentId: string, skillId: string, request: SetAgentShadowRequest): Observable<AgentSkillState> {\n return this.request<AgentSkillState>(\n 'POST',\n `admin/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}/shadow`,\n request);\n }\n\n /**\n * Changes the technical account that answers for the agent's new runs, or with `actorId: null`\n * uses the account in code again. Fails with `assistant-service-account-not-found` for an\n * account that does not exist or may not sign in.\n */\n setServiceAccount(agentId: string, request: SetAgentServiceAccountRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/service-account`, request);\n }\n\n /**\n * Switches the routes of the agent's consultations on, off or back to the setting in code; a route\n * left out keeps its switch. Code is the ceiling: switching on a route that no consultation in code\n * allows fails with `assistant-consult-route-not-allowed`. Returns the agent's state with its\n * `consultationRoutes`.\n */\n setConsultationRoutes(agentId: string, request: SetAgentConsultationRoutesRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/consultation-routes`, request);\n }\n\n /**\n * Puts an agent, in code or created here, in exactly `groups` of the run catalog's `agentGroups`\n * and out of the others. The choice wins over the agent's `InGroup` in code. Fails with a field error\n * on `groups` for an unknown group and with `assistant-shadow-variant` for a shadow variant.\n */\n setAgentGroups(agentId: string, groups: readonly string[]): Observable<AdminAgentGroups> {\n return this.request<AdminAgentGroups>('PUT', `admin/agents/${encodeURIComponent(agentId)}/groups`, { groups });\n }\n\n /**\n * Every entry of agent metadata the application registers, with the agent's value in effect, where\n * it comes from and whether it changes here (`GET admin/agents/{id}/metadata`).\n */\n getAgentMetadata(agentId: string): Observable<AgentMetadata[]> {\n return this.request<AgentMetadata[]>('GET', `${agentPath(agentId)}/metadata`);\n }\n\n /**\n * Saves the agent's value of one metadata entry after the checks in code: field errors `value` or\n * `value.<field>`. For an agent created here it makes the agent's next version (`expectedVersion` is\n * the agent's version); for an agent in code only an editable entry changes, as an override with a\n * version of its own (`assistant-metadata-read-only` otherwise).\n */\n saveAgentMetadata(agentId: string, name: string, request: AgentMetadataRequest): Observable<AgentMetadata> {\n return this.request<AgentMetadata>('PUT', metadataPath(agentId, name), request);\n }\n\n /**\n * Removes the agent's stored value of one metadata entry, so an agent in code uses its value in code\n * again; answers the entry as it is now.\n */\n removeAgentMetadata(agentId: string, name: string, expectedVersion: number | null): Observable<AgentMetadata> {\n return this.request<AgentMetadata>('DELETE', withQuery(metadataPath(agentId, name), { expectedVersion }));\n }\n\n /** Deletes an admin agent. Code agents cannot be deleted; stop them instead. */\n deleteAgent(agentId: string): Observable<void> {\n return this.request<void>('DELETE', `admin/agents/${encodeURIComponent(agentId)}`);\n }\n\n getMcpServers(): Observable<McpServer[]> {\n return this.request<McpServer[]>('GET', 'admin/mcp-servers');\n }\n\n /**\n * The authentication modes the application registered in code (`GET admin/mcp-auth-modes`), which\n * administrators choose next to the built-in modes.\n */\n getMcpAuthModes(): Observable<McpCustomAuthMode[]> {\n return this.request<McpCustomAuthMode[]>('GET', 'admin/mcp-auth-modes');\n }\n\n createMcpServer(input: McpServerInput): Observable<McpServer> {\n return this.request<McpServer>('POST', 'admin/mcp-servers', input);\n }\n\n /** Omit `secret` to keep the stored secret; send `\"\"` to clear it. */\n updateMcpServer(serverId: string, input: McpServerInput): Observable<McpServer> {\n return this.request<McpServer>('PUT', `admin/mcp-servers/${encodeURIComponent(serverId)}`, input);\n }\n\n deleteMcpServer(serverId: string): Observable<void> {\n return this.request<void>('DELETE', `admin/mcp-servers/${encodeURIComponent(serverId)}`);\n }\n\n testMcpServer(serverId: string): Observable<McpServerTestResult> {\n return this.request<McpServerTestResult>('POST', `admin/mcp-servers/${encodeURIComponent(serverId)}/test`);\n }\n\n /** Reads the remote tool list. New tools start disabled; a changed input schema disables a tool. */\n syncMcpServer(serverId: string): Observable<McpTool[]> {\n return this.request<McpTool[]>('POST', `admin/mcp-servers/${encodeURIComponent(serverId)}/sync`);\n }\n\n getMcpTools(serverId: string): Observable<McpTool[]> {\n return this.request<McpTool[]>('GET', `admin/mcp-servers/${encodeURIComponent(serverId)}/tools`);\n }\n\n /**\n * Reads the protected resource metadata of a server address and its authorization server without\n * storing anything. Save the server with `oauth.confirmAuthorization` to pin what was found.\n */\n discoverMcpServer(url: string): Observable<McpDiscovery> {\n return this.request<McpDiscovery>('POST', 'admin/mcp-servers/discover', { url });\n }\n\n /** The organization's OAuth connection of a server, without tokens. */\n getMcpOrganizationConnection(serverId: string): Observable<McpOrganizationConnection> {\n return this.request<McpOrganizationConnection>('GET', `${mcpServerPath(serverId)}/connection`);\n }\n\n /**\n * Starts the administrator's authorization of the organization connection. Open\n * `authorizationUrl` in the administrator's browser, then complete with `completeMcpAuthorization`.\n */\n authorizeMcpOrganizationConnection(serverId: string, request: McpAuthorizeRequest = {}): Observable<McpAuthorizationStart> {\n return this.request<McpAuthorizationStart>('POST', `${mcpServerPath(serverId)}/connection/authorize`, request);\n }\n\n /** Removes the organization connection and revokes its tokens. */\n disconnectMcpOrganizationConnection(serverId: string): Observable<void> {\n return this.request<void>('DELETE', `${mcpServerPath(serverId)}/connection`);\n }\n\n /** The personal connections of a server per status. */\n getMcpConnectionsSummary(serverId: string): Observable<McpConnectionsSummary> {\n return this.request<McpConnectionsSummary>('GET', `${mcpServerPath(serverId)}/connections/summary`);\n }\n\n /** Revokes every person's connection of a server; each person connects again. */\n revokeMcpConnections(serverId: string): Observable<void> {\n return this.request<void>('DELETE', `${mcpServerPath(serverId)}/connections`);\n }\n\n /**\n * Activates the connection of an authorization the caller started with the completion code the\n * callback handed to the browser. An organization connection also needs the admin policy. The same\n * call as `NhAssistantApiService.completeMcpAuthorization`, with the same failure codes.\n */\n completeMcpAuthorization(request: McpCompleteRequest): Observable<McpCompletion> {\n return this.api.completeMcpAuthorization(request);\n }\n\n /**\n * Enables or disables a tool, sets its effect and its description. A remote name that no sync has\n * seen yet stores these reviewed settings as a tool that awaits its sync (`awaitingSync`).\n */\n updateMcpTool(serverId: string, remoteName: string, request: UpdateMcpToolRequest): Observable<McpTool> {\n const path = `admin/mcp-servers/${encodeURIComponent(serverId)}/tools/${encodeURIComponent(remoteName)}`;\n return this.request<McpTool>('PUT', path, request);\n }\n\n /**\n * Assigns a server to an agent (`PUT admin/mcp-servers/{id}/agents/{agentId}`). Only the assignment\n * changes, never the agent's definition or version; assigning an assigned server changes nothing.\n * Answers the server with its `assignedAgentIds`.\n */\n assignMcpServer(serverId: string, agentId: string): Observable<McpServer> {\n return this.request<McpServer>('PUT', `${mcpServerPath(serverId)}/agents/${encodeURIComponent(agentId)}`);\n }\n\n /**\n * Removes a server's assignment to an agent (`DELETE admin/mcp-servers/{id}/agents/{agentId}`); the\n * agent's definition and version stay. Answers the server with its `assignedAgentIds`.\n */\n unassignMcpServer(serverId: string, agentId: string): Observable<McpServer> {\n return this.request<McpServer>('DELETE', `${mcpServerPath(serverId)}/agents/${encodeURIComponent(agentId)}`);\n }\n\n /**\n * The agent's proposals per tool and agent version in the period: decisions, the rejection rate,\n * feedback per category and the number of different people who gave it.\n */\n getAgentFeedbackSummary(agentId: string, filter: AgentFeedbackFilter = {}): Observable<AgentFeedbackSummary> {\n return this.request<AgentFeedbackSummary>('GET', withQuery(`${feedbackPath(agentId)}/summary`, filter));\n }\n\n /** The feedback on the agent's proposals with the proposal as approvers read it, newest change first. */\n getAgentFeedback(agentId: string, filter: AgentFeedbackListFilter = {}): Observable<AgentFeedbackList> {\n return this.request<AgentFeedbackList>('GET', withQuery(feedbackPath(agentId), filter));\n }\n\n /**\n * Downloads the feedback as JSON Lines with the tool input of each proposal. The file holds\n * subject data and the server audits the export. Rejects with `NhAssistantApiError`.\n */\n exportAgentFeedback(agentId: string, filter: AgentFeedbackExportFilter = {}): Promise<Blob> {\n return this.download(withQuery(`${feedbackPath(agentId)}/export`, filter));\n }\n\n /**\n * Compares a shadow variant with its live agent over a period: the runs that handled the same\n * events, the proposals per tool with what people decided about the live ones, cost and routing.\n */\n getAgentEvaluation(agentId: string, filter: AgentEvaluationFilter): Observable<AgentEvaluation> {\n return this.request<AgentEvaluation>('GET', withQuery(`${agentPath(agentId)}/evaluation`, filter));\n }\n\n /**\n * Downloads the paired runs of the comparison as JSON Lines: identifiers, statuses, usage and\n * proposal identities, no content. The server audits the export. Rejects with `NhAssistantApiError`.\n */\n exportAgentEvaluation(agentId: string, filter: AgentEvaluationFilter): Promise<Blob> {\n return this.download(withQuery(`${agentPath(agentId)}/evaluation/export`, filter));\n }\n\n /**\n * Replays the recorded runs of another agent in a period into a shadow variant, against today's\n * state of each subject. One replay runs per variant (`assistant-replay-active`).\n */\n startAgentReplay(variantId: string, request: AgentReplayRequest): Observable<AgentReplay> {\n return this.request<AgentReplay>('POST', `${agentPath(variantId)}/replay`, request);\n }\n\n /** The latest replays into a shadow variant, newest first. */\n getAgentReplays(variantId: string): Observable<AgentReplayList> {\n return this.request<AgentReplayList>('GET', `${agentPath(variantId)}/replays`);\n }\n\n /** The building blocks in code that run settings, skills and triggers defined as data can name. */\n getRunCatalog(): Observable<RunCatalog> {\n return this.request<RunCatalog>('GET', 'admin/run-catalog');\n }\n\n /**\n * The application's assets an administrator may choose as instructions, without their content\n * (`GET admin/instruction-assets`). Fails with `assistant-instructions-asset-unavailable` when the\n * application's source fails.\n */\n listInstructionAssets(): Observable<InstructionAssetList> {\n return this.request<InstructionAssetList>('GET', 'admin/instruction-assets');\n }\n\n /**\n * The text of one asset, read-only, with the hash a reference stores. Fails with\n * `assistant-instructions-asset-not-found` for an asset or version the application does not have.\n */\n getInstructionAsset(assetId: string, version: number): Observable<InstructionAssetText> {\n return this.request<InstructionAssetText>(\n 'GET',\n `admin/instruction-assets/${encodeURIComponent(assetId)}/versions/${encodeURIComponent(String(version))}`\n );\n }\n\n /**\n * Accounts whose name or e-mail address contains `query` (2 to 100 characters), at most `limit`.\n * Fails with `assistant-account-search-unavailable` when the application offers no search; the\n * run catalog's `accountSearch` tells beforehand.\n */\n searchAccounts(query: string, limit?: number): Observable<AssistantAccount[]> {\n return this.request<AssistantAccount[]>('GET', withQuery('admin/accounts', { query, limit }));\n }\n\n /**\n * The names the application knows for these account ids; unknown ids are left out. The server reads\n * at most 50 ids per request, so more ids are asked for in parts of 50 and the answers merged in\n * the order of the ids. Fails with `NhAssistantApiError` when any part fails.\n */\n getAccounts(actorIds: readonly string[]): Observable<AssistantAccount[]> {\n // An empty id or one longer than the server reads names no account.\n const ids = [...new Set(actorIds.filter(id => id.trim().length > 0 && id.length <= maxAccountIdLength))];\n if (ids.length === 0) {\n return of([]);\n }\n\n const parts: Observable<AssistantAccount[]>[] = [];\n for (let start = 0; start < ids.length; start += maxAccountIds) {\n const part = ids.slice(start, start + maxAccountIds);\n parts.push(this.request<AssistantAccount[]>('GET', withQuery('admin/accounts', { ids: part.join(',') })));\n }\n\n return forkJoin(parts).pipe(map(answers => answers.flat()));\n }\n\n /**\n * The agent's run settings, skills and triggers, in code and as data, and the data that no longer\n * fits the code. An agent in code without a run configuration answers `assistant-agent-not-found`.\n */\n getAgentConfiguration(agentId: string): Observable<AgentRunConfiguration> {\n return this.request<AgentRunConfiguration>('GET', `${agentPath(agentId)}/configuration`);\n }\n\n /**\n * Adds or changes the run settings of an agent created in the administration. An agent in code\n * fails with `assistant-run-settings-in-code`; an unknown technical account with\n * `assistant-service-account-not-found`.\n */\n saveRunSettings(agentId: string, request: AgentRunSettingsRequest): Observable<AgentRunSettings> {\n return this.request<AgentRunSettings>('PUT', `${agentPath(agentId)}/run-settings`, request);\n }\n\n /**\n * Every run of the agent, live and shadow, newest first, for its runs view. Read one run's whole\n * result with `NhAssistantAgentRunApiService.getRunResult`. The server checks the filter first:\n * `assistant-run-filter-invalid` with the refused parts in `fieldErrors`, then\n * `assistant-agent-not-found` for an unknown agent.\n */\n getAgentRuns(agentId: string, filter: Omit<AgentRunFilter, 'agentId'> = {}): Observable<AgentRunHistory> {\n return this.request<AgentRunHistory>('GET', withQuery(`${agentPath(agentId)}/runs`, filter));\n }\n\n /**\n * Removes the run settings; while data skills, triggers, consultations or hand-offs defined as data\n * belong to the agent, `assistant-run-settings-in-use`.\n */\n removeRunSettings(agentId: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(`${agentPath(agentId)}/run-settings`, removal));\n }\n\n /**\n * Adds a skill defined as data, which starts in shadow, or stores its next version: with `apply`\n * `live` at once, with `shadow` as the candidate that runs in shadow next to the live version.\n */\n saveDataSkill(agentId: string, skillId: string, request: DataSkillRequest): Observable<DataSkill> {\n return this.request<DataSkill>('PUT', skillPath(agentId, skillId), request);\n }\n\n /** Takes a skill defined as data out of effect; while a data trigger names it, `assistant-skill-in-use`. */\n removeDataSkill(agentId: string, skillId: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(skillPath(agentId, skillId), removal));\n }\n\n /** Every version of a skill defined as data, newest first. */\n getDataSkillVersions(agentId: string, skillId: string): Observable<DataSkillVersion[]> {\n return this.request<DataSkillVersion[]>('GET', `${skillPath(agentId, skillId)}/versions`);\n }\n\n /** Makes the candidate the live version of its skill. */\n promoteSkillCandidate(agentId: string, skillId: string, request: SkillCandidateRequest): Observable<DataSkill> {\n return this.request<DataSkill>('POST', `${skillPath(agentId, skillId)}/candidate/promote`, request);\n }\n\n /** Discards the candidate; it stays as history. */\n discardSkillCandidate(agentId: string, skillId: string, request: SkillCandidateRequest): Observable<void> {\n return this.request<void>('POST', `${skillPath(agentId, skillId)}/candidate/discard`, request);\n }\n\n /** Compares the candidate with the live version on the runs they made in the period. */\n compareSkillCandidate(agentId: string, skillId: string, filter: SkillComparisonFilter = {}): Observable<SkillComparison> {\n return this.request<SkillComparison>('GET', withQuery(`${skillPath(agentId, skillId)}/candidate/comparison`, filter));\n }\n\n /**\n * Adds a trigger defined as data, which starts in shadow, or stores its next version: with `apply`\n * `live` (default) it takes effect at once in the trigger's mode; with `shadow` it becomes the\n * candidate that fires next to the live version until it is promoted or discarded.\n */\n saveDataTrigger(agentId: string, triggerId: string, request: DataTriggerRequest): Observable<DataTrigger> {\n return this.request<DataTrigger>('PUT', triggerPath(agentId, triggerId), request);\n }\n\n /** Every version of a trigger defined as data, newest first, with its definition. */\n getDataTriggerVersions(agentId: string, triggerId: string): Observable<DataTriggerVersion[]> {\n return this.request<DataTriggerVersion[]>('GET', `${triggerPath(agentId, triggerId)}/versions`);\n }\n\n /** Makes the candidate the live version of its trigger, in the trigger's mode. */\n promoteTriggerCandidate(agentId: string, triggerId: string, request: TriggerCandidateRequest): Observable<DataTrigger> {\n return this.request<DataTrigger>('POST', `${triggerPath(agentId, triggerId)}/candidate/promote`, request);\n }\n\n /** Discards the candidate of a trigger; it stays as history and fires no more. */\n discardTriggerCandidate(agentId: string, triggerId: string, request: TriggerCandidateRequest): Observable<void> {\n return this.request<void>('POST', `${triggerPath(agentId, triggerId)}/candidate/discard`, request);\n }\n\n /** Compares the trigger's candidate with its live version on the runs they started in the period. */\n compareTriggerCandidate(agentId: string, triggerId: string, filter: SkillComparisonFilter = {}): Observable<TriggerComparison> {\n return this.request<TriggerComparison>('GET', withQuery(`${triggerPath(agentId, triggerId)}/candidate/comparison`, filter));\n }\n\n removeDataTrigger(agentId: string, triggerId: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(triggerPath(agentId, triggerId), removal));\n }\n\n /** Puts a trigger defined as data in shadow or live. */\n setDataTriggerShadow(agentId: string, triggerId: string, request: DataTriggerShadowRequest): Observable<DataTrigger> {\n return this.request<DataTrigger>('POST', `${triggerPath(agentId, triggerId)}/shadow`, request);\n }\n\n /**\n * Adds or changes the consultation defined as data of an agent about one subject type, within the\n * agent's `consultationCeiling`. It is in effect once saved and answers when an asking agent selects\n * its consult tool. An agent that may get none fails with `assistant-consultations-not-allowed`, an\n * agent created here without run settings with `assistant-agent-not-configured`, a type the agent\n * allows consultation about in code with `assistant-consultation-in-code`, more than the ceiling's\n * `maxConsultations` with `assistant-configuration-limit`, a stale `expectedVersion` with\n * `assistant-version-conflict` and invalid input with field errors, such as `routes: not-allowed` for\n * a route outside the ceiling.\n */\n saveDataConsultation(agentId: string, subjectType: string, request: DataConsultationRequest): Observable<DataConsultation> {\n return this.request<DataConsultation>('PUT', consultationPath(agentId, subjectType), request);\n }\n\n /**\n * Switches a consultation defined as data on or off, without a new version. Off, it is not offered,\n * while its recorded proposals can still be decided. Fails with `assistant-consultation-not-found`\n * without one and with `assistant-consultation-in-code` for a consultation in code.\n */\n setDataConsultationState(agentId: string, subjectType: string, request: DataConsultationStateRequest): Observable<DataConsultation> {\n return this.request<DataConsultation>('POST', `${consultationPath(agentId, subjectType)}/state`, request);\n }\n\n /**\n * Removes a consultation defined as data: its tools disappear, while its recorded proposals can still\n * be decided. Fails with `assistant-consultation-not-found` without one and with\n * `assistant-consultation-in-code` for a consultation in code.\n */\n removeDataConsultation(agentId: string, subjectType: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(consultationPath(agentId, subjectType), removal));\n }\n\n /**\n * The hand-offs the agent accepts, in code and as data with their problems, and what the ceiling in\n * code (`UseHandOffsAsData`) lets administrators add; `ceiling` is `null` when it may accept none.\n */\n getAgentHandOffs(agentId: string): Observable<AgentHandOffs> {\n return this.request<AgentHandOffs>('GET', `${agentPath(agentId)}/hand-offs`);\n }\n\n /**\n * Adds or changes the hand-off defined as data that the agent accepts about one subject type, within\n * the ceiling: in effect once saved, as one in code. An agent the ceiling connects to no agent fails\n * with `assistant-handoffs-not-allowed`, a type it accepts in code with `assistant-handoff-in-code`,\n * an agent without run configuration with `assistant-agent-not-configured`, more than the ceiling's\n * `maxHandOffs` with `assistant-configuration-limit`, a stale `expectedVersion` with\n * `assistant-version-conflict` and invalid input with field errors, such as `sources: not-allowed`\n * for a source outside the ceiling.\n */\n saveDataHandOff(agentId: string, subjectType: string, request: DataHandOffRequest): Observable<DataHandOff> {\n return this.request<DataHandOff>('PUT', handOffPath(agentId, subjectType), request);\n }\n\n /**\n * Removes a hand-off defined as data; its tool disappears from the sources' next turns. Fails with\n * `assistant-handoff-not-found` without one and with `assistant-handoff-in-code` for one in code.\n */\n removeDataHandOff(agentId: string, subjectType: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(handOffPath(agentId, subjectType), removal));\n }\n\n /**\n * The agent's shadow variants, in code and created as data, and whether administrators may create\n * more (`UseShadowVariantsAsData`). Create a data variant with `createAgent` and `shadowOf`.\n */\n getShadowVariants(agentId: string): Observable<AgentShadowVariants> {\n return this.request<AgentShadowVariants>('GET', `${agentPath(agentId)}/shadow-variants`);\n }\n\n /**\n * Promotes the data shadow variant `variantId` onto its live agent (`POST admin/agents/{id}/promote`):\n * its definition becomes the live agent's next version through the update path, with its checks,\n * locks and audit, its data skills move along when asked, and the variant is deleted. The live agent\n * keeps its name, MCP servers, metadata, run settings, triggers, state and shadow mode; an agent in\n * code takes only the fields it can override. Fails with `assistant-not-shadow-variant`,\n * `assistant-shadow-variants-not-allowed`, `assistant-version-conflict` and `assistant-skill-in-code`.\n */\n promoteShadowVariant(variantId: string, request: ShadowVariantPromotionRequest): Observable<ShadowVariantPromotion> {\n return this.request<ShadowVariantPromotion>('POST', `${agentPath(variantId)}/promote`, request);\n }\n\n /**\n * Exports exactly `agentIds` (1 to 20) as one agent package (`POST admin/agent-packages/export`):\n * agents created here whole, agents in code as an overlay of what data changes on them; never\n * history, candidates, runs, run state, shadow overrides, MCP servers, the technical account or\n * secrets. The options set the package id, version and locks; left out, the id of the package the\n * first agent is linked to and its next version, otherwise the first agent's id and 1. Answers the\n * package, its JSON exactly as the server wrote it for the download, and every reference to an agent\n * outside the selection, which must exist where the package is imported. Fails with\n * `assistant-agent-not-found` for an unknown agent and with field errors for invalid options; the\n * server audits the export.\n */\n exportAgentPackage(agentIds: readonly string[], options: AgentPackageExportOptions = {}): Observable<AgentPackageExport> {\n return this.transport.file('POST', 'admin/agent-packages/export', { agentIds: [...agentIds], options }, 'application/json', adminStatusCodes).pipe(\n map(file => {\n let agentPackage: AgentPackage;\n try {\n agentPackage = JSON.parse(file.text) as AgentPackage;\n } catch {\n throw new NhAssistantApiError(200, NhAssistantClientErrorCodes.invalidResponse, nhAssistantErrorMessageKey(NhAssistantClientErrorCodes.invalidResponse));\n }\n\n return { package: agentPackage, json: file.text, warnings: packageWarnings(file.headers.get(packageWarningsHeader)) };\n }));\n }\n\n /**\n * What importing the package would do, per agent and part (`POST admin/agent-packages/preview`):\n * `created`, `changed`, `unchanged`, `kept-local`, `left-behind` or `refused` with the field\n * errors of the save validators, after one check of the whole package against this host as it would\n * be after the import. Changes nothing. The server reads the package strictly: a package it does not\n * read fails with `assistant-package-format-unsupported`, one above 1 MB or 20 agents with\n * `assistant-package-too-large`.\n */\n previewAgentPackageImport(agentPackage: AgentPackage, options: AgentPackageImportOptions = {}): Observable<AgentPackagePreview> {\n return this.request<AgentPackagePreview>('POST', 'admin/agent-packages/preview', { package: agentPackage, options });\n }\n\n /**\n * Imports the package in one transaction (`POST admin/agent-packages/import`): every agent and part\n * of it, or nothing. Fails as `previewAgentPackageImport` does, and with `assistant-package-refused`\n * and the field error `parts: invalid` when the check refuses a part; preview again to see which part\n * and why. Every part is audited as its save.\n */\n importAgentPackage(agentPackage: AgentPackage, options: AgentPackageImportOptions = {}): Observable<AgentPackageImport> {\n return this.request<AgentPackageImport>('POST', 'admin/agent-packages/import', { package: agentPackage, options });\n }\n\n /**\n * Unlinks one part of the agent, or without `part` the whole agent, from its package\n * (`POST admin/agents/{id}/package/unlink`): its locks no longer hold and the next upgrade keeps it as\n * `kept-local` unless the import relinks it. Fails with `assistant-package-not-linked` for an agent\n * or part without a link and with the field error `part: invalid` for an unknown part key.\n */\n unlinkAgentPackage(agentId: string, request: AgentPackageUnlinkRequest = {}): Observable<AgentPackageUnlink> {\n return this.request<AgentPackageUnlink>('POST', `${agentPath(agentId)}/package/unlink`, request);\n }\n\n private download(path: string): Promise<Blob> {\n return this.transport.download(path, 'application/x-ndjson', adminStatusCodes);\n }\n\n private request<T>(method: string, path: string, body?: unknown): Observable<T> {\n return this.transport.json<T>(method, path, body, adminStatusCodes);\n }\n}\n\nfunction mcpServerPath(serverId: string): string {\n return `admin/mcp-servers/${encodeURIComponent(serverId)}`;\n}\n\nfunction feedbackPath(agentId: string): string {\n return `${agentPath(agentId)}/feedback`;\n}\n\nfunction agentPath(agentId: string): string {\n return `admin/agents/${encodeURIComponent(agentId)}`;\n}\n\nfunction skillPath(agentId: string, skillId: string): string {\n return `${agentPath(agentId)}/skills/${encodeURIComponent(skillId)}`;\n}\n\nfunction triggerPath(agentId: string, triggerId: string): string {\n return `${agentPath(agentId)}/triggers/${encodeURIComponent(triggerId)}`;\n}\n\nfunction consultationPath(agentId: string, subjectType: string): string {\n return `${agentPath(agentId)}/consultations/${encodeURIComponent(subjectType)}`;\n}\n\nfunction handOffPath(agentId: string, subjectType: string): string {\n return `${agentPath(agentId)}/hand-offs/${encodeURIComponent(subjectType)}`;\n}\n\nfunction metadataPath(agentId: string, name: string): string {\n return `${agentPath(agentId)}/metadata/${encodeURIComponent(name)}`;\n}\n\n/**\n * The references to agents outside an exported selection, from the export's header: a JSON array,\n * of which only entries with a safe code and string ids are kept. Without the header, none.\n */\nfunction packageWarnings(header: string | null): AgentPackageWarning[] {\n if (!header) {\n return [];\n }\n\n let items: unknown;\n try {\n items = JSON.parse(header);\n } catch {\n return [];\n }\n if (!Array.isArray(items)) {\n return [];\n }\n\n const warnings: AgentPackageWarning[] = [];\n for (const item of items) {\n const record = item && typeof item === 'object' ? item as Record<string, unknown> : null;\n if (record\n && typeof record['agentId'] === 'string'\n && typeof record['part'] === 'string'\n && typeof record['referencedAgentId'] === 'string'\n && nhAssistantIsSafeCode(record['code'])) {\n warnings.push({ agentId: record['agentId'], part: record['part'], code: record['code'], referencedAgentId: record['referencedAgentId'] });\n }\n }\n return warnings;\n}\n\n/** Appends the filter values that are set as query parameters. */\nfunction withQuery(path: string, filter: object): string {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null && value !== '') {\n query.set(key, String(value));\n }\n }\n\n const suffix = query.toString();\n return suffix ? `${path}?${suffix}` : path;\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport {\n AgentArtifact,\n AgentBoard,\n AgentBoardList,\n AgentBoardVisit,\n AgentConsultationList,\n AgentDecisionOutcome,\n AgentExecutionResolution,\n AgentFeedbackOutcome,\n AgentInbox,\n AgentInboxFilter,\n AgentInboxVisit,\n AgentObjectAgents,\n AgentProposal,\n AgentProposalDecision,\n AgentProposalFeedback,\n AgentProposalFeedbackCategory,\n AgentProposalLookup,\n AgentRunFilter,\n AgentRunHistory,\n AgentRunList,\n AgentRunResult,\n AgentRunRetryMode,\n AgentSubjectSearch,\n AgentSubjectSummaryList,\n AgentSubjectWork,\n AgentSubjectWorkProposal,\n AgentThreadLookup,\n AgentThreadMemory,\n AgentTriggerReceipt,\n StartAgentRequest\n} from '../models/assistant-agent-run.models';\nimport { NhAssistantTransport } from './nh-assistant-transport';\n\n/**\n * Client for the agent-run endpoints: the agent thread about a subject, its runs, proposals,\n * working memory and artifacts, and the approval inbox. Access follows the caller's role on the\n * subject, which the server checks on every request; failures error with `NhAssistantApiError`.\n */\n@Injectable()\nexport class NhAssistantAgentRunApiService {\n private readonly transport = inject(NhAssistantTransport);\n\n /** The agent's thread about the subject, the caller's role and whether the caller may start the agent. */\n getThread(agentId: string, subjectType: string, subjectId: string): Observable<AgentThreadLookup> {\n const query = new URLSearchParams({ agentId, subjectType, subjectId });\n return this.transport.json<AgentThreadLookup>('GET', `threads?${query.toString()}`);\n }\n\n /**\n * The agent's thread about the subject, created without starting a run when it is missing, so\n * the caller can open the conversation and type there. Creating a thread needs the participant\n * role; readers may open an existing one. Errors with `assistant-subject-access-denied` otherwise.\n */\n openThread(agentId: string, subjectType: string, subjectId: string): Observable<AgentThreadLookup> {\n return this.transport.json<AgentThreadLookup>('POST', 'threads/open', { agentId, subjectType, subjectId });\n }\n\n /**\n * Runs the agent now on the subject with the caller as initiator. On an object it needs the\n * participant role; on the whole application (`nh-system`) the agent's run policy, by default the\n * administration policy. The receipt says what became of the start (`AgentTriggerOutcome`), for\n * example `waiting` while the agent is paused. A refusal errors with `NhAssistantApiError`:\n * `assistant-agent-does-not-work-on`, `assistant-agent-stopped`, `assistant-trigger-rate-limited`\n * and the other conflicts (409), `assistant-subject-access-denied` or `assistant-agent-forbidden`\n * (403), `assistant-agent-not-found` or `assistant-subject-not-found` (404),\n * `assistant-subject-invalid` (400) and `assistant-trigger-rolled-back` (503).\n */\n startAgent(request: StartAgentRequest): Observable<AgentTriggerReceipt> {\n return this.transport.json<AgentTriggerReceipt>('POST', 'threads/start', request);\n }\n\n /**\n * All agent work on one subject: the caller's role, every agent with a thread on it plus\n * `agentId`, and the open proposals of all of them with the caller's live decision right. Errors\n * with `assistant-subject-not-found` when the caller has no role on the subject.\n */\n getSubjectWork(subjectType: string, subjectId: string, agentId?: string): Observable<AgentSubjectWork> {\n const path = `subjects/${encodeURIComponent(subjectType)}/${encodeURIComponent(subjectId)}/work`;\n const query = agentId ? `?${new URLSearchParams({ agentId }).toString()}` : '';\n return this.transport.json<AgentSubjectWork>('GET', path + query);\n }\n\n /**\n * The agents that work on the subject and that the caller may use, with whether the caller may run\n * each now, its newest run with the beginning of its result and its open proposals. The subject is\n * an object or the whole application (`nh-system`, `global` or `division-…`). Errors with\n * `assistant-subject-not-found` when the caller has no role on the subject.\n */\n getObjectAgents(subjectType: string, subjectId: string): Observable<AgentObjectAgents> {\n return this.transport.json<AgentObjectAgents>(\n 'GET',\n `subjects/${encodeURIComponent(subjectType)}/${encodeURIComponent(subjectId)}/agents`\n );\n }\n\n /**\n * Counts the agent work on at most `NH_ASSISTANT_MAX_SUBJECT_SUMMARY` subjects of one type in one\n * request, for badges in a list; one item per id in request order. `NhAssistantSubjectSummaryService`\n * batches and caches these requests for many badges.\n */\n summarizeSubjects(subjectType: string, subjectIds: readonly string[]): Observable<AgentSubjectSummaryList> {\n return this.transport.json<AgentSubjectSummaryList>('POST', `subjects/${encodeURIComponent(subjectType)}/summary`, {\n subjectIds\n });\n }\n\n /**\n * Finds subjects of one type by name, at most `limit` (default 20, at most 50), among those the\n * caller may read; `query` has 2 to 100 characters. Errors with `assistant-subject-search-unavailable`\n * for a type the application does not search (people then give the subject's id), with\n * `assistant-subject-type-unknown` for an unknown type and with `assistant-validation` for a\n * query of the wrong length.\n */\n searchSubjects(subjectType: string, query: string, limit?: number): Observable<AgentSubjectSearch> {\n const parameters = new URLSearchParams({ query });\n if (limit !== undefined) {\n parameters.set('limit', String(limit));\n }\n return this.transport.json<AgentSubjectSearch>(\n 'GET',\n `subjects/${encodeURIComponent(subjectType)}/search?${parameters.toString()}`\n );\n }\n\n getRuns(conversationId: string): Observable<AgentRunList> {\n return this.transport.json<AgentRunList>('GET', `threads/${encodeURIComponent(conversationId)}/runs`);\n }\n\n /** Who consulted the thread's agent through another assistant, newest first. */\n getConsultations(conversationId: string, page = 1, itemsPerPage = 20): Observable<AgentConsultationList> {\n const query = new URLSearchParams({ page: String(page), itemsPerPage: String(itemsPerPage) });\n return this.transport.json<AgentConsultationList>(\n 'GET',\n `threads/${encodeURIComponent(conversationId)}/consultations?${query.toString()}`\n );\n }\n\n getProposals(conversationId: string): Observable<AgentProposal[]> {\n return this.transport.json<AgentProposal[]>('GET', `threads/${encodeURIComponent(conversationId)}/proposals`);\n }\n\n /**\n * One proposal of an agent thread in any status, with the caller's live right to decide it, for\n * example the one an `AgentWorkChanged` update names. Fails with `assistant-approval-not-found`\n * for an unknown proposal and for one the caller may not see.\n */\n getProposal(approvalId: string): Observable<AgentSubjectWorkProposal> {\n return this.transport.json<AgentSubjectWorkProposal>('GET', `approvals/${encodeURIComponent(approvalId)}`);\n }\n\n /**\n * The proposals among at most `NH_ASSISTANT_MAX_PROPOSAL_LOOKUP` ids that the caller may see, in\n * the order of the ids, each with the caller's live right to decide it. The others are left out.\n */\n lookupProposals(approvalIds: readonly string[]): Observable<AgentProposalLookup> {\n return this.transport.json<AgentProposalLookup>('POST', 'approvals/lookup', { approvalIds });\n }\n\n getMemory(conversationId: string): Observable<AgentThreadMemory> {\n return this.transport.json<AgentThreadMemory>('GET', `threads/${encodeURIComponent(conversationId)}/memory`);\n }\n\n getArtifacts(conversationId: string): Observable<AgentArtifact[]> {\n return this.transport.json<AgentArtifact[]>('GET', `threads/${encodeURIComponent(conversationId)}/artifacts`);\n }\n\n /**\n * Downloads one artifact version with the host's credentials. Rejects with `NhAssistantApiError`,\n * for example `assistant-artifact-not-found` or `assistant-network`.\n */\n downloadArtifact(conversationId: string, artifactId: string): Promise<Blob> {\n const path = `threads/${encodeURIComponent(conversationId)}/artifacts/${encodeURIComponent(artifactId)}/content`;\n return this.transport.download(path, '*/*');\n }\n\n /**\n * The agent runs the caller may see, newest first: runs on objects the caller reads and runs for\n * the whole application whose agent's view policy the caller passes. Errors with\n * `assistant-run-filter-invalid` for an invalid filter, with the refused parts in `fieldErrors`\n * (`page`, `itemsPerPage`, `agentId`, `subjectType`, `subjectId`, `status`, `to`).\n */\n getRunHistory(filter: AgentRunFilter = {}): Observable<AgentRunHistory> {\n return this.transport.json<AgentRunHistory>('GET', withQuery('runs', filter));\n }\n\n /**\n * The boards of the groups of agents the caller sees at least one agent of, ordered by name: an\n * agent that works on the whole application by its view policy, another by its required policy.\n */\n getBoards(): Observable<AgentBoardList> {\n return this.transport.json<AgentBoardList>('GET', 'boards');\n }\n\n /**\n * The board of one group: per agent what it works on, its latest result for the whole application,\n * its open proposals, whether the caller may run it now and whether something is new since the\n * caller's last visit. `divisionId` opens the board of one division the caller may work in. Fails\n * with `assistant-board-not-found` for an unknown group or one the caller sees no agent of, and with\n * `assistant-board-scope-invalid` for a malformed division id.\n */\n getBoard(groupId: string, divisionId?: string | null): Observable<AgentBoard> {\n return this.transport.json<AgentBoard>('GET', withQuery(`boards/${encodeURIComponent(groupId)}`, { divisionId }));\n }\n\n /** Records that the caller looked at the board now, so it marks what is new after this visit. */\n visitBoard(groupId: string, divisionId?: string | null): Observable<AgentBoardVisit> {\n return this.transport.json<AgentBoardVisit>('POST', withQuery(`boards/${encodeURIComponent(groupId)}/visit`, { divisionId }));\n }\n\n /**\n * One run with its whole result, its proposals and its files. Fails with `assistant-run-not-found`\n * for an unknown run and for one the caller may not see.\n */\n getRunResult(runId: string): Observable<AgentRunResult> {\n return this.transport.json<AgentRunResult>('GET', `runs/${encodeURIComponent(runId)}`);\n }\n\n /**\n * Downloads one file a run saved, with the host's credentials. Rejects with `NhAssistantApiError`,\n * for example `assistant-artifact-not-found`, `assistant-run-not-found` or `assistant-network`.\n */\n downloadRunArtifact(runId: string, artifactId: string): Promise<Blob> {\n const path = `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/content`;\n return this.transport.download(path, '*/*');\n }\n\n /** Cancels a run at its next safe point and withdraws its open proposals; needs the participant role. */\n cancelRun(runId: string): Observable<void> {\n return this.transport.json<void>('POST', `runs/${encodeURIComponent(runId)}/cancel`);\n }\n\n /**\n * Resumes or restarts a failed or cancelled run; needs the approver role. A restart starts the agent\n * again like `startAgent`, with the same outcomes and refusals; a resume answers `queued`.\n */\n retryRun(runId: string, mode: AgentRunRetryMode): Observable<AgentTriggerReceipt> {\n return this.transport.json<AgentTriggerReceipt>('POST', `runs/${encodeURIComponent(runId)}/retry`, { mode });\n }\n\n /**\n * Pending proposals the caller may decide, sorted by expiry, or with `grouped` by parent and subject,\n * with what is new since the caller's last visit (`visitInbox`). `status` lists the proposals that\n * wait for the application's report (`awaiting-application`) or for an approver to resolve an\n * uncertain execution (`execution-unknown`) instead, with the same visibility.\n */\n getInbox(filter: AgentInboxFilter = {}): Observable<AgentInbox> {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null && value !== '') {\n query.set(key, String(value));\n }\n }\n const suffix = query.toString();\n return this.transport.json<AgentInbox>('GET', suffix ? `approvals/inbox?${suffix}` : 'approvals/inbox');\n }\n\n /**\n * Records that the caller looked at the inbox now, so it marks the proposals made after this visit\n * as new. `divisionId` records the visit of the inbox of one division the caller may work in;\n * otherwise of the whole inbox. Fails with `assistant-subject-not-found` for a division the caller\n * may not work in.\n */\n visitInbox(divisionId?: string | null): Observable<AgentInboxVisit> {\n return this.transport.json<AgentInboxVisit>('POST', withQuery('approvals/inbox/visit', { divisionId }));\n }\n\n /**\n * Decides one proposal, bound to the proposal hash the person saw; the server checks the approval\n * policy and the tool's approve policy again. Accepts an inbox proposal or the approval part of an\n * agent thread.\n */\n decide(\n proposal: Pick<AgentProposal, 'approvalId' | 'proposalHash'>,\n decision: AgentProposalDecision,\n reason?: string\n ): Observable<AgentProposal> {\n return this.transport.json<AgentProposal>('POST', `approvals/${encodeURIComponent(proposal.approvalId)}/decisions`, {\n decision,\n expectedProposalHash: proposal.proposalHash,\n reason: reason?.trim() || null\n });\n }\n\n /** Decides several proposals; each one is checked and decided on its own. */\n decideMany(approvalIds: string[], decision: AgentProposalDecision, reason?: string): Observable<{ results: AgentDecisionOutcome[] }> {\n return this.transport.json<{ results: AgentDecisionOutcome[] }>('POST', 'approvals/decisions', {\n approvalIds,\n decision,\n reason: reason?.trim() || null\n });\n }\n\n /** Resolves an execution whose outcome is unknown. */\n resolve(approvalId: string, action: AgentExecutionResolution, reason?: string): Observable<AgentProposal> {\n return this.transport.json<AgentProposal>('POST', `approvals/${encodeURIComponent(approvalId)}/resolve`, {\n action,\n reason: reason?.trim() || null\n });\n }\n\n /**\n * Gives or changes the caller's feedback on a closed proposal (`canGiveFeedback`). Feedback is\n * optional and separate from the decision; an empty text is sent as `null`. Fails with\n * `assistant-feedback-not-accepted` while the proposal is pending or after it was approved.\n */\n giveFeedback(\n approvalId: string,\n category: AgentProposalFeedbackCategory,\n text?: string | null\n ): Observable<AgentProposalFeedback> {\n return this.transport.json<AgentProposalFeedback>('PUT', `approvals/${encodeURIComponent(approvalId)}/feedback`, {\n category,\n text: text?.trim() || null\n });\n }\n\n /**\n * Gives the same feedback on at most `NH_ASSISTANT_MAX_BULK_FEEDBACK` proposals that were\n * rejected together. Each proposal is checked on its own and stored as bulk feedback.\n */\n giveFeedbackMany(\n approvalIds: readonly string[],\n category: AgentProposalFeedbackCategory,\n text?: string | null\n ): Observable<{ results: AgentFeedbackOutcome[] }> {\n return this.transport.json<{ results: AgentFeedbackOutcome[] }>('POST', 'approvals/feedback', {\n approvalIds,\n category,\n text: text?.trim() || null\n });\n }\n}\n\n/** Appends the filter values that are set as query parameters. */\nfunction withQuery(path: string, filter: object): string {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null && value !== '') {\n query.set(key, String(value));\n }\n }\n\n const suffix = query.toString();\n return suffix ? `${path}?${suffix}` : path;\n}\n","import { DestroyRef, EnvironmentInjector, Injectable, PLATFORM_ID, inject, runInInjectionContext, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport type { HubConnection } from '@microsoft/signalr';\nimport { Observable, Subject } from 'rxjs';\nimport {\n LiveAgentWorkChanged,\n LiveAgentWorkWatch,\n LiveConversationChanged,\n LiveConversationEvent,\n LiveConversationRead,\n LiveConversationRemoved\n} from '../models/assistant-live.models';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { nhAssistantRequestHeaders } from './nh-assistant-transport';\n\nexport type NhAssistantLiveState = 'off' | 'connecting' | 'connected' | 'reconnecting' | 'disconnected';\n\nconst reconnectDelaysMs = [0, 2_000, 5_000, 10_000, 30_000];\nconst restartDelayMs = 30_000;\n/** How long a watch of the whole application's agent work lasts when the server does not say. */\nconst defaultWatchRenewalSeconds = 300;\n/** The shortest renewal of a watch, whatever the server says. */\nconst minimumWatchRenewalSeconds = 30;\n/** Query parameters the library and SignalR set themselves. */\nconst reservedHubQueryParameters = new Set(['access_token', 'id', 'negotiateversion']);\n\n/**\n * Live updates of the assistant hub: conversation changes, read positions, removals, the turn\n * events of other sessions and changes to the work of agents that run on their own. Connects only\n * while the store asks for it, reconnects on its own and emits `resync` after every (re)connect,\n * because updates sent while disconnected are lost. The work of agents for the whole application\n * lists no members, so it arrives only while a screen watches it (`watchAgentWork`).\n */\n@Injectable()\nexport class NhAssistantLiveService {\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly injector = inject(EnvironmentInjector);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly changedSubject = new Subject<LiveConversationChanged>();\n private readonly readSubject = new Subject<LiveConversationRead>();\n private readonly removedSubject = new Subject<LiveConversationRemoved>();\n private readonly eventSubject = new Subject<LiveConversationEvent>();\n private readonly agentWorkSubject = new Subject<LiveAgentWorkChanged>();\n private readonly resyncSubject = new Subject<void>();\n private readonly stateSignal = signal<NhAssistantLiveState>('off');\n\n private connection?: HubConnection;\n private hubPath: string | null = null;\n private hubUrl: string | null = null;\n private revision = 0;\n private restartTimer?: ReturnType<typeof setTimeout>;\n /** The screens that watch the work of agents for the whole application. */\n private agentWorkWatchers = 0;\n private watchTimer?: ReturnType<typeof setTimeout>;\n\n readonly changed$: Observable<LiveConversationChanged> = this.changedSubject.asObservable();\n readonly read$: Observable<LiveConversationRead> = this.readSubject.asObservable();\n readonly removed$: Observable<LiveConversationRemoved> = this.removedSubject.asObservable();\n readonly events$: Observable<LiveConversationEvent> = this.eventSubject.asObservable();\n /**\n * A run, proposal or feedback of an agent thread changed. It carries no content; components\n * that show the thread reload it.\n */\n readonly agentWork$: Observable<LiveAgentWorkChanged> = this.agentWorkSubject.asObservable();\n /** Reload snapshots: emitted after every (re)connect. */\n readonly resync$: Observable<void> = this.resyncSubject.asObservable();\n readonly state = this.stateSignal.asReadonly();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.agentWorkWatchers = 0;\n void this.stop();\n this.changedSubject.complete();\n this.readSubject.complete();\n this.removedSubject.complete();\n this.eventSubject.complete();\n this.agentWorkSubject.complete();\n this.resyncSubject.complete();\n });\n }\n\n /**\n * Connects to the hub at `hubPath`, or disconnects when it is `null`. Calling it again with the\n * same path keeps the connection; another path or `restart` reconnects, for example after the\n * signed-in user changed.\n */\n async connect(hubPath: string | null, restart = false): Promise<void> {\n const url = this.browser && this.config.liveUpdates !== false && hubPath ? this.resolveUrl(hubPath) : null;\n if (!restart && url === this.hubUrl && this.connection) {\n return;\n }\n\n await this.stop();\n this.hubPath = url ? hubPath : null;\n this.hubUrl = url;\n if (!url) {\n return;\n }\n\n const revision = ++this.revision;\n this.stateSignal.set('connecting');\n try {\n const connection = await this.build(url);\n if (revision !== this.revision) {\n await connection.stop().catch(() => undefined);\n return;\n }\n this.connection = connection;\n await connection.start();\n if (revision === this.revision) {\n this.stateSignal.set('connected');\n this.resyncSubject.next();\n void this.renewAgentWorkWatch();\n }\n } catch {\n // Live updates are optional; snapshots keep the assistant correct. Try again later.\n if (revision === this.revision) {\n this.stateSignal.set('disconnected');\n this.scheduleRestart(revision);\n }\n }\n }\n\n /**\n * Follows the work of agents for the whole application, such as their proposals and runs, while the\n * returned function has not been called; a screen that shows it, such as the approval inbox or a\n * board, watches it while it is shown. The whole application lists no members, so the hub sends its\n * agents' work only to connections that watch it: it joins the work the server decides the person\n * may read, the agent's view policy included, renews the watch when the server says and after every\n * reconnect, and so checks the person's rights again. The watch ends when the last screen releases\n * it. Without a connection nothing arrives and screens keep their own reload.\n */\n watchAgentWork(): () => void {\n this.agentWorkWatchers++;\n if (this.agentWorkWatchers === 1) {\n void this.renewAgentWorkWatch();\n }\n\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n this.agentWorkWatchers = Math.max(0, this.agentWorkWatchers - 1);\n if (this.agentWorkWatchers === 0) {\n clearTimeout(this.watchTimer);\n const connection = this.connection;\n if (connection && this.stateSignal() === 'connected') {\n connection.invoke('UnwatchAgentWork').catch(() => undefined);\n }\n }\n };\n }\n\n async stop(): Promise<void> {\n this.revision++;\n this.hubUrl = null;\n clearTimeout(this.restartTimer);\n clearTimeout(this.watchTimer);\n const connection = this.connection;\n this.connection = undefined;\n this.stateSignal.set('off');\n if (connection) {\n await connection.stop().catch(() => undefined);\n }\n }\n\n private async build(url: string): Promise<HubConnection> {\n const signalR = await import('@microsoft/signalr');\n const headers = await nhAssistantRequestHeaders(this.config, this.injector);\n const hubUrl = await this.withQueryParameters(url);\n const connection = new signalR.HubConnectionBuilder()\n .withUrl(hubUrl, {\n accessTokenFactory: async () => (await this.token()) ?? '',\n headers\n })\n .withAutomaticReconnect(reconnectDelaysMs)\n .configureLogging(signalR.LogLevel.None)\n .build();\n\n connection.on('ConversationChanged', (message: LiveConversationChanged) => this.changedSubject.next(message));\n connection.on('ConversationRead', (message: LiveConversationRead) => this.readSubject.next(message));\n connection.on('ConversationRemoved', (message: LiveConversationRemoved) => this.removedSubject.next(message));\n connection.on('ConversationEvent', (message: LiveConversationEvent) => this.eventSubject.next(message));\n connection.on('AgentWorkChanged', (message: LiveAgentWorkChanged) => this.agentWorkSubject.next(message));\n connection.onreconnecting(() => this.stateSignal.set('reconnecting'));\n connection.onreconnected(() => {\n this.stateSignal.set('connected');\n this.resyncSubject.next();\n // A new connection belongs to no watch yet.\n void this.renewAgentWorkWatch();\n });\n connection.onclose(() => {\n if (this.connection === connection) {\n this.connection = undefined;\n this.stateSignal.set('disconnected');\n this.scheduleRestart(this.revision);\n }\n });\n return connection;\n }\n\n /**\n * Asks the hub to watch the work of agents for the whole application for the screens that watch it,\n * and schedules the renewal the server asks for. An older server without watching, or a failed call,\n * is tried again later; live updates stay optional.\n */\n private async renewAgentWorkWatch(): Promise<void> {\n clearTimeout(this.watchTimer);\n const connection = this.connection;\n if (this.agentWorkWatchers === 0 || !connection || this.stateSignal() !== 'connected') {\n return;\n }\n\n let seconds = defaultWatchRenewalSeconds;\n try {\n const watch = await connection.invoke<LiveAgentWorkWatch | null>('WatchAgentWork');\n if (typeof watch?.refreshAfterSeconds === 'number' && Number.isFinite(watch.refreshAfterSeconds)) {\n seconds = Math.max(minimumWatchRenewalSeconds, watch.refreshAfterSeconds);\n }\n } catch {\n // Tried again at the next renewal or reconnect.\n }\n\n if (connection === this.connection && this.agentWorkWatchers > 0) {\n clearTimeout(this.watchTimer);\n this.watchTimer = setTimeout(() => void this.renewAgentWorkWatch(), seconds * 1_000);\n }\n }\n\n /** Starts over after the automatic reconnect gave up or the first start failed. */\n private scheduleRestart(revision: number): void {\n clearTimeout(this.restartTimer);\n this.restartTimer = setTimeout(() => {\n if (revision === this.revision && this.hubPath) {\n void this.connect(this.hubPath, true);\n }\n }, restartDelayMs);\n }\n\n private async token(): Promise<string | null> {\n try {\n return await runInInjectionContext(this.injector, () => this.config.getAccessToken());\n } catch {\n return null;\n }\n }\n\n /**\n * The hub URL with the host's `getHubQueryParameters`, which reach the hub on every transport,\n * unlike headers on WebSockets and server-sent events.\n */\n private async withQueryParameters(url: string): Promise<string> {\n const getter = this.config.getHubQueryParameters;\n if (!getter) {\n return url;\n }\n\n let parameters: Record<string, string> | null;\n try {\n parameters = await runInInjectionContext(this.injector, () => getter());\n } catch {\n return url;\n }\n\n const target = new URL(url);\n for (const [name, value] of Object.entries(parameters ?? {})) {\n if (typeof value === 'string' && value.length > 0 && !reservedHubQueryParameters.has(name.toLowerCase())) {\n target.searchParams.set(name, value);\n }\n }\n return target.toString();\n }\n\n /** `hubBaseUrl` + `hubPath`, or the hub path on the origin of `apiBaseUrl`. */\n private resolveUrl(hubPath: string): string {\n const page = globalThis.location?.href ?? 'http://localhost';\n if (this.config.hubBaseUrl) {\n const base = new URL(this.config.hubBaseUrl, page).toString().replace(/\\/+$/, '');\n return `${base}/${hubPath.replace(/^\\/+/, '')}`;\n }\n return new URL(hubPath, new URL(this.config.apiBaseUrl, page).origin).toString();\n }\n}\n","import { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantError } from '../services/nh-assistant.store';\nimport { NhAssistantApiError, nhAssistantErrorMessageKey } from '../services/nh-assistant-transport';\n\n/** The text every error falls back to when neither its key nor its code has one. */\nconst genericErrorKey = 'nh-assistant.errors.generic';\n\n/** Converts any failure into a user-facing code and translation key, never raw text. */\nexport function toNhAssistantError(error: unknown): NhAssistantError {\n if (error instanceof NhAssistantApiError) {\n return Object.keys(error.fieldErrors).length > 0\n ? { code: error.code, messageKey: error.messageKey, fieldErrors: error.fieldErrors }\n : { code: error.code, messageKey: error.messageKey };\n }\n\n return nhAssistantErrorOf(NhAssistantClientErrorCodes.server);\n}\n\n/** The error of a code without a message key of its own, such as a code a callback page reported. */\nexport function nhAssistantErrorOf(code: string): NhAssistantError {\n return { code, messageKey: nhAssistantErrorMessageKey(code) };\n}\n\n/** Translation keys for an error, from the most to the least specific. */\nexport function nhAssistantErrorKeys(error: NhAssistantError | null): string[] {\n return error ? [error.messageKey, nhAssistantErrorMessageKey(error.code), genericErrorKey] : [];\n}\n\n/**\n * Translation keys for a bare failure code, such as a run's `failureCode`: the registered text of\n * the code, then the generic text. Empty without a code.\n */\nexport function nhAssistantCodeKeys(code: string | null | undefined): string[] {\n return code ? [nhAssistantErrorMessageKey(code), genericErrorKey] : [];\n}\n\n/** Dash-case identifiers as the contract requires for agent and MCP server ids. */\nexport const NH_ASSISTANT_DASH_CASE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n","import { DOCUMENT } from '@angular/common';\nimport { InjectionToken, inject } from '@angular/core';\nimport { Observable, catchError, switchMap, throwError } from 'rxjs';\nimport { McpAuthorizationStart, McpCompleteRequest, McpCompletion } from '../models/assistant-admin.models';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantApiError, nhAssistantErrorMessageKey, nhAssistantIsSafeCode } from './nh-assistant-transport';\n\n/** The `type` of the message the assistant's OAuth callback page posts to its opener. */\nexport const NH_ASSISTANT_MCP_AUTHORIZATION_MESSAGE = 'nh-assistant-mcp-authorization';\n\n/**\n * What an authorization window reports: the flow and its one-time completion code, which\n * `POST mcp-connections/complete` turns into the connection with the caller's own session, or the\n * failure code of the callback (for example `assistant-mcp-authorization-failed`).\n */\nexport type NhAssistantMcpAuthorizationOutcome =\n | { flowId: string; completionCode: string; code?: undefined }\n | { flowId: string | null; code: string; completionCode?: undefined };\n\n/** A window opened for one authorization. */\nexport interface NhAssistantMcpAuthorizationHandle {\n /** Shows the authorization and emits its outcome once, then completes. */\n authorize(start: McpAuthorizationStart): Observable<NhAssistantMcpAuthorizationOutcome>;\n /** Closes the window, for example when starting the authorization failed. */\n close(): void;\n}\n\n/**\n * Opens MCP authorizations in the person's browser. `open()` runs in the click handler, before the\n * authorization URL is known, so popup blockers allow the window.\n */\nexport interface NhAssistantMcpAuthorizationWindow {\n open(): NhAssistantMcpAuthorizationHandle;\n}\n\n/**\n * The authorization window of the assistant components. The default opens a popup and waits for the\n * callback page's message; the testing package replaces it for the mock back-end.\n */\nexport const NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW = new InjectionToken<NhAssistantMcpAuthorizationWindow>(\n 'NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW',\n { providedIn: 'root', factory: () => new NhAssistantMcpPopupAuthorizationWindow(inject(DOCUMENT)) }\n);\n\nconst safeToken = /^[A-Za-z0-9_-]{16,128}$/;\n/** The code of a callback whose own code cannot be shown. */\nconst authorizationFailed = 'assistant-mcp-authorization-failed';\nconst flowPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * Opens the authorization in a popup. Only a message from that popup, sent by the assistant's\n * callback page (`callbackOrigin`), with the started flow is accepted; the completion code is useless\n * without the starter's own session. A closed popup\n * without a message reports `assistant-mcp-authorization-cancelled`, a blocked one\n * `assistant-mcp-popup-blocked`.\n */\nexport class NhAssistantMcpPopupAuthorizationWindow implements NhAssistantMcpAuthorizationWindow {\n constructor(private readonly document: Document) {}\n\n open(): NhAssistantMcpAuthorizationHandle {\n const view = this.document.defaultView;\n // The callback page needs window.opener, so the popup cannot be opened with noopener.\n const popup = view?.open('about:blank', '_blank', 'popup=yes,width=560,height=720') ?? null;\n return new PopupHandle(view, popup);\n }\n}\n\nclass PopupHandle implements NhAssistantMcpAuthorizationHandle {\n constructor(\n private readonly view: Window | null,\n private readonly popup: Window | null\n ) {}\n\n authorize(start: McpAuthorizationStart): Observable<NhAssistantMcpAuthorizationOutcome> {\n return new Observable<NhAssistantMcpAuthorizationOutcome>(subscriber => {\n const view = this.view;\n const popup = this.popup;\n if (!view || !popup || popup.closed) {\n subscriber.next({ flowId: start.flowId, code: NhAssistantClientErrorCodes.mcpPopupBlocked });\n subscriber.complete();\n return undefined;\n }\n\n let finished = false;\n const finish = (outcome: NhAssistantMcpAuthorizationOutcome): void => {\n if (finished) {\n return;\n }\n finished = true;\n subscriber.next(outcome);\n subscriber.complete();\n };\n const onMessage = (event: MessageEvent): void => {\n if (event.source !== popup || event.origin !== start.callbackOrigin) {\n return;\n }\n const outcome = readMessage(event.data, start.flowId);\n if (outcome) {\n finish(outcome);\n }\n };\n view.addEventListener('message', onMessage);\n const closedCheck = view.setInterval(() => {\n if (popup.closed) {\n // The message is dispatched before the page closes itself; a later check finds nothing.\n finish({ flowId: start.flowId, code: NhAssistantClientErrorCodes.mcpAuthorizationCancelled });\n }\n }, 500);\n popup.location.replace(start.authorizationUrl);\n\n return () => {\n view.removeEventListener('message', onMessage);\n view.clearInterval(closedCheck);\n };\n });\n }\n\n close(): void {\n if (this.popup && !this.popup.closed) {\n this.popup.close();\n }\n }\n}\n\n/**\n * The outcome in a callback message for the started flow, or null for any other message. The message\n * is `{ type, flowId, completionCode, code, messageKey }`; the text of a failure comes from its code,\n * so the message key the page sends along is not needed.\n */\nfunction readMessage(data: unknown, flowId: string): NhAssistantMcpAuthorizationOutcome | null {\n if (!data || typeof data !== 'object') {\n return null;\n }\n const message = data as Record<string, unknown>;\n if (message['type'] !== NH_ASSISTANT_MCP_AUTHORIZATION_MESSAGE) {\n return null;\n }\n const messageFlow = message['flowId'];\n if (messageFlow !== null && messageFlow !== flowId) {\n return null;\n }\n const completionCode = message['completionCode'];\n if (messageFlow === flowId && typeof completionCode === 'string' && safeToken.test(completionCode)) {\n return { flowId, completionCode };\n }\n const code = message['code'];\n return { flowId, code: nhAssistantIsSafeCode(code) ? code : authorizationFailed };\n}\n\n/**\n * Reads the outcome of a redirect-mode authorization from a URL fragment\n * (`#nh-mcp-flow=…&nh-mcp-code=…` or `#nh-mcp-error=…&nh-mcp-message-key=…`); null when the fragment\n * has none. The text of a failure comes from its code. Remove the fragment from the address bar after\n * reading it.\n */\nexport function nhAssistantMcpAuthorizationFromFragment(fragment: string): NhAssistantMcpAuthorizationOutcome | null {\n const values = new URLSearchParams(fragment.startsWith('#') ? fragment.slice(1) : fragment);\n const flowId = values.get('nh-mcp-flow');\n const completionCode = values.get('nh-mcp-code');\n const error = values.get('nh-mcp-error');\n if (flowId && flowPattern.test(flowId) && completionCode && safeToken.test(completionCode)) {\n return { flowId, completionCode };\n }\n if (error) {\n return { flowId: flowId && flowPattern.test(flowId) ? flowId : null, code: nhAssistantIsSafeCode(error) ? error : authorizationFailed };\n }\n return null;\n}\n\n/**\n * Runs one authorization: starts it, shows it in the window opened before, and completes it with\n * the caller's own session. Errors with `NhAssistantApiError`, also for the window's failure codes.\n */\nexport function nhAssistantConnectMcp(\n handle: NhAssistantMcpAuthorizationHandle,\n start: Observable<McpAuthorizationStart>,\n complete: (request: McpCompleteRequest) => Observable<McpCompletion>\n): Observable<McpCompletion> {\n return start.pipe(\n catchError((error: unknown) => {\n handle.close();\n return throwError(() => error);\n }),\n switchMap(started => handle.authorize(started)),\n switchMap(outcome => outcome.completionCode !== undefined\n ? complete({ flowId: outcome.flowId, completionCode: outcome.completionCode })\n : throwError(() => new NhAssistantApiError(0, outcome.code, nhAssistantErrorMessageKey(outcome.code)))));\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { NEVER, Observable, catchError, map, of, switchMap } from 'rxjs';\nimport { toNhAssistantError } from '../internal/nh-assistant-errors';\nimport { McpAuthorizationStart, McpAuthorizeRequest, McpCompletion } from '../models/assistant-admin.models';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { NhAssistantApiService } from './nh-assistant-api.service';\nimport {\n NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW,\n nhAssistantConnectMcp,\n nhAssistantMcpAuthorizationFromFragment\n} from './nh-assistant-mcp-authorization';\n\n/**\n * The outcome of an authorization the page returned from in redirect mode: the activated connection,\n * or the failure code to show. `serverId` names the server whose connection the page left for, when\n * this browser tab remembered it, so a screen shows the outcome at that server only.\n */\nexport type NhAssistantMcpReturnOutcome =\n | { completion: McpCompletion; code?: undefined; serverId?: string | null }\n | { code: string; completion?: undefined; serverId?: string | null };\n\n/** Where this tab remembers the server whose connection it left for, until it returns. */\nconst leftForKey = 'nh-assistant.mcp-connect.server';\n\n/**\n * Connects MCP accounts the way the host configured (`mcpConnectMode`): in a popup that the click\n * opens, or by sending the page to the authorization server and back. Every authorization completes\n * with the caller's own session.\n */\n@Injectable()\nexport class NhAssistantMcpConnectService {\n private readonly api = inject(NhAssistantApiService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly authorizationWindow = inject(NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW);\n private readonly document = inject(DOCUMENT);\n\n /**\n * The outcome of the redirect-mode authorization this page opened with, until a screen showed it.\n * `nh-assistant-connection-required` shows the outcome of its server without taking it; the\n * connection lists of the preferences and the administration show it and take it.\n */\n readonly returned = signal<NhAssistantMcpReturnOutcome | null>(null);\n\n /** Whether authorizations leave the page instead of opening a popup. */\n get redirects(): boolean {\n return this.config.mcpConnectMode === 'redirect';\n }\n\n /**\n * Connects the caller's own account to a server each person connects to. Call it in the click\n * handler, so the popup is allowed. In redirect mode the page leaves and the observable never\n * emits; the page completes the authorization when it returns.\n */\n connect(serverId: string, options: { allowBackgroundUse?: boolean } = {}): Observable<McpCompletion> {\n return this.run(\n request => this.api.authorizeMcpConnection(serverId, { ...request, allowBackgroundUse: options.allowBackgroundUse ?? null }),\n serverId);\n }\n\n /**\n * Runs any authorization start, for example an administrator's organization connection, in the\n * configured mode. `serverId` lets the page show the outcome at that server after a redirect.\n */\n run(start: (request: McpAuthorizeRequest) => Observable<McpAuthorizationStart>, serverId?: string): Observable<McpCompletion> {\n if (!this.redirects) {\n return nhAssistantConnectMcp(this.authorizationWindow.open(), start({}), request => this.api.completeMcpAuthorization(request));\n }\n\n const returnUrl = this.config.mcpConnectReturnUrl?.() ?? withoutFragment(this.document.location.href);\n return start({ returnUrl }).pipe(switchMap(started => {\n this.rememberLeftFor(serverId ?? null);\n this.navigate(started.authorizationUrl);\n return NEVER;\n }));\n }\n\n /** Leaves the page for an authorization in redirect mode. */\n navigate(url: string): void {\n this.document.location.assign(url);\n }\n\n /**\n * Completes a redirect-mode authorization when the page opened with its fragment, removes the\n * fragment from the address and records the outcome in `returned`: the connection, or the code of\n * whatever failed, also when completing it failed. Emits null without a fragment and never errors.\n */\n completeReturn(): Observable<NhAssistantMcpReturnOutcome | null> {\n const outcome = nhAssistantMcpAuthorizationFromFragment(this.document.location.hash);\n if (!outcome) {\n return of(null);\n }\n\n // The fragment carries a one-time code; it leaves the address before anything else happens.\n this.removeFragment();\n const serverId = this.takeLeftFor();\n\n if (outcome.completionCode === undefined) {\n return of(this.record({ code: outcome.code, serverId }));\n }\n\n const request = { flowId: outcome.flowId, completionCode: outcome.completionCode };\n return this.api.completeMcpAuthorization(request).pipe(\n map(completion => this.record({ completion, serverId: completion.serverId })),\n catchError((error: unknown) => of(this.record({ code: toNhAssistantError(error).code, serverId }))));\n }\n\n private record(outcome: NhAssistantMcpReturnOutcome): NhAssistantMcpReturnOutcome {\n this.returned.set(outcome);\n return outcome;\n }\n\n private removeFragment(): void {\n const view = this.document.defaultView;\n try {\n view?.history.replaceState(view.history.state, '', withoutFragment(this.document.location.href));\n } catch {\n // A page that may not change its history keeps the fragment; the code inside works only once.\n }\n }\n\n /** Remembers in this tab which server's connection the page leaves for. */\n private rememberLeftFor(serverId: string | null): void {\n try {\n const storage = this.document.defaultView?.sessionStorage;\n if (serverId) {\n storage?.setItem(leftForKey, serverId);\n } else {\n storage?.removeItem(leftForKey);\n }\n } catch {\n // Without session storage the outcome shows in the connection lists only.\n }\n }\n\n /** The server this tab left for, forgotten once read. */\n private takeLeftFor(): string | null {\n try {\n const storage = this.document.defaultView?.sessionStorage;\n const serverId = storage?.getItem(leftForKey) ?? null;\n storage?.removeItem(leftForKey);\n return serverId;\n } catch {\n return null;\n }\n }\n}\n\nfunction withoutFragment(url: string): string {\n const index = url.indexOf('#');\n return index < 0 ? url : url.slice(0, index);\n}\n","import { DestroyRef, Injectable, PLATFORM_ID, computed, inject, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { TranslateService } from '@ngx-translate/core';\nimport { Observable, Subject, firstValueFrom } from 'rxjs';\nimport { NotificationSettings } from '../models/assistant-api.models';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { NhAssistantApiService } from './nh-assistant-api.service';\n\n/**\n * Push state of this browser for the signed-in user:\n * - `unavailable`: the server, the browser or the host configuration does not support Web Push;\n * - `off`: the user turned notifications off;\n * - `prompt`: on, but the browser has not asked for permission yet (it asks on the next message sent);\n * - `blocked`: on, but the browser denied permission;\n * - `on`: this browser receives notifications.\n */\nexport type NhAssistantPushState = 'unavailable' | 'off' | 'prompt' | 'blocked' | 'on';\n\nconst openConversationMessage = 'nh-assistant.open-conversation';\n\n/**\n * Keeps this browser's Web Push subscription in line with the user's choice. Notifications are on\n * by default; because browsers only ask for permission after a user action, the assistant asks\n * when the user sends a message or turns notifications on. The bundled service worker shows a\n * notification only when no window of the application is focused.\n */\n@Injectable()\nexport class NhAssistantPushService {\n private readonly api = inject(NhAssistantApiService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly settingsState = signal<NotificationSettings | null>(null);\n private readonly permissionState = signal<NotificationPermission | 'unsupported'>('default');\n private readonly subscribedState = signal(false);\n private readonly busyState = signal(false);\n private readonly openSubject = new Subject<string>();\n private readonly openRunSubject = new Subject<string>();\n private registration?: Promise<ServiceWorkerRegistration>;\n private revision = 0;\n private readonly onWorkerMessage = (event: MessageEvent) => {\n const data = event.data as { type?: unknown; conversationId?: unknown; runId?: unknown } | null;\n if (data?.type === openConversationMessage && typeof data.conversationId === 'string') {\n this.openNotification(data.conversationId, typeof data.runId === 'string' ? data.runId : undefined);\n }\n };\n\n /** The caller's server-side choice, or `null` before it was loaded. */\n readonly settings = this.settingsState.asReadonly();\n readonly busy = this.busyState.asReadonly();\n /**\n * Conversations a clicked notification asks to open; the assistant panel opens them. A\n * notification about the proposals of a run goes to `openRun$` instead while the application\n * subscribes to it.\n */\n readonly openConversation$: Observable<string> = this.openSubject.asObservable();\n /**\n * Runs whose proposals a clicked notification is about, for the application to open its inbox of\n * the run, for example `nh-assistant-agent-inbox` with `[runId]`, which lists every proposal of the\n * run the person may decide. While the application subscribes, such a click emits the run here\n * instead of opening the conversation in the panel; without a subscriber it opens the conversation\n * as before. Subscribe in the application shell, so a notification that opens a new window finds\n * the subscription.\n */\n readonly openRun$: Observable<string> = this.openRunSubject.asObservable();\n readonly state = computed<NhAssistantPushState>(() => {\n const settings = this.settingsState();\n if (!settings?.pushAvailable || !this.isSupported()) {\n return 'unavailable';\n }\n if (!settings.pushEnabled) {\n return 'off';\n }\n const permission = this.permissionState();\n if (permission === 'denied' || permission === 'unsupported') {\n return 'blocked';\n }\n return permission === 'granted' && this.subscribedState() ? 'on' : 'prompt';\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n if (this.browser && this.isSupported()) {\n navigator.serviceWorker.removeEventListener('message', this.onWorkerMessage);\n }\n this.openSubject.complete();\n this.openRunSubject.complete();\n });\n if (this.browser && this.isSupported()) {\n navigator.serviceWorker.addEventListener('message', this.onWorkerMessage);\n navigator.serviceWorker.startMessages();\n }\n }\n\n /**\n * Opens what a clicked notification is about: the run through `openRun$` when the notification\n * names one and the application subscribes, otherwise the conversation through\n * `openConversation$`. The bundled worker and the panel's notification fragments call it.\n */\n openNotification(conversationId: string, runId?: string): void {\n if (runId && this.openRunSubject.observed) {\n this.openRunSubject.next(runId);\n return;\n }\n\n this.openSubject.next(conversationId);\n }\n\n /**\n * Loads the user's choice and, when permission was granted before, renews this browser's\n * subscription, which also moves it to the current user and to a rotated server key.\n */\n async activate(serverSupportsPush: boolean): Promise<void> {\n const revision = ++this.revision;\n if (!serverSupportsPush || !this.isSupported()) {\n this.settingsState.set(null);\n return;\n }\n\n try {\n const settings = await firstValueFrom(this.api.getNotificationSettings());\n if (revision !== this.revision) {\n return;\n }\n this.settingsState.set(settings);\n this.permissionState.set(Notification.permission);\n if (settings.pushEnabled && Notification.permission === 'granted') {\n await this.subscribe(settings);\n }\n } catch {\n // Notifications are optional; the assistant works without them.\n if (revision === this.revision) {\n this.settingsState.set(null);\n }\n }\n }\n\n /**\n * Forgets the user. The browser subscription is cancelled, so a previous user on a shared device\n * stops receiving notifications even when the server cannot be told.\n */\n async deactivate(): Promise<void> {\n this.revision++;\n this.settingsState.set(null);\n this.subscribedState.set(false);\n if (!this.isSupported()) {\n return;\n }\n try {\n const registration = await navigator.serviceWorker.getRegistration(this.scope());\n const subscription = await registration?.pushManager.getSubscription();\n await subscription?.unsubscribe();\n } catch {\n // Nothing to cancel.\n }\n }\n\n /** Asks for permission once, after a user action such as sending a message. */\n async onUserGesture(): Promise<void> {\n const settings = this.settingsState();\n if (!settings?.pushEnabled || !settings.pushAvailable || !this.isSupported() || Notification.permission !== 'default') {\n return;\n }\n const permission = await Notification.requestPermission();\n this.permissionState.set(permission);\n if (permission === 'granted') {\n await this.subscribe(settings);\n }\n }\n\n /** Turns notifications on or off for every browser of the user. Call it from a user action. */\n async setEnabled(enabled: boolean): Promise<void> {\n this.busyState.set(true);\n try {\n const settings = await firstValueFrom(this.api.updateNotificationSettings(enabled));\n this.settingsState.set(settings);\n if (!this.isSupported()) {\n return;\n }\n if (enabled) {\n if (Notification.permission === 'default') {\n this.permissionState.set(await Notification.requestPermission());\n }\n if (Notification.permission === 'granted') {\n await this.subscribe(settings);\n }\n return;\n }\n await this.unsubscribe();\n } finally {\n this.busyState.set(false);\n }\n }\n\n private async subscribe(settings: NotificationSettings): Promise<void> {\n if (!settings.publicKey) {\n return;\n }\n const revision = this.revision;\n const registration = await this.register();\n const key = decodeBase64Url(settings.publicKey);\n let subscription = await registration.pushManager.getSubscription();\n if (subscription && !sameKey(subscription.options.applicationServerKey, key)) {\n // The server rotated its key; a subscription for the old key would be refused.\n await subscription.unsubscribe();\n subscription = null;\n }\n subscription ??= await registration.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: key });\n const json = subscription.toJSON();\n if (!json.endpoint || !json.keys?.['p256dh'] || !json.keys['auth'] || revision !== this.revision) {\n return;\n }\n await firstValueFrom(this.api.subscribePush({\n endpoint: json.endpoint,\n keys: { p256dh: json.keys['p256dh'], auth: json.keys['auth'] },\n language: this.translate?.getCurrentLang() ?? navigator.language\n }), { defaultValue: undefined });\n if (revision === this.revision) {\n this.subscribedState.set(true);\n }\n }\n\n private async unsubscribe(): Promise<void> {\n this.subscribedState.set(false);\n const registration = await navigator.serviceWorker.getRegistration(this.scope());\n const subscription = await registration?.pushManager.getSubscription();\n if (!subscription) {\n return;\n }\n await firstValueFrom(this.api.unsubscribePush(subscription.endpoint), { defaultValue: undefined }).catch(() => undefined);\n await subscription.unsubscribe();\n }\n\n private register(): Promise<ServiceWorkerRegistration> {\n const push = this.config.push!;\n this.registration ??= (async () => {\n const url = new URL(push.serviceWorkerUrl, location.href);\n url.searchParams.set('app', new URL(push.openUrl ?? '/', location.href).href);\n if (push.icon) {\n url.searchParams.set('icon', new URL(push.icon, location.href).href);\n }\n return navigator.serviceWorker.register(url.href, { scope: this.scope() });\n })();\n return this.registration;\n }\n\n private scope(): string {\n const push = this.config.push;\n if (!push) {\n return '/';\n }\n return push.scope ?? new URL('./', new URL(push.serviceWorkerUrl, location.href)).pathname;\n }\n\n private isSupported(): boolean {\n return this.browser\n && !!this.config.push?.serviceWorkerUrl\n && globalThis.isSecureContext === true\n && 'serviceWorker' in navigator\n && 'PushManager' in globalThis\n && 'Notification' in globalThis;\n }\n}\n\nfunction decodeBase64Url(value: string): Uint8Array<ArrayBuffer> {\n const base64 = value.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(value.length / 4) * 4, '=');\n const binary = atob(base64);\n const bytes = new Uint8Array(new ArrayBuffer(binary.length));\n for (let index = 0; index < binary.length; index++) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytes;\n}\n\nfunction sameKey(current: ArrayBuffer | null, expected: Uint8Array): boolean {\n if (!current) {\n return false;\n }\n const bytes = new Uint8Array(current);\n return bytes.length === expected.length && bytes.every((byte, index) => byte === expected[index]);\n}\n","import { AgentUploadExtension, AgentUploads } from '../models/assistant-api.models';\n\n/** The longest file name a file reference takes. */\nexport const NH_ASSISTANT_MAX_FILE_NAME_LENGTH = 256;\n\nconst unknownMediaType = 'application/octet-stream';\n\nconst zipAliases = ['application/zip', 'application/x-zip-compressed'];\n\n/**\n * The media types the platform names, with the extensions a file picker offers and a short label.\n * The extensions are the same as the server's table of upload media types.\n */\nconst knownTypes: Record<string, { extensions: string[]; label: string }> = {\n 'application/pdf': { extensions: ['.pdf'], label: 'PDF' },\n 'image/png': { extensions: ['.png'], label: 'PNG' },\n 'image/jpeg': { extensions: ['.jpg', '.jpeg'], label: 'JPEG' },\n 'image/gif': { extensions: ['.gif'], label: 'GIF' },\n 'image/webp': { extensions: ['.webp'], label: 'WebP' },\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': { extensions: ['.docx'], label: 'Word' },\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': { extensions: ['.xlsx'], label: 'Excel' },\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation': { extensions: ['.pptx'], label: 'PowerPoint' },\n 'application/msword': { extensions: ['.doc'], label: 'Word' },\n 'application/vnd.ms-excel': { extensions: ['.xls'], label: 'Excel' },\n 'text/csv': { extensions: ['.csv'], label: 'CSV' },\n 'text/tab-separated-values': { extensions: ['.tsv'], label: 'TSV' },\n 'text/plain': { extensions: ['.txt'], label: 'Text' },\n 'text/markdown': { extensions: ['.md', '.markdown'], label: 'Markdown' },\n 'application/json': { extensions: ['.json'], label: 'JSON' },\n 'application/xml': { extensions: ['.xml'], label: 'XML' }\n};\n\n/** Types that say nothing about the content, whatever the file's extension. */\nconst genericTypes = new Set([unknownMediaType, 'binary/octet-stream', 'application/unknown']);\n\n/**\n * The types browsers commonly give a file of an extension instead of its own type: the program\n * that opens it, as Windows does with `application/vnd.ms-excel` for `.csv`, an outdated name or\n * the container format.\n */\nconst aliasesByExtension: Record<string, string[]> = {\n '.csv': [\n 'application/vnd.ms-excel',\n 'application/csv',\n 'application/x-csv',\n 'text/x-csv',\n 'text/comma-separated-values',\n 'text/x-comma-separated-values'\n ],\n '.md': ['text/x-markdown'],\n '.markdown': ['text/x-markdown'],\n '.jpg': ['image/jpg', 'image/pjpeg'],\n '.jpeg': ['image/jpg', 'image/pjpeg'],\n '.png': ['image/x-png'],\n '.docx': zipAliases,\n '.xlsx': zipAliases,\n '.pptx': zipAliases,\n // Browsers send the older name of XML; an application that accepts only it keeps receiving it.\n '.xml': ['text/xml']\n};\n\n/** The extension of a file name in lowercase, such as `.csv`; empty without one. */\nfunction extensionOf(name: string): string {\n const base = name.slice(Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\\\')) + 1);\n const dot = base.lastIndexOf('.');\n return dot > 0 || (dot === 0 && base.length > 1) ? base.slice(dot).toLowerCase() : '';\n}\n\n/** The application's extensions (`AgentUploads.mappedExtensions`) whose type is accepted, lowercase. */\nfunction acceptedMappings(\n acceptedMediaTypes: readonly string[],\n mappedExtensions: readonly AgentUploadExtension[] | null | undefined\n): AgentUploadExtension[] {\n return (mappedExtensions ?? [])\n .map(mapping => ({ extension: mapping.extension.toLowerCase(), mediaType: mapping.mediaType.toLowerCase() }))\n .filter(mapping => acceptedMediaTypes.includes(mapping.mediaType));\n}\n\n/** The platform's media type of an extension, or `null`. */\nfunction knownMediaTypeOf(extension: string): string | null {\n for (const [mediaType, known] of Object.entries(knownTypes)) {\n if (known.extensions.includes(extension)) {\n return mediaType;\n }\n }\n\n return null;\n}\n\n/**\n * The accepted type an extension names: the application's mapping, otherwise the platform's table;\n * `null` when neither names an accepted type.\n */\nfunction mediaTypeOfExtension(extension: string, acceptedMediaTypes: readonly string[], mappings: readonly AgentUploadExtension[]): string | null {\n if (extension.length === 0) {\n return null;\n }\n const mapped = mappings.find(mapping => mapping.extension === extension);\n if (mapped) {\n return mapped.mediaType;\n }\n\n const known = knownMediaTypeOf(extension);\n return known && acceptedMediaTypes.includes(known) ? known : null;\n}\n\n/**\n * The media type a chosen file uploads as, lowercase and without parameters, by the same rule as the\n * server. A browser gives no type, or a generic one, for a file its system does not know, and some\n * systems name an extension after the program that opens it, such as `application/vnd.ms-excel` for\n * a `.csv` file; the file name's extension then names the type, but only a type of\n * `acceptedMediaTypes`: the type the application mapped the extension to (`mappedExtensions`),\n * otherwise the platform's. A specific type stays as it is, so a type that is not accepted is refused\n * whatever the extension. Without a type and an accepted extension, `application/octet-stream`.\n */\nexport function nhAssistantMediaTypeOf(\n file: Pick<File, 'name' | 'type'>,\n acceptedMediaTypes: readonly string[],\n mappedExtensions?: readonly AgentUploadExtension[] | null\n): string {\n const declared = file.type.split(';')[0].trim().toLowerCase();\n const extension = extensionOf(file.name);\n if (declared.length === 0 || genericTypes.has(declared) || (aliasesByExtension[extension] ?? []).includes(declared)) {\n const derived = mediaTypeOfExtension(extension, acceptedMediaTypes, acceptedMappings(acceptedMediaTypes, mappedExtensions));\n if (derived) {\n return derived;\n }\n }\n\n return declared.length > 0 ? declared : unknownMediaType;\n}\n\n/**\n * The failure code of a file before it is uploaded, or `null` when it may be: the most files of one\n * message, an accepted media type, content and a usable name, and the largest size. `attached` counts\n * the files the message already carries.\n */\nexport function nhAssistantFileProblem(\n file: Pick<File, 'name' | 'size'>,\n mediaType: string,\n uploads: AgentUploads,\n attached: number\n): string | null {\n if (attached >= uploads.maxFiles) {\n return 'assistant-file-count-limit';\n }\n if (!uploads.acceptedMediaTypes.includes(mediaType)) {\n return 'assistant-file-type-not-accepted';\n }\n if (file.size === 0 || file.name.trim().length === 0 || file.name.length > NH_ASSISTANT_MAX_FILE_NAME_LENGTH) {\n return 'assistant-file-upload-invalid';\n }\n if (file.size > uploads.maxFileBytes) {\n return 'assistant-file-too-large';\n }\n\n return null;\n}\n\n/**\n * The `accept` attribute of a file input for these accepted media types: each type and the extensions\n * that name it, those the application mapped to it (`mappedExtensions`) and those of the platform's\n * table that the application did not map to another accepted type.\n */\nexport function nhAssistantAcceptAttribute(\n mediaTypes: readonly string[],\n mappedExtensions?: readonly AgentUploadExtension[] | null\n): string {\n const mappings = acceptedMappings(mediaTypes, mappedExtensions);\n const values = mediaTypes.flatMap(mediaType => [\n mediaType,\n ...mappings.filter(mapping => mapping.mediaType === mediaType).map(mapping => mapping.extension),\n ...(knownTypes[mediaType]?.extensions ?? []).filter(extension => !mappings.some(mapping => mapping.extension === extension))\n ]);\n return [...new Set(values)].join(',');\n}\n\n/** A short name of a media type, such as `PDF` or `Word`; otherwise its subtype in capitals. */\nexport function nhAssistantFileTypeLabel(mediaType: string): string {\n const known = knownTypes[mediaType];\n if (known) {\n return known.label;\n }\n\n const subtype = mediaType.split('/')[1] ?? mediaType;\n return subtype.split(/[.+]/).pop()!.toUpperCase();\n}\n\n/** A size in bytes as people read it, such as `820 KB` or `1.4 MB`, in the given language. */\nexport function nhAssistantFormatFileSize(bytes: number, language?: string | null): string {\n const units = ['B', 'KB', 'MB', 'GB'];\n let value = Math.max(0, bytes);\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) {\n value /= 1024;\n unit++;\n }\n\n let format: Intl.NumberFormat;\n try {\n format = new Intl.NumberFormat(language || undefined, { maximumFractionDigits: unit === 0 || value >= 10 ? 0 : 1 });\n } catch {\n format = new Intl.NumberFormat(undefined, { maximumFractionDigits: unit === 0 || value >= 10 ? 0 : 1 });\n }\n return `${format.format(value)} ${units[unit]}`;\n}\n","import {\n ApprovalDecision,\n ApprovalPart,\n Conversation,\n ConversationStatus,\n Message,\n MessagePart,\n QuestionPart,\n ToolCallPart\n} from '../models/assistant-api.models';\nimport { LiveConversationChanged, LiveConversationEvent } from '../models/assistant-live.models';\nimport { NH_ASSISTANT_SSE_EVENT_TYPES, NhAssistantSseEvent, TurnCompletionStatus } from '../models/assistant-sse.models';\n\n/**\n * Applies one assistant event to a conversation and returns the new conversation.\n * The input is never mutated, so the result can be stored in a signal directly.\n *\n * @param clientMessageId id of the optimistic user message of the current turn; its id is\n * replaced by the server's `userMessageId` when `turn.started` arrives.\n */\nexport function applyNhAssistantEvent(\n conversation: Conversation,\n event: NhAssistantSseEvent,\n clientMessageId?: string\n): Conversation {\n switch (event.type) {\n case 'turn.started': {\n let messages = conversation.messages.map(message =>\n clientMessageId && message.id === clientMessageId ? { ...message, id: event.data.userMessageId } : message\n );\n if (!messages.some(message => message.id === event.data.assistantMessageId)) {\n messages = [...messages, createAssistantMessage(event.data.assistantMessageId)];\n }\n\n return { ...conversation, status: 'running', messages };\n }\n\n case 'message.delta': {\n const messages = ensureMessage(conversation.messages, event.data.messageId);\n return {\n ...conversation,\n messages: messages.map(message =>\n message.id === event.data.messageId ? appendText(message, event.data.text) : message\n )\n };\n }\n\n case 'tool.started': {\n const data = event.data;\n if (findToolCall(conversation.messages, data.invocationId)) {\n return updateToolCall(conversation, data.invocationId, part => ({\n ...part,\n toolId: data.toolId,\n toolVersion: data.toolVersion,\n displayName: data.displayName,\n argumentsPreview: data.argumentsPreview,\n status: 'running'\n }));\n }\n\n const part: ToolCallPart = {\n type: 'tool-call',\n invocationId: data.invocationId,\n toolId: data.toolId,\n toolVersion: data.toolVersion,\n displayName: data.displayName,\n status: 'running',\n argumentsPreview: data.argumentsPreview,\n resultPreview: null,\n resultCode: null\n };\n return appendToCurrentAssistantMessage(conversation, part);\n }\n\n case 'tool.completed': {\n const data = event.data;\n return updateToolCall(conversation, data.invocationId, part => ({\n ...part,\n status: data.status,\n resultCode: data.resultCode,\n resultPreview: data.resultPreview\n }));\n }\n\n case 'approval.required': {\n const approval: ApprovalPart = { ...event.data, type: 'approval' };\n const withToolAwaiting = markLatestRunningToolAwaiting(\n conversation,\n approval.toolId,\n approval.presentation?.toolDisplayName);\n const exists = withToolAwaiting.messages.some(message =>\n message.parts.some(part => part.type === 'approval' && part.approvalId === approval.approvalId)\n );\n const withApproval = exists\n ? replaceApproval(withToolAwaiting, approval)\n : appendToCurrentAssistantMessage(withToolAwaiting, approval);\n\n return { ...withApproval, status: 'waiting-for-approval', pendingApproval: approval };\n }\n\n case 'question.asked': {\n const question: QuestionPart = { ...event.data, type: 'question' };\n // The ask_question call waits for the answer as a call waits for an approval.\n const withToolAwaiting = updateToolCall(conversation, question.questionId, part => ({ ...part, status: 'awaiting-answer' }));\n const withQuestion = hasQuestion(withToolAwaiting, question.questionId)\n ? replaceQuestion(withToolAwaiting, question)\n : appendToCurrentAssistantMessage(withToolAwaiting, question);\n\n return { ...withQuestion, status: 'waiting-for-approval', pendingQuestion: question };\n }\n\n case 'question.answered': {\n const question: QuestionPart = { ...event.data, type: 'question' };\n return {\n ...replaceQuestion(conversation, question),\n pendingQuestion: conversation.pendingQuestion?.questionId === question.questionId ? null : conversation.pendingQuestion ?? null\n };\n }\n\n case 'connection.required': {\n const data = event.data;\n // One card per server and answer, also when a live update repeats the event.\n const current = [...conversation.messages].reverse().find(message => message.role === 'assistant');\n if (current?.parts.some(part => part.type === 'connection-required' && part.serverId === data.serverId)) {\n return conversation;\n }\n return appendToCurrentAssistantMessage(conversation, {\n type: 'connection-required',\n serverId: data.serverId,\n displayName: data.displayName,\n reason: data.reason\n });\n }\n\n case 'turn.completed': {\n const status = conversationStatusFor(event.data.status);\n return {\n ...conversation,\n status,\n pendingApproval: status === 'waiting-for-approval' ? conversation.pendingApproval : null,\n pendingQuestion: status === 'waiting-for-approval' ? conversation.pendingQuestion ?? null : null\n };\n }\n\n case 'error':\n return {\n ...conversation,\n status: conversation.status === 'running' ? 'failed' : conversation.status\n };\n }\n}\n\n/**\n * Records the user's approval decision locally until the server state is reloaded. A consulted\n * agent's proposal that the user left for the subject's approvers (`leave`) closes here as the server\n * closes it, rejected in this conversation, and can no longer be left; the waiting tool call goes on.\n */\nexport function applyNhAssistantApprovalDecision(\n conversation: Conversation,\n approvalId: string,\n decision: ApprovalDecision\n): Conversation {\n const approval = conversation.messages\n .flatMap(message => message.parts)\n .find((part): part is ApprovalPart => part.type === 'approval' && part.approvalId === approvalId)\n ?? conversation.pendingApproval;\n const toolId = approval?.approvalId === approvalId ? approval.toolId : null;\n\n const messages = conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'approval' && part.approvalId === approvalId\n ? decidedApproval(part, decision)\n : part\n )\n }));\n\n let updated: Conversation = {\n ...conversation,\n messages,\n status: 'running',\n pendingApproval: null\n };\n\n if (toolId) {\n const awaiting = findLatestToolCall(updated.messages, part => part.toolId === toolId && part.status === 'awaiting-approval');\n if (awaiting) {\n updated = updateToolCall(updated, awaiting.invocationId, part => ({\n ...part,\n status: decision === 'reject' ? 'rejected' : 'running'\n }));\n }\n }\n\n return updated;\n}\n\n/**\n * Records the addressee's answer to a question locally until the server state is reloaded: the\n * question reads as answered with the chosen index and the turn runs again.\n */\nexport function applyNhAssistantQuestionAnswer(\n conversation: Conversation,\n questionId: string,\n choice: number\n): Conversation {\n const messages = conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'question' && part.questionId === questionId\n ? { ...part, status: 'answered' as const, answerIndex: choice }\n : part\n )\n }));\n\n return updateToolCall(\n { ...conversation, messages, status: 'running', pendingQuestion: null },\n questionId,\n part => ({ ...part, status: 'running' }));\n}\n\n/** An approval part after the user's decision. */\nfunction decidedApproval(part: ApprovalPart, decision: ApprovalDecision): ApprovalPart {\n const decided: ApprovalPart = { ...part, status: decision === 'approve' ? 'approved' : 'rejected' };\n if (decision === 'leave' && part.consultation) {\n decided.consultation = { ...part.consultation, leaveRoute: null };\n }\n return decided;\n}\n\n/**\n * Applies a live update of another session: `message.created` adds a participant's or the\n * application's message once, where its sequence number puts it; the turn events behave exactly\n * like the starting request's stream. Unknown types are ignored.\n */\nexport function applyNhAssistantLiveEvent(conversation: Conversation, event: LiveConversationEvent): Conversation {\n if (event.type === 'message.created') {\n const message = event.data as Message;\n if (!message?.id || conversation.messages.some(existing => existing.id === message.id)) {\n return conversation;\n }\n return { ...conversation, messages: insertBySequence(conversation.messages, message) };\n }\n\n if (!(NH_ASSISTANT_SSE_EVENT_TYPES as readonly string[]).includes(event.type)) {\n return conversation;\n }\n return applyNhAssistantEvent(conversation, { type: event.type, data: event.data } as NhAssistantSseEvent);\n}\n\n/** Applies the shared state of a conversation that a live update announced. */\nexport function applyNhAssistantConversationChange(conversation: Conversation, change: LiveConversationChanged): Conversation {\n return {\n ...conversation,\n status: change.status,\n title: change.title,\n updatedAt: change.updatedAt,\n activeActorId: change.activeActorId,\n lastMessageSequence: change.lastMessageSequence,\n participantCount: change.participantCount,\n pendingApproval: change.status === 'waiting-for-approval' ? conversation.pendingApproval : null,\n pendingQuestion: change.status === 'waiting-for-approval' ? conversation.pendingQuestion ?? null : null\n };\n}\n\n/**\n * True when an assistant message after the latest user message contains non-blank text,\n * so the latest turn produced a visible answer. Tool calls and approvals alone do not count.\n */\nexport function nhAssistantLatestTurnHasText(conversation: Conversation): boolean {\n for (let position = conversation.messages.length - 1; position >= 0; position--) {\n const message = conversation.messages[position];\n if (message.role === 'user') {\n return false;\n }\n if (message.role === 'assistant' && message.parts.some(part => part.type === 'text' && part.text.trim().length > 0)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction conversationStatusFor(status: TurnCompletionStatus): ConversationStatus {\n switch (status) {\n case 'completed':\n case 'cancelled':\n return 'idle';\n case 'waiting-for-approval':\n return 'waiting-for-approval';\n case 'failed':\n return 'failed';\n }\n}\n\n/**\n * Places a stored message before the messages at the end that have a higher sequence number. A\n * message without a number, such as an optimistic message or the answer a running turn is still\n * writing, counts as earlier: the server numbers a turn's messages when the turn starts, so a message\n * stored during the turn follows its answer. A message without a number of its own goes last.\n */\nfunction insertBySequence(messages: Message[], message: Message): Message[] {\n const sequence = message.sequence;\n let index = messages.length;\n if (typeof sequence === 'number' && sequence > 0) {\n while (index > 0) {\n const previous = messages[index - 1].sequence;\n if (typeof previous !== 'number' || previous <= sequence) {\n break;\n }\n index--;\n }\n }\n\n return [...messages.slice(0, index), message, ...messages.slice(index)];\n}\n\nfunction createAssistantMessage(id: string): Message {\n return { id, role: 'assistant', createdAt: new Date().toISOString(), parts: [] };\n}\n\nfunction ensureMessage(messages: Message[], messageId: string): Message[] {\n return messages.some(message => message.id === messageId)\n ? messages\n : [...messages, createAssistantMessage(messageId)];\n}\n\nfunction appendText(message: Message, text: string): Message {\n const last = message.parts[message.parts.length - 1];\n if (last?.type === 'text') {\n return { ...message, parts: [...message.parts.slice(0, -1), { type: 'text', text: last.text + text }] };\n }\n\n return { ...message, parts: [...message.parts, { type: 'text', text }] };\n}\n\nfunction appendToCurrentAssistantMessage(conversation: Conversation, part: MessagePart): Conversation {\n let index = -1;\n for (let position = conversation.messages.length - 1; position >= 0; position--) {\n if (conversation.messages[position].role === 'assistant') {\n index = position;\n break;\n }\n }\n\n if (index < 0) {\n const message = createAssistantMessage(`local-${partKey(part)}`);\n return { ...conversation, messages: [...conversation.messages, { ...message, parts: [part] }] };\n }\n\n return {\n ...conversation,\n messages: conversation.messages.map((message, position) =>\n position === index ? { ...message, parts: [...message.parts, part] } : message\n )\n };\n}\n\nfunction partKey(part: MessagePart): string {\n if (part.type === 'tool-call') {\n return part.invocationId;\n }\n if (part.type === 'approval') {\n return part.approvalId;\n }\n if (part.type === 'connection-required') {\n return `connection-${part.serverId}`;\n }\n if (part.type === 'question') {\n return `question-${part.questionId}`;\n }\n\n return 'text';\n}\n\nfunction hasQuestion(conversation: Conversation, questionId: string): boolean {\n return conversation.messages.some(message =>\n message.parts.some(part => part.type === 'question' && part.questionId === questionId));\n}\n\nfunction replaceQuestion(conversation: Conversation, question: QuestionPart): Conversation {\n return {\n ...conversation,\n messages: conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'question' && part.questionId === question.questionId ? question : part\n )\n }))\n };\n}\n\nfunction findToolCall(messages: Message[], invocationId: string): ToolCallPart | undefined {\n return findLatestToolCall(messages, part => part.invocationId === invocationId);\n}\n\nfunction findLatestToolCall(messages: Message[], predicate: (part: ToolCallPart) => boolean): ToolCallPart | undefined {\n for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex--) {\n const parts = messages[messageIndex].parts;\n for (let partIndex = parts.length - 1; partIndex >= 0; partIndex--) {\n const part = parts[partIndex];\n if (part.type === 'tool-call' && predicate(part)) {\n return part;\n }\n }\n }\n\n return undefined;\n}\n\nfunction updateToolCall(\n conversation: Conversation,\n invocationId: string,\n update: (part: ToolCallPart) => ToolCallPart\n): Conversation {\n return {\n ...conversation,\n messages: conversation.messages.map(message =>\n message.parts.some(part => part.type === 'tool-call' && part.invocationId === invocationId)\n ? {\n ...message,\n parts: message.parts.map(part =>\n part.type === 'tool-call' && part.invocationId === invocationId ? update(part) : part\n )\n }\n : message\n )\n };\n}\n\nfunction markLatestRunningToolAwaiting(\n conversation: Conversation,\n toolId: string,\n displayName?: string\n): Conversation {\n const running = findLatestToolCall(conversation.messages, part => part.toolId === toolId && part.status === 'running');\n if (!running) {\n return conversation;\n }\n\n return updateToolCall(conversation, running.invocationId, part => ({\n ...part,\n displayName: displayName ?? part.displayName,\n status: 'awaiting-approval'\n }));\n}\n\nfunction replaceApproval(conversation: Conversation, approval: ApprovalPart): Conversation {\n return {\n ...conversation,\n messages: conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'approval' && part.approvalId === approval.approvalId ? approval : part\n )\n }))\n };\n}\n","import { ClientContext, ClientContextEntity } from '../models/assistant-api.models';\n\n/** Limits of the page context (contract 15.2). */\nexport const NH_ASSISTANT_PAGE_CONTEXT_LIMITS = {\n route: 200,\n title: 120,\n entities: 5,\n entityId: 64,\n entityLabel: 120\n} as const;\n\nconst dashCase = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/**\n * Validates host-provided page context and truncates it to the contract limits.\n * Returns null for an invalid shape (not an object or no route), so the message is sent\n * without page context. Route, title and labels are truncated; entities beyond five are\n * dropped, and entities with a type that is not dash-case, an empty id or an id longer\n * than 64 characters are dropped because a truncated id would point at another entity.\n */\nexport function normalizeNhAssistantClientContext(value: unknown): ClientContext | null {\n if (!isRecord(value)) {\n return null;\n }\n\n const route = typeof value['route'] === 'string' ? value['route'].trim() : '';\n if (route.length === 0) {\n return null;\n }\n\n const result: ClientContext = { route: truncate(route, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.route) };\n\n const title = typeof value['title'] === 'string' ? value['title'].trim() : '';\n if (title.length > 0) {\n result.title = truncate(title, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.title);\n }\n\n if (Array.isArray(value['entities'])) {\n const entities = value['entities']\n .map(normalizeEntity)\n .filter((entity): entity is ClientContextEntity => entity !== null)\n .slice(0, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.entities);\n if (entities.length > 0) {\n result.entities = entities;\n }\n }\n\n return result;\n}\n\n/** Short text for the page-context chip: the first entity's label, the title or the route. */\nexport function describeNhAssistantClientContext(context: ClientContext): string {\n const entity = context.entities?.[0];\n if (entity) {\n return entity.label ?? `${entity.type} ${entity.id}`;\n }\n\n return context.title ?? context.route;\n}\n\nfunction normalizeEntity(value: unknown): ClientContextEntity | null {\n if (!isRecord(value)) {\n return null;\n }\n\n const type = typeof value['type'] === 'string' ? value['type'].trim() : '';\n const id = typeof value['id'] === 'string' ? value['id'].trim() : '';\n if (!dashCase.test(type) || id.length === 0 || id.length > NH_ASSISTANT_PAGE_CONTEXT_LIMITS.entityId) {\n return null;\n }\n\n const entity: ClientContextEntity = { type, id };\n const label = typeof value['label'] === 'string' ? value['label'].trim() : '';\n if (label.length > 0) {\n entity.label = truncate(label, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.entityLabel);\n }\n return entity;\n}\n\nfunction truncate(value: string, max: number): string {\n return value.length <= max ? value : value.slice(0, max);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n","import { EnvironmentInjector, Injectable, inject, runInInjectionContext } from '@angular/core';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\n\ninterface AssistantUiState {\n agentId: string | null;\n conversationId: string | null;\n panelOpen: boolean;\n}\n\nconst emptyState: AssistantUiState = { agentId: null, conversationId: null, panelOpen: false };\nconst storagePrefix = 'nh-assistant-ui:v1:';\n\n/** Browser-only UI pointers. Messages, drafts, tokens and page context are never stored. */\n@Injectable()\nexport class NhAssistantUiState {\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly injector = inject(EnvironmentInjector);\n private key: string | null = null;\n private state: AssistantUiState = { ...emptyState };\n private activated = false;\n private activationRevision = 0;\n\n async activate(): Promise<{ changed: boolean; state: Readonly<AssistantUiState> }> {\n const revision = ++this.activationRevision;\n let scope: string | null = null;\n try {\n scope = await runInInjectionContext(this.injector, () => this.config.getStateScope?.() ?? null);\n } catch {\n scope = null;\n }\n\n if (revision !== this.activationRevision) {\n return { changed: false, state: this.state };\n }\n\n const normalized = typeof scope === 'string' ? scope.trim() : '';\n const key = normalized.length > 0 && normalized.length <= 256\n ? `${storagePrefix}${encodeURIComponent(this.config.apiBaseUrl)}:${encodeURIComponent(normalized)}`\n : null;\n if (this.activated && key === this.key) {\n return { changed: false, state: this.state };\n }\n\n this.activated = true;\n this.key = key;\n this.state = this.read();\n return { changed: true, state: this.state };\n }\n\n deactivate(): void {\n this.activationRevision++;\n this.activated = false;\n this.key = null;\n this.state = { ...emptyState };\n }\n\n update(patch: Partial<AssistantUiState>): void {\n this.state = { ...this.state, ...patch };\n if (!this.key) {\n return;\n }\n\n try {\n globalThis.localStorage?.setItem(this.key, JSON.stringify(this.state));\n } catch {\n // Storage can be unavailable or full; the live assistant remains usable.\n }\n }\n\n private read(): AssistantUiState {\n if (!this.key) {\n return { ...emptyState };\n }\n\n try {\n const raw = globalThis.localStorage?.getItem(this.key);\n const value: unknown = raw ? JSON.parse(raw) : null;\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return { ...emptyState };\n }\n\n const saved = value as Record<string, unknown>;\n return {\n agentId: validId(saved['agentId']),\n conversationId: validId(saved['conversationId']),\n panelOpen: saved['panelOpen'] === true\n };\n } catch {\n return { ...emptyState };\n }\n }\n}\n\nfunction validId(value: unknown): string | null {\n return typeof value === 'string' && value.length > 0 && value.length <= 256 ? value : null;\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n EnvironmentInjector,\n Injectable,\n PLATFORM_ID,\n computed,\n effect,\n inject,\n runInInjectionContext,\n signal,\n untracked\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Observable, Subscription, firstValueFrom, isObservable } from 'rxjs';\nimport {\n AgentSummary,\n AgentUploads,\n ApprovalDecision,\n ApprovalPart,\n ApprovalResolution,\n ApprovalStatus,\n AssistantStatus,\n ClientContext,\n Conversation,\n ConversationMember,\n ConversationStatus,\n ConversationSummary,\n DirectoryEntry,\n FileReference,\n Message,\n MessagePart\n} from '../models/assistant-api.models';\nimport { nhAssistantFileProblem, nhAssistantMediaTypeOf } from '../internal/nh-assistant-files';\nimport {\n LiveAgentWorkChanged,\n LiveConversationChanged,\n LiveConversationEvent,\n LiveConversationRead,\n LiveConversationRemoved\n} from '../models/assistant-live.models';\nimport { AgentProposalDecision } from '../models/assistant-agent-run.models';\nimport { NhAssistantClientErrorCodes, NhAssistantMessageEvent, NhAssistantSseEvent, TurnUsage } from '../models/assistant-sse.models';\nimport { NH_ASSISTANT_ACCESS_POLICY, NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { NhAssistantAgentRunApiService } from './nh-assistant-agent-run-api.service';\nimport { NhAssistantApiError, NhAssistantApiService, nhAssistantErrorMessageKey } from './nh-assistant-api.service';\nimport { NhAssistantLiveService } from './nh-assistant-live.service';\nimport { NhAssistantPushService } from './nh-assistant-push.service';\nimport {\n applyNhAssistantApprovalDecision,\n applyNhAssistantConversationChange,\n applyNhAssistantEvent,\n applyNhAssistantLiveEvent,\n applyNhAssistantQuestionAnswer,\n nhAssistantLatestTurnHasText\n} from './nh-assistant-reducer';\nimport { normalizeNhAssistantClientContext } from './nh-assistant-page-context';\nimport { NhAssistantUiState } from './nh-assistant-ui-state';\n\n/** A user-facing assistant failure: a stable code and a translation key, never raw server text. */\nexport interface NhAssistantError {\n code: string;\n messageKey: string;\n /** The field errors of an `assistant-validation` failure, by camelCase field name. */\n fieldErrors?: Readonly<Record<string, readonly string[]>>;\n}\n\n/**\n * A non-blocking remark about a turn that completed normally, for example a limit that cut the\n * answer short. The conversation stays usable; the notice only explains the answer.\n */\nexport type NhAssistantNotice = NhAssistantError;\n\n/** An unsent message held in this tab, scoped to its original conversation. */\nexport interface NhAssistantQueuedMessage {\n id: string;\n conversationId: string;\n text: string;\n state: 'preparing' | 'queued' | 'sending' | 'failed';\n /** The files the message carries, uploaded before it was queued. */\n files?: readonly FileReference[];\n}\n\n/**\n * A file the person attaches to the next message of the open conversation: while it uploads, once\n * the application stored it, or why it cannot be attached. Attachments live only in this tab's\n * memory.\n */\nexport interface NhAssistantAttachment {\n /** The attachment's id in this tab. */\n id: string;\n name: string;\n /** The media type the upload declares, lowercase. */\n mediaType: string;\n /** The size in bytes. */\n size: number;\n state: 'uploading' | 'uploaded' | 'failed';\n /** The share of the file sent so far, from 0 to 1. */\n progress: number;\n /** The stored file, once uploaded; the message carries its reference. */\n file: FileReference | null;\n /** Why the file is not attached, for a failed attachment. */\n error: NhAssistantError | null;\n}\n\ninterface QueuedMessage extends NhAssistantQueuedMessage {\n clientContext?: ClientContext | null;\n}\n\n/** Notice code for a completed turn that produced no answer text and no server code. */\nexport const NH_ASSISTANT_NO_ANSWER_NOTICE_CODE = 'assistant-no-answer';\n\n/**\n * Notice code for a message that waits for the next run of the agent working in its thread: the\n * server answered `202` with the trigger receipt, and the run adds the message, with its files.\n */\nexport const NH_ASSISTANT_MESSAGE_QUEUED_NOTICE_CODE = 'assistant-message-queued';\n\n/**\n * Who decides an approval the current user cannot decide: `turn`, the person whose turn created\n * it in a chat; `approver`, an approver of the agent thread's subject; `other-approver`, another\n * approver, because the current user started the work and four-eyes applies; `asker`, the person\n * who consulted the thread's agent, in their own chat.\n */\nexport type NhAssistantApprovalWaitingFor = 'turn' | 'approver' | 'other-approver' | 'asker';\n\n/** The current user's right to decide, or to give feedback on, one approval of the open conversation. */\nexport interface NhAssistantApprovalRight {\n canDecide: boolean;\n /** Who decides when the current user cannot. */\n waitingFor: NhAssistantApprovalWaitingFor;\n /** Name of the person who decides a `turn` approval; `null` when unknown. */\n decisionOwner: string | null;\n /**\n * True for an agent's proposal the current user rejected in this session, so the approval card\n * offers the optional feedback question. Chat approvals never offer feedback.\n */\n canGiveFeedback?: boolean;\n}\n\nconst fourEyesRequiredCode = 'assistant-four-eyes-required';\n\n/** A consultation's proposal in the consulted thread that the person who asked decides in their own chat. */\nconst askerDecidesCode = 'assistant-consult-asker-decides';\n\n\n/**\n * A conversation that needs attention outside the open thread: a turn runs, an approval waits or\n * there is something unread.\n */\nexport interface NhAssistantActivity {\n id: string;\n title: string | null;\n status: ConversationStatus;\n unread: boolean;\n shared: boolean;\n /** True for the conversation shown in the panel. */\n active: boolean;\n updatedAt: string;\n}\n\n/** True when a conversation has messages the caller has not read. A running turn is not unread yet. */\nexport function nhAssistantIsUnread(summary: Pick<ConversationSummary, 'status' | 'lastMessageSequence' | 'lastReadSequence'>): boolean {\n if (summary.status === 'running' || summary.lastReadSequence === undefined) {\n return false;\n }\n return (summary.lastMessageSequence ?? 0) > summary.lastReadSequence;\n}\n\n/** The state of one conversation this tab has opened. */\ninterface NhAssistantSession {\n conversation: Conversation;\n /** A request of this tab streams a turn of the conversation. */\n streaming: boolean;\n deciding: boolean;\n error: NhAssistantError | null;\n notice: NhAssistantNotice | null;\n lastUsage: TurnUsage | null;\n /**\n * The answer the running turn writes, from its `turn.started`: of the turn this tab streams or of\n * one it follows live; `null` between turns.\n */\n writingMessageId: string | null;\n}\n\n/**\n * True when the server accepts a new message in this conversation. A failed turn leaves the\n * conversation open: the person can ask again in the same conversation or agent thread. A chat whose\n * waiting question or approval passed its lifetime at `now` takes the message too (`waitExpired`).\n */\nfunction acceptsMessage(conversation: Conversation | null | undefined, now: number): boolean {\n const status = conversation?.status;\n return status === 'idle' || status === 'failed' || waitExpired(conversation, now);\n}\n\n/**\n * True when a chat waits for a question or an approval whose `expiresAt` passed at `now`. The server\n * closes it as expired when the next message arrives and then starts that message's turn (CS9), so the\n * client sends the message instead of queueing it. The server stays the judge: while its own clock\n * still counts the wait, it refuses the message as `assistant-conversation-busy`, which the client\n * handles as any refusal. An agent's thread keeps its own rules and never takes a message this way.\n */\nfunction waitExpired(conversation: Conversation | null | undefined, now: number): boolean {\n const expiresAt = waitExpiresAt(conversation);\n return expiresAt !== null && expiresAt <= now;\n}\n\n/** The end of the wait of a chat that waits for a question or an approval; `null` otherwise. */\nfunction waitExpiresAt(conversation: Conversation | null | undefined): number | null {\n if (!conversation || conversation.status !== 'waiting-for-approval' || conversation.kind === 'thread') {\n return null;\n }\n const value = conversation.pendingQuestion?.expiresAt ?? conversation.pendingApproval?.expiresAt;\n const expiresAt = value ? Date.parse(value) : Number.NaN;\n return Number.isFinite(expiresAt) ? expiresAt : null;\n}\n\nconst conversationPageSize = 50;\nconst cancelGracePeriodMs = 5_000;\nconst maxSessions = 20;\nconst refreshDelayMs = 300;\nconst newConversationKey = '';\n/** The longest the store sleeps before it looks at the end of a wait again; below the timer limit. */\nconst maxWaitCheckDelayMs = 60 * 60 * 1000;\n\n/**\n * Signal-based state of one assistant scope: availability, agents, the conversation list and\n * every conversation this tab has opened. Several conversations can run turns at the same time;\n * the public signals describe the conversation that is open in the panel. With live updates the\n * store follows turns of other people and of the user's other tabs.\n */\n@Injectable()\nexport class NhAssistantStore {\n private readonly api = inject(NhAssistantApiService);\n private readonly agentRuns = inject(NhAssistantAgentRunApiService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly injector = inject(EnvironmentInjector);\n private readonly accessPolicy = inject(NH_ASSISTANT_ACCESS_POLICY);\n private readonly uiState = inject(NhAssistantUiState);\n private readonly live = inject(NhAssistantLiveService);\n private readonly push = inject(NhAssistantPushService);\n private readonly document = inject(DOCUMENT);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly accessGrantedState = signal<boolean | null>(null);\n private readonly statusState = signal<AssistantStatus | null>(null);\n private readonly statusLoadingState = signal(false);\n private readonly selectedAgentIdState = signal<string | null>(null);\n private readonly conversationsState = signal<ConversationSummary[]>([]);\n private readonly conversationsTotalState = signal(0);\n private readonly conversationsLoadingState = signal(false);\n private readonly sessionsState = signal<ReadonlyMap<string, NhAssistantSession>>(new Map());\n private readonly activeIdState = signal<string | null>(null);\n private readonly conversationLoadingState = signal(false);\n /** The conversation a message is being prepared for; `''` while a new conversation is created. */\n private readonly sendingState = signal<string | null>(null);\n private readonly draftErrorState = signal<NhAssistantError | null>(null);\n private readonly restoredDraftState = signal<string | null>(null);\n private readonly pageContextState = signal<ClientContext | null>(null);\n private readonly pageContextExcludedState = signal(false);\n private readonly restorePanelOpenState = signal(false);\n private readonly viewingState = signal(false);\n private readonly pageVisibleState = signal(true);\n private readonly queuedState = signal<QueuedMessage[]>([]);\n private readonly pausedQueuesState = signal<ReadonlySet<string>>(new Set());\n private readonly queueDispatchState = signal<string | null>(null);\n private readonly steeringState = signal<string | null>(null);\n private readonly submittingState = signal(false);\n /**\n * The client's clock as the store last read it, moved forward when the wait of an open conversation\n * ends, so a message is sent instead of queued from then on.\n */\n private readonly clockState = signal(Date.now());\n /** Agent proposals the current user rejected in this session and may give feedback on. */\n private readonly feedbackApprovalsState = signal<ReadonlySet<string>>(new Set());\n /** The attachments of the next message per conversation; `''` for a new conversation. */\n private readonly attachmentsState = signal<ReadonlyMap<string, readonly NhAssistantAttachment[]>>(new Map());\n private destroyed = false;\n private readonly uploadSubscriptions = new Map<string, Subscription>();\n /** The conversation an attachment of a new conversation creates, once for every file chosen meanwhile. */\n private attachmentConversation: Promise<Conversation | null> | null = null;\n\n private readonly streams = new Map<string, Subscription>();\n private readonly cancelTimers = new Map<string, ReturnType<typeof setTimeout>>();\n /** Pending reloads of agent threads after live agent-work updates, per conversation. */\n private readonly agentWorkTimers = new Map<string, ReturnType<typeof setTimeout>>();\n private readonly pendingSendResolves = new Map<string, (accepted: boolean) => void>();\n private readonly markingRead = new Set<string>();\n private readonly liveSubscription = new Subscription();\n private accessSubscription?: Subscription;\n private refreshTimer?: ReturnType<typeof setTimeout>;\n private initialization?: Promise<void>;\n private statusRevision = 0;\n private accountRevision = 0;\n private collaborationKey: string | null = null;\n\n private readonly activeSession = computed(() => {\n const id = this.activeIdState();\n return id === null ? null : this.sessionsState().get(id) ?? null;\n });\n\n /** True when the access policy allows the user and the server reports the assistant as enabled. */\n readonly enabled = computed(() => this.accessGrantedState() === true && this.statusState()?.enabled === true);\n readonly accessGranted = this.accessGrantedState.asReadonly();\n /** True when the assistant is enabled and the server reports that the caller passes the admin policy. */\n readonly canAdminister = computed(() => this.enabled() && this.statusState()?.canAdminister === true);\n readonly statusLoading = this.statusLoadingState.asReadonly();\n readonly limits = computed(() => this.statusState()?.limits ?? null);\n readonly agents = computed<AgentSummary[]>(() => this.statusState()?.agents ?? []);\n /** Sharing, live update and notification features the server offers. */\n readonly collaboration = computed(() => this.statusState()?.collaboration ?? null);\n readonly selectedAgentId = this.selectedAgentIdState.asReadonly();\n readonly selectedAgent = computed(() =>\n this.agents().find(agent => agent.id === this.selectedAgentIdState()) ?? null\n );\n readonly conversations = this.conversationsState.asReadonly();\n readonly conversationsTotal = this.conversationsTotalState.asReadonly();\n readonly conversationsLoading = this.conversationsLoadingState.asReadonly();\n /** The conversation open in the panel, or `null` for a new one. */\n readonly activeConversation = computed(() => this.activeSession()?.conversation ?? null);\n readonly conversationLoading = this.conversationLoadingState.asReadonly();\n /** True while this tab sends a message or streams a turn of the open conversation. */\n readonly streaming = computed(() => {\n const sending = this.sendingState();\n const activeId = this.activeIdState();\n return (sending !== null && sending === (activeId ?? newConversationKey)) || this.activeSession()?.streaming === true;\n });\n readonly pendingApproval = computed(() => this.activeConversation()?.pendingApproval ?? null);\n readonly deciding = computed(() => this.activeSession()?.deciding === true);\n readonly error = computed(() => this.activeIdState() === null ? this.draftErrorState() : this.activeSession()?.error ?? null);\n /** Non-blocking remark about the latest completed turn; shown only while no error is shown. */\n readonly notice = computed(() => this.activeSession()?.notice ?? null);\n readonly lastUsage = computed(() => this.activeSession()?.lastUsage ?? null);\n /**\n * The answer the running turn of the open conversation writes, while this tab streams the turn or\n * follows it live; `null` otherwise. Pass it to `nh-assistant-thread` as `writingMessageId`, so\n * the working indicator stays under that answer when a message arrives after it during the turn.\n */\n readonly writingMessageId = computed(() => this.activeSession()?.writingMessageId ?? null);\n /** Text of a message the server did not accept, so the composer can offer it again. */\n readonly restoredDraft = this.restoredDraftState.asReadonly();\n /** Page context that the next message would send, for the transparency chip. */\n readonly pageContext = this.pageContextState.asReadonly();\n /** True when the user left the page context out of the next message. */\n readonly pageContextExcluded = this.pageContextExcludedState.asReadonly();\n /** Whether the drawer was open when this account last left the application. */\n readonly restorePanelOpen = this.restorePanelOpenState.asReadonly();\n /**\n * True while the user can send: enabled, an agent is chosen and no turn runs or waits. A\n * conversation whose last turn failed accepts a new message; an archived one does not.\n */\n readonly canSend = computed(() => {\n const conversation = this.activeConversation();\n const blocked = conversation !== null && !acceptsMessage(conversation, this.clockState());\n return this.enabled() && this.selectedAgentIdState() !== null && !this.streaming() && !this.conversationLoadingState() && !blocked;\n });\n /**\n * True while the open chat waits for a question or an approval whose lifetime passed by the\n * client's clock: a message is then sent at once, and the server closes the wait as expired before\n * the message's turn starts. The composer no longer says that the conversation waits.\n */\n readonly waitExpired = computed(() => waitExpired(this.activeConversation(), this.clockState()));\n /** Messages not yet accepted by the server, for the open conversation. Never persisted. */\n readonly queuedMessages = computed<readonly NhAssistantQueuedMessage[]>(() =>\n this.queuedState().filter(item => item.conversationId === this.activeIdState()));\n /** Sending or queueing is available during a turn and while an approval waits. */\n readonly canSubmit = computed(() => (this.canSend() && !this.submittingState()) || (this.enabled()\n && !this.conversationLoading() && this.activeConversation() !== null\n && ['idle', 'failed', 'running', 'waiting-for-approval'].includes(this.activeConversation()!.status)));\n readonly queuePaused = computed(() => this.pausedQueuesState().has(this.activeIdState() ?? '') || this.error() !== null);\n /** Steering cancels the active turn before sending the selected correction. */\n readonly canSteer = computed(() => {\n const conversation = this.activeConversation();\n const ownsTurn = conversation?.activeActorId && conversation.currentActorId\n ? conversation.activeActorId === conversation.currentActorId : this.activeSession()?.streaming === true;\n return this.enabled() && this.steeringState() === null && !this.submittingState()\n && this.queueDispatchState() === null\n && ['running', 'waiting-for-approval'].includes(conversation?.status ?? '')\n && (this.isOwner() || ownsTurn);\n });\n /**\n * What the person may attach to the next message: the uploads of the open conversation's agent, or\n * of the selected agent for a new conversation. `null` when nothing can be attached: the server\n * offers no uploads for the agent, the conversation is archived, or the person only reads the\n * agent's thread.\n */\n readonly uploads = computed<AgentUploads | null>(() => {\n const conversation = this.activeConversation();\n const thread = conversation?.thread;\n if (!this.enabled() || conversation?.status === 'archived'\n || (thread && thread.role !== 'participant' && thread.role !== 'approver')) {\n return null;\n }\n\n const agentId = conversation?.agentId ?? this.selectedAgentIdState();\n const uploads = this.agents().find(agent => agent.id === agentId)?.uploads ?? null;\n return uploads && uploads.acceptedMediaTypes.length > 0 && uploads.maxFiles > 0 ? uploads : null;\n });\n /** The attachments of the next message of the open conversation, in the order they were chosen. */\n readonly attachments = computed<readonly NhAssistantAttachment[]>(() =>\n this.attachmentsState().get(this.activeIdState() ?? newConversationKey) ?? []);\n /** The stored files of the open conversation's next message, for `submit`. */\n readonly attachedFiles = computed<FileReference[]>(() => this.attachments()\n .filter(attachment => attachment.state === 'uploaded' && attachment.file !== null)\n .map(attachment => attachment.file!));\n /** True while a file of the next message still uploads; the message waits for it. */\n readonly uploading = computed(() => this.attachments().some(attachment => attachment.state === 'uploading'));\n /** The owner and participants of the open conversation; empty while it is not shared. */\n readonly members = computed<ConversationMember[]>(() => this.activeConversation()?.members ?? []);\n /** True when the current user owns the open conversation (or it is new). */\n readonly isOwner = computed(() => (this.activeConversation()?.role ?? 'owner') === 'owner');\n /** True when the open conversation is the durable thread of an agent about a subject. */\n readonly isAgentThread = computed(() => this.activeConversation()?.kind === 'thread');\n /**\n * The current user's right to decide each pending approval of the open conversation, by approval\n * id. In a chat only the author of the waiting turn decides. In an agent thread the subject's\n * approvers decide, as the server reports per proposal: the approval policy, four-eyes and the\n * tool's approve policy, checked live. Proposals the user rejected in this session carry\n * `canGiveFeedback`.\n */\n readonly approvalRights = computed<ReadonlyMap<string, NhAssistantApprovalRight>>(() => {\n const conversation = this.activeConversation();\n const rights = new Map<string, NhAssistantApprovalRight>();\n if (!conversation) {\n return rights;\n }\n\n if (conversation.kind === 'thread') {\n const decisions = new Map((conversation.thread?.decisions ?? []).map(decision => [decision.approvalId, decision]));\n for (const approval of pendingApprovalParts(conversation)) {\n const decision = decisions.get(approval.approvalId);\n rights.set(approval.approvalId, {\n canDecide: decision?.canDecide === true,\n waitingFor: waitingForOf(decision?.reasonCode),\n decisionOwner: null\n });\n }\n\n const feedbackApprovals = this.feedbackApprovalsState();\n for (const approval of approvalParts(conversation)) {\n if (approval.status === 'rejected' && feedbackApprovals.has(approval.approvalId)) {\n rights.set(approval.approvalId, {\n canDecide: false,\n waitingFor: 'approver',\n decisionOwner: null,\n canGiveFeedback: true\n });\n }\n }\n return rights;\n }\n\n if (conversation.pendingApproval) {\n rights.set(conversation.pendingApproval.approvalId, {\n canDecide: !conversation.activeActorId || !conversation.currentActorId\n || conversation.activeActorId === conversation.currentActorId,\n waitingFor: 'turn',\n decisionOwner: this.activeMember()?.displayName ?? null\n });\n }\n return rights;\n });\n /**\n * True when the current user may decide the pending approval: in a chat it belongs to their own\n * turn, in an agent thread the server allows them as an approver.\n */\n readonly canDecide = computed(() => {\n const approval = this.activeConversation()?.pendingApproval;\n return approval ? this.approvalRights().get(approval.approvalId)?.canDecide === true : false;\n });\n /**\n * True when the current user may answer the question the open chat waits for: it is addressed to\n * them and still pending (`ask_question`, `run.AllowQuestions()` on the server).\n */\n readonly canAnswer = computed(() => {\n const conversation = this.activeConversation();\n const question = conversation?.pendingQuestion;\n return !!question && question.status === 'pending' && question.addresseeActorId === conversation?.currentActorId;\n });\n /** The member a pending question of the open conversation is addressed to, when it is someone else. */\n readonly questionAddressee = computed<ConversationMember | null>(() => {\n const conversation = this.activeConversation();\n const question = conversation?.pendingQuestion;\n if (!question || question.addresseeActorId === conversation?.currentActorId) {\n return null;\n }\n return conversation?.members?.find(member => member.actorId === question.addresseeActorId) ?? null;\n });\n /** The member whose turn runs or waits in the open conversation, when it is someone else. */\n readonly activeMember = computed<ConversationMember | null>(() => {\n const conversation = this.activeConversation();\n if (!conversation?.activeActorId || conversation.activeActorId === conversation.currentActorId) {\n return null;\n }\n return conversation.members?.find(member => member.actorId === conversation.activeActorId) ?? null;\n });\n /** Conversations that need attention: running, waiting for approval or unread. Most recent first. */\n readonly activity = computed<NhAssistantActivity[]>(() => {\n const sessions = this.sessionsState();\n const activeId = this.activeIdState();\n return this.conversationsState()\n .map(summary => {\n const session = sessions.get(summary.id);\n const status = session?.streaming ? session.conversation.status : summary.status;\n return {\n id: summary.id,\n title: summary.title,\n status,\n unread: nhAssistantIsUnread({ ...summary, status }),\n shared: (summary.participantCount ?? 0) > 0,\n active: summary.id === activeId,\n updatedAt: summary.updatedAt\n };\n })\n .filter(item => item.status === 'running' || item.status === 'waiting-for-approval' || item.unread);\n });\n readonly runningCount = computed(() => this.activity().filter(item => item.status === 'running').length);\n readonly waitingCount = computed(() => this.activity().filter(item => item.status === 'waiting-for-approval').length);\n readonly unreadCount = computed(() => this.activity().filter(item => item.unread).length);\n /** Live update connection state. */\n readonly liveState = this.live.state;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.accessSubscription?.unsubscribe();\n this.liveSubscription.unsubscribe();\n this.stopAllTurns();\n this.clearAgentWorkTimers();\n for (const upload of this.uploadSubscriptions.values()) {\n upload.unsubscribe();\n }\n clearTimeout(this.refreshTimer);\n });\n\n effect(() => {\n const queued = this.queuedState();\n const sessions = this.sessionsState();\n const paused = this.pausedQueuesState();\n const steering = this.steeringState();\n const steeringItem = queued.find(item => item.id === steering);\n const steeringSession = steeringItem ? sessions.get(steeringItem.conversationId) : null;\n if (steering && (!steeringItem || steeringSession?.error\n || (steeringSession?.conversation.status === 'idle' && !steeringSession.streaming))) {\n untracked(() => this.steeringState.set(null));\n }\n if (!this.enabled() || this.queueDispatchState() !== null || this.sendingState() !== null || this.submittingState()) {\n return;\n }\n const next = queued.find((item, index) => {\n const session = sessions.get(item.conversationId);\n return item.state === 'queued' && !paused.has(item.conversationId)\n && !queued.slice(0, index).some(previous => previous.conversationId === item.conversationId)\n && acceptsMessage(session?.conversation, this.clockState()) && !session?.streaming && !session?.deciding && !session?.error;\n });\n if (next) {\n untracked(() => void this.dispatchQueued(next));\n }\n });\n\n // The end of a wait moves the clock, so queued and new messages go out from then on.\n effect(onCleanup => {\n const clock = this.clockState();\n const sessions = this.sessionsState();\n const now = Date.now();\n let next: number | null = null;\n for (const session of sessions.values()) {\n const expiresAt = waitExpiresAt(session.conversation);\n if (expiresAt === null) {\n continue;\n }\n if (expiresAt > clock && expiresAt <= now) {\n // A wait ended while nothing looked, such as one the store read only now.\n untracked(() => this.clockState.set(now));\n return;\n }\n if (expiresAt > now && (next === null || expiresAt < next)) {\n next = expiresAt;\n }\n }\n if (next === null || !this.browser) {\n return;\n }\n const timer = setTimeout(() => this.clockState.set(Date.now()), Math.min(next - now + 1, maxWaitCheckDelayMs));\n onCleanup(() => clearTimeout(timer));\n });\n\n this.liveSubscription.add(this.live.changed$.subscribe(change => this.onLiveChanged(change)));\n this.liveSubscription.add(this.live.read$.subscribe(read => this.onLiveRead(read)));\n this.liveSubscription.add(this.live.removed$.subscribe(removed => this.onLiveRemoved(removed)));\n this.liveSubscription.add(this.live.events$.subscribe(event => this.onLiveEvent(event)));\n this.liveSubscription.add(this.live.agentWork$.subscribe(change => this.onLiveAgentWork(change)));\n this.liveSubscription.add(this.live.resync$.subscribe(() => this.resync()));\n\n if (this.browser) {\n const update = () => this.pageVisibleState.set(this.document.visibilityState === 'visible' && this.document.hasFocus());\n const visible = () => {\n update();\n if (this.document.visibilityState === 'visible' && this.enabled()) {\n // Without live updates, or on another instance, coming back reloads the list.\n void this.refreshConversations();\n }\n };\n this.document.addEventListener('visibilitychange', visible);\n globalThis.addEventListener?.('focus', update);\n globalThis.addEventListener?.('blur', update);\n destroyRef.onDestroy(() => {\n this.document.removeEventListener('visibilitychange', visible);\n globalThis.removeEventListener?.('focus', update);\n globalThis.removeEventListener?.('blur', update);\n });\n update();\n }\n\n // Marks the open conversation as read while the user looks at it.\n effect(() => {\n this.activeIdState();\n this.viewingState();\n this.pageVisibleState();\n this.conversationsState();\n this.sessionsState();\n untracked(() => this.markActiveReadWhenSeen());\n });\n }\n\n /** Evaluates the access policy and loads the server status once. Safe to call repeatedly. */\n initialize(): Promise<void> {\n this.initialization ??= this.startInitialization();\n return this.initialization;\n }\n\n /** Reloads the server status, for example after the host changed the signed-in user. */\n async reloadStatus(): Promise<void> {\n const revision = ++this.statusRevision;\n if (this.accessGrantedState() !== true) {\n this.resetAccount();\n this.statusState.set(null);\n this.selectedAgentIdState.set(null);\n this.restorePanelOpenState.set(false);\n this.uiState.deactivate();\n return;\n }\n\n this.statusLoadingState.set(true);\n try {\n const restored = await this.uiState.activate();\n if (revision !== this.statusRevision) {\n return;\n }\n if (restored.changed) {\n this.resetAccount();\n this.statusState.set(null);\n this.selectedAgentIdState.set(restored.state.agentId);\n this.restorePanelOpenState.set(restored.state.panelOpen);\n }\n\n const status = await firstValueFrom(this.api.status());\n if (revision !== this.statusRevision) {\n return;\n }\n this.statusState.set(status);\n if (status.enabled) {\n this.selectInitialAgent(status.agents);\n this.startCollaboration(status);\n if (this.activeIdState() === null && restored.state.conversationId) {\n await this.loadConversation(restored.state.conversationId, true);\n }\n }\n } catch {\n // An unavailable assistant endpoint hides the assistant instead of showing an error.\n if (revision === this.statusRevision) {\n this.statusState.set(null);\n }\n } finally {\n if (revision === this.statusRevision) {\n this.statusLoadingState.set(false);\n }\n }\n }\n\n async refreshConversations(): Promise<void> {\n if (!this.enabled()) {\n return;\n }\n\n const revision = this.accountRevision;\n this.conversationsLoadingState.set(true);\n try {\n const page = await firstValueFrom(this.api.listConversations(1, conversationPageSize));\n if (revision === this.accountRevision) {\n this.conversationsState.set(page.items.map(item => this.withLocalState(item)));\n this.conversationsTotalState.set(page.total);\n }\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(this.activeIdState(), error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.conversationsLoadingState.set(false);\n }\n }\n }\n\n /** Chooses the agent for the next new conversation. Switching away from the open conversation's agent starts a new one. */\n selectAgent(agentId: string): void {\n if (!this.agents().some(agent => agent.id === agentId)) {\n return;\n }\n\n this.selectedAgentIdState.set(agentId);\n this.uiState.update({ agentId });\n const active = this.activeConversation();\n if (active && active.agentId !== agentId) {\n this.startNewConversation();\n }\n }\n\n /**\n * Leaves the open conversation; the next message creates a new one. Turns of other\n * conversations keep running in the background.\n */\n startNewConversation(): void {\n this.activeIdState.set(null);\n this.uiState.update({ conversationId: null });\n this.draftErrorState.set(null);\n }\n\n /** Opens a conversation; one that this tab already follows opens immediately. */\n async openConversation(conversationId: string): Promise<void> {\n await this.loadConversation(conversationId, false);\n }\n\n /** Tells the store whether the user can see the open thread, so it can mark it as read. */\n setViewing(viewing: boolean): void {\n this.viewingState.set(viewing);\n }\n\n async deleteConversation(conversationId: string): Promise<void> {\n if (this.sessionsState().get(conversationId)?.streaming) {\n return;\n }\n\n const revision = this.accountRevision;\n try {\n await firstValueFrom(this.api.deleteConversation(conversationId), { defaultValue: undefined });\n if (revision !== this.accountRevision) {\n return;\n }\n this.forget(conversationId);\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(this.activeIdState(), error);\n }\n }\n }\n\n /**\n * Sends a user message. Creates a conversation with the selected agent when none is open,\n * shows the message optimistically and applies the streamed events. Other conversations keep\n * their own turns. Resolves `false` when the message was not accepted. `files` are uploaded\n * attachments, such as `attachedFiles()`; once the message is accepted, the attachments of the\n * conversation leave the composer.\n */\n async send(text: string, files: readonly FileReference[] = []): Promise<boolean> {\n // Browsers only ask for notification permission during a user action such as this one.\n void this.push.onUserGesture().catch(() => undefined);\n return this.sendMessage(text, undefined, files);\n }\n\n /**\n * Sends immediately when the conversation accepts a message, otherwise appends to the\n * conversation's FIFO queue. A shown error alone does not hold a message back while nothing is\n * queued: the person asks again, for example after a failed turn. Queued messages still wait\n * for an explicit `resumeQueue` after Stop or a failure. A queued message keeps its `files`.\n */\n async submit(text: string, files: readonly FileReference[] = []): Promise<boolean> {\n const stopped = this.pausedQueuesState().has(this.activeIdState() ?? newConversationKey);\n if (this.canSend() && this.queuedMessages().length === 0 && !stopped && !this.submittingState()) {\n const revision = this.accountRevision;\n this.submittingState.set(true);\n try {\n return await this.send(text, files);\n } finally {\n if (revision === this.accountRevision && !this.destroyed) {\n this.submittingState.set(false);\n }\n }\n }\n const conversationId = this.activeIdState();\n const trimmed = text.trim();\n if (!conversationId || !this.canSubmit() || !trimmed || trimmed.length > (this.limits()?.maxMessageChars ?? Infinity)) {\n return false;\n }\n void this.push.onUserGesture().catch(() => undefined);\n const revision = this.accountRevision;\n const item: QueuedMessage = {\n id: createClientMessageId(),\n conversationId,\n text: trimmed,\n state: 'preparing',\n ...(files.length > 0 ? { files: [...files] } : {})\n };\n this.queuedState.update(items => [...items, item]);\n this.releaseAttachments(conversationId, files);\n const clientContext = await this.contextForMessage();\n if (revision !== this.accountRevision || this.destroyed) {\n return false;\n }\n this.queuedState.update(items => items.map(current => current.id === item.id\n ? { ...current, state: 'queued', clientContext } : current));\n return true;\n }\n\n /** Edits an unsent queued message without replacing the composer's current draft. */\n updateQueuedMessage(id: string, text: string): boolean {\n const trimmed = text.trim();\n if (!trimmed || trimmed.length > (this.limits()?.maxMessageChars ?? Infinity)\n || !this.queuedMessages().some(item => item.id === id && item.state !== 'sending')) {\n return false;\n }\n this.queuedState.update(items => items.map(item => item.id === id ? { ...item, text: trimmed } : item));\n return true;\n }\n\n removeQueuedMessage(id: string): void {\n this.queuedState.update(items => items.filter(item => item.id !== id\n || item.conversationId !== this.activeIdState() || item.state === 'sending'));\n }\n\n /** Pauses automatic dispatch while keeping all unsent messages available. */\n pauseQueue(): void {\n const conversationId = this.activeIdState();\n if (conversationId) {\n this.pausedQueuesState.update(paused => new Set([...paused, conversationId]));\n }\n }\n\n /** Explicitly resumes after Stop or a failure; approval decisions remain separate. */\n resumeQueue(): void {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return;\n }\n this.pausedQueuesState.update(paused => new Set([...paused].filter(id => id !== conversationId)));\n this.patchSession(conversationId, session => ({ ...session, error: null }));\n this.queuedState.update(items => items.map(item => item.conversationId === conversationId && item.state === 'failed'\n ? { ...item, state: 'queued' } : item));\n }\n\n /** Prioritizes a queued correction and waits for confirmed cancellation before dispatch. */\n async steerQueuedMessage(id: string): Promise<void> {\n const item = this.queuedState().find(message => message.id === id && message.conversationId === this.activeIdState());\n if (!item || item.state !== 'queued' || !this.canSteer()) {\n return;\n }\n this.steeringState.set(id);\n this.queuedState.update(items => [item, ...items.filter(message => message.id !== id)]);\n this.resumeQueue();\n try {\n await this.cancelConversation(item.conversationId);\n } finally {\n if (this.steeringState() === id && this.sessionsState().get(item.conversationId)?.error) {\n this.steeringState.set(null);\n }\n }\n }\n\n private async dispatchQueued(item: QueuedMessage): Promise<void> {\n const revision = this.accountRevision;\n this.queueDispatchState.set(item.id);\n this.queuedState.update(items => items.map(current => current.id === item.id ? { ...current, state: 'sending' } : current));\n const accepted = await this.sendMessage(item.text, item, item.files ?? []);\n if (revision !== this.accountRevision || this.destroyed) {\n return;\n }\n this.queuedState.update(items => accepted ? items.filter(current => current.id !== item.id)\n : items.map(current => current.id === item.id ? { ...current, state: 'failed' } : current));\n if (!accepted) {\n this.pausedQueuesState.update(paused => new Set([...paused, item.conversationId]));\n }\n this.queueDispatchState.set(null);\n }\n\n private async sendMessage(text: string, queued: QueuedMessage | undefined, files: readonly FileReference[]): Promise<boolean> {\n const trimmed = text.trim();\n const accountRevision = this.accountRevision;\n await this.initialize();\n await this.reloadStatus();\n if (accountRevision !== this.accountRevision || this.destroyed) {\n return false;\n }\n let conversation = queued ? this.sessionsState().get(queued.conversationId)?.conversation ?? null : this.activeConversation();\n const session = queued ? this.sessionsState().get(queued.conversationId) : null;\n const available = queued ? this.enabled() && !this.pausedQueuesState().has(queued.conversationId)\n && acceptsMessage(conversation, this.clockState()) && !session?.streaming\n && !session?.deciding && this.agents().some(agent => agent.id === conversation?.agentId) : this.canSend();\n const maxChars = this.limits()?.maxMessageChars ?? Number.MAX_SAFE_INTEGER;\n if (trimmed.length === 0 || trimmed.length > maxChars || !available) {\n return false;\n }\n\n this.sendingState.set(conversation?.id ?? newConversationKey);\n if (!queued) {\n this.restoredDraftState.set(null);\n }\n this.draftErrorState.set(null);\n\n if (!conversation) {\n conversation = await this.createConversation();\n if (!conversation) {\n if (accountRevision === this.accountRevision) {\n this.sendingState.set(null);\n this.restoredDraftState.set(text);\n }\n return false;\n }\n this.sendingState.set(conversation.id);\n }\n\n const clientContext = queued ? queued.clientContext : await this.contextForMessage();\n if (accountRevision !== this.accountRevision) {\n return false;\n }\n const conversationId = conversation.id;\n const clientMessageId = createClientMessageId();\n const previousStatus = conversation.status;\n // A chat accepts a message while it waits only when the wait passed its lifetime; the server then\n // closes what it waited for, which the client reads again once the turn ended.\n const closesWait = previousStatus === 'waiting-for-approval';\n const parts: MessagePart[] = [\n { type: 'text', text: trimmed },\n ...files.map(file => ({ type: 'file' as const, name: file.name, mediaType: file.mediaType, size: file.size }))\n ];\n this.patchSession(conversationId, session => ({\n ...session,\n error: null,\n notice: null,\n conversation: {\n ...session.conversation,\n status: 'running',\n messages: [\n ...session.conversation.messages,\n {\n id: clientMessageId,\n role: 'user',\n createdAt: new Date().toISOString(),\n parts,\n authorActorId: session.conversation.currentActorId ?? null\n }\n ]\n }\n }));\n this.patchSummary(conversationId, { status: 'running', updatedAt: new Date().toISOString() });\n\n return new Promise<boolean>(resolve => {\n this.pendingSendResolves.set(conversationId, resolve);\n let started = false;\n let failedAfterStart = false;\n let waitsForRun = false;\n\n this.runStream(conversationId, this.api.sendMessage(conversationId, {\n text: trimmed,\n clientMessageId,\n ...(clientContext === undefined ? {} : { clientContext }),\n ...(files.length > 0 ? { files: [...files] } : {})\n }), {\n next: event => {\n if (event.type === 'message.queued') {\n // An agent's run works in the thread: the message, with its files, waits for the next run,\n // which adds it to the thread. Until then the notice says so.\n waitsForRun = true;\n this.removeMessage(conversationId, clientMessageId, previousStatus);\n this.releaseAttachments(conversationId, files);\n this.patchSession(conversationId, session => ({ ...session, notice: messageQueuedNotice(files.length) }));\n resolve(true);\n return;\n }\n if (event.type === 'error' && !started) {\n this.removeMessage(conversationId, clientMessageId, previousStatus);\n if (!queued && this.activeIdState() === conversationId) {\n this.restoredDraftState.set(text);\n }\n this.patchSession(conversationId, session => ({ ...session, error: event.data }));\n resolve(false);\n return;\n }\n\n if (event.type === 'turn.started') {\n started = true;\n // The message carries the files now; they leave the composer.\n this.releaseAttachments(conversationId, files);\n resolve(true);\n }\n if (event.type === 'error') {\n failedAfterStart = true;\n }\n\n this.applyEvent(conversationId, event, clientMessageId);\n },\n complete: () => {\n this.pendingSendResolves.delete(conversationId);\n resolve(started || waitsForRun);\n // A waiting message started no turn here: the thread's own state comes from the server, as\n // does the question or approval that an expired wait closed.\n this.afterTurn(conversationId, failedAfterStart || waitsForRun || closesWait);\n }\n });\n this.sendingState.set(null);\n });\n }\n\n /**\n * Approves or rejects an approval of the open conversation: `approvalId`, or the pending approval\n * when it is left out. A proposal of an agent's run is decided with its proposal hash through the\n * agent-run endpoint; other approvals resume their turn as a stream. `leave` leaves a consulted\n * agent's proposal that has a `consultation.leaveRoute` for the subject's approvers; it resumes the\n * turn like a decision and reads the conversation again, which then names the proposal that waits\n * at the subject. Ignores calls the current user may not make, `leave` for other approvals and\n * repeated calls while a decision is in flight.\n */\n decide(decision: ApprovalDecision, reason?: string, approvalId?: string): void {\n const session = this.activeSession();\n const conversation = session?.conversation;\n if (!session || !conversation || session.deciding || session.streaming) {\n return;\n }\n const approval = approvalId\n ? pendingApprovalParts(conversation).find(part => part.approvalId === approvalId) ?? null\n : conversation.pendingApproval;\n if (!approval || this.approvalRights().get(approval.approvalId)?.canDecide !== true) {\n return;\n }\n\n if (decision === 'leave' && !approval.consultation?.leaveRoute) {\n // Only a consulted agent's proposal with a route at the subject can be left for its approvers.\n return;\n }\n\n const proposal = conversation.thread?.decisions.find(item => item.approvalId === approval.approvalId);\n if (proposal?.runId) {\n if (decision !== 'leave') {\n void this.decideProposal(conversation.id, approval, decision, reason);\n }\n return;\n }\n if (conversation.pendingApproval?.approvalId !== approval.approvalId) {\n // Only the approval the conversation waits for resumes a turn.\n return;\n }\n\n const conversationId = conversation.id;\n this.patchSession(conversationId, current => ({ ...current, deciding: true, error: null, notice: null }));\n\n let accepted = false;\n let failed = false;\n const request = { decision, expectedProposalHash: approval.proposalHash, ...(reason ? { reason } : {}) };\n\n this.runStream(conversationId, this.api.decideApproval(conversationId, approval.approvalId, request), {\n next: event => {\n if (!accepted && event.type !== 'error') {\n accepted = true;\n this.patchSession(conversationId, current => ({\n ...current,\n conversation: applyNhAssistantApprovalDecision(current.conversation, approval.approvalId, decision)\n }));\n }\n if (event.type === 'error') {\n failed = true;\n if (!accepted) {\n this.patchSession(conversationId, current => ({ ...current, error: event.data }));\n return;\n }\n }\n\n this.applyEvent(conversationId, event);\n },\n complete: () => {\n this.patchSession(conversationId, current => ({ ...current, deciding: false }));\n // A proposal left for the subject's approvers names the one that waits there only once read again.\n this.afterTurn(conversationId, failed || decision === 'leave');\n }\n });\n }\n\n /**\n * Answers the question the open chat waits for with the choice at `choice` and streams the resumed\n * turn, as a decision does. Ignores another question, a question addressed to someone else, a choice\n * the question does not offer and calls while a turn or a decision is in flight. A refused answer,\n * such as an expired question, shows its error and reads the conversation again.\n */\n answerQuestion(questionId: string, choice: number): void {\n const session = this.activeSession();\n const conversation = session?.conversation;\n if (!session || !conversation || session.deciding || session.streaming || !this.canAnswer()) {\n return;\n }\n const question = conversation.pendingQuestion;\n if (!question || question.questionId !== questionId || !Number.isInteger(choice) || choice < 0 || choice >= question.choices.length) {\n return;\n }\n\n const conversationId = conversation.id;\n this.patchSession(conversationId, current => ({ ...current, deciding: true, error: null, notice: null }));\n\n let accepted = false;\n let failed = false;\n this.runStream(conversationId, this.api.answerQuestion(conversationId, questionId, { choice }), {\n next: event => {\n if (!accepted && event.type !== 'error') {\n accepted = true;\n this.patchSession(conversationId, current => ({\n ...current,\n conversation: applyNhAssistantQuestionAnswer(current.conversation, questionId, choice)\n }));\n }\n if (event.type === 'error') {\n failed = true;\n if (!accepted) {\n this.patchSession(conversationId, current => ({ ...current, error: event.data }));\n return;\n }\n }\n\n this.applyEvent(conversationId, event);\n },\n complete: () => {\n this.patchSession(conversationId, current => ({ ...current, deciding: false }));\n // An expired question released the conversation; reading it again shows that.\n this.afterTurn(conversationId, failed);\n }\n });\n }\n\n /**\n * Decides a proposal of an agent's run with `POST approvals/{id}/decisions`. An approved deferred\n * proposal executes later as a background operation; an inline one wakes the waiting run. The\n * reloaded snapshot shows the outcome and the proposals that remain open.\n */\n private async decideProposal(\n conversationId: string,\n approval: ApprovalPart,\n decision: AgentProposalDecision,\n reason?: string\n ): Promise<void> {\n const revision = this.accountRevision;\n this.patchSession(conversationId, session => ({ ...session, deciding: true, error: null, notice: null }));\n try {\n const proposal = await firstValueFrom(this.agentRuns.decide(approval, decision, reason));\n if (revision === this.accountRevision) {\n if (decision === 'reject' && proposal.status === 'rejected' && proposal.canGiveFeedback === true) {\n this.feedbackApprovalsState.update(approvals => new Set(approvals).add(approval.approvalId));\n }\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: applyProposalDecision(session.conversation, approval.approvalId, proposal.status)\n }));\n }\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(conversationId, error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.patchSession(conversationId, session => ({ ...session, deciding: false }));\n await this.reloadSession(conversationId);\n }\n }\n }\n\n /**\n * Resolves an uncertain hand-off in the open chat that the current user approved (`canResolve`):\n * `hand-to-application` hands it to the application again with a new report deadline,\n * `mark-resolved` confirms its outcome. The conversation the server returns replaces the shown one.\n * Ignores approvals the user may not resolve and calls while a decision or a turn is in flight.\n */\n async resolveApproval(approvalId: string, resolution: ApprovalResolution, reason?: string): Promise<void> {\n const session = this.activeSession();\n const conversation = session?.conversation;\n if (!session || !conversation || session.deciding || session.streaming\n || !resolvableApprovalParts(conversation).some(part => part.approvalId === approvalId)) {\n return;\n }\n\n const conversationId = conversation.id;\n const revision = this.accountRevision;\n this.patchSession(conversationId, current => ({ ...current, deciding: true, error: null, notice: null }));\n try {\n const resolved = await firstValueFrom(this.api.resolveApproval(conversationId, approvalId, {\n action: resolution,\n ...(reason ? { reason } : {})\n }));\n if (revision === this.accountRevision) {\n this.upsertSession(resolved);\n }\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(conversationId, error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.patchSession(conversationId, current => ({ ...current, deciding: false }));\n }\n }\n }\n\n /** Asks the server to stop the running turn or to abandon a waiting approval of the open conversation. */\n async cancel(): Promise<void> {\n const conversationId = this.activeIdState();\n if (conversationId) {\n this.pauseQueue();\n await this.cancelConversation(conversationId);\n }\n }\n\n private async cancelConversation(conversationId: string): Promise<void> {\n const session = this.sessionsState().get(conversationId);\n const conversation = session?.conversation;\n if (!session || !conversation || (conversation.status === 'idle' && !session.streaming)) {\n return;\n }\n\n const revision = this.accountRevision;\n try {\n await firstValueFrom(this.api.cancel(conversationId), { defaultValue: undefined });\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(conversationId, error);\n }\n return;\n }\n\n if (revision !== this.accountRevision) {\n return;\n }\n\n if (!this.sessionsState().get(conversationId)?.streaming) {\n await this.reloadSession(conversationId);\n return;\n }\n\n // The server ends the stream with turn.completed(cancelled); stop waiting if it does not.\n clearTimeout(this.cancelTimers.get(conversationId));\n this.cancelTimers.set(conversationId, setTimeout(() => {\n this.cancelTimers.delete(conversationId);\n if (this.sessionsState().get(conversationId)?.streaming) {\n this.streams.get(conversationId)?.unsubscribe();\n this.streams.delete(conversationId);\n this.patchSession(conversationId, current => ({ ...current, streaming: false, deciding: false, writingMessageId: null }));\n void this.reloadSession(conversationId);\n }\n }, cancelGracePeriodMs));\n }\n\n /** Joins a shared conversation with an invitation link and opens it. Resolves `false` on failure. */\n async joinConversation(conversationId: string, token: string): Promise<boolean> {\n await this.initialize();\n const revision = this.accountRevision;\n try {\n const conversation = await firstValueFrom(this.api.joinConversation(conversationId, token));\n if (revision !== this.accountRevision) {\n return false;\n }\n this.upsertSession(conversation);\n this.setActive(conversation.id, conversation.agentId);\n void this.refreshConversations();\n return true;\n } catch (error) {\n if (revision === this.accountRevision) {\n this.startNewConversation();\n this.setError(null, error);\n }\n return false;\n }\n }\n\n /** Owner only: creates a new invitation link for the open conversation and returns its token. */\n async createShareLink(): Promise<string | null> {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return null;\n }\n try {\n const link = await firstValueFrom(this.api.createShareLink(conversationId));\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: { ...session.conversation, shareToken: link.token }\n }));\n return link.token;\n } catch (error) {\n this.setError(conversationId, error);\n return null;\n }\n }\n\n /** Owner only: the invitation link of the open conversation stops working. */\n async revokeShareLink(): Promise<boolean> {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return false;\n }\n try {\n await firstValueFrom(this.api.revokeShareLink(conversationId), { defaultValue: undefined });\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: { ...session.conversation, shareToken: null }\n }));\n return true;\n } catch (error) {\n this.setError(conversationId, error);\n return false;\n }\n }\n\n /** Owner only: searches the application's directory for people to invite to the open conversation. */\n async searchParticipantCandidates(query: string): Promise<DirectoryEntry[]> {\n const conversationId = this.activeIdState();\n if (!conversationId || query.trim().length < 2) {\n return [];\n }\n try {\n return await firstValueFrom(this.api.searchParticipantCandidates(conversationId, query.trim()));\n } catch (error) {\n this.setError(conversationId, error);\n return [];\n }\n }\n\n /** Owner only: invites a person from the directory to the open conversation. */\n async inviteParticipant(actorId: string): Promise<boolean> {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return false;\n }\n try {\n await firstValueFrom(this.api.inviteParticipant(conversationId, actorId), { defaultValue: undefined });\n await this.reloadSession(conversationId);\n return true;\n } catch (error) {\n this.setError(conversationId, error);\n return false;\n }\n }\n\n /**\n * The owner removes a participant of the open conversation; with the current user's own id a\n * participant leaves it.\n */\n async removeParticipant(actorId: string): Promise<boolean> {\n const conversation = this.activeConversation();\n if (!conversation) {\n return false;\n }\n try {\n await firstValueFrom(this.api.removeParticipant(conversation.id, actorId), { defaultValue: undefined });\n if (actorId === conversation.currentActorId) {\n this.forget(conversation.id);\n } else {\n await this.reloadSession(conversation.id);\n }\n return true;\n } catch (error) {\n this.setError(conversation.id, error);\n return false;\n }\n }\n\n clearError(): void {\n const activeId = this.activeIdState();\n if (activeId === null) {\n this.draftErrorState.set(null);\n return;\n }\n this.patchSession(activeId, session => ({ ...session, error: null }));\n }\n\n clearNotice(): void {\n const activeId = this.activeIdState();\n if (activeId !== null) {\n this.patchSession(activeId, session => ({ ...session, notice: null }));\n }\n }\n\n /** Persists only drawer visibility, never the page context or a message draft. */\n setPanelOpen(open: boolean): void {\n this.restorePanelOpenState.set(open);\n this.uiState.update({ panelOpen: open });\n }\n\n /** Reads the host's page context again so the chip shows what the next message sends. */\n async refreshPageContext(): Promise<void> {\n const revision = this.accountRevision;\n const context = await this.readPageContext();\n if (revision === this.accountRevision) {\n this.pageContextState.set(context ?? null);\n }\n }\n\n /** Leaves the page context out of the next message only, or includes it again. */\n setPageContextExcluded(excluded: boolean): void {\n this.pageContextExcludedState.set(excluded);\n }\n\n /** Returns and clears the draft of a message that was not accepted. */\n consumeRestoredDraft(): string | null {\n const draft = this.restoredDraftState();\n this.restoredDraftState.set(null);\n return draft;\n }\n\n /**\n * Attaches files to the next message of the open conversation and uploads them at once. Each\n * file is checked first against `uploads()`: the most files of one message, the accepted media\n * types and the largest size; a file that fails stays as a failed attachment with its code and\n * is never uploaded. A new conversation is created first, because an upload belongs to one.\n */\n async attach(files: readonly File[]): Promise<void> {\n const uploads = this.uploads();\n if (!uploads || files.length === 0) {\n return;\n }\n\n const revision = this.accountRevision;\n const key = this.activeIdState() ?? newConversationKey;\n let attached = this.attachmentsOf(key).filter(attachment => attachment.state !== 'failed').length;\n const added: NhAssistantAttachment[] = [];\n const pending: { attachment: NhAssistantAttachment; content: Blob }[] = [];\n for (const file of files) {\n const mediaType = nhAssistantMediaTypeOf(file, uploads.acceptedMediaTypes, uploads.mappedExtensions);\n const problem = nhAssistantFileProblem(file, mediaType, uploads, attached);\n const attachment: NhAssistantAttachment = {\n id: createClientMessageId(),\n name: file.name,\n mediaType,\n size: file.size,\n state: problem ? 'failed' : 'uploading',\n progress: 0,\n file: null,\n error: problem ? clientError(problem) : null\n };\n added.push(attachment);\n if (!problem) {\n attached++;\n // The upload declares the media type the check accepted, also when the browser gave none.\n pending.push({ attachment, content: file.slice(0, file.size, mediaType) });\n }\n }\n this.patchAttachments(key, attachments => [...attachments, ...added]);\n if (pending.length === 0) {\n return;\n }\n\n let conversationId = this.activeIdState();\n if (conversationId === null) {\n this.attachmentConversation ??= this.createConversation().finally(() => {\n this.attachmentConversation = null;\n });\n const conversation = await this.attachmentConversation;\n if (revision !== this.accountRevision || this.destroyed) {\n return;\n }\n if (!conversation) {\n const error = this.draftErrorState() ?? clientError(NhAssistantClientErrorCodes.server);\n this.patchAttachments(key, attachments => attachments.map(attachment => pending.some(item => item.attachment.id === attachment.id)\n ? { ...attachment, state: 'failed', error }\n : attachment));\n return;\n }\n conversationId = conversation.id;\n this.moveAttachments(key, conversationId);\n }\n\n for (const { attachment, content } of pending) {\n this.startUpload(conversationId, attachment, content);\n }\n }\n\n /** Removes an attachment of the next message; an upload in progress stops. */\n removeAttachment(attachmentId: string): void {\n this.uploadSubscriptions.get(attachmentId)?.unsubscribe();\n this.uploadSubscriptions.delete(attachmentId);\n this.attachmentsState.update(all => {\n const next = new Map<string, readonly NhAssistantAttachment[]>();\n for (const [key, attachments] of all) {\n const kept = attachments.filter(attachment => attachment.id !== attachmentId);\n if (kept.length > 0) {\n next.set(key, kept);\n }\n }\n return next;\n });\n }\n\n private startUpload(conversationId: string, attachment: NhAssistantAttachment, content: Blob): void {\n const revision = this.accountRevision;\n const update = (change: Partial<NhAssistantAttachment>) => {\n if (revision === this.accountRevision) {\n this.patchAttachments(conversationId, attachments => attachments.map(item => item.id === attachment.id ? { ...item, ...change } : item));\n }\n };\n const subscription = this.api.uploadFile(conversationId, content, attachment.name).subscribe({\n next: event => {\n if (event.type === 'progress') {\n update({ progress: event.total > 0 ? Math.min(1, event.loaded / event.total) : 0 });\n return;\n }\n update({ state: 'uploaded', progress: 1, file: event.file });\n },\n error: error => {\n this.uploadSubscriptions.delete(attachment.id);\n update({ state: 'failed', error: error instanceof NhAssistantApiError\n ? { code: error.code, messageKey: error.messageKey }\n : clientError(NhAssistantClientErrorCodes.server) });\n },\n complete: () => this.uploadSubscriptions.delete(attachment.id)\n });\n if (!subscription.closed) {\n this.uploadSubscriptions.set(attachment.id, subscription);\n }\n }\n\n private attachmentsOf(key: string): readonly NhAssistantAttachment[] {\n return this.attachmentsState().get(key) ?? [];\n }\n\n private patchAttachments(\n key: string,\n update: (attachments: readonly NhAssistantAttachment[]) => readonly NhAssistantAttachment[]\n ): void {\n this.attachmentsState.update(all => {\n const next = new Map(all);\n const attachments = update(all.get(key) ?? []);\n if (attachments.length > 0) {\n next.set(key, attachments);\n } else {\n next.delete(key);\n }\n return next;\n });\n }\n\n /** Moves the attachments of a new conversation to the conversation that was created for them. */\n private moveAttachments(from: string, to: string): void {\n const moving = this.attachmentsOf(from);\n this.patchAttachments(from, () => []);\n this.patchAttachments(to, attachments => [...attachments, ...moving]);\n }\n\n /**\n * The attachments a message took leave the composer, and with them the failed ones; files that\n * still upload stay for the next message.\n */\n private releaseAttachments(conversationId: string, files: readonly FileReference[]): void {\n const sent = new Set(files.map(file => file.id));\n this.patchAttachments(conversationId, attachments => attachments.filter(attachment =>\n attachment.state === 'uploading' || (attachment.state === 'uploaded' && !sent.has(attachment.file?.id ?? ''))));\n }\n\n /** Stops the uploads of a conversation, or of every conversation, and forgets their attachments. */\n private dropAttachments(conversationId?: string): void {\n for (const [key, attachments] of this.attachmentsState()) {\n if (conversationId !== undefined && key !== conversationId) {\n continue;\n }\n for (const attachment of attachments) {\n this.uploadSubscriptions.get(attachment.id)?.unsubscribe();\n this.uploadSubscriptions.delete(attachment.id);\n }\n }\n if (conversationId === undefined) {\n this.attachmentsState.set(new Map());\n } else {\n this.patchAttachments(conversationId, () => []);\n }\n }\n\n private async loadConversation(conversationId: string, restoring: boolean): Promise<void> {\n if (this.sessionsState().has(conversationId)) {\n const session = this.sessionsState().get(conversationId)!;\n const offered = this.agents().some(agent => agent.id === session.conversation.agentId);\n this.setActive(conversationId, offered ? session.conversation.agentId : undefined);\n return;\n }\n if (this.activeIdState() === conversationId) {\n return;\n }\n\n const revision = this.accountRevision;\n this.conversationLoadingState.set(true);\n this.draftErrorState.set(null);\n try {\n const conversation = await firstValueFrom(this.api.getConversation(conversationId));\n if (revision !== this.accountRevision) {\n return;\n }\n // An agent's thread about a subject opens for whoever the server lets read it, also for an\n // agent kept out of the chat, such as one run by hand; it is never chosen for a new chat.\n const offered = this.agents().some(agent => agent.id === conversation.agentId);\n if (!offered && conversation.kind !== 'thread') {\n this.uiState.update({ conversationId: null });\n return;\n }\n this.upsertSession(conversation);\n this.setActive(conversationId, offered ? conversation.agentId : undefined);\n } catch (error) {\n if (revision !== this.accountRevision) {\n return;\n }\n if (error instanceof NhAssistantApiError && (error.status === 403 || error.status === 404)) {\n this.uiState.update({ conversationId: null });\n }\n if (!restoring) {\n this.setError(null, error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.conversationLoadingState.set(false);\n }\n }\n }\n\n private setActive(conversationId: string | null, agentId?: string): void {\n this.activeIdState.set(conversationId);\n if (agentId) {\n this.selectedAgentIdState.set(agentId);\n }\n this.uiState.update(agentId ? { conversationId, agentId } : { conversationId });\n }\n\n /**\n * Page context for one message: `undefined` omits the field (no getter, getter failed or\n * invalid shape), `null` sends an explicit \"none\" (no context or left out by the user).\n */\n private async contextForMessage(): Promise<ClientContext | null | undefined> {\n if (!this.config.getPageContext) {\n return undefined;\n }\n\n if (this.pageContextExcludedState()) {\n this.pageContextExcludedState.set(false);\n return null;\n }\n\n const revision = this.accountRevision;\n const context = await this.readPageContext();\n if (revision === this.accountRevision) {\n this.pageContextState.set(context ?? null);\n }\n return context;\n }\n\n private async readPageContext(): Promise<ClientContext | null | undefined> {\n const getter = this.config.getPageContext;\n if (!getter) {\n return undefined;\n }\n\n try {\n const value = await runInInjectionContext(this.injector, () => getter());\n if (value === null || value === undefined) {\n return null;\n }\n return normalizeNhAssistantClientContext(value) ?? undefined;\n } catch {\n // A failing host getter never blocks sending; the message goes without page context.\n return undefined;\n }\n }\n\n private async startInitialization(): Promise<void> {\n const decision = this.accessPolicy.canUse();\n if (!isObservable(decision)) {\n this.accessGrantedState.set(decision);\n await this.reloadStatus();\n return;\n }\n\n await new Promise<void>(resolve => {\n this.accessSubscription = (decision as Observable<boolean>).subscribe({\n next: granted => {\n this.accessGrantedState.set(granted);\n void this.reloadStatus().finally(() => resolve());\n },\n error: () => {\n this.accessGrantedState.set(false);\n resolve();\n },\n complete: () => resolve()\n });\n });\n }\n\n /** Connects live updates and notifications once per account and server configuration. */\n private startCollaboration(status: AssistantStatus): void {\n const collaboration = status.collaboration ?? null;\n const key = `${this.accountRevision}|${collaboration?.hubPath ?? ''}|${collaboration?.push === true}`;\n if (key === this.collaborationKey) {\n return;\n }\n const accountChanged = this.collaborationKey?.split('|')[0] !== String(this.accountRevision);\n this.collaborationKey = key;\n void this.live.connect(collaboration?.hubPath ?? null, accountChanged);\n void this.push.activate(collaboration?.push === true);\n }\n\n /** Forgets everything about the previous account: turns, conversations, live updates and push. */\n private resetAccount(): void {\n this.accountRevision++;\n this.collaborationKey = null;\n this.stopAllTurns();\n this.sessionsState.set(new Map());\n this.activeIdState.set(null);\n this.conversationsState.set([]);\n this.conversationsTotalState.set(0);\n this.conversationLoadingState.set(false);\n this.conversationsLoadingState.set(false);\n this.pageContextState.set(null);\n this.pageContextExcludedState.set(false);\n this.restoredDraftState.set(null);\n this.draftErrorState.set(null);\n this.sendingState.set(null);\n this.queuedState.set([]);\n this.pausedQueuesState.set(new Set());\n this.queueDispatchState.set(null);\n this.steeringState.set(null);\n this.submittingState.set(false);\n this.feedbackApprovalsState.set(new Set());\n this.dropAttachments();\n this.attachmentConversation = null;\n this.clearAgentWorkTimers();\n void this.live.stop();\n void this.push.deactivate().catch(() => undefined);\n }\n\n private async createConversation(): Promise<Conversation | null> {\n const agentId = this.selectedAgentIdState();\n if (!agentId) {\n return null;\n }\n\n const revision = this.accountRevision;\n try {\n const conversation = await firstValueFrom(this.api.createConversation({ agentId }));\n if (revision !== this.accountRevision) {\n return null;\n }\n this.upsertSession(conversation);\n this.setActive(conversation.id);\n this.conversationsState.update(items => [toSummary(conversation), ...items.filter(item => item.id !== conversation.id)]);\n this.conversationsTotalState.update(total => total + 1);\n return conversation;\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(null, error);\n }\n return null;\n }\n }\n\n private runStream<TEvent extends NhAssistantMessageEvent>(\n conversationId: string,\n stream: Observable<TEvent>,\n handlers: { next: (event: TEvent) => void; complete: () => void }\n ): void {\n this.streams.get(conversationId)?.unsubscribe();\n this.patchSession(conversationId, session => ({ ...session, streaming: true, writingMessageId: null }));\n\n const finish = () => {\n clearTimeout(this.cancelTimers.get(conversationId));\n this.cancelTimers.delete(conversationId);\n this.streams.delete(conversationId);\n this.patchSession(conversationId, session => ({ ...session, streaming: false, writingMessageId: null }));\n handlers.complete();\n };\n\n const subscription = stream.subscribe({\n next: event => handlers.next(event),\n error: () => {\n this.patchSession(conversationId, session => ({ ...session, error: clientError(NhAssistantClientErrorCodes.network) }));\n finish();\n },\n complete: finish\n });\n if (!subscription.closed) {\n this.streams.set(conversationId, subscription);\n }\n }\n\n private stopAllTurns(): void {\n for (const subscription of this.streams.values()) {\n subscription.unsubscribe();\n }\n this.streams.clear();\n for (const resolve of this.pendingSendResolves.values()) {\n resolve(false);\n }\n this.pendingSendResolves.clear();\n for (const timer of this.cancelTimers.values()) {\n clearTimeout(timer);\n }\n this.cancelTimers.clear();\n }\n\n private applyEvent(conversationId: string, event: NhAssistantSseEvent, clientMessageId?: string): void {\n this.patchSession(conversationId, session => {\n const conversation = applyNhAssistantEvent(session.conversation, event, clientMessageId);\n let { error, notice, lastUsage } = session;\n if (event.type === 'error') {\n error = event.data;\n }\n if (event.type === 'turn.completed') {\n lastUsage = event.data.usage;\n if (event.data.status === 'failed') {\n error = clientError(event.data.errorCode ?? NhAssistantClientErrorCodes.server);\n } else if (event.data.status === 'completed') {\n notice = completionNotice(conversation, event.data.errorCode);\n }\n }\n return { ...session, conversation, error, notice, lastUsage, writingMessageId: writingAnswerAfter(session.writingMessageId, event) };\n });\n }\n\n private afterTurn(conversationId: string, reload: boolean): void {\n const session = this.sessionsState().get(conversationId);\n if (session) {\n const status = session.conversation.status;\n this.patchSummary(conversationId, summary => ({\n ...summary,\n status,\n updatedAt: new Date().toISOString(),\n activeActorId: status === 'waiting-for-approval' ? summary.activeActorId ?? session.conversation.currentActorId ?? null : null\n }));\n }\n\n if (reload) {\n void this.reloadSession(conversationId);\n }\n // The list carries the exact title, latest message and read position of the finished turn.\n void this.refreshConversations();\n }\n\n private async reloadSession(conversationId: string): Promise<void> {\n const revision = this.accountRevision;\n try {\n const conversation = await firstValueFrom(this.api.getConversation(conversationId));\n const session = this.sessionsState().get(conversationId);\n if (revision === this.accountRevision && session && !session.streaming) {\n this.upsertSession(conversation);\n }\n } catch (error) {\n if (error instanceof NhAssistantApiError && (error.status === 403 || error.status === 404)) {\n this.forget(conversationId);\n }\n // Otherwise keep the local state; the error of the turn is already shown.\n }\n }\n\n private markActiveReadWhenSeen(): void {\n const conversationId = this.activeIdState();\n if (!conversationId || !this.viewingState() || !this.pageVisibleState() || this.markingRead.has(conversationId)) {\n return;\n }\n const session = this.sessionsState().get(conversationId);\n const summary = this.conversationsState().find(item => item.id === conversationId);\n if (!session || session.streaming || !summary || !nhAssistantIsUnread(summary)) {\n return;\n }\n\n this.markingRead.add(conversationId);\n const revision = this.accountRevision;\n let request: Observable<void>;\n try {\n request = this.api.markRead(conversationId);\n } catch {\n this.markingRead.delete(conversationId);\n return;\n }\n firstValueFrom(request, { defaultValue: undefined })\n .then(() => {\n if (revision === this.accountRevision) {\n this.patchSummary(conversationId, item => ({ ...item, lastReadSequence: item.lastMessageSequence ?? item.lastReadSequence }));\n }\n })\n .catch(() => undefined)\n .finally(() => this.markingRead.delete(conversationId));\n }\n\n private onLiveChanged(change: LiveConversationChanged): void {\n const known = this.conversationsState().some(item => item.id === change.conversationId);\n if (!known) {\n this.scheduleRefresh();\n } else {\n this.patchSummary(change.conversationId, summary => ({\n ...summary,\n status: change.status,\n title: change.title,\n updatedAt: change.updatedAt,\n activeActorId: change.activeActorId,\n lastMessageSequence: Math.max(summary.lastMessageSequence ?? 0, change.lastMessageSequence),\n participantCount: change.participantCount\n }));\n }\n\n const session = this.sessionsState().get(change.conversationId);\n if (!session || session.streaming) {\n return;\n }\n const wasRunning = session.conversation.status === 'running';\n this.patchSession(change.conversationId, current => ({\n ...current,\n conversation: applyNhAssistantConversationChange(current.conversation, change),\n writingMessageId: change.status === 'running' ? current.writingMessageId : null\n }));\n if (wasRunning && change.status !== 'running') {\n // Another session ended its turn; the snapshot holds the exact answer and approvals.\n void this.reloadSession(change.conversationId);\n } else if (session.conversation.participantCount !== change.participantCount) {\n void this.reloadSession(change.conversationId);\n }\n }\n\n private onLiveRead(read: LiveConversationRead): void {\n this.patchSummary(read.conversationId, summary => ({\n ...summary,\n lastReadSequence: Math.max(summary.lastReadSequence ?? 0, read.lastReadSequence)\n }));\n }\n\n private onLiveRemoved(removed: LiveConversationRemoved): void {\n const wasActive = this.activeIdState() === removed.conversationId;\n this.forget(removed.conversationId);\n if (wasActive) {\n this.draftErrorState.set(clientError(NhAssistantClientErrorCodes.conversationRemoved));\n }\n }\n\n /**\n * Applies a live turn event or message to a conversation this tab shows. While the tab streams a\n * turn of the conversation, its stream brings the turn's events and its own message, so it applies\n * only messages that others stored meanwhile: the application's and other people's.\n */\n private onLiveEvent(event: LiveConversationEvent): void {\n const session = this.sessionsState().get(event.conversationId);\n if (event.type === 'turn.started') {\n this.patchSummary(event.conversationId, summary => ({ ...summary, status: 'running', activeActorId: event.actorId }));\n }\n if (!session) {\n return;\n }\n if (session.streaming && !isMessageOfOthers(session.conversation, event)) {\n return;\n }\n this.patchSession(event.conversationId, current => ({\n ...current,\n conversation: applyNhAssistantLiveEvent(current.conversation, event),\n // A turn this tab follows live names its answer; while the tab streams, its stream does.\n writingMessageId: current.streaming ? current.writingMessageId : writingAnswerAfter(current.writingMessageId, event)\n }));\n }\n\n /**\n * A run or proposal of an agent thread changed, for example a colleague decided a proposal in the\n * inbox: reload the thread when this tab has it open, so its approval cards show the decision.\n * A burst of updates reloads once. Feedback does not change the thread.\n */\n private onLiveAgentWork(change: LiveAgentWorkChanged): void {\n const conversationId = change.conversationId;\n const session = this.sessionsState().get(conversationId);\n if (change.reason === 'feedback' || !session || session.streaming) {\n return;\n }\n\n clearTimeout(this.agentWorkTimers.get(conversationId));\n this.agentWorkTimers.set(conversationId, setTimeout(() => {\n this.agentWorkTimers.delete(conversationId);\n const current = this.sessionsState().get(conversationId);\n // A decision of this tab reloads the thread itself when it ends.\n if (current && !current.streaming && !current.deciding) {\n void this.reloadSession(conversationId);\n }\n }, refreshDelayMs));\n }\n\n private clearAgentWorkTimers(): void {\n for (const timer of this.agentWorkTimers.values()) {\n clearTimeout(timer);\n }\n this.agentWorkTimers.clear();\n }\n\n /** After a reconnect: updates sent while disconnected are lost, so reload what is shown. */\n private resync(): void {\n if (!this.enabled()) {\n return;\n }\n void this.refreshConversations();\n for (const [conversationId, session] of this.sessionsState()) {\n if (!session.streaming) {\n void this.reloadSession(conversationId);\n }\n }\n }\n\n private scheduleRefresh(): void {\n clearTimeout(this.refreshTimer);\n this.refreshTimer = setTimeout(() => void this.refreshConversations(), refreshDelayMs);\n }\n\n /** Stores a snapshot, keeping at most `maxSessions` idle conversations in memory. */\n private upsertSession(conversation: Conversation): void {\n this.sessionsState.update(sessions => {\n const next = new Map(sessions);\n const existing = next.get(conversation.id);\n next.set(conversation.id, existing\n ? { ...existing, conversation, writingMessageId: conversation.status === 'running' ? existing.writingMessageId : null }\n : { conversation, streaming: false, deciding: false, error: null, notice: null, lastUsage: null, writingMessageId: null });\n if (next.size > maxSessions) {\n const activeId = this.activeIdState();\n for (const [id, session] of next) {\n if (next.size <= maxSessions) {\n break;\n }\n if (id !== activeId && id !== conversation.id && !session.streaming\n && !this.queuedState().some(item => item.conversationId === id)) {\n next.delete(id);\n }\n }\n }\n return next;\n });\n this.patchSummary(conversation.id, summary => ({\n ...summary,\n title: conversation.title,\n status: conversation.status,\n updatedAt: conversation.updatedAt,\n ...(conversation.lastMessageSequence === undefined ? {} : { lastMessageSequence: conversation.lastMessageSequence }),\n ...(conversation.lastReadSequence === undefined ? {} : { lastReadSequence: conversation.lastReadSequence }),\n ...(conversation.activeActorId === undefined ? {} : { activeActorId: conversation.activeActorId }),\n ...(conversation.members === undefined ? {} : { participantCount: Math.max(0, conversation.members.length - 1) })\n }));\n }\n\n private patchSession(conversationId: string, update: (session: NhAssistantSession) => NhAssistantSession): void {\n const session = this.sessionsState().get(conversationId);\n if (!session) {\n return;\n }\n this.sessionsState.update(sessions => new Map(sessions).set(conversationId, update(session)));\n }\n\n private patchSummary(\n conversationId: string,\n update: Partial<ConversationSummary> | ((summary: ConversationSummary) => ConversationSummary)\n ): void {\n this.conversationsState.update(items => items.map(item => {\n if (item.id !== conversationId) {\n return item;\n }\n return typeof update === 'function' ? update(item) : { ...item, ...update };\n }));\n }\n\n /**\n * Keeps local knowledge when the list is reloaded: the status of turns this tab streams, and a\n * read position the server already confirmed, which a list response sent earlier may not show.\n */\n private withLocalState(summary: ConversationSummary): ConversationSummary {\n const session = this.sessionsState().get(summary.id);\n const known = this.conversationsState().find(item => item.id === summary.id)?.lastReadSequence;\n const lastReadSequence = known !== undefined && summary.lastReadSequence !== undefined\n ? Math.max(known, summary.lastReadSequence)\n : summary.lastReadSequence;\n return {\n ...summary,\n lastReadSequence,\n status: session?.streaming ? session.conversation.status : summary.status\n };\n }\n\n /** Removes a deleted, left or inaccessible conversation everywhere. */\n private forget(conversationId: string): void {\n this.dropAttachments(conversationId);\n this.queuedState.update(items => items.filter(item => item.conversationId !== conversationId));\n this.pausedQueuesState.update(paused => new Set([...paused].filter(id => id !== conversationId)));\n this.streams.get(conversationId)?.unsubscribe();\n this.streams.delete(conversationId);\n this.sessionsState.update(sessions => {\n const next = new Map(sessions);\n next.delete(conversationId);\n return next;\n });\n const before = this.conversationsState().length;\n this.conversationsState.update(items => items.filter(item => item.id !== conversationId));\n if (this.conversationsState().length < before) {\n this.conversationsTotalState.update(total => Math.max(0, total - 1));\n }\n if (this.activeIdState() === conversationId) {\n this.activeIdState.set(null);\n this.uiState.update({ conversationId: null });\n }\n }\n\n private removeMessage(conversationId: string, messageId: string, status: Conversation['status']): void {\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: {\n ...session.conversation,\n status,\n messages: session.conversation.messages.filter(message => message.id !== messageId)\n }\n }));\n this.patchSummary(conversationId, { status });\n }\n\n private selectInitialAgent(agents: AgentSummary[]): void {\n const current = this.selectedAgentIdState();\n if (current && agents.some(agent => agent.id === current)) {\n return;\n }\n\n const preferred = agents.find(agent => agent.id === this.config.defaultAgentId) ?? agents[0] ?? null;\n this.selectedAgentIdState.set(preferred?.id ?? null);\n this.uiState.update({ agentId: preferred?.id ?? null });\n }\n\n /** Shows an error on a conversation, or on the new-conversation view for `null`. */\n private setError(conversationId: string | null, error: unknown): void {\n const value = error instanceof NhAssistantApiError\n ? { code: error.code, messageKey: error.messageKey }\n : clientError(NhAssistantClientErrorCodes.server);\n if (conversationId === null || !this.sessionsState().has(conversationId)) {\n this.draftErrorState.set(value);\n return;\n }\n this.patchSession(conversationId, session => ({ ...session, error: value }));\n }\n}\n\nfunction clientError(code: string): NhAssistantError {\n return { code, messageKey: nhAssistantErrorMessageKey(code) };\n}\n\n/**\n * The notice of a message that waits for the next run of the agent working in the thread, with its\n * files when it carries any; the run adds the message to the thread when it takes it.\n */\nfunction messageQueuedNotice(fileCount: number): NhAssistantNotice {\n return {\n code: NH_ASSISTANT_MESSAGE_QUEUED_NOTICE_CODE,\n messageKey: fileCount > 0 ? 'nh-assistant.notices.message-queued-with-files' : 'nh-assistant.notices.message-queued'\n };\n}\n\n/**\n * The answer a turn writes after `event`: `turn.started` names it, `turn.completed` and `error` end\n * the turn, and every other event leaves it as it is.\n */\nfunction writingAnswerAfter(current: string | null, event: { type: string; data: unknown }): string | null {\n switch (event.type) {\n case 'turn.started':\n return (event.data as { assistantMessageId?: string } | null)?.assistantMessageId ?? null;\n case 'turn.completed':\n case 'error':\n return null;\n default:\n return current;\n }\n}\n\n/**\n * A completed turn with a server code, or without any answer text, explains itself with a notice.\n * Another person's message that arrived while the turn ran does not end this tab's turn.\n */\nfunction completionNotice(conversation: Conversation, errorCode: string | null): NhAssistantNotice | null {\n if (errorCode) {\n return clientError(errorCode);\n }\n const ownTurn = { ...conversation, messages: conversation.messages.filter(message => !isOtherPersonsMessage(conversation, message)) };\n if (!nhAssistantLatestTurnHasText(ownTurn)) {\n return { code: NH_ASSISTANT_NO_ANSWER_NOTICE_CODE, messageKey: 'nh-assistant.notices.no-answer' };\n }\n\n return null;\n}\n\n/**\n * True for a live `message.created` of a message that this tab did not write: the application's, or\n * a user message of another writer. A user message is this tab's own when the current user wrote it,\n * and when the tab does not know the current user, so a turn's own message never shows twice.\n */\nfunction isMessageOfOthers(conversation: Conversation, event: LiveConversationEvent): boolean {\n if (event.type !== 'message.created') {\n return false;\n }\n const message = event.data as Message | null;\n if (!message?.id) {\n return false;\n }\n if (message.role === 'application') {\n return true;\n }\n\n return message.role === 'user' && isOtherPersonsMessage(conversation, message, event.actorId);\n}\n\n/** True for a user message that a known writer other than the current user wrote. */\nfunction isOtherPersonsMessage(conversation: Conversation, message: Message, fallbackAuthor?: string): boolean {\n const author = message.authorActorId ?? fallbackAuthor;\n const currentActorId = conversation.currentActorId;\n return message.role === 'user' && !!author && !!currentActorId && author !== currentActorId;\n}\n\n/** The approvals of a conversation that still wait for a decision, each once. */\n/** Every approval of the conversation once, by approval id; later parts win. */\nfunction approvalParts(conversation: Conversation): ApprovalPart[] {\n const approvals = new Map<string, ApprovalPart>();\n for (const message of conversation.messages) {\n for (const part of message.parts) {\n if (part.type === 'approval') {\n approvals.set(part.approvalId, part);\n }\n }\n }\n return [...approvals.values()];\n}\n\n/** The uncertain hand-offs of a chat that the current user may resolve (`canResolve`). */\nfunction resolvableApprovalParts(conversation: Conversation): ApprovalPart[] {\n return conversation.messages\n .flatMap(message => message.parts)\n .filter((part): part is ApprovalPart => part.type === 'approval' && part.canResolve === true && part.status === 'execution-unknown');\n}\n\nfunction pendingApprovalParts(conversation: Conversation): ApprovalPart[] {\n const approvals = new Map<string, ApprovalPart>();\n for (const message of conversation.messages) {\n for (const part of message.parts) {\n if (part.type === 'approval' && part.status === 'pending') {\n approvals.set(part.approvalId, part);\n }\n }\n }\n if (conversation.pendingApproval?.status === 'pending') {\n approvals.set(conversation.pendingApproval.approvalId, conversation.pendingApproval);\n }\n return [...approvals.values()];\n}\n\n/**\n * Who decides an open proposal of an agent thread the caller may not decide, by the server's reason:\n * the person who consulted the agent, another approver for four-eyes, otherwise an approver.\n */\nfunction waitingForOf(reasonCode: string | null | undefined): NhAssistantApprovalWaitingFor {\n switch (reasonCode) {\n case askerDecidesCode:\n return 'asker';\n case fourEyesRequiredCode:\n return 'other-approver';\n default:\n return 'approver';\n }\n}\n\n/**\n * Shows the decision of an agent's proposal until the reloaded snapshot arrives: the approval's new\n * status, no open decision for it and, for the approval the conversation waited for, no pending one.\n */\nfunction applyProposalDecision(conversation: Conversation, approvalId: string, status: ApprovalStatus): Conversation {\n const messages = conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part => part.type === 'approval' && part.approvalId === approvalId ? { ...part, status } : part)\n }));\n const thread = conversation.thread\n ? { ...conversation.thread, decisions: conversation.thread.decisions.filter(item => item.approvalId !== approvalId) }\n : conversation.thread;\n const pendingApproval = conversation.pendingApproval?.approvalId === approvalId ? null : conversation.pendingApproval;\n return { ...conversation, messages, thread, pendingApproval };\n}\n\nfunction toSummary(conversation: Conversation): ConversationSummary {\n return {\n id: conversation.id,\n agentId: conversation.agentId,\n title: conversation.title,\n status: conversation.status,\n createdAt: conversation.createdAt,\n updatedAt: conversation.updatedAt,\n role: conversation.role,\n participantCount: conversation.members ? Math.max(0, conversation.members.length - 1) : conversation.participantCount,\n lastMessageSequence: conversation.lastMessageSequence,\n lastReadSequence: conversation.lastReadSequence,\n activeActorId: conversation.activeActorId\n };\n}\n\nfunction createClientMessageId(): string {\n const cryptoApi = globalThis.crypto;\n if (cryptoApi?.randomUUID) {\n return cryptoApi.randomUUID();\n }\n\n const bytes = new Uint8Array(16);\n if (cryptoApi?.getRandomValues) {\n cryptoApi.getRandomValues(bytes);\n } else {\n for (let index = 0; index < bytes.length; index++) {\n bytes[index] = Math.floor(Math.random() * 256);\n }\n }\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Injectable, Injector, Signal, afterNextRender, effect, inject, signal, untracked } from '@angular/core';\nimport { Subscription, firstValueFrom } from 'rxjs';\nimport { AgentThreadLookup } from '../models/assistant-agent-run.models';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantAgentRunApiService } from './nh-assistant-agent-run-api.service';\nimport { NhAssistantApiError, nhAssistantErrorMessageKey } from './nh-assistant-transport';\nimport { NhAssistantStore } from './nh-assistant.store';\n\n/** Drawer width on wider screens; below the mobile breakpoint the panel fills the screen. */\nexport const NH_ASSISTANT_PANEL_WIDTH = '420px';\nexport const NH_ASSISTANT_PANEL_MOBILE_QUERY = '(max-width: 599.98px)';\n\n/**\n * Opens and closes the assistant panel as a CDK overlay drawer on the right edge.\n * `nh-assistant-panel` registers its content once; any component can then open the panel,\n * optionally on a specific conversation. Escape closes the panel and focus returns to the\n * element that opened it.\n */\n@Injectable()\nexport class NhAssistantPanelService {\n private readonly overlay = inject(Overlay);\n private readonly store = inject(NhAssistantStore);\n private readonly agentRuns = inject(NhAssistantAgentRunApiService);\n private readonly injector = inject(Injector);\n private readonly document = inject(DOCUMENT);\n private readonly breakpoints = inject(BreakpointObserver);\n\n private readonly openState = signal(false);\n private overlayRef?: OverlayRef;\n private portal?: TemplatePortal;\n private subscriptions = new Subscription();\n private returnFocusTo: HTMLElement | null = null;\n\n readonly isOpen: Signal<boolean> = this.openState.asReadonly();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.dispose());\n effect(() => {\n if (this.store.enabled() && this.store.restorePanelOpen() && this.portal && !this.openState()) {\n untracked(() => queueMicrotask(() => {\n if (this.portal && this.store.enabled() && this.store.restorePanelOpen() && !this.openState()) {\n this.showPanel();\n }\n }));\n }\n });\n }\n\n open(conversationId?: string): void {\n if (this.openState() && !conversationId) {\n return;\n }\n\n this.showPanel();\n void this.store.initialize().then(() => this.store.reloadStatus()).then(() => {\n if (this.openState()) {\n this.store.setPanelOpen(true);\n }\n if (conversationId) {\n void this.store.openConversation(conversationId);\n }\n });\n }\n\n /**\n * Opens the panel on the conversation with an agent about a subject, for example the intake\n * reviewer about one project. The server returns the agent's thread about the subject and creates\n * it without starting a run when it is missing; people then type in the conversation, which runs\n * a turn. Creating needs the participant role, readers may open an existing thread.\n *\n * Resolves with the lookup once the panel opens the conversation. A failure, such as\n * `assistant-subject-access-denied`, rejects with `NhAssistantApiError` and leaves the panel as\n * it is, so the caller shows the localized `messageKey` where the person asked.\n */\n async openSubject(agentId: string, subject: { type: string; id: string }): Promise<AgentThreadLookup> {\n const lookup = await firstValueFrom(this.agentRuns.openThread(agentId, subject.type, subject.id));\n const conversationId = lookup.thread?.conversationId;\n if (!conversationId) {\n const code = NhAssistantClientErrorCodes.invalidResponse;\n throw new NhAssistantApiError(200, code, nhAssistantErrorMessageKey(code));\n }\n\n this.open(conversationId);\n return lookup;\n }\n\n private showPanel(): void {\n if (this.openState()) {\n return;\n }\n\n const active = this.document.activeElement;\n this.returnFocusTo = active instanceof HTMLElement ? active : null;\n this.openState.set(true);\n this.attach();\n }\n\n close(): void {\n if (!this.openState()) {\n return;\n }\n\n this.openState.set(false);\n this.store.setPanelOpen(false);\n this.overlayRef?.detach();\n\n const target = this.returnFocusTo;\n this.returnFocusTo = null;\n if (target?.isConnected) {\n target.focus();\n }\n }\n\n toggle(): void {\n if (this.openState()) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Called by `nh-assistant-panel`; hosts should place that component once instead. */\n registerPanel(portal: TemplatePortal): void {\n this.portal = portal;\n if (this.openState()) {\n this.attach();\n } else {\n void this.store.initialize().then(() => {\n if (this.portal === portal && this.store.enabled() && this.store.restorePanelOpen()) {\n this.showPanel();\n }\n });\n }\n }\n\n unregisterPanel(portal: TemplatePortal): void {\n if (this.portal !== portal) {\n return;\n }\n\n this.overlayRef?.detach();\n this.portal = undefined;\n }\n\n private attach(): void {\n if (!this.portal || this.overlayRef?.hasAttached()) {\n return;\n }\n\n const overlayRef = this.ensureOverlay();\n overlayRef.attach(this.portal);\n this.updateSize(this.breakpoints.isMatched(NH_ASSISTANT_PANEL_MOBILE_QUERY));\n\n afterNextRender(() => {\n const target = overlayRef.overlayElement.querySelector<HTMLElement>('[data-nh-assistant-autofocus]');\n target?.focus();\n }, { injector: this.injector });\n }\n\n private ensureOverlay(): OverlayRef {\n if (this.overlayRef) {\n return this.overlayRef;\n }\n\n const overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().top('0').right('0'),\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n hasBackdrop: false,\n panelClass: 'nh-assistant-overlay-pane',\n height: '100%',\n width: NH_ASSISTANT_PANEL_WIDTH,\n maxWidth: '100vw'\n });\n\n this.subscriptions.add(overlayRef.keydownEvents().subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n }\n }));\n this.subscriptions.add(this.breakpoints.observe(NH_ASSISTANT_PANEL_MOBILE_QUERY).subscribe(state => {\n this.updateSize(state.matches);\n }));\n\n this.overlayRef = overlayRef;\n return overlayRef;\n }\n\n private updateSize(mobile: boolean): void {\n this.overlayRef?.updateSize({ width: mobile ? '100vw' : NH_ASSISTANT_PANEL_WIDTH, height: '100%' });\n }\n\n private dispose(): void {\n this.subscriptions.unsubscribe();\n this.overlayRef?.dispose();\n this.overlayRef = undefined;\n }\n}\n","import { DestroyRef, inject } from '@angular/core';\nimport { debounceTime, filter, merge } from 'rxjs';\nimport { LiveAgentWorkChanged } from '../models/assistant-live.models';\nimport { NhAssistantLiveService } from '../services/nh-assistant-live.service';\n\n/** How long a view waits for more agent-work updates before it reloads once. */\nexport const NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS = 300;\n\n/**\n * Watches the work of agents for the whole application while the calling component lives, so their\n * proposals and runs arrive as live agent-work updates although the whole application lists no\n * members (see `NhAssistantLiveService.watchAgentWork`). Call it in an injection context, for example\n * a component constructor, of a screen that shows that work, such as the approval inbox or a board.\n */\nexport function nhAssistantWatchAgentWork(): void {\n const live = inject(NhAssistantLiveService, { optional: true });\n if (!live || typeof live.watchAgentWork !== 'function') {\n return;\n }\n\n const release = live.watchAgentWork();\n inject(DestroyRef).onDestroy(() => release());\n}\n\n/**\n * Calls `reload` once a burst of live agent-work updates that `matches` has settled, and after\n * every (re)connect of the hub, because updates sent while it was disconnected are lost. Without a\n * live service or a connected hub nothing arrives and the view keeps its manual refresh. Call it in\n * an injection context, for example a component constructor; it stops when that context ends.\n */\nexport function nhAssistantReloadOnAgentWork(\n matches: (change: LiveAgentWorkChanged) => boolean,\n reload: () => void\n): void {\n const live = inject(NhAssistantLiveService, { optional: true });\n if (!live) {\n return;\n }\n\n const subscription = merge(live.agentWork$.pipe(filter(matches)), live.resync$)\n .pipe(debounceTime(NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS))\n .subscribe(() => reload());\n inject(DestroyRef).onDestroy(() => subscription.unsubscribe());\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Injectable, PLATFORM_ID, effect, inject, untracked } from '@angular/core';\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs';\nimport { AgentSubjectSummary, NH_ASSISTANT_MAX_SUBJECT_SUMMARY } from '../models/assistant-agent-run.models';\nimport { LiveAgentWorkChanged } from '../models/assistant-live.models';\nimport { NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS } from '../internal/nh-assistant-agent-work';\nimport { NhAssistantAgentRunApiService } from './nh-assistant-agent-run-api.service';\nimport { NhAssistantLiveService } from './nh-assistant-live.service';\nimport { NhAssistantStore } from './nh-assistant.store';\n\n/** Summaries kept for subjects that nobody shows any more, so a list that re-renders needs no request. */\nconst maxUnwatchedSummaries = 500;\n\ninterface SummaryEntry {\n readonly subjectType: string;\n readonly subjectId: string;\n readonly value: BehaviorSubject<AgentSubjectSummary | null>;\n watchers: number;\n queued: boolean;\n loaded: boolean;\n failed: boolean;\n /** The request whose answer the entry takes; older answers are ignored. */\n request: number;\n}\n\n/**\n * Counts of agent work per subject for badges in lists and on pages. Every summary asked for in the\n * same tick becomes one `POST subjects/{type}/summary` per subject type, in chunks of\n * `NH_ASSISTANT_MAX_SUBJECT_SUMMARY`. Results are cached per subject and shared by everyone who\n * shows it. Live agent-work updates refetch only the subjects they name, batched; a reconnect of\n * the hub refetches every subject shown. Nothing is requested on the server or while the assistant\n * is disabled or denied, and the cache clears when it becomes unavailable, for example on sign-out.\n */\n@Injectable()\nexport class NhAssistantSubjectSummaryService {\n private readonly api = inject(NhAssistantAgentRunApiService);\n private readonly store = inject(NhAssistantStore);\n private readonly live = inject(NhAssistantLiveService, { optional: true });\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly entries = new Map<string, SummaryEntry>();\n /** Subject ids per type that wait for the next request. */\n private readonly queue = new Map<string, Set<string>>();\n /** Subjects named by live updates that wait for the end of the burst. */\n private readonly changed = new Set<string>();\n private requests = new Subscription();\n private readonly liveSubscription = new Subscription();\n private flushScheduled = false;\n private changedTimer?: ReturnType<typeof setTimeout>;\n private requestRevision = 0;\n private destroyed = false;\n\n constructor() {\n effect(() => {\n const enabled = this.store.enabled();\n untracked(() => this.onAvailabilityChanged(enabled));\n });\n\n if (this.live) {\n this.liveSubscription.add(this.live.agentWork$.subscribe(change => this.onAgentWork(change)));\n this.liveSubscription.add(this.live.resync$.subscribe(() => this.refetchShown()));\n }\n\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.liveSubscription.unsubscribe();\n this.requests.unsubscribe();\n clearTimeout(this.changedTimer);\n for (const entry of this.entries.values()) {\n entry.value.complete();\n }\n this.entries.clear();\n this.queue.clear();\n });\n }\n\n /**\n * The agent work on one subject: `null` until it is known, then every update. Subscribing shows\n * the subject; summaries of subjects that are shown stay current with live updates. The request\n * starts in the next microtask, together with every other summary asked for until then.\n */\n summary(subjectType: string, subjectId: string): Observable<AgentSubjectSummary | null> {\n return new Observable<AgentSubjectSummary | null>(subscriber => {\n const entry = this.watch(subjectType, subjectId);\n const subscription = entry.value.subscribe(subscriber);\n\n return () => {\n subscription.unsubscribe();\n this.unwatch(entry);\n };\n });\n }\n\n /**\n * Fetches the summaries of these subjects again, or of every subject of the type that is shown,\n * for example after the application changed them without an agent.\n */\n refresh(subjectType: string, subjectIds?: readonly string[]): void {\n const ids = subjectIds ? new Set(subjectIds) : null;\n for (const entry of [...this.entries.values()]) {\n if (entry.subjectType !== subjectType || (ids && !ids.has(entry.subjectId))) {\n continue;\n }\n\n if (entry.watchers > 0) {\n this.enqueue(entry);\n } else {\n this.forget(entry);\n }\n }\n }\n\n private watch(subjectType: string, subjectId: string): SummaryEntry {\n const key = summaryKey(subjectType, subjectId);\n let entry = this.entries.get(key);\n if (entry) {\n // The most recently shown summaries stay longest.\n this.entries.delete(key);\n } else {\n entry = {\n subjectType,\n subjectId,\n value: new BehaviorSubject<AgentSubjectSummary | null>(null),\n watchers: 0,\n queued: false,\n loaded: false,\n failed: false,\n request: 0\n };\n }\n\n this.entries.set(key, entry);\n entry.watchers++;\n if (!entry.loaded || entry.failed) {\n this.enqueue(entry);\n }\n if (this.browser) {\n void this.store.initialize();\n }\n return entry;\n }\n\n private unwatch(entry: SummaryEntry): void {\n entry.watchers = Math.max(0, entry.watchers - 1);\n if (entry.watchers > 0) {\n return;\n }\n\n let unwatched = 0;\n for (const item of this.entries.values()) {\n if (item.watchers === 0) {\n unwatched++;\n }\n }\n for (const item of [...this.entries.values()]) {\n if (unwatched <= maxUnwatchedSummaries) {\n break;\n }\n if (item.watchers === 0) {\n this.forget(item);\n unwatched--;\n }\n }\n }\n\n private isCurrent(entry: SummaryEntry): boolean {\n return this.entries.get(summaryKey(entry.subjectType, entry.subjectId)) === entry;\n }\n\n /** Drops a summary nobody shows; the next subscriber fetches it again. */\n private forget(entry: SummaryEntry): void {\n if (this.isCurrent(entry)) {\n this.entries.delete(summaryKey(entry.subjectType, entry.subjectId));\n }\n this.queue.get(entry.subjectType)?.delete(entry.subjectId);\n entry.value.complete();\n }\n\n private enqueue(entry: SummaryEntry): void {\n if (entry.queued) {\n return;\n }\n\n entry.queued = true;\n let ids = this.queue.get(entry.subjectType);\n if (!ids) {\n ids = new Set<string>();\n this.queue.set(entry.subjectType, ids);\n }\n ids.add(entry.subjectId);\n this.scheduleFlush();\n }\n\n private scheduleFlush(): void {\n if (this.flushScheduled) {\n return;\n }\n\n this.flushScheduled = true;\n queueMicrotask(() => {\n this.flushScheduled = false;\n this.flush();\n });\n }\n\n /** Sends the queued subjects: one request per type and chunk. Waits while the assistant is unavailable. */\n private flush(): void {\n if (this.destroyed || !this.browser || !this.store.enabled()) {\n return;\n }\n\n for (const [subjectType, ids] of [...this.queue]) {\n this.queue.delete(subjectType);\n const subjectIds = [...ids];\n for (let start = 0; start < subjectIds.length; start += NH_ASSISTANT_MAX_SUBJECT_SUMMARY) {\n this.send(subjectType, subjectIds.slice(start, start + NH_ASSISTANT_MAX_SUBJECT_SUMMARY));\n }\n }\n }\n\n private send(subjectType: string, subjectIds: string[]): void {\n const revision = ++this.requestRevision;\n const entries: SummaryEntry[] = [];\n for (const subjectId of subjectIds) {\n const entry = this.entries.get(summaryKey(subjectType, subjectId));\n if (entry) {\n entry.queued = false;\n entry.request = revision;\n entries.push(entry);\n }\n }\n if (entries.length === 0) {\n return;\n }\n\n const subscription = this.api.summarizeSubjects(subjectType, entries.map(entry => entry.subjectId)).subscribe({\n next: list => {\n const items = new Map(list.items.map(item => [item.subjectId, item]));\n for (const entry of entries) {\n if (entry.request !== revision || !this.isCurrent(entry)) {\n continue;\n }\n\n entry.loaded = true;\n entry.failed = false;\n entry.value.next(items.get(entry.subjectId) ?? emptySummary(entry.subjectId));\n }\n },\n error: () => {\n // A badge without a count is better than an error in a list; the next live update,\n // reconnect or subscriber tries again.\n for (const entry of entries) {\n if (entry.request === revision) {\n entry.failed = true;\n }\n }\n }\n });\n this.requests.add(subscription);\n }\n\n private onAgentWork(change: LiveAgentWorkChanged): void {\n if (!change.subjectType || !change.subjectId) {\n return;\n }\n\n const key = summaryKey(change.subjectType, change.subjectId);\n const entry = this.entries.get(key);\n if (!entry) {\n return;\n }\n if (entry.watchers === 0) {\n this.forget(entry);\n return;\n }\n\n this.changed.add(key);\n if (this.changedTimer === undefined) {\n this.changedTimer = setTimeout(() => this.refetchChanged(), NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS);\n }\n }\n\n /** Refetches the shown subjects of a burst of live updates, together. */\n private refetchChanged(): void {\n this.changedTimer = undefined;\n const keys = [...this.changed];\n this.changed.clear();\n for (const key of keys) {\n const entry = this.entries.get(key);\n if (entry && entry.watchers > 0) {\n this.enqueue(entry);\n }\n }\n }\n\n /** After a reconnect updates may have been missed: refetch what is shown, forget the rest. */\n private refetchShown(): void {\n for (const entry of [...this.entries.values()]) {\n if (entry.watchers > 0) {\n this.enqueue(entry);\n } else {\n this.forget(entry);\n }\n }\n }\n\n private onAvailabilityChanged(enabled: boolean): void {\n if (enabled) {\n for (const entry of this.entries.values()) {\n if (entry.watchers > 0 && (!entry.loaded || entry.failed)) {\n this.enqueue(entry);\n }\n }\n this.scheduleFlush();\n return;\n }\n\n // Signed out, denied or disabled: no counts of a previous account may remain.\n this.requests.unsubscribe();\n this.requests = new Subscription();\n clearTimeout(this.changedTimer);\n this.changedTimer = undefined;\n this.changed.clear();\n this.queue.clear();\n for (const entry of [...this.entries.values()]) {\n if (entry.watchers === 0) {\n this.forget(entry);\n continue;\n }\n\n entry.queued = false;\n entry.loaded = false;\n entry.failed = false;\n entry.request = 0;\n if (entry.value.value !== null) {\n entry.value.next(null);\n }\n }\n }\n}\n\nfunction summaryKey(subjectType: string, subjectId: string): string {\n return `${subjectType}\\u0000${subjectId}`;\n}\n\nfunction emptySummary(subjectId: string): AgentSubjectSummary {\n return { subjectId, openProposals: 0, proposalsToDecide: 0, runActive: false };\n}\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';\nimport { NhAssistantTranslationMerger } from './i18n/nh-assistant-translations';\nimport {\n NH_ASSISTANT_ACCESS_POLICY,\n NH_ASSISTANT_CONFIG,\n NhAssistantAllowAllAccessPolicy,\n NhAssistantConfig\n} from './nh-assistant.config';\nimport { NhAssistantAdminApiService } from './services/nh-assistant-admin-api.service';\nimport { NhAssistantAgentRunApiService } from './services/nh-assistant-agent-run-api.service';\nimport { NhAssistantApiService } from './services/nh-assistant-api.service';\nimport { NhAssistantLiveService } from './services/nh-assistant-live.service';\nimport { NhAssistantMcpConnectService } from './services/nh-assistant-mcp-connect.service';\nimport { NhAssistantPushService } from './services/nh-assistant-push.service';\nimport { NhAssistantPanelService } from './services/nh-assistant-panel.service';\nimport { NhAssistantStore } from './services/nh-assistant.store';\nimport { NhAssistantSubjectSummaryService } from './services/nh-assistant-subject-summary.service';\nimport { NhAssistantUiState } from './services/nh-assistant-ui-state';\nimport { NhAssistantTransport } from './services/nh-assistant-transport';\n\n/**\n * Registers the assistant client, store and panel for one application or route scope.\n * Call it once in the root providers; a route may call it again to host an isolated\n * assistant with its own configuration.\n */\nexport function provideNhAssistant(config: NhAssistantConfig): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: NH_ASSISTANT_CONFIG, useValue: config },\n { provide: NH_ASSISTANT_ACCESS_POLICY, useClass: config.accessPolicy ?? NhAssistantAllowAllAccessPolicy },\n NhAssistantTransport,\n NhAssistantApiService,\n NhAssistantAdminApiService,\n NhAssistantAgentRunApiService,\n NhAssistantLiveService,\n NhAssistantPushService,\n NhAssistantStore,\n NhAssistantUiState,\n NhAssistantPanelService,\n NhAssistantSubjectSummaryService,\n NhAssistantMcpConnectService,\n // A redirect-mode MCP authorization returns to the page with its outcome in the fragment. Every\n // outcome, a failure to complete it included, arrives in `NhAssistantMcpConnectService.returned`,\n // where the connection screens show it.\n ...(config.mcpConnectMode === 'redirect'\n ? [provideEnvironmentInitializer(() => {\n inject(NhAssistantMcpConnectService).completeReturn().subscribe();\n })]\n : []),\n ...(config.translations === 'host'\n ? []\n : [provideEnvironmentInitializer(() => inject(NhAssistantTranslationMerger).start())])\n ]);\n}\n","import { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\n\n/**\n * Failure codes the assistant back-end sends in error bodies, SSE `error` events and tool\n * result codes (`NhAssistantErrorCodes`, `NhAssistantAdminErrorCodes` and the runtime codes\n * of `NewHeap.Platform.AI.Chat`). Every code needs a text under `nh-assistant.errors.<code>`\n * in each bundled language; the translation tests enforce that.\n */\nexport const NH_ASSISTANT_SERVER_ERROR_CODES: readonly string[] = [\n // Chat endpoints and turns\n 'assistant-disabled',\n 'assistant-conversation-not-found',\n 'assistant-conversation-busy',\n 'assistant-agent-not-found',\n 'assistant-agent-forbidden',\n 'assistant-message-invalid',\n 'assistant-message-too-long',\n 'assistant-message-duplicate',\n 'assistant-title-invalid',\n 'assistant-approval-not-found',\n 'assistant-approval-not-pending',\n 'assistant-approval-decision-invalid',\n 'assistant-proposal-hash-mismatch',\n 'assistant-approval-expired',\n 'assistant-approval-invalid',\n 'assistant-approval-rejected',\n 'assistant-budget-exhausted',\n 'assistant-tool-call-limit-reached',\n 'assistant-tools-disabled',\n 'assistant-turn-timeout',\n 'assistant-model-unavailable',\n 'assistant-classification-not-permitted',\n 'assistant-model-region-denied',\n 'assistant-files-unavailable',\n 'assistant-files-not-accepted',\n 'assistant-file-reference-invalid',\n 'assistant-file-not-found',\n 'assistant-file-forbidden',\n 'assistant-file-unavailable',\n 'assistant-file-reader-failed',\n 'assistant-file-too-large',\n 'assistant-file-too-many-pages',\n 'assistant-file-count-limit',\n 'assistant-file-token-limit',\n 'assistant-file-type-not-supported',\n 'assistant-file-upload-invalid',\n 'assistant-file-type-not-accepted',\n 'assistant-file-upload-refused',\n 'assistant-file-upload-failed',\n 'assistant-file-scan-refused',\n 'assistant-turn-failed',\n 'assistant-context-unavailable',\n 'assistant-actor-mismatch',\n // Sharing and notifications\n 'assistant-owner-required',\n 'assistant-approval-forbidden',\n 'assistant-turn-forbidden',\n 'assistant-share-link-invalid',\n 'assistant-participant-not-found',\n 'assistant-participant-limit-reached',\n 'assistant-directory-unavailable',\n 'assistant-push-unavailable',\n 'assistant-push-subscription-invalid',\n // Agent runs\n 'assistant-subject-not-found',\n 'assistant-subject-invalid',\n 'assistant-subject-type-unknown',\n 'assistant-subject-search-unavailable',\n 'assistant-agent-does-not-work-on',\n 'assistant-subject-access-denied',\n 'assistant-no-accountable-owner',\n 'assistant-agent-disabled',\n 'assistant-agent-stopped',\n 'assistant-agent-paused',\n 'assistant-agent-configured-off',\n 'assistant-run-token-limit',\n 'assistant-skill-stopped',\n 'assistant-skill-paused',\n 'assistant-agent-off',\n 'assistant-skill-off',\n 'assistant-skill-not-found',\n 'assistant-skill-not-available',\n 'assistant-skill-switch-limit',\n 'assistant-moved-to-shadow',\n 'assistant-shadow-variant',\n 'assistant-not-shadow-variant',\n 'assistant-service-account-not-used',\n 'assistant-service-account-not-found',\n 'assistant-skill-in-code',\n 'assistant-trigger-in-code',\n 'assistant-trigger-filter-not-found',\n 'assistant-skill-in-use',\n 'assistant-configuration-limit',\n 'assistant-run-settings-in-code',\n 'assistant-run-settings-in-use',\n 'assistant-skill-candidate-not-found',\n 'assistant-trigger-candidate-not-found',\n 'assistant-skill-version-gone',\n 'assistant-account-search-unavailable',\n 'assistant-handoff-unavailable',\n 'assistant-handoff-not-accepted',\n 'assistant-handoff-subject-unavailable',\n 'assistant-handoff-shadow-to-live',\n 'assistant-handoff-chain-limit',\n 'assistant-handoff-limit-reached',\n 'assistant-replay-not-shadow',\n 'assistant-replay-active',\n 'assistant-evaluation-not-variant',\n 'assistant-agent-not-configured',\n 'assistant-run-not-found',\n 'assistant-run-not-retryable',\n 'assistant-run-filter-invalid',\n 'assistant-run-operation-cancelled',\n 'assistant-run-operation-stalled',\n 'assistant-run-operation-ended',\n 'assistant-board-not-found',\n 'assistant-board-scope-invalid',\n 'assistant-approval-policy-denied',\n 'assistant-four-eyes-required',\n 'assistant-execution-not-uncertain',\n 'assistant-proposal-stale',\n 'assistant-proposal-check-failed',\n 'assistant-proposal-already-open',\n 'assistant-proposal-recently-rejected',\n 'assistant-proposal-superseded',\n 'assistant-proposal-refused',\n 'assistant-proposal-placed',\n 'assistant-proposal-not-placed',\n 'assistant-proposal-not-needed',\n 'assistant-trigger-not-found',\n 'assistant-trigger-rate-limited',\n 'assistant-trigger-rolled-back',\n 'assistant-webhook-signature-invalid',\n 'assistant-webhook-payload-invalid',\n 'assistant-webhook-payload-too-large',\n 'assistant-memory-not-configured',\n 'assistant-memory-invalid',\n 'assistant-memory-conflict',\n 'assistant-artifact-invalid',\n 'assistant-artifact-outside-turn',\n 'assistant-artifact-not-found',\n // Feedback on proposals\n 'assistant-feedback-invalid',\n 'assistant-feedback-not-accepted',\n // Questions an agent asks with ask_question in a person's chat\n 'assistant-question-invalid',\n 'assistant-question-not-found',\n 'assistant-question-not-pending',\n 'assistant-question-forbidden',\n 'assistant-question-expired',\n 'assistant-question-cancelled',\n 'assistant-question-answer-invalid',\n // Consultations of other agents\n 'assistant-consult-subject-unavailable',\n 'assistant-consult-agent-unavailable',\n 'assistant-consult-depth-exceeded',\n 'assistant-consult-budget-exhausted',\n 'assistant-consult-limit-reached',\n 'assistant-consult-turn-limit',\n 'assistant-consult-timeout',\n 'assistant-consult-failed',\n 'assistant-consult-read-only',\n 'assistant-consult-tool-not-selected',\n 'assistant-consult-proposal-refused',\n 'assistant-consult-asker-decides',\n 'assistant-consult-route-not-allowed',\n 'assistant-consult-proposal-moved',\n // Consultations defined as data in the administration\n 'assistant-consultation-in-code',\n 'assistant-consultation-not-found',\n 'assistant-consultations-not-allowed',\n // Hand-offs defined as data and shadow variants created in the administration\n 'assistant-handoffs-not-allowed',\n 'assistant-handoff-in-code',\n 'assistant-handoff-not-found',\n 'assistant-shadow-variants-not-allowed',\n // Agent packages: their format and the parts they lock\n 'assistant-package-format-unsupported',\n 'assistant-package-too-large',\n 'assistant-package-refused',\n 'assistant-package-locked',\n 'assistant-package-not-linked',\n // Preferences and administration\n 'assistant-validation',\n 'assistant-instructions-too-long',\n 'assistant-forbidden',\n 'assistant-not-found',\n 'assistant-context-not-found',\n 'assistant-version-conflict',\n 'assistant-agent-exists',\n 'assistant-code-agent-not-deletable',\n 'assistant-agent-not-code',\n // Agent metadata registered by the application\n 'assistant-metadata-entry-not-found',\n 'assistant-metadata-read-only',\n // Instructions from the application's text assets\n 'assistant-instructions-asset-not-found',\n 'assistant-instructions-asset-unavailable',\n 'assistant-agent-instructions-unavailable',\n 'assistant-mcp-server-not-found',\n 'assistant-mcp-server-exists',\n 'assistant-mcp-tool-not-found',\n 'assistant-mcp-unreachable',\n 'assistant-mcp-unauthorized',\n 'assistant-mcp-host-blocked',\n 'assistant-mcp-schema-changed',\n 'assistant-mcp-tool-disabled',\n 'assistant-mcp-insufficient-scope',\n 'assistant-mcp-headless-not-allowed',\n 'assistant-mcp-credential-mismatch',\n 'assistant-mcp-consent-required',\n 'assistant-mcp-initiator-only',\n 'assistant-mcp-delegated-token-unavailable',\n 'assistant-mcp-secret-reference-invalid',\n 'assistant-mcp-certificate-reference-invalid',\n 'assistant-mcp-secret-unreadable',\n 'assistant-mcp-secret-unavailable',\n // MCP OAuth connections\n 'assistant-mcp-connection-required',\n 'assistant-mcp-reauthorization-required',\n 'assistant-mcp-scope-not-allowed',\n 'assistant-mcp-authorization-failed',\n 'assistant-mcp-authorization-expired',\n 'assistant-mcp-authorization-invalid',\n 'assistant-mcp-discovery-failed',\n 'assistant-mcp-pkce-unsupported',\n 'assistant-mcp-client-registration-required',\n 'assistant-mcp-token-request-failed',\n 'assistant-mcp-issuer-changed',\n 'assistant-mcp-authorization-not-confirmed',\n 'assistant-mcp-oauth-not-configured',\n 'assistant-mcp-too-many-authorizations',\n 'assistant-mcp-connection-not-supported'\n];\n\n/** Every code the assistant UI can show: server codes and client-side transport codes. */\nexport const NH_ASSISTANT_ERROR_CODES: readonly string[] = [\n ...new Set([...NH_ASSISTANT_SERVER_ERROR_CODES, ...Object.values(NhAssistantClientErrorCodes)])\n];\n","/** Fragment the panel reads to join a shared conversation: `#nh-assistant-join=<id>.<token>`. */\nexport const NH_ASSISTANT_JOIN_FRAGMENT = 'nh-assistant-join';\n\n/** Fragment a clicked notification opens: `#nh-assistant-conversation=<id>`. */\nexport const NH_ASSISTANT_CONVERSATION_FRAGMENT = 'nh-assistant-conversation';\n\n/**\n * Fragment a clicked notification about the proposals of a run opens:\n * `#nh-assistant-run=<runId>.<conversationId>`. The run goes to `NhAssistantPushService.openRun$`\n * while the application subscribes; otherwise the panel opens the conversation.\n */\nexport const NH_ASSISTANT_RUN_FRAGMENT = 'nh-assistant-run';\n\n/** Builds the default invitation link: the current page with the join fragment. */\nexport function nhAssistantShareLink(conversationId: string, token: string): string {\n const location = globalThis.location;\n const page = location ? `${location.origin}${location.pathname}${location.search}` : '';\n return `${page}#${NH_ASSISTANT_JOIN_FRAGMENT}=${encodeURIComponent(conversationId)}.${encodeURIComponent(token)}`;\n}\n","import { ChangeDetectionStrategy, Component, InjectionToken, computed, inject, input } from '@angular/core';\n\nexport type NhAssistantIconName =\n | 'assistant'\n | 'close'\n | 'send'\n | 'stop'\n | 'plus'\n | 'list'\n | 'trash'\n | 'tool'\n | 'check'\n | 'x'\n | 'warning'\n | 'chevron-down'\n | 'clock'\n | 'settings'\n | 'admin'\n | 'edit'\n | 'refresh'\n | 'link'\n | 'page'\n | 'users'\n | 'copy'\n | 'bell'\n | 'leave'\n | 'attach'\n | 'file'\n | 'lock';\n\n/**\n * Optional icon classes of the host's icon library, for example `{ close: 'ph ph-x' }`.\n * Icons without a class use the library's small built-in outline glyphs.\n */\nexport const NH_ASSISTANT_ICONS = new InjectionToken<Partial<Record<NhAssistantIconName, string>>>('NH_ASSISTANT_ICONS');\n\nconst builtInPaths: Record<NhAssistantIconName, string> = {\n assistant: 'M12 3l1.8 4.7 4.7 1.8-4.7 1.8L12 16l-1.8-4.7-4.7-1.8 4.7-1.8zM18.5 15l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z',\n close: 'M6 6l12 12M18 6L6 18',\n send: 'M4 12l16-8-6 16-2.5-6.5zM11.5 13.5L20 4',\n stop: 'M7 7h10v10H7z',\n plus: 'M12 5v14M5 12h14',\n list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',\n trash: 'M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3',\n tool: 'M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17l3 3 5.3-5.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.1-.4-.4-2.1z',\n check: 'M5 12.5l4.5 4.5L19 7.5',\n x: 'M7 7l10 10M17 7L7 17',\n warning: 'M12 4L2.5 20h19zM12 10v4M12 17h.01',\n 'chevron-down': 'M6 9l6 6 6-6',\n clock: 'M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18zM12 7v5l3 2',\n settings: 'M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4',\n admin: 'M12 3l7 3v5c0 4.5-3 8.2-7 10-4-1.8-7-5.5-7-10V6zM9.5 12l2 2 3.5-3.5',\n edit: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4',\n refresh: 'M20 11a8 8 0 0 0-14.3-4.9L4 8M4 4v4h4M4 13a8 8 0 0 0 14.3 4.9L20 16M20 20v-4h-4',\n link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',\n page: 'M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 16h6',\n users: 'M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 1 0 0 7zM3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14.5c1.8.9 3 2.8 3 5',\n copy: 'M9 9h11v11H9zM5 15H4V4h11v1',\n bell: 'M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0',\n leave: 'M10 4H5v16h5M14 8l4 4-4 4M18 12H9',\n attach: 'M19 11.5l-7.6 7.6a4.6 4.6 0 0 1-6.5-6.5l8.3-8.3a3 3 0 0 1 4.3 4.3l-8.2 8.2a1.5 1.5 0 0 1-2.1-2.1l7.4-7.4',\n file: 'M6 3h8l4 4v14H6zM14 3v4h4',\n lock: 'M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 0 1 7 0v3M12 15v2'\n};\n\n/** Decorative icon. The surrounding control provides the accessible name. */\n@Component({\n selector: 'nh-assistant-icon',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (iconClass(); as iconClass) {\n <i [class]=\"iconClass\" aria-hidden=\"true\"></i>\n } @else {\n <svg viewBox=\"0 0 24 24\" width=\"1em\" height=\"1em\" aria-hidden=\"true\" focusable=\"false\">\n <path [attr.d]=\"path()\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n }\n `,\n styles: [`\n :host { display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-size: 1.15em; }\n svg { display: block; }\n `]\n})\nexport class NhAssistantIconComponent {\n private readonly icons = inject(NH_ASSISTANT_ICONS, { optional: true });\n\n readonly name = input.required<NhAssistantIconName>();\n readonly iconClass = computed(() => this.icons?.[this.name()] ?? null);\n readonly path = computed(() => builtInPaths[this.name()]);\n}\n","import { ChangeDetectionStrategy, Component, afterNextRender, computed, effect, inject, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantPanelService } from '../../services/nh-assistant-panel.service';\nimport { NhAssistantStore } from '../../services/nh-assistant.store';\n\n/**\n * Header button that opens the assistant panel. It renders nothing while the assistant is\n * disabled on the server or the access policy denies the user. One small badge shows what needs\n * attention, in this order: an approval that waits, the number of unread conversations, or a\n * turn that runs. Projected content replaces the default icon.\n */\n@Component({\n selector: 'nh-assistant-launcher',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (store.enabled()) {\n <button\n class=\"launcher\"\n type=\"button\"\n [class.open]=\"panel.isOpen()\"\n [attr.aria-expanded]=\"panel.isOpen()\"\n [attr.aria-label]=\"label() | translate\"\n [attr.title]=\"label() | translate\"\n (click)=\"panel.toggle()\">\n <ng-content><nh-assistant-icon name=\"assistant\" /></ng-content>\n @switch (badge()) {\n @case ('waiting') {\n <span class=\"badge\" data-state=\"waiting\" aria-hidden=\"true\"></span>\n }\n @case ('unread') {\n <span class=\"badge count\" data-state=\"unread\" aria-hidden=\"true\">{{ unreadLabel() }}</span>\n }\n @case ('running') {\n <span class=\"badge\" data-state=\"running\" aria-hidden=\"true\"></span>\n }\n }\n @if (waitingForApproval()) {\n <span class=\"visually-hidden\">{{ 'nh-assistant.launcher.pending-approval' | translate }}</span>\n }\n @if (store.unreadCount() > 0) {\n <span class=\"visually-hidden\">{{ 'nh-assistant.launcher.unread' | translate: { count: store.unreadCount() } }}</span>\n }\n @if (store.runningCount() > 0) {\n <span class=\"visually-hidden\">{{ 'nh-assistant.launcher.running' | translate: { count: store.runningCount() } }}</span>\n }\n </button>\n }\n `,\n styleUrl: './nh-assistant-launcher.component.scss'\n})\nexport class NhAssistantLauncherComponent {\n readonly store = inject(NhAssistantStore);\n readonly panel = inject(NhAssistantPanelService);\n\n readonly waitingForApproval = computed(() =>\n this.store.pendingApproval() !== null ||\n this.store.conversations().some(conversation => conversation.status === 'waiting-for-approval')\n );\n readonly badge = computed<'waiting' | 'unread' | 'running' | null>(() => {\n if (this.waitingForApproval()) {\n return 'waiting';\n }\n if (this.store.unreadCount() > 0) {\n return 'unread';\n }\n return this.store.runningCount() > 0 || this.store.streaming() ? 'running' : null;\n });\n readonly unreadLabel = computed(() => this.store.unreadCount() > 9 ? '9+' : String(this.store.unreadCount()));\n readonly label = computed(() => this.panel.isOpen() ? 'nh-assistant.launcher.close' : 'nh-assistant.launcher.open');\n\n constructor() {\n // Browser only: the status request and access policy need the signed-in user.\n afterNextRender(() => {\n void this.store.initialize();\n });\n\n effect(() => {\n if (this.store.enabled()) {\n untracked(() => void this.store.refreshConversations());\n }\n });\n }\n}\n","import { ChangeDetectorRef, DestroyRef, Pipe, PipeTransform, inject } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { merge } from 'rxjs';\n\n/**\n * Translates the first key that has a translation and otherwise returns the fallback text.\n * Used for server-provided keys (agent names, error message keys, result codes) that the\n * host may or may not translate.\n */\n@Pipe({ name: 'nhAssistantTranslate', standalone: true, pure: false })\nexport class NhAssistantTranslatePipe implements PipeTransform {\n private readonly translate = inject(TranslateService);\n private lastKeys = '';\n private lastParams = '';\n private lastValue = '';\n private dirty = true;\n\n constructor() {\n const changeDetector = inject(ChangeDetectorRef);\n const subscription = merge(this.translate.onTranslationChange, this.translate.onLangChange).subscribe(() => {\n this.dirty = true;\n changeDetector.markForCheck();\n });\n inject(DestroyRef).onDestroy(() => subscription.unsubscribe());\n }\n\n transform(keys: string | readonly (string | null | undefined)[], fallback = '', params?: Record<string, unknown>): string {\n const candidates = (Array.isArray(keys) ? keys : [keys]).filter((key): key is string => !!key);\n const keySignature = candidates.join('|');\n const paramSignature = params ? JSON.stringify(params) : '';\n if (!this.dirty && keySignature === this.lastKeys && paramSignature === this.lastParams) {\n return this.lastValue;\n }\n\n this.lastKeys = keySignature;\n this.lastParams = paramSignature;\n this.dirty = false;\n this.lastValue = this.resolve(candidates, fallback, params);\n return this.lastValue;\n }\n\n private resolve(candidates: string[], fallback: string, params?: Record<string, unknown>): string {\n for (const key of candidates) {\n const value = this.translate.instant(key, params);\n if (typeof value === 'string' && value.length > 0 && value !== key) {\n return value;\n }\n }\n\n return fallback;\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantActivity } from '../../services/nh-assistant.store';\n\n/**\n * One slim row of the other conversations that need attention: a running turn, an approval that\n * waits, or an unread answer. It renders nothing when there are none, so it costs no space in the\n * usual case. Selecting a chip opens that conversation; its turn keeps running meanwhile.\n */\n@Component({\n selector: 'nh-assistant-activity',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (others().length > 0) {\n <nav class=\"strip\" [attr.aria-label]=\"'nh-assistant.activity.label' | translate\">\n @for (item of others(); track item.id) {\n <button\n class=\"chip\"\n type=\"button\"\n [attr.data-state]=\"state(item)\"\n [attr.title]=\"(item.title || ('nh-assistant.conversation-list.untitled' | translate)) + ' — ' + ('nh-assistant.activity.' + state(item) | translate)\"\n (click)=\"conversationSelect.emit(item.id)\">\n <span class=\"indicator\" aria-hidden=\"true\"></span>\n <span class=\"title\">{{ item.title || ('nh-assistant.conversation-list.untitled' | translate) }}</span>\n @if (item.shared) {\n <nh-assistant-icon class=\"shared\" name=\"users\" />\n }\n <span class=\"visually-hidden\">{{ 'nh-assistant.activity.' + state(item) | translate }}</span>\n </button>\n }\n </nav>\n }\n `,\n styleUrl: './nh-assistant-activity.component.scss'\n})\nexport class NhAssistantActivityComponent {\n readonly items = input.required<readonly NhAssistantActivity[]>();\n readonly conversationSelect = output<string>();\n\n /** The open conversation already shows its own state. */\n readonly others = computed(() => this.items().filter(item => !item.active));\n\n state(item: NhAssistantActivity): 'running' | 'waiting' | 'unread' {\n if (item.status === 'running') {\n return 'running';\n }\n return item.status === 'waiting-for-approval' ? 'waiting' : 'unread';\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { AgentSummary } from '../../models/assistant-api.models';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\n\nlet nextId = 0;\n\n/**\n * Chooses the agent for new conversations. Agent names come from the host's translation\n * keys; agents created by an administrator carry literal text, which is shown as is.\n */\n@Component({\n selector: 'nh-assistant-agent-picker',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { '[class.compact]': 'compact()' },\n template: `\n <label class=\"visually-hidden\" [for]=\"selectId\">{{ 'nh-assistant.agent-picker.label' | translate }}</label>\n <select\n [id]=\"selectId\"\n [disabled]=\"disabled() || agents().length < 2\"\n [attr.aria-describedby]=\"selected() ? selectId + '-capability' : null\"\n [attr.title]=\"selected() ? (([selected()!.descriptionKey] | nhAssistantTranslate: selected()!.descriptionKey) + (compact() ? ' · ' + ((selected()!.canMutate ? 'nh-assistant.agent-picker.can-mutate' : 'nh-assistant.agent-picker.read-only') | translate) : '')) : null\"\n (change)=\"onChange($event)\">\n @for (agent of agents(); track agent.id) {\n <option [value]=\"agent.id\" [selected]=\"agent.id === selectedAgentId()\">\n {{ [agent.displayNameKey] | nhAssistantTranslate: agent.displayNameKey }}\n </option>\n }\n </select>\n @if (selected(); as agent) {\n <span class=\"capability\" [id]=\"selectId + '-capability'\" [class.visually-hidden]=\"compact()\" [attr.data-can-mutate]=\"agent.canMutate\">\n {{ (agent.canMutate ? 'nh-assistant.agent-picker.can-mutate' : 'nh-assistant.agent-picker.read-only') | translate }}\n </span>\n }\n `,\n styleUrl: './nh-assistant-agent-picker.component.scss'\n})\nexport class NhAssistantAgentPickerComponent {\n readonly agents = input.required<readonly AgentSummary[]>();\n readonly selectedAgentId = input<string | null>(null);\n readonly disabled = input(false);\n /** Compact prompt-bar control; capability information remains in the tooltip and accessible description. */\n readonly compact = input(false);\n readonly agentChange = output<string>();\n\n readonly selectId = `nh-assistant-agent-picker-${nextId++}`;\n readonly selected = computed(() => this.agents().find(agent => agent.id === this.selectedAgentId()) ?? null);\n\n onChange(event: Event): void {\n this.agentChange.emit((event.target as HTMLSelectElement).value);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe, TranslateService } from '@ngx-translate/core';\nimport { AgentUploads } from '../../models/assistant-api.models';\nimport {\n nhAssistantAcceptAttribute,\n nhAssistantFileTypeLabel,\n nhAssistantFormatFileSize\n} from '../../internal/nh-assistant-files';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport type { NhAssistantAttachment } from '../../services/nh-assistant.store';\n\nlet nextId = 0;\n\n/**\n * Message input. Enter sends when sending is available; Shift+Enter inserts a new line.\n * Drafting remains available while the assistant runs or waits for approval. With `uploads`, an\n * attach button chooses files for the next message; the host uploads them and passes them back as\n * `attachments`, which show their progress, or why they cannot be attached, at the control. Sending\n * waits while a file uploads.\n */\n@Component({\n selector: 'nh-assistant-composer',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent, NhAssistantTranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-composer.component.html',\n styleUrl: './nh-assistant-composer.component.scss'\n})\nexport class NhAssistantComposerComponent {\n /** Disables the editor only when the conversation itself cannot accept a draft. */\n readonly disabled = input(false);\n /** Blocks sending without disabling the editor or clearing its draft. */\n readonly sendDisabled = input(false);\n /** Shows the stop button instead of the send button. */\n readonly busy = input(false);\n /** Keeps the send action available next to Stop so the host can queue messages. */\n readonly queueWhileBusy = input(false);\n /**\n * Announces why sending is temporarily unavailable: a running turn, a turn that waits for an\n * approval, or one that waits for the answer to a question the agent asked.\n */\n readonly status = input<'running' | 'waiting-for-approval' | 'waiting-for-answer' | null>(null);\n /** Name of the participant whose turn runs or waits, or who answers the question, when it is someone else. */\n readonly statusActor = input<string | null>(null);\n /** False when the user may not stop the running turn, such as another participant's turn. */\n readonly canStop = input(true);\n readonly maxLength = input<number | null>(null);\n /** Text to put back into the input, for example a message the server did not accept. */\n readonly restore = input<string | null>(null);\n /**\n * What the person may attach, for example `NhAssistantStore.uploads()`; `null` hides the attach\n * button.\n */\n readonly uploads = input<AgentUploads | null>(null);\n /** The attachments of the next message, for example `NhAssistantStore.attachments()`. */\n readonly attachments = input<readonly NhAssistantAttachment[]>([]);\n\n readonly send = output<string>();\n readonly cancel = output<void>();\n readonly restored = output<void>();\n /** Files the person chose to attach, for example for `NhAssistantStore.attach`. */\n readonly attach = output<File[]>();\n /** The id of an attachment the person removed, for example for `NhAssistantStore.removeAttachment`. */\n readonly removeAttachment = output<string>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly textarea = viewChild.required<ElementRef<HTMLTextAreaElement>>('textarea');\n private readonly attachButton = viewChild<ElementRef<HTMLButtonElement>>('attachButton');\n private ownedFocus = false;\n private previousBusy = false;\n\n readonly inputId = `nh-assistant-composer-${nextId++}`;\n readonly hintId = `${this.inputId}-hint`;\n readonly attachHintId = `${this.inputId}-attach-hint`;\n readonly attachmentsId = `${this.inputId}-attachments`;\n readonly text = signal('');\n readonly length = computed(() => this.text().trim().length);\n readonly tooLong = computed(() => {\n const max = this.maxLength();\n return max !== null && this.length() > max;\n });\n readonly showCounter = computed(() => {\n const max = this.maxLength();\n return max !== null && this.length() >= max * 0.8;\n });\n /** True while a file of the next message still uploads. */\n readonly uploading = computed(() => this.attachments().some(attachment => attachment.state === 'uploading'));\n readonly canSend = computed(() =>\n !this.disabled() && !this.sendDisabled() && this.length() > 0 && !this.tooLong() && !this.uploading());\n /** The `accept` attribute of the file input, with the extensions the application mapped. */\n readonly accept = computed(() => {\n const uploads = this.uploads();\n return nhAssistantAcceptAttribute(uploads?.acceptedMediaTypes ?? [], uploads?.mappedExtensions);\n });\n /** The values the attachment texts name: the accepted types, the largest size and the most files. */\n readonly uploadParams = computed(() => {\n const uploads = this.uploads();\n return {\n types: (uploads?.acceptedMediaTypes ?? []).map(nhAssistantFileTypeLabel).join(', '),\n max: uploads ? this.size(uploads.maxFileBytes) : '',\n count: uploads?.maxFiles ?? 0\n };\n });\n\n constructor() {\n effect(() => {\n const draft = this.restore();\n if (draft !== null) {\n untracked(() => {\n this.text.set(draft);\n this.restored.emit();\n });\n }\n });\n\n effect(() => {\n const busy = this.busy();\n if (this.previousBusy && !busy) {\n queueMicrotask(() => this.restoreOwnedFocus());\n }\n this.previousBusy = busy;\n });\n }\n\n @HostListener('focusin')\n onFocusIn(): void {\n this.ownedFocus = true;\n }\n\n @HostListener('focusout', ['$event'])\n onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n if (next instanceof Node && !this.host.nativeElement.contains(next)) {\n this.ownedFocus = false;\n }\n }\n\n onInput(event: Event): void {\n this.text.set((event.target as HTMLTextAreaElement).value);\n }\n\n onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Enter' || event.shiftKey || event.isComposing) {\n return;\n }\n\n event.preventDefault();\n this.submit();\n }\n\n onSubmit(event: SubmitEvent): void {\n event.preventDefault();\n this.submit();\n queueMicrotask(() => this.textarea().nativeElement.focus({ preventScroll: true }));\n }\n\n submit(): void {\n if (!this.canSend()) {\n return;\n }\n\n const text = this.text().trim();\n this.text.set('');\n this.send.emit(text);\n }\n\n /** Hands the chosen files to the host and empties the input, so the same file can be chosen again. */\n onFilesChosen(event: Event): void {\n const input = event.target as HTMLInputElement;\n const files = Array.from(input.files ?? []);\n input.value = '';\n if (files.length > 0) {\n this.attach.emit(files);\n }\n }\n\n /** Removes an attachment and keeps the keyboard in the composer, on the attach button. */\n remove(attachment: NhAssistantAttachment): void {\n this.removeAttachment.emit(attachment.id);\n queueMicrotask(() => (this.attachButton()?.nativeElement ?? this.textarea().nativeElement).focus({ preventScroll: true }));\n }\n\n /** The translation keys of why an attachment failed, from the composer's own text to the generic one. */\n errorKeys(attachment: NhAssistantAttachment): string[] {\n const error = attachment.error;\n if (!error) {\n return [];\n }\n\n return [\n `nh-assistant.composer.attachment-errors.${error.code}`,\n error.messageKey,\n `nh-assistant.errors.${error.code}`,\n 'nh-assistant.errors.generic'\n ];\n }\n\n percent(attachment: NhAssistantAttachment): number {\n return Math.round(attachment.progress * 100);\n }\n\n /** A size in bytes in the current language, such as `1.4 MB`. */\n size(bytes: number): string {\n return nhAssistantFormatFileSize(bytes, this.translate?.getCurrentLang());\n }\n\n private restoreOwnedFocus(): void {\n if (!this.ownedFocus || matchMedia('(pointer: coarse)').matches) {\n return;\n }\n\n const active = document.activeElement;\n if (active === document.body || active === null || !active.isConnected) {\n this.textarea().nativeElement.focus({ preventScroll: true });\n }\n }\n}\n","<form class=\"composer\" (submit)=\"onSubmit($event)\">\n <label class=\"visually-hidden\" [for]=\"inputId\">{{ 'nh-assistant.composer.label' | translate }}</label>\n <textarea\n #textarea\n data-nh-assistant-autofocus\n rows=\"2\"\n [id]=\"inputId\"\n [value]=\"text()\"\n [disabled]=\"disabled()\"\n [attr.placeholder]=\"'nh-assistant.composer.placeholder' | translate\"\n [attr.aria-describedby]=\"hintId\"\n [attr.aria-invalid]=\"tooLong() ? true : null\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"></textarea>\n\n @if (attachments().length > 0) {\n <ul class=\"attachments\" [id]=\"attachmentsId\" [attr.aria-label]=\"'nh-assistant.composer.attachments' | translate\">\n @for (attachment of attachments(); track attachment.id) {\n <li class=\"attachment\" [attr.data-state]=\"attachment.state\">\n <nh-assistant-icon class=\"attachment-icon\" [name]=\"attachment.state === 'failed' ? 'warning' : 'file'\" />\n <div class=\"attachment-body\">\n <span class=\"attachment-name\" [attr.title]=\"attachment.name\">{{ attachment.name }}</span>\n @switch (attachment.state) {\n @case ('uploading') {\n <progress\n class=\"attachment-progress\"\n max=\"100\"\n [value]=\"percent(attachment)\"\n [attr.aria-label]=\"'nh-assistant.composer.uploading' | translate: { name: attachment.name }\"></progress>\n }\n @case ('failed') {\n <span class=\"attachment-error\" role=\"alert\">\n {{ errorKeys(attachment) | nhAssistantTranslate: (attachment.error?.code ?? '') : uploadParams() }}\n </span>\n }\n @default {\n <span class=\"attachment-meta\">{{ size(attachment.size) }}</span>\n }\n }\n </div>\n <button\n class=\"attachment-remove\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.composer.remove-attachment' | translate: { name: attachment.name }\"\n [attr.title]=\"'nh-assistant.composer.remove-attachment' | translate: { name: attachment.name }\"\n (click)=\"remove(attachment)\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </li>\n }\n </ul>\n }\n\n <div class=\"prompt-bar\">\n @if (uploads()) {\n <button\n #attachButton\n class=\"attach\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.composer.attach' | translate\"\n [attr.title]=\"'nh-assistant.composer.attach-hint' | translate: uploadParams()\"\n [attr.aria-describedby]=\"attachHintId\"\n (click)=\"fileInput.click()\">\n <nh-assistant-icon name=\"attach\" />\n </button>\n <span class=\"visually-hidden\" [id]=\"attachHintId\">{{ 'nh-assistant.composer.attach-hint' | translate: uploadParams() }}</span>\n <input\n #fileInput\n class=\"visually-hidden\"\n type=\"file\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept()\"\n (change)=\"onFilesChosen($event)\" />\n }\n <div class=\"prompt-controls\">\n <ng-content select=\"[nhAssistantComposerControls]\" />\n </div>\n <div class=\"actions\">\n @if (busy() && canStop()) {\n <button\n class=\"stop\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.composer.stop' | translate\"\n [attr.title]=\"'nh-assistant.composer.stop' | translate\"\n (click)=\"cancel.emit()\">\n <nh-assistant-icon name=\"stop\" />\n </button>\n }\n @if (!busy() || !canStop() || queueWhileBusy()) {\n <button\n class=\"send\"\n type=\"submit\"\n [disabled]=\"!canSend()\"\n [attr.aria-label]=\"(busy() && queueWhileBusy() ? 'nh-assistant.queue.add' : 'nh-assistant.composer.send') | translate\"\n [attr.title]=\"(busy() && queueWhileBusy() ? 'nh-assistant.queue.add' : 'nh-assistant.composer.send') | translate\">\n <nh-assistant-icon name=\"send\" />\n </button>\n }\n </div>\n </div>\n</form>\n\n@if (status() === 'waiting-for-approval') {\n <p class=\"composer-status\" role=\"status\" aria-live=\"polite\">\n @if (statusActor(); as name) {\n {{ 'nh-assistant.composer.status.waiting-for-approval-by' | translate: { name } }}\n } @else {\n {{ 'nh-assistant.composer.status.waiting-for-approval' | translate }}\n }\n </p>\n} @else if (status() === 'waiting-for-answer') {\n <p class=\"composer-status\" role=\"status\" aria-live=\"polite\">\n @if (statusActor(); as name) {\n {{ 'nh-assistant.composer.status.waiting-for-answer-by' | translate: { name } }}\n } @else {\n {{ 'nh-assistant.composer.status.waiting-for-answer' | translate }}\n }\n </p>\n}\n\n<p class=\"hint\" [id]=\"hintId\">\n @if (tooLong()) {\n <span class=\"error\">{{ 'nh-assistant.composer.too-long' | translate }}</span>\n } @else if (uploading()) {\n <span>{{ 'nh-assistant.composer.uploading-hint' | translate }}</span>\n } @else {\n <span>{{ (busy() && queueWhileBusy() ? 'nh-assistant.queue.hint' : 'nh-assistant.composer.hint') | translate }}</span>\n }\n @if (showCounter()) {\n <span class=\"counter\" [class.error]=\"tooLong()\">\n {{ 'nh-assistant.composer.characters' | translate: { count: length(), max: maxLength() } }}\n </span>\n }\n</p>\n","import { DatePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ConversationSummary } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { nhAssistantIsUnread } from '../../services/nh-assistant.store';\n\n/**\n * The user's own and shared conversations with loading and empty states; selecting one opens it.\n * Each row marks a running turn, a waiting approval and unread messages. A participant leaves a\n * shared conversation instead of deleting it.\n */\n@Component({\n selector: 'nh-assistant-conversation-list',\n standalone: true,\n imports: [DatePipe, TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-conversation-list.component.html',\n styleUrl: './nh-assistant-conversation-list.component.scss'\n})\nexport class NhAssistantConversationListComponent {\n readonly conversations = input.required<readonly ConversationSummary[]>();\n readonly total = input(0);\n readonly activeConversationId = input<string | null>(null);\n readonly loading = input(false);\n readonly disabled = input(false);\n\n readonly conversationSelect = output<string>();\n /** The owner deletes the conversation; a participant leaves it. */\n readonly conversationDelete = output<string>();\n readonly conversationCreate = output<void>();\n\n unread(conversation: ConversationSummary): boolean {\n return nhAssistantIsUnread(conversation);\n }\n\n indicator(conversation: ConversationSummary): 'running' | 'waiting' | 'unread' | null {\n if (conversation.status === 'running') {\n return 'running';\n }\n if (conversation.status === 'waiting-for-approval') {\n return 'waiting';\n }\n return this.unread(conversation) ? 'unread' : null;\n }\n}\n","<nav class=\"list\" [attr.aria-label]=\"'nh-assistant.conversation-list.title' | translate\" [attr.aria-busy]=\"loading()\">\n <header class=\"header\">\n <h3>{{ 'nh-assistant.conversation-list.title' | translate }}</h3>\n @if (conversations().length > 0 && total() > conversations().length) {\n <span class=\"count\">{{ 'nh-assistant.conversation-list.count' | translate: { count: conversations().length, total: total() } }}</span>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.panel.new-conversation' | translate\"\n [attr.title]=\"'nh-assistant.panel.new-conversation' | translate\"\n (click)=\"conversationCreate.emit()\">\n <nh-assistant-icon name=\"plus\" />\n </button>\n </header>\n\n @if (loading() && conversations().length === 0) {\n <p class=\"state\" role=\"status\">{{ 'nh-assistant.conversation-list.loading' | translate }}</p>\n } @else if (conversations().length === 0) {\n <p class=\"state\">{{ 'nh-assistant.conversation-list.empty' | translate }}</p>\n } @else {\n <ul>\n @for (conversation of conversations(); track conversation.id) {\n <li [class.active]=\"conversation.id === activeConversationId()\" [class.unread]=\"unread(conversation)\">\n <button\n class=\"item\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-current]=\"conversation.id === activeConversationId() ? 'true' : null\"\n (click)=\"conversationSelect.emit(conversation.id)\">\n <span class=\"title-row\">\n <span class=\"indicator\" [attr.data-state]=\"indicator(conversation)\" aria-hidden=\"true\"></span>\n <span class=\"title\">{{ conversation.title || ('nh-assistant.conversation-list.untitled' | translate) }}</span>\n @if ((conversation.participantCount ?? 0) > 0) {\n <nh-assistant-icon\n class=\"shared\"\n name=\"users\"\n [attr.title]=\"'nh-assistant.conversation-list.shared' | translate: { count: conversation.participantCount }\" />\n }\n </span>\n <span class=\"meta\">\n <span class=\"status\" [attr.data-status]=\"conversation.status\">{{ 'nh-assistant.conversation-list.status.' + conversation.status | translate }}</span>\n @if (unread(conversation)) {\n <span class=\"unread-label\">{{ 'nh-assistant.conversation-list.unread' | translate }}</span>\n }\n @if (conversation.role === 'participant') {\n <span>{{ 'nh-assistant.conversation-list.shared-with-you' | translate }}</span>\n }\n <time [attr.datetime]=\"conversation.updatedAt\">{{ conversation.updatedAt | date: 'short' }}</time>\n </span>\n </button>\n <button\n class=\"icon-button delete\"\n type=\"button\"\n [disabled]=\"disabled() || conversation.status === 'running'\"\n [attr.aria-label]=\"((conversation.role === 'participant' ? 'nh-assistant.conversation-list.leave' : 'nh-assistant.conversation-list.delete') | translate) + ': ' + (conversation.title || ('nh-assistant.conversation-list.untitled' | translate))\"\n [attr.title]=\"(conversation.role === 'participant' ? 'nh-assistant.conversation-list.leave' : 'nh-assistant.conversation-list.delete') | translate\"\n (click)=\"conversationDelete.emit(conversation.id)\">\n <nh-assistant-icon [name]=\"conversation.role === 'participant' ? 'leave' : 'trash'\" />\n </button>\n </li>\n }\n </ul>\n }\n</nav>\n","import { DatePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, computed, effect, inject, signal, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Subscription } from 'rxjs';\nimport { McpConnection } from '../../models/assistant-admin.models';\nimport { nhAssistantErrorKeys, nhAssistantErrorOf, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantApiService } from '../../services/nh-assistant-api.service';\nimport { NhAssistantMcpConnectService } from '../../services/nh-assistant-mcp-connect.service';\nimport { NhAssistantError, NhAssistantStore } from '../../services/nh-assistant.store';\n\nlet nextId = 0;\n\n/**\n * The caller's own MCP accounts: servers each person connects to with OAuth, with Connect,\n * Connect again and Disconnect, and the consent to background use of servers that run with the\n * caller's own account. Each change applies at once. Renders nothing while no server asks for it,\n * so most applications never show it.\n */\n@Component({\n selector: 'nh-assistant-mcp-connections',\n standalone: true,\n imports: [DatePipe, TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-mcp-connections.component.html',\n styleUrl: './nh-assistant-mcp-connections.component.scss'\n})\nexport class NhAssistantMcpConnectionsComponent {\n private readonly api = inject(NhAssistantApiService);\n private readonly connector = inject(NhAssistantMcpConnectService);\n private readonly store = inject(NhAssistantStore, { optional: true });\n private loadSubscription?: Subscription;\n private updateSubscription?: Subscription;\n\n readonly id = `nh-assistant-mcp-connections-${nextId++}`;\n readonly connections = signal<McpConnection[]>([]);\n readonly loadFailed = signal(false);\n /** The server whose consent or connection is being changed. */\n readonly busy = signal<string | null>(null);\n readonly confirmingDisconnect = signal<string | null>(null);\n /** The latest change to announce, per server. */\n readonly notice = signal<{ serverId: string; key: string } | null>(null);\n readonly error = signal<NhAssistantError | null>(null);\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n /** Whether any listed server is one the caller connects with OAuth. */\n readonly connectsAccounts = computed(() => this.connections().some(connection => connection.connectionStatus !== null));\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.loadSubscription?.unsubscribe();\n this.updateSubscription?.unsubscribe();\n });\n this.load();\n // A redirect-mode authorization that returned to this page.\n effect(() => {\n const returned = this.connector.returned();\n if (returned) {\n untracked(() => {\n this.connector.returned.set(null);\n if (returned.completion) {\n this.notice.set({ serverId: returned.completion.serverId, key: 'nh-assistant.preferences.mcp.connect-done' });\n this.load();\n } else {\n this.error.set(nhAssistantErrorOf(returned.code));\n }\n });\n }\n });\n }\n\n load(): void {\n this.loadFailed.set(false);\n this.loadSubscription?.unsubscribe();\n this.loadSubscription = this.api.getMcpConnections().subscribe({\n next: connections => this.connections.set(connections),\n error: () => this.loadFailed.set(true)\n });\n }\n\n /** The agents' names as the chat shows them; an agent the chat does not list shows its id. */\n agentKeys(connection: McpConnection): string[] {\n const agents = this.store?.agents() ?? [];\n return connection.agentIds.map(agentId => agents.find(agent => agent.id === agentId)?.displayNameKey ?? agentId);\n }\n\n toggle(connection: McpConnection, event: Event): void {\n const allow = (event.target as HTMLInputElement).checked;\n this.busy.set(connection.serverId);\n this.error.set(null);\n this.notice.set(null);\n this.updateSubscription?.unsubscribe();\n this.updateSubscription = this.api.updateMcpConnection(connection.serverId, { allowBackgroundUse: allow }).subscribe({\n next: updated => {\n this.connections.update(items => items.map(item => item.serverId === updated.serverId ? updated : item));\n this.busy.set(null);\n },\n error: (error: unknown) => {\n // Show the stored decision again.\n this.connections.update(items => [...items]);\n (event.target as HTMLInputElement).checked = connection.allowBackgroundUse;\n this.busy.set(null);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n /** Connects the caller's own account; call from the click, so the popup is allowed. */\n connect(connection: McpConnection): void {\n this.busy.set(connection.serverId);\n this.error.set(null);\n this.notice.set(null);\n this.updateSubscription?.unsubscribe();\n this.updateSubscription = this.connector.connect(connection.serverId).subscribe({\n next: () => {\n this.busy.set(null);\n this.notice.set({ serverId: connection.serverId, key: 'nh-assistant.preferences.mcp.connect-done' });\n this.load();\n },\n error: (error: unknown) => {\n this.busy.set(null);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n disconnect(connection: McpConnection): void {\n this.confirmingDisconnect.set(null);\n this.busy.set(connection.serverId);\n this.error.set(null);\n this.notice.set(null);\n this.updateSubscription?.unsubscribe();\n this.updateSubscription = this.api.disconnectMcpConnection(connection.serverId).subscribe({\n complete: () => {\n this.busy.set(null);\n this.notice.set({ serverId: connection.serverId, key: 'nh-assistant.preferences.mcp.disconnect-done' });\n this.load();\n },\n error: (error: unknown) => {\n this.busy.set(null);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n}\n","@if (connections().length > 0) {\n <fieldset class=\"connections\" [attr.aria-busy]=\"busy() !== null\">\n <legend>{{ (connectsAccounts() ? 'nh-assistant.preferences.mcp.accounts-title' : 'nh-assistant.preferences.mcp.title') | translate }}</legend>\n <p class=\"hint\">{{ (connectsAccounts() ? 'nh-assistant.preferences.mcp.accounts-description' : 'nh-assistant.preferences.mcp.description') | translate }}</p>\n <ul class=\"list\">\n @for (connection of connections(); track connection.serverId) {\n <li class=\"item\" [attr.data-status]=\"connection.connectionStatus\">\n @if (connection.connectionStatus !== null) {\n <div class=\"account\">\n <strong class=\"name\">{{ connection.displayName }}</strong>\n <span\n class=\"badge\"\n [class.success]=\"connection.connectionStatus === 'active'\"\n [class.warning]=\"connection.connectionStatus === 'reauthorization-required' || connection.connectionStatus === 'issuer-changed'\">\n {{ 'nh-assistant.preferences.mcp.status.' + connection.connectionStatus | translate }}\n </span>\n </div>\n @if (connection.connectionStatus === 'active' && connection.connectedAt) {\n <p class=\"hint details\">{{ 'nh-assistant.preferences.mcp.connected-since' | translate: { date: (connection.connectedAt | date: 'medium') } }}</p>\n }\n @if (connection.requiredScopes; as scopes) {\n <p class=\"hint details\">{{ 'nh-assistant.preferences.mcp.more-permissions' | translate: { scopes: scopes } }}</p>\n }\n @if (connection.connectionStatus === 'issuer-changed') {\n <p class=\"hint details\">{{ 'nh-assistant.preferences.mcp.issuer-changed' | translate }}</p>\n }\n <div class=\"actions\">\n @if (connection.connectionStatus !== 'issuer-changed') {\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy() !== null\" (click)=\"connect(connection)\">\n {{ (connection.connectionStatus === 'not-connected' ? 'nh-assistant.preferences.mcp.connect' : 'nh-assistant.preferences.mcp.connect-again') | translate }}\n </button>\n }\n @if (connection.connectionStatus !== 'not-connected') {\n @if (confirmingDisconnect() === connection.serverId) {\n <button class=\"secondary danger\" type=\"button\" [disabled]=\"busy() !== null\" (click)=\"disconnect(connection)\">\n {{ 'nh-assistant.preferences.mcp.confirm-disconnect' | translate }}\n </button>\n <button class=\"secondary\" type=\"button\" (click)=\"confirmingDisconnect.set(null)\">{{ 'nh-assistant.preferences.mcp.cancel' | translate }}</button>\n } @else {\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy() !== null\" (click)=\"confirmingDisconnect.set(connection.serverId)\">\n {{ 'nh-assistant.preferences.mcp.disconnect' | translate }}\n </button>\n }\n }\n </div>\n }\n @if (connection.offersBackgroundUse) {\n <label class=\"switch\">\n <input\n type=\"checkbox\"\n [checked]=\"connection.allowBackgroundUse\"\n [disabled]=\"busy() !== null\"\n [attr.aria-describedby]=\"id + '-' + connection.serverId\"\n (change)=\"toggle(connection, $event)\" />\n <span>{{ 'nh-assistant.preferences.mcp.allow' | translate: { name: connection.displayName } }}</span>\n </label>\n }\n <p class=\"hint details\" [id]=\"id + '-' + connection.serverId\">\n <span class=\"host\">{{ connection.host }}</span>\n @if (connection.offersBackgroundUse) {\n <span>\n @if (connection.allowBackgroundUse && connection.consentedAt) {\n {{ 'nh-assistant.preferences.mcp.allowed-since' | translate: { date: (connection.consentedAt | date: 'medium') } }}\n } @else {\n {{ 'nh-assistant.preferences.mcp.not-allowed' | translate }}\n }\n </span>\n }\n <span>\n {{ 'nh-assistant.preferences.mcp.used-by' | translate }}\n @for (key of agentKeys(connection); track $index) {\n <span class=\"agent\">{{ [key] | nhAssistantTranslate: key }}</span>\n }\n </span>\n </p>\n @if (notice()?.serverId === connection.serverId) {\n <p class=\"message success\" role=\"status\"><nh-assistant-icon name=\"check\" />{{ notice()!.key | translate: { name: connection.displayName } }}</p>\n }\n </li>\n }\n </ul>\n @if (error(); as failure) {\n <p class=\"message error\" role=\"alert\">\n <nh-assistant-icon name=\"warning\" />\n {{ errorKeys() | nhAssistantTranslate: failure.code }}\n </p>\n }\n </fieldset>\n} @else if (loadFailed()) {\n <div class=\"load-failed\" role=\"alert\">\n <span>{{ 'nh-assistant.preferences.mcp.load-failed' | translate }}</span>\n <button class=\"secondary\" type=\"button\" (click)=\"load()\">{{ 'nh-assistant.preferences.retry' | translate }}</button>\n </div>\n}\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, inject, output, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Subscription } from 'rxjs';\nimport {\n AssistantAddressForm,\n AssistantPreferences,\n AssistantResponseLength,\n AssistantStyle\n} from '../../models/assistant-admin.models';\nimport { nhAssistantErrorKeys, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantMcpConnectionsComponent } from './nh-assistant-mcp-connections.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantApiService } from '../../services/nh-assistant-api.service';\nimport { NhAssistantPushService } from '../../services/nh-assistant-push.service';\nimport { NhAssistantError } from '../../services/nh-assistant.store';\n\n/** Maximum length of the user's own instructions. */\nexport const NH_ASSISTANT_MAX_CUSTOM_INSTRUCTIONS = 1_000;\n\nlet nextId = 0;\n\n/**\n * The user's own assistant preferences: desktop notifications, background use of MCP servers\n * with the user's own account, style, form of address, answer length and optional instructions.\n * Notifications and background use apply immediately; the other\n * preferences steer style only and are saved together, below the application context and\n * agent instructions.\n */\n@Component({\n selector: 'nh-assistant-preferences',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent, NhAssistantMcpConnectionsComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-preferences.component.html',\n styleUrl: './nh-assistant-preferences.component.scss'\n})\nexport class NhAssistantPreferencesComponent {\n private readonly api = inject(NhAssistantApiService);\n readonly push = inject(NhAssistantPushService);\n private subscription?: Subscription;\n\n /** Emitted when the user leaves the preferences. */\n readonly closed = output<void>();\n /** Emitted with the stored preferences after a successful save. */\n readonly saved = output<AssistantPreferences>();\n\n readonly id = `nh-assistant-preferences-${nextId++}`;\n readonly styles: readonly AssistantStyle[] = ['default', 'direct', 'personal', 'detailed'];\n readonly addressForms: readonly AssistantAddressForm[] = ['informal', 'formal'];\n readonly responseLengths: readonly AssistantResponseLength[] = ['short', 'normal', 'long'];\n readonly maxInstructions = NH_ASSISTANT_MAX_CUSTOM_INSTRUCTIONS;\n\n readonly loading = signal(true);\n readonly loadFailed = signal(false);\n readonly saving = signal(false);\n readonly savedMessage = signal(false);\n readonly error = signal<NhAssistantError | null>(null);\n\n readonly style = signal<AssistantStyle>('default');\n readonly addressForm = signal<AssistantAddressForm>('informal');\n readonly responseLength = signal<AssistantResponseLength>('normal');\n readonly customInstructions = signal('');\n private readonly stored = signal<AssistantPreferences | null>(null);\n\n readonly instructionsLength = computed(() => this.customInstructions().length);\n readonly tooLong = computed(() => this.instructionsLength() > this.maxInstructions);\n readonly dirty = computed(() => {\n const stored = this.stored();\n return !stored || stored.style !== this.style() || stored.addressForm !== this.addressForm() ||\n stored.responseLength !== this.responseLength() || (stored.customInstructions ?? '') !== this.customInstructions();\n });\n readonly canSave = computed(() => !this.loading() && !this.saving() && !this.tooLong() && this.dirty());\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());\n this.load();\n }\n\n load(): void {\n this.loading.set(true);\n this.loadFailed.set(false);\n this.subscription?.unsubscribe();\n this.subscription = this.api.getPreferences().subscribe({\n next: preferences => {\n this.apply(preferences);\n this.loading.set(false);\n },\n error: () => {\n this.loading.set(false);\n this.loadFailed.set(true);\n }\n });\n }\n\n /** Turns desktop notifications on or off; turning them on asks the browser for permission. */\n async toggleNotifications(event: Event): Promise<void> {\n const enabled = (event.target as HTMLInputElement).checked;\n this.error.set(null);\n try {\n await this.push.setEnabled(enabled);\n } catch (error) {\n this.error.set(toNhAssistantError(error));\n }\n }\n\n onInstructionsInput(event: Event): void {\n this.customInstructions.set((event.target as HTMLTextAreaElement).value);\n this.savedMessage.set(false);\n }\n\n choose<T>(target: { set(value: T): void }, value: T): void {\n target.set(value);\n this.savedMessage.set(false);\n }\n\n save(): void {\n if (!this.canSave()) {\n return;\n }\n\n const instructions = this.customInstructions().trim();\n const preferences: AssistantPreferences = {\n style: this.style(),\n addressForm: this.addressForm(),\n responseLength: this.responseLength(),\n customInstructions: instructions.length > 0 ? instructions : null\n };\n\n this.saving.set(true);\n this.error.set(null);\n this.savedMessage.set(false);\n this.subscription?.unsubscribe();\n this.subscription = this.api.updatePreferences(preferences).subscribe({\n next: stored => {\n this.apply(stored);\n this.saving.set(false);\n this.savedMessage.set(true);\n this.saved.emit(stored);\n },\n error: (error: unknown) => {\n this.saving.set(false);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n private apply(preferences: AssistantPreferences): void {\n this.stored.set(preferences);\n this.style.set(preferences.style);\n this.addressForm.set(preferences.addressForm);\n this.responseLength.set(preferences.responseLength);\n this.customInstructions.set(preferences.customInstructions ?? '');\n }\n}\n","<section class=\"preferences\" [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"loading() || saving()\">\n <header class=\"header\">\n <h3 [id]=\"id + '-title'\">{{ 'nh-assistant.preferences.title' | translate }}</h3>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.preferences.back' | translate\"\n [attr.title]=\"'nh-assistant.preferences.back' | translate\"\n (click)=\"closed.emit()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </header>\n\n @if (loading()) {\n <p class=\"state\" role=\"status\">{{ 'nh-assistant.preferences.loading' | translate }}</p>\n } @else if (loadFailed()) {\n <div class=\"state\" role=\"alert\">\n <p>{{ 'nh-assistant.preferences.load-failed' | translate }}</p>\n <button class=\"secondary\" type=\"button\" (click)=\"load()\">{{ 'nh-assistant.preferences.retry' | translate }}</button>\n </div>\n } @else {\n <form class=\"form\" (submit)=\"$event.preventDefault(); save()\">\n @if (push.state() !== 'unavailable') {\n <fieldset class=\"notifications\">\n <legend>{{ 'nh-assistant.preferences.notifications-label' | translate }}</legend>\n <label class=\"switch\">\n <input\n type=\"checkbox\"\n [checked]=\"push.settings()?.pushEnabled === true\"\n [disabled]=\"push.busy()\"\n [attr.aria-describedby]=\"id + '-notifications-hint'\"\n (change)=\"toggleNotifications($event)\" />\n <span>{{ 'nh-assistant.preferences.notifications' | translate }}</span>\n </label>\n <p class=\"hint\" [id]=\"id + '-notifications-hint'\">\n <span>{{ 'nh-assistant.preferences.notifications-state.' + push.state() | translate }}</span>\n </p>\n </fieldset>\n }\n\n <nh-assistant-mcp-connections />\n\n <p class=\"description\">{{ 'nh-assistant.preferences.description' | translate }}</p>\n\n <fieldset>\n <legend>{{ 'nh-assistant.preferences.style-label' | translate }}</legend>\n <div class=\"options styles\">\n @for (option of styles; track option) {\n <label class=\"option\" [class.selected]=\"style() === option\">\n <input type=\"radio\" [name]=\"id + '-style'\" [value]=\"option\" [checked]=\"style() === option\" (change)=\"choose(style, option)\" />\n <span>\n <strong>{{ 'nh-assistant.preferences.style.' + option | translate }}</strong>\n <small>{{ 'nh-assistant.preferences.style.' + option + '-description' | translate }}</small>\n </span>\n </label>\n }\n </div>\n </fieldset>\n\n <fieldset>\n <legend>{{ 'nh-assistant.preferences.address-form-label' | translate }}</legend>\n <div class=\"options segmented\">\n @for (option of addressForms; track option) {\n <label class=\"option\" [class.selected]=\"addressForm() === option\">\n <input type=\"radio\" [name]=\"id + '-address'\" [value]=\"option\" [checked]=\"addressForm() === option\" (change)=\"choose(addressForm, option)\" />\n <span><strong>{{ 'nh-assistant.preferences.address-form.' + option | translate }}</strong></span>\n </label>\n }\n </div>\n </fieldset>\n\n <fieldset>\n <legend>{{ 'nh-assistant.preferences.response-length-label' | translate }}</legend>\n <div class=\"options segmented\">\n @for (option of responseLengths; track option) {\n <label class=\"option\" [class.selected]=\"responseLength() === option\">\n <input type=\"radio\" [name]=\"id + '-length'\" [value]=\"option\" [checked]=\"responseLength() === option\" (change)=\"choose(responseLength, option)\" />\n <span><strong>{{ 'nh-assistant.preferences.response-length.' + option | translate }}</strong></span>\n </label>\n }\n </div>\n </fieldset>\n\n <div class=\"field\">\n <label [for]=\"id + '-instructions'\">{{ 'nh-assistant.preferences.custom-instructions-label' | translate }}</label>\n <textarea\n rows=\"4\"\n [id]=\"id + '-instructions'\"\n [value]=\"customInstructions()\"\n [attr.aria-describedby]=\"id + '-instructions-hint'\"\n [attr.aria-invalid]=\"tooLong() ? true : null\"\n (input)=\"onInstructionsInput($event)\"></textarea>\n <p class=\"hint\" [id]=\"id + '-instructions-hint'\">\n @if (tooLong()) {\n <span class=\"error-text\">{{ 'nh-assistant.preferences.too-long' | translate }}</span>\n } @else {\n <span>{{ 'nh-assistant.preferences.custom-instructions-hint' | translate }}</span>\n }\n <span class=\"counter\" [class.error-text]=\"tooLong()\">\n {{ 'nh-assistant.preferences.characters' | translate: { count: instructionsLength(), max: maxInstructions } }}\n </span>\n </p>\n </div>\n\n @if (error(); as error) {\n <p class=\"message error\" role=\"alert\">\n <nh-assistant-icon name=\"warning\" />\n {{ errorKeys() | nhAssistantTranslate: error.code }}\n </p>\n }\n @if (savedMessage()) {\n <p class=\"message success\" role=\"status\">\n <nh-assistant-icon name=\"check\" />\n {{ 'nh-assistant.preferences.saved' | translate }}\n </p>\n }\n\n <div class=\"actions\">\n <button class=\"secondary\" type=\"button\" (click)=\"closed.emit()\">{{ 'nh-assistant.preferences.back' | translate }}</button>\n <button class=\"primary\" type=\"submit\" [disabled]=\"!canSave()\">\n {{ (saving() ? 'nh-assistant.preferences.saving' : 'nh-assistant.preferences.save') | translate }}\n </button>\n </div>\n </form>\n }\n</section>\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, inject, input, output, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ConversationMember, DirectoryEntry } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NH_ASSISTANT_CONFIG } from '../../nh-assistant.config';\nimport { NhAssistantStore } from '../../services/nh-assistant.store';\nimport { nhAssistantShareLink } from '../../services/nh-assistant-share-link';\n\nlet nextId = 0;\nconst searchDelayMs = 250;\n\n/**\n * Sharing of the open conversation. The owner creates, copies, renews or stops an invitation\n * link, invites colleagues through the application's directory when it offers one, and removes\n * participants. A participant sees who takes part and can leave.\n */\n@Component({\n selector: 'nh-assistant-share',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-share.component.html',\n styleUrl: './nh-assistant-share.component.scss'\n})\nexport class NhAssistantShareComponent {\n readonly store = inject(NhAssistantStore);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private searchTimer?: ReturnType<typeof setTimeout>;\n private searchRevision = 0;\n\n /** Emitted when the user leaves the view. */\n readonly closed = output<void>();\n /** Show the invitation link, participants, or both (the default for custom hosts). */\n readonly section = input<'all' | 'link' | 'members'>('all');\n\n readonly id = `nh-assistant-share-${nextId++}`;\n readonly conversation = this.store.activeConversation;\n readonly isOwner = this.store.isOwner;\n readonly busy = signal(false);\n readonly copied = signal(false);\n readonly query = signal('');\n readonly searching = signal(false);\n readonly candidates = signal<DirectoryEntry[]>([]);\n readonly invited = signal<string | null>(null);\n\n readonly directory = computed(() => this.store.collaboration()?.directory === true && this.isOwner());\n readonly maxParticipants = computed(() => this.store.collaboration()?.maxParticipants ?? null);\n readonly participants = computed(() => this.store.members().filter(member => member.role === 'participant'));\n readonly link = computed(() => {\n const conversation = this.conversation();\n if (!conversation?.shareToken) {\n return null;\n }\n return (this.config.buildShareLink ?? nhAssistantShareLink)(conversation.id, conversation.shareToken);\n });\n readonly full = computed(() => {\n const max = this.maxParticipants();\n return max !== null && this.participants().length >= max;\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => clearTimeout(this.searchTimer));\n }\n\n async createLink(): Promise<void> {\n await this.run(() => this.store.createShareLink());\n this.copied.set(false);\n }\n\n async revokeLink(): Promise<void> {\n await this.run(() => this.store.revokeShareLink());\n this.copied.set(false);\n }\n\n async copy(input: HTMLInputElement): Promise<void> {\n const link = this.link();\n if (!link) {\n return;\n }\n try {\n await navigator.clipboard.writeText(link);\n } catch {\n // Without clipboard access the selected text can be copied by hand.\n input.select();\n }\n this.copied.set(true);\n }\n\n onSearch(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.query.set(value);\n this.invited.set(null);\n clearTimeout(this.searchTimer);\n const revision = ++this.searchRevision;\n if (value.trim().length < 2) {\n this.candidates.set([]);\n this.searching.set(false);\n return;\n }\n this.searching.set(true);\n this.searchTimer = setTimeout(async () => {\n const results = await this.store.searchParticipantCandidates(value);\n if (revision === this.searchRevision) {\n this.candidates.set(results);\n this.searching.set(false);\n }\n }, searchDelayMs);\n }\n\n async invite(entry: DirectoryEntry): Promise<void> {\n const invited = await this.run(() => this.store.inviteParticipant(entry.actorId));\n if (invited) {\n this.invited.set(entry.displayName);\n this.candidates.update(items => items.filter(item => item.actorId !== entry.actorId));\n }\n }\n\n async remove(member: ConversationMember): Promise<void> {\n await this.run(() => this.store.removeParticipant(member.actorId));\n }\n\n async leave(): Promise<void> {\n const actorId = this.conversation()?.currentActorId;\n if (!actorId) {\n return;\n }\n if (await this.run(() => this.store.removeParticipant(actorId))) {\n this.closed.emit();\n }\n }\n\n isCurrentUser(member: ConversationMember): boolean {\n return member.actorId === this.conversation()?.currentActorId;\n }\n\n private async run<T>(action: () => Promise<T>): Promise<T | undefined> {\n if (this.busy()) {\n return undefined;\n }\n this.busy.set(true);\n try {\n return await action();\n } finally {\n this.busy.set(false);\n }\n }\n}\n","<section class=\"share\" [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"busy()\">\n <header class=\"header\">\n <h3 [id]=\"id + '-title'\">\n {{ (isOwner() && section() !== 'members' ? 'nh-assistant.share.title' : 'nh-assistant.share.members-title') | translate }}\n </h3>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.share.back' | translate\"\n [attr.title]=\"'nh-assistant.share.back' | translate\"\n (click)=\"closed.emit()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </header>\n\n @if (conversation(); as conversation) {\n <div class=\"content\">\n @if (isOwner()) {\n <p class=\"description\">{{ 'nh-assistant.share.description' | translate }}</p>\n\n @if (section() !== 'members' || !directory()) {\n <section class=\"block\" [attr.aria-labelledby]=\"id + '-link'\">\n <h4 [id]=\"id + '-link'\">{{ 'nh-assistant.share.link-title' | translate }}</h4>\n @if (link(); as link) {\n <div class=\"link-row\">\n <label class=\"visually-hidden\" [for]=\"id + '-link-input'\">{{ 'nh-assistant.share.link-label' | translate }}</label>\n <input #linkInput type=\"text\" readonly [id]=\"id + '-link-input'\" [value]=\"link\" (focus)=\"linkInput.select()\" />\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.share.copy' | translate\"\n [attr.title]=\"'nh-assistant.share.copy' | translate\"\n (click)=\"copy(linkInput)\">\n <nh-assistant-icon name=\"copy\" />\n </button>\n </div>\n @if (copied()) {\n <p class=\"message success\" role=\"status\">\n <nh-assistant-icon name=\"check\" />\n {{ 'nh-assistant.share.copied' | translate }}\n </p>\n }\n <div class=\"actions\">\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy()\" (click)=\"revokeLink()\">\n {{ 'nh-assistant.share.revoke' | translate }}\n </button>\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy()\" (click)=\"createLink()\">\n {{ 'nh-assistant.share.renew' | translate }}\n </button>\n </div>\n <p class=\"hint\">{{ 'nh-assistant.share.link-hint' | translate }}</p>\n } @else {\n <button class=\"primary\" type=\"button\" [disabled]=\"busy() || full()\" (click)=\"createLink()\">\n <nh-assistant-icon name=\"link\" />\n {{ 'nh-assistant.share.create' | translate }}\n </button>\n }\n </section>\n }\n\n @if (directory() && section() !== 'link') {\n <section class=\"block\" [attr.aria-labelledby]=\"id + '-invite'\">\n <h4 [id]=\"id + '-invite'\">{{ 'nh-assistant.share.invite-title' | translate }}</h4>\n <label class=\"visually-hidden\" [for]=\"id + '-search'\">{{ 'nh-assistant.share.search-label' | translate }}</label>\n <input\n type=\"search\"\n autocomplete=\"off\"\n [id]=\"id + '-search'\"\n [value]=\"query()\"\n [disabled]=\"full()\"\n [attr.placeholder]=\"'nh-assistant.share.search-placeholder' | translate\"\n (input)=\"onSearch($event)\" />\n @if (searching()) {\n <p class=\"hint\" role=\"status\">{{ 'nh-assistant.share.searching' | translate }}</p>\n } @else if (query().trim().length >= 2 && candidates().length === 0 && !invited()) {\n <p class=\"hint\">{{ 'nh-assistant.share.no-results' | translate }}</p>\n }\n @if (candidates().length > 0) {\n <ul class=\"people\">\n @for (entry of candidates(); track entry.actorId) {\n <li>\n <span class=\"person\">\n <strong>{{ entry.displayName }}</strong>\n @if (entry.detail) {\n <small>{{ entry.detail }}</small>\n }\n </span>\n <button class=\"secondary small\" type=\"button\" [disabled]=\"busy() || full()\" (click)=\"invite(entry)\">\n {{ 'nh-assistant.share.invite' | translate }}\n </button>\n </li>\n }\n </ul>\n }\n @if (invited(); as name) {\n <p class=\"message success\" role=\"status\">\n <nh-assistant-icon name=\"check\" />\n {{ 'nh-assistant.share.invited' | translate: { name } }}\n </p>\n }\n </section>\n }\n }\n\n @if (section() !== 'link') {\n <section class=\"block\" [attr.aria-labelledby]=\"id + '-members'\">\n <h4 [id]=\"id + '-members'\">\n {{ 'nh-assistant.share.members' | translate }}\n @if (maxParticipants() !== null && isOwner()) {\n <span class=\"count\">{{ 'nh-assistant.share.count' | translate: { count: participants().length, max: maxParticipants() } }}</span>\n }\n </h4>\n @if (store.members().length === 0) {\n <p class=\"hint\">{{ 'nh-assistant.share.not-shared' | translate }}</p>\n } @else {\n <ul class=\"people\">\n @for (member of store.members(); track member.actorId) {\n <li>\n <span class=\"person\">\n <strong>\n {{ member.displayName || ('nh-assistant.share.unnamed' | translate) }}\n @if (isCurrentUser(member)) {\n <small class=\"you\">{{ 'nh-assistant.share.you' | translate }}</small>\n }\n </strong>\n <small>{{ 'nh-assistant.share.role.' + member.role | translate }}</small>\n </span>\n @if (isOwner() && member.role === 'participant') {\n <button\n class=\"icon-button\"\n type=\"button\"\n [disabled]=\"busy()\"\n [attr.aria-label]=\"'nh-assistant.share.remove' | translate: { name: member.displayName || ('nh-assistant.share.unnamed' | translate) }\"\n [attr.title]=\"'nh-assistant.share.remove' | translate: { name: member.displayName || ('nh-assistant.share.unnamed' | translate) }\"\n (click)=\"remove(member)\">\n <nh-assistant-icon name=\"trash\" />\n </button>\n }\n </li>\n }\n </ul>\n }\n </section>\n }\n\n @if (!isOwner()) {\n <div class=\"actions\">\n <button class=\"secondary danger\" type=\"button\" [disabled]=\"busy() || conversation.status === 'running'\" (click)=\"leave()\">\n <nh-assistant-icon name=\"leave\" />\n {{ 'nh-assistant.share.leave' | translate }}\n </button>\n </div>\n }\n </div>\n } @else {\n <p class=\"state\">{{ 'nh-assistant.share.no-conversation' | translate }}</p>\n }\n</section>\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\nimport createDOMPurify, { DOMPurify } from 'dompurify';\nimport { Marked, Tokens } from 'marked';\n\n/** The tags model text may render as; shared with `nh-assistant-document`. */\nexport const nhAssistantMarkdownTags: readonly string[] = [\n 'p', 'br', 'strong', 'em', 'del', 'code', 'pre', 'blockquote', 'ul', 'ol', 'li', 'a',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'table', 'thead', 'tbody', 'tr', 'th', 'td'\n];\nexport const nhAssistantMarkdownAttributes: readonly string[] = ['href', 'title', 'start', 'align'];\nconst allowedUris = /^(?:https?:|mailto:|\\/(?!\\/)|#)/i;\n\nexport function nhAssistantEscapeHtml(text: string): string {\n return text\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * Renders model text as Markdown into a strict HTML subset. Inline HTML in the model text\n * is shown as literal text, images render as their alt text, and the result is sanitized\n * with DOMPurify. Links open in a new tab with `rel=\"noopener noreferrer\"`.\n */\n@Injectable({ providedIn: 'root' })\nexport class NhAssistantMarkdownRenderer {\n private readonly document = inject(DOCUMENT);\n private readonly marked = new Marked({\n gfm: true,\n breaks: true,\n async: false,\n renderer: {\n html(token: Tokens.HTML | Tokens.Tag): string {\n return nhAssistantEscapeHtml(token.text);\n },\n image(token: Tokens.Image): string {\n return nhAssistantEscapeHtml(token.text);\n }\n }\n });\n private purifier: DOMPurify | null = null;\n\n render(text: string): string {\n const purifier = this.getPurifier();\n if (!purifier) {\n return `<p>${nhAssistantEscapeHtml(text)}</p>`;\n }\n\n const html = this.marked.parse(text, { async: false });\n return purifier.sanitize(html, {\n ALLOWED_TAGS: [...nhAssistantMarkdownTags],\n ALLOWED_ATTR: [...nhAssistantMarkdownAttributes],\n ALLOWED_URI_REGEXP: allowedUris,\n ALLOW_DATA_ATTR: false,\n ALLOW_ARIA_ATTR: false\n });\n }\n\n private getPurifier(): DOMPurify | null {\n if (this.purifier) {\n return this.purifier;\n }\n\n const view = this.document.defaultView;\n if (!view) {\n return null;\n }\n\n const purifier = createDOMPurify(view);\n if (!purifier.isSupported) {\n return null;\n }\n\n purifier.addHook('afterSanitizeAttributes', node => {\n if (node.tagName === 'A') {\n node.setAttribute('target', '_blank');\n node.setAttribute('rel', 'noopener noreferrer');\n }\n });\n\n this.purifier = purifier;\n return purifier;\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { NhAssistantMarkdownRenderer } from './nh-assistant-markdown';\n\n/** Renders model text into sanitized HTML. Pure, so unchanged text is not rendered again. */\n@Pipe({ name: 'nhAssistantMarkdown', standalone: true })\nexport class NhAssistantMarkdownPipe implements PipeTransform {\n private readonly renderer = inject(NhAssistantMarkdownRenderer);\n\n transform(text: string): string {\n return this.renderer.render(text);\n }\n}\n","import { LocationStrategy } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EnvironmentInjector,\n computed,\n inject,\n input,\n runInInjectionContext\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\n\n/** Where a subject link leads: a route of the host application or an `https` address elsewhere. */\nexport interface NhAssistantSubjectTarget {\n href: string;\n /** The URL the router navigates to; `null` for an address outside the application. */\n route: string | null;\n}\n\n/**\n * The name of a subject with the name of its type, linked to where the application shows the\n * subject (internal). The host's `subjectLinks` builder wins over the server's link; a link within\n * the application navigates through the router, an `https` link leaves it, and anything else shows\n * no link. Ctrl-, Cmd-, Shift- and middle-clicks keep the browser's behavior, such as a new tab.\n * A name that already says the type, as \"The whole application\" does for the application as a\n * whole, is shown once.\n */\n@Component({\n selector: 'nh-assistant-subject-link',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (shownTypeName(); as type) {\n <!-- The space keeps the type and the name apart for screen readers; the flex gap shows it. -->\n <span class=\"nh-assistant-subject-type\">{{ type }}</span>{{ ' ' }}\n }\n @if (target(); as link) {\n <a class=\"nh-assistant-subject-name\" [href]=\"link.href\" (click)=\"open($event, link)\">{{ label() }}</a>\n } @else {\n <span class=\"nh-assistant-subject-name\">{{ label() }}</span>\n }\n `,\n styleUrl: './nh-assistant-subject-link.component.scss'\n})\nexport class NhAssistantSubjectLinkComponent {\n private readonly config = inject(NH_ASSISTANT_CONFIG, { optional: true });\n private readonly router = inject(Router, { optional: true });\n private readonly locationStrategy = inject(LocationStrategy, { optional: true });\n private readonly injector = inject(EnvironmentInjector);\n\n readonly subjectType = input.required<string>();\n readonly subjectId = input.required<string>();\n /** The text people read, usually the subject's display name. */\n readonly label = input.required<string>();\n /** The name of the subject type, such as \"Project\"; nothing is shown without one. */\n readonly typeName = input<string | null | undefined>(null);\n /** The server's link to the subject. */\n readonly link = input<string | null | undefined>(null);\n\n /** The type's name, unless the subject's name is the type's name itself, as for the whole application. */\n readonly shownTypeName = computed(() => {\n const type = this.typeName()?.trim();\n if (!type) {\n return null;\n }\n\n return type.toLocaleLowerCase() === this.label().trim().toLocaleLowerCase() ? null : type;\n });\n\n readonly target = computed<NhAssistantSubjectTarget | null>(() => {\n const builder = this.config?.subjectLinks?.[this.subjectType()];\n const subject = { type: this.subjectType(), id: this.subjectId() };\n const custom = builder ? runInInjectionContext(this.injector, () => builder(subject)) : undefined;\n if (custom === null) {\n return null;\n }\n if (Array.isArray(custom)) {\n return this.routeTarget(this.router ? this.router.serializeUrl(this.router.createUrlTree([...custom])) : null);\n }\n\n return this.urlTarget(typeof custom === 'string' ? custom : this.link() ?? null);\n });\n\n open(event: MouseEvent, target: NhAssistantSubjectTarget): void {\n nhAssistantOpenLink(event, target, this.router);\n }\n\n private urlTarget(url: string | null): NhAssistantSubjectTarget | null {\n return nhAssistantLinkTarget(url, this.router, this.locationStrategy);\n }\n\n private routeTarget(url: string | null): NhAssistantSubjectTarget | null {\n return nhAssistantRouteTarget(url, this.router, this.locationStrategy);\n }\n}\n\n/**\n * Where a link the server sent leads (internal): a path within the application, which the router\n * opens, an `https` address elsewhere, or `null` for anything else, so no other scheme reaches an\n * anchor. Subject links and the links of application messages follow this rule.\n */\nexport function nhAssistantLinkTarget(\n url: string | null | undefined,\n router: Router | null,\n locationStrategy: LocationStrategy | null\n): NhAssistantSubjectTarget | null {\n if (!url) {\n return null;\n }\n if (url.startsWith('/') && !url.startsWith('//') && !url.startsWith('/\\\\')) {\n return nhAssistantRouteTarget(url, router, locationStrategy);\n }\n\n return /^https:\\/\\/[^/\\\\\\s]+/i.test(url) ? { href: url, route: null } : null;\n}\n\n/** A route of the application as the browser shows it and as the router opens it (internal). */\nexport function nhAssistantRouteTarget(\n url: string | null,\n router: Router | null,\n locationStrategy: LocationStrategy | null\n): NhAssistantSubjectTarget | null {\n if (!url) {\n return null;\n }\n\n return {\n href: locationStrategy ? locationStrategy.prepareExternalUrl(url) : url,\n route: router ? url : null\n };\n}\n\n/**\n * Opens a route of the application through the router on a plain click (internal). Ctrl-, Cmd-,\n * Shift-, Alt- and middle-clicks, and addresses outside the application, keep the browser's behavior.\n */\nexport function nhAssistantOpenLink(event: MouseEvent, target: NhAssistantSubjectTarget, router: Router | null): void {\n if (!target.route || !router || event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {\n return;\n }\n\n event.preventDefault();\n void router.navigateByUrl(target.route);\n}\n","import { LocationStrategy } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { NhAssistantIconComponent } from './nh-assistant-icon.component';\nimport { NhAssistantSubjectTarget, nhAssistantLinkTarget, nhAssistantOpenLink } from './nh-assistant-subject-link.component';\n\n/**\n * The link of a message the application posted (internal): a path within the application opens\n * through the router, an `https` address leaves it, and anything else shows nothing, by the same rule\n * as subject links.\n */\n@Component({\n selector: 'nh-assistant-message-link',\n standalone: true,\n imports: [NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (target(); as link) {\n <a class=\"nh-assistant-message-link\" [href]=\"link.href\" (click)=\"open($event, link)\">\n <nh-assistant-icon name=\"link\" />{{ label() }}\n </a>\n }\n `,\n styles: `\n :host {\n display: block;\n }\n\n .nh-assistant-message-link {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n color: var(--nha-accent);\n font-size: 13px;\n font-weight: 600;\n text-decoration: none;\n }\n\n .nh-assistant-message-link:hover {\n text-decoration: underline;\n }\n\n .nh-assistant-message-link:focus-visible {\n outline: 2px solid var(--nha-focus);\n outline-offset: 2px;\n border-radius: 4px;\n }\n `\n})\nexport class NhAssistantMessageLinkComponent {\n private readonly router = inject(Router, { optional: true });\n private readonly locationStrategy = inject(LocationStrategy, { optional: true });\n\n /** A path within the application or an `https` address. */\n readonly url = input.required<string>();\n /** The text people read. */\n readonly label = input.required<string>();\n\n readonly target = computed(() => nhAssistantLinkTarget(this.url(), this.router, this.locationStrategy));\n\n open(event: MouseEvent, target: NhAssistantSubjectTarget): void {\n nhAssistantOpenLink(event, target, this.router);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { ApprovalPart, ConnectionRequiredPart, FilePart, MessagePart, QuestionPart, TextPart, ToolCallPart } from '../models/assistant-api.models';\n\n/**\n * A message part as the thread renders it: consecutive tool calls form one group, and so do\n * consecutive attached files.\n */\nexport type NhAssistantPartGroup =\n | { kind: 'text'; key: string; part: TextPart }\n | { kind: 'approval'; key: string; part: ApprovalPart }\n | { kind: 'question'; key: string; part: QuestionPart }\n | { kind: 'connection'; key: string; part: ConnectionRequiredPart }\n | { kind: 'tools'; key: string; calls: ToolCallPart[] }\n | { kind: 'files'; key: string; files: FilePart[] };\n\n/**\n * Groups consecutive tool calls of a message, and consecutive files. Text and approvals break a\n * group, so an approval always stays visible. A tool group's key is its first invocation id, so it\n * keeps its identity while later calls of the same run are appended.\n */\nexport function groupNhAssistantParts(parts: readonly MessagePart[]): NhAssistantPartGroup[] {\n const groups: NhAssistantPartGroup[] = [];\n let tools: { kind: 'tools'; key: string; calls: ToolCallPart[] } | null = null;\n let files: { kind: 'files'; key: string; files: FilePart[] } | null = null;\n\n parts.forEach((part, index) => {\n if (part.type === 'tool-call') {\n files = null;\n if (!tools) {\n tools = { kind: 'tools', key: `tools:${part.invocationId}`, calls: [] };\n groups.push(tools);\n }\n tools.calls.push(part);\n return;\n }\n\n tools = null;\n if (part.type === 'file') {\n if (!files) {\n files = { kind: 'files', key: `files:${index}`, files: [] };\n groups.push(files);\n }\n files.files.push(part);\n return;\n }\n\n files = null;\n if (part.type === 'approval') {\n groups.push({ kind: 'approval', key: `approval:${part.approvalId}`, part });\n } else if (part.type === 'question') {\n groups.push({ kind: 'question', key: `question:${part.questionId}`, part });\n } else if (part.type === 'connection-required') {\n groups.push({ kind: 'connection', key: `connection:${part.serverId}:${index}`, part });\n } else {\n groups.push({ kind: 'text', key: `text:${index}`, part });\n }\n });\n\n return groups;\n}\n\n/** Pure, so the groups are only rebuilt when the reducer replaces a message's parts. */\n@Pipe({ name: 'nhAssistantPartGroups', standalone: true })\nexport class NhAssistantPartGroupsPipe implements PipeTransform {\n transform(parts: readonly MessagePart[]): NhAssistantPartGroup[] {\n return groupNhAssistantParts(parts);\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n inject,\n input,\n linkedSignal,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Observable, Subscription, forkJoin, map } from 'rxjs';\nimport {\n AgentFeedbackOutcome,\n AgentProposalFeedback,\n AgentProposalFeedbackCategory,\n NH_ASSISTANT_FEEDBACK_CATEGORIES,\n NH_ASSISTANT_MAX_BULK_FEEDBACK,\n NH_ASSISTANT_MAX_FEEDBACK_TEXT\n} from '../../models/assistant-agent-run.models';\nimport { nhAssistantErrorKeys, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantAgentRunApiService } from '../../services/nh-assistant-agent-run-api.service';\nimport { nhAssistantErrorMessageKey } from '../../services/nh-assistant-transport';\nimport type { NhAssistantError } from '../../services/nh-assistant.store';\n\n/** What `nh-assistant-proposal-feedback` stored. */\nexport interface NhAssistantProposalFeedbackSaved {\n /** The proposals whose feedback the server stored. */\n approvalIds: string[];\n category: AgentProposalFeedbackCategory;\n text: string | null;\n}\n\nconst notAcceptedCode = 'assistant-feedback-not-accepted';\n\nlet nextId = 0;\n\n/**\n * Asks, after a rejection, what was wrong with one or more agent proposals: a category from a fixed\n * set and an optional text. It is optional and never blocks the decision; people skip it with one\n * action. One proposal is sent with `PUT approvals/{id}/feedback`, several rejected together with\n * `POST approvals/feedback` as bulk feedback. With `initial` it changes the caller's own feedback.\n * After saving it thanks the person in place of the form; hosts remove it after `dismissed`.\n */\n@Component({\n selector: 'nh-assistant-proposal-feedback',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-proposal-feedback.component.html',\n styleUrl: './nh-assistant-proposal-feedback.component.scss'\n})\nexport class NhAssistantProposalFeedbackComponent {\n private readonly api = inject(NhAssistantAgentRunApiService);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n private readonly thanks = viewChild<ElementRef<HTMLElement>>('thanks');\n private subscription?: Subscription;\n\n /** The proposals the feedback is about; several when they were rejected together. */\n readonly approvalIds = input.required<readonly string[]>();\n /** The caller's current feedback, to change it; `null` for new feedback. */\n readonly initial = input<AgentProposalFeedback | null>(null);\n /** Emits after the server stored the feedback. */\n readonly saved = output<NhAssistantProposalFeedbackSaved>();\n /** Emits when the person skips the question. */\n readonly dismissed = output<void>();\n\n readonly id = `nh-assistant-proposal-feedback-${nextId++}`;\n readonly categories = NH_ASSISTANT_FEEDBACK_CATEGORIES;\n readonly maxText = NH_ASSISTANT_MAX_FEEDBACK_TEXT;\n\n /** A new question when the host passes other proposals or other initial feedback. */\n private readonly question = computed(() => ({ approvalIds: this.approvalIds(), initial: this.initial() }));\n\n readonly category = linkedSignal<AgentProposalFeedbackCategory | null>(() => this.question().initial?.category ?? null);\n readonly text = linkedSignal(() => this.question().initial?.text ?? '');\n readonly busy = signal(false);\n readonly done = linkedSignal({ source: this.question, computation: () => false });\n /** Set when a bulk request stored the feedback for only part of the proposals. */\n readonly partial = linkedSignal<unknown, { stored: number; total: number } | null>({\n source: this.question,\n computation: () => null\n });\n readonly error = linkedSignal<unknown, NhAssistantError | null>({ source: this.question, computation: () => null });\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n readonly count = computed(() => new Set(this.approvalIds()).size);\n readonly textLength = computed(() => this.text().length);\n readonly tooLong = computed(() => this.textLength() > this.maxText);\n readonly canSend = computed(() => this.category() !== null && this.count() > 0 && !this.busy() && !this.tooLong());\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());\n }\n\n choose(category: AgentProposalFeedbackCategory): void {\n this.category.set(category);\n this.error.set(null);\n }\n\n onText(event: Event): void {\n this.text.set((event.target as HTMLTextAreaElement).value);\n }\n\n dismiss(): void {\n this.subscription?.unsubscribe();\n this.busy.set(false);\n this.dismissed.emit();\n }\n\n send(): void {\n const category = this.category();\n if (!this.canSend() || category === null) {\n return;\n }\n\n const approvalIds = [...new Set(this.approvalIds())];\n const text = this.text().trim() || null;\n this.busy.set(true);\n this.error.set(null);\n this.subscription?.unsubscribe();\n this.subscription = this.request(approvalIds, category, text).subscribe({\n next: outcomes => {\n this.busy.set(false);\n const stored = outcomes.filter(outcome => outcome.succeeded).map(outcome => outcome.approvalId);\n if (stored.length === 0) {\n const code = outcomes.find(outcome => outcome.code)?.code ?? notAcceptedCode;\n this.error.set({ code, messageKey: nhAssistantErrorMessageKey(code) });\n return;\n }\n\n // The form disappears; keep keyboard focus on the confirmation instead of losing it.\n const focused = this.host.nativeElement.contains(this.document.activeElement);\n this.partial.set(stored.length < approvalIds.length ? { stored: stored.length, total: approvalIds.length } : null);\n this.done.set(true);\n if (focused) {\n afterNextRender(() => this.thanks()?.nativeElement.focus(), { injector: this.injector });\n }\n this.saved.emit({ approvalIds: stored, category, text });\n },\n error: failure => {\n this.busy.set(false);\n this.error.set(toNhAssistantError(failure));\n }\n });\n }\n\n /** One proposal through its own endpoint; several in requests of at most the bulk limit. */\n private request(\n approvalIds: string[],\n category: AgentProposalFeedbackCategory,\n text: string | null\n ): Observable<AgentFeedbackOutcome[]> {\n if (approvalIds.length === 1) {\n const [approvalId] = approvalIds;\n return this.api.giveFeedback(approvalId, category, text).pipe(\n map(() => [{ approvalId, succeeded: true, code: null }])\n );\n }\n\n const chunks: string[][] = [];\n for (let index = 0; index < approvalIds.length; index += NH_ASSISTANT_MAX_BULK_FEEDBACK) {\n chunks.push(approvalIds.slice(index, index + NH_ASSISTANT_MAX_BULK_FEEDBACK));\n }\n return forkJoin(chunks.map(chunk => this.api.giveFeedbackMany(chunk, category, text))).pipe(\n map(responses => responses.flatMap(response => response.results))\n );\n }\n}\n","@if (done()) {\n <div class=\"feedback done\" role=\"status\" tabindex=\"-1\" #thanks>\n <p class=\"thanks\"><nh-assistant-icon name=\"check\" />{{ 'nh-assistant.proposal-feedback.thanks' | translate }}</p>\n @if (partial(); as stored) {\n <p class=\"scope\">{{ 'nh-assistant.proposal-feedback.partial' | translate: { stored: stored.stored, total: stored.total } }}</p>\n }\n </div>\n} @else {\n <form class=\"feedback\" [attr.aria-busy]=\"busy()\" (submit)=\"$event.preventDefault(); send()\">\n <fieldset class=\"categories\" [disabled]=\"busy()\">\n <legend>{{ 'nh-assistant.proposal-feedback.legend' | translate }}</legend>\n @if (count() > 1) {\n <p class=\"scope\">{{ 'nh-assistant.proposal-feedback.bulk' | translate: { count: count() } }}</p>\n }\n <div class=\"chips\">\n @for (option of categories; track option) {\n <label class=\"chip\" [class.selected]=\"category() === option\">\n <input\n type=\"radio\"\n [name]=\"id + '-category'\"\n [value]=\"option\"\n [checked]=\"category() === option\"\n [attr.aria-describedby]=\"id + '-hint-' + option\"\n (change)=\"choose(option)\" />\n @if (category() === option) {\n <nh-assistant-icon name=\"check\" />\n }\n <span>{{ 'nh-assistant.proposal-feedback.categories.' + option | translate }}</span>\n </label>\n }\n </div>\n @for (option of categories; track option) {\n <span class=\"visually-hidden\" [id]=\"id + '-hint-' + option\">{{ 'nh-assistant.proposal-feedback.hints.' + option | translate }}</span>\n }\n @if (category(); as selected) {\n <p class=\"selected-hint\" aria-hidden=\"true\">{{ 'nh-assistant.proposal-feedback.hints.' + selected | translate }}</p>\n }\n\n <div class=\"field\">\n <label [for]=\"id + '-text'\">{{ 'nh-assistant.proposal-feedback.text-label' | translate }}</label>\n <textarea\n rows=\"2\"\n [id]=\"id + '-text'\"\n [attr.maxlength]=\"maxText\"\n [value]=\"text()\"\n [attr.aria-describedby]=\"id + '-text-hint'\"\n [attr.aria-invalid]=\"tooLong() ? true : null\"\n (input)=\"onText($event)\"></textarea>\n <p class=\"hint\" [id]=\"id + '-text-hint'\">\n <span>{{ 'nh-assistant.proposal-feedback.text-hint' | translate }}</span>\n <span class=\"counter\" [class.error-text]=\"tooLong()\">\n {{ 'nh-assistant.proposal-feedback.characters' | translate: { count: textLength(), max: maxText } }}\n </span>\n </p>\n </div>\n </fieldset>\n\n @if (error(); as failure) {\n <p class=\"message error\" role=\"alert\"><nh-assistant-icon name=\"warning\" />{{ errorKeys() | nhAssistantTranslate: failure.code }}</p>\n }\n\n <div class=\"actions\">\n <button class=\"text-button\" type=\"button\" (click)=\"dismiss()\">\n {{ (initial() ? 'nh-assistant.proposal-feedback.cancel' : 'nh-assistant.proposal-feedback.skip') | translate }}\n </button>\n <button class=\"primary\" type=\"submit\" [disabled]=\"!canSend()\">\n {{ (busy() ? 'nh-assistant.proposal-feedback.sending' : 'nh-assistant.proposal-feedback.send') | translate }}\n </button>\n </div>\n </form>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ApprovalDecision, ApprovalPart, ApprovalResolution } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantStore, type NhAssistantApprovalWaitingFor } from '../../services/nh-assistant.store';\nimport { NhAssistantProposalFeedbackComponent } from '../proposal-feedback/nh-assistant-proposal-feedback.component';\n\nlet nextId = 0;\n\n/** Formats remaining milliseconds as `m:ss`, or `h:mm:ss` above one hour. */\nexport function formatNhAssistantCountdown(milliseconds: number): string {\n const totalSeconds = Math.max(0, Math.ceil(milliseconds / 1000));\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const paddedSeconds = seconds.toString().padStart(2, '0');\n\n return hours > 0\n ? `${hours}:${minutes.toString().padStart(2, '0')}:${paddedSeconds}`\n : `${minutes}:${paddedSeconds}`;\n}\n\n/**\n * Asks the user to approve or reject a proposed mutation. Shows the summary, targets,\n * proposed arguments and a countdown to expiry. A decision is emitted at most once until\n * the host reports that it is no longer deciding. After the user rejected an agent's proposal\n * (`canGiveFeedback`), a low-key action asks what was wrong. A proposal that closed because it no\n * longer fits shows why, such as \"Already done\", with the application's explanation. A proposal of\n * another agent the assistant consulted (`consultation`) names that agent and the subject, offers the\n * agent's answer and says that approving runs it with the user's own rights; with a\n * `consultation.leaveRoute` a third action leaves it for the subject's approvers (`leave`), after which\n * the card says that it waits for them. A proposal the user approved in their chat whose hand-off to the\n * application has an unknown outcome (`canResolve`) offers to hand it to the application again or to mark\n * it resolved (`resolve`).\n */\n@Component({\n selector: 'nh-assistant-approval-card',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent, NhAssistantProposalFeedbackComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-approval-card.component.html',\n styleUrl: './nh-assistant-approval-card.component.scss',\n host: {\n '[attr.data-status]': 'shownStatus()'\n }\n})\nexport class NhAssistantApprovalCardComponent {\n /** Names the consulted agent as the status does; the card also works outside `provideNhAssistant`. */\n private readonly store = inject(NhAssistantStore, { optional: true });\n\n readonly approval = input.required<ApprovalPart>();\n /** True while the host submits a decision; disables both buttons. */\n readonly deciding = input(false);\n /**\n * False when the current user may not decide: in a chat the approval belongs to another\n * participant's turn, in an agent thread the user is no approver of the proposal.\n */\n readonly canDecide = input(true);\n /** Name of the participant who decides a `turn` approval, shown when the current user cannot. */\n readonly decisionOwner = input<string | null>(null);\n /**\n * Who decides when the current user cannot: the author of the turn (`turn`, the default), an\n * approver of the agent thread's subject (`approver`), or another approver because the current\n * user started the work (`other-approver`).\n */\n readonly waitingFor = input<NhAssistantApprovalWaitingFor>('turn');\n /**\n * True when the current user rejected this agent proposal and may say what was wrong, for example\n * from `NhAssistantStore.approvalRights`. Chat approvals never offer feedback.\n */\n readonly canGiveFeedback = input(false);\n readonly decide = output<ApprovalDecision>();\n /** How the user resolves an uncertain execution they approved in this chat (`canResolve`). */\n readonly resolve = output<ApprovalResolution>();\n\n private readonly now = signal(Date.now());\n private readonly submitted = signal(false);\n /** The decision this card sent last, so a proposal left for the approvers reads as such at once. */\n private readonly chosen = signal<ApprovalDecision | null>(null);\n /** The feedback question is expanded. */\n readonly feedbackOpen = signal(false);\n /** The feedback was stored; the question thanks the person and the action disappears. */\n readonly feedbackSaved = signal(false);\n private readonly feedbackToggle = viewChild<ElementRef<HTMLButtonElement>>('feedbackToggle');\n\n readonly remainingMs = computed(() => Date.parse(this.approval().expiresAt) - this.now());\n readonly expired = computed(() => this.approval().status === 'expired' ||\n (this.approval().status === 'pending' && this.remainingMs() <= 0));\n readonly effectiveStatus = computed(() => this.expired() ? 'expired' : this.approval().status);\n /** Where a consulted agent's proposal comes from; `null` for the conversation's own proposals. */\n readonly consultation = computed(() => this.approval().consultation ?? null);\n /**\n * The translation keys of the consulted agent's name: the name the assistant's status gives it,\n * then the convention `nh-assistant.agents.{id}.name`; the id when neither translates.\n */\n readonly consultedAgentKeys = computed(() => {\n const consultation = this.consultation();\n if (!consultation) {\n return [];\n }\n\n const convention = `nh-assistant.agents.${consultation.agentId}.name`;\n const known = this.store?.agents().find(agent => agent.id === consultation.agentId)?.displayNameKey;\n return known && known !== convention ? [known, convention] : [convention];\n });\n /** The subject the consulted agent was asked about, by name or else by id. */\n readonly consultedSubject = computed(() => {\n const consultation = this.consultation();\n return consultation ? consultation.subjectDisplayName ?? consultation.subjectId : null;\n });\n /**\n * The user left the consulted agent's proposal for the subject's approvers: the server names the\n * proposal that waits there, or this card just sent the decision and it was accepted.\n */\n readonly leftForApprovers = computed(() => {\n const consultation = this.consultation();\n return consultation !== null\n && (!!consultation.movedToApprovalId || (this.chosen() === 'leave' && this.approval().status !== 'pending'));\n });\n /** The status the card shows: `moved` for a proposal left for the subject's approvers. */\n readonly shownStatus = computed(() => this.leftForApprovers() ? 'moved' : this.effectiveStatus());\n /**\n * Translation key of the status: the kind of a stale proposal, \"replaced\" for a superseded one,\n * \"left for approvers\" for a consulted agent's proposal the user left, otherwise the status itself.\n */\n readonly statusKey = computed(() => {\n if (this.leftForApprovers()) {\n return 'nh-assistant.approval.consultation.moved-status';\n }\n\n const kind = this.approval().staleKind;\n if (this.effectiveStatus() === 'stale' && kind) {\n return `nh-assistant.approval.stale-kind.${kind}`;\n }\n\n return this.effectiveStatus() === 'withdrawn' && this.approval().supersededByApprovalId\n ? 'nh-assistant.approval.superseded'\n : `nh-assistant.approval.status.${this.effectiveStatus()}`;\n });\n /** Why the agent's rules proposed it; model proposals have none. */\n readonly rationale = computed(() => this.approval().rationale ?? null);\n /** The application's explanation of a stale proposal, such as who already did the work. */\n readonly staleExplanation = computed(() =>\n this.effectiveStatus() === 'stale' ? this.approval().staleExplanation ?? null : null);\n readonly actionable = computed(() => this.effectiveStatus() === 'pending');\n readonly succeeded = computed(() =>\n ['approved', 'executing', 'awaiting-application', 'executed', 'resolved'].includes(this.effectiveStatus()));\n readonly disabled = computed(() => !this.actionable() || !this.canDecide() || this.deciding() || this.submitted());\n /** The route at the subject the pending proposal may be left for; `null` when it can only be approved or rejected. */\n readonly leaveRoute = computed(() => this.actionable() ? this.consultation()?.leaveRoute ?? null : null);\n readonly leaveHintId = `nh-assistant-approval-leave-${nextId++}`;\n /** The user may resolve this uncertain hand-off: the server says so for the person who approved it. */\n readonly resolvable = computed(() => this.approval().canResolve === true && this.effectiveStatus() === 'execution-unknown');\n readonly resolveDisabled = computed(() => !this.resolvable() || this.deciding() || this.resolving());\n readonly resolveHintId = `nh-assistant-approval-resolve-${nextId++}`;\n private readonly resolving = signal(false);\n readonly countdown = computed(() => formatNhAssistantCountdown(this.remainingMs()));\n readonly presentedSummary = computed(() => this.approval().presentation?.summary ?? null);\n readonly feedbackAvailable = computed(() => this.canGiveFeedback() && this.effectiveStatus() === 'rejected');\n readonly feedbackIds = computed(() => [this.approval().approvalId]);\n readonly feedbackPanelId = `nh-assistant-approval-feedback-${nextId++}`;\n /** Translation key of the text shown instead of the buttons when the current user cannot decide. */\n readonly waitingKey = computed(() => {\n switch (this.waitingFor()) {\n case 'approver':\n return 'nh-assistant.approval.waiting-for-approver';\n case 'other-approver':\n return 'nh-assistant.approval.waiting-for-other-approver';\n case 'asker':\n return 'nh-assistant.approval.waiting-for-asker';\n default:\n return this.decisionOwner() ? 'nh-assistant.approval.waiting-for' : 'nh-assistant.approval.waiting-for-participant';\n }\n });\n\n constructor() {\n // Tick only while the approval is pending and not yet expired.\n effect(onCleanup => {\n if (this.approval().status !== 'pending') {\n return;\n }\n\n const expiresAt = Date.parse(this.approval().expiresAt);\n const timer = setInterval(() => {\n this.now.set(Date.now());\n if (Date.now() >= expiresAt) {\n clearInterval(timer);\n }\n }, 1000);\n onCleanup(() => clearInterval(timer));\n });\n\n // Allow a new attempt once the host finished deciding and the approval is still pending.\n effect(() => {\n if (!this.deciding() && this.approval().status === 'pending') {\n this.submitted.set(false);\n }\n });\n\n // Allow another resolution once the host finished and the outcome is still unknown.\n effect(() => {\n if (!this.deciding() && this.approval().status === 'execution-unknown') {\n this.resolving.set(false);\n }\n });\n }\n\n /** Emits a resolution of an uncertain hand-off, at most once until the host reports it is done. */\n chooseResolution(resolution: ApprovalResolution): void {\n if (this.resolveDisabled()) {\n return;\n }\n\n this.resolving.set(true);\n this.resolve.emit(resolution);\n }\n\n /** Emits a decision; `leave` only for a consulted agent's proposal with a route at the subject. */\n choose(decision: ApprovalDecision): void {\n if (this.disabled() || (decision === 'leave' && this.leaveRoute() === null)) {\n return;\n }\n\n this.submitted.set(true);\n this.chosen.set(decision);\n this.decide.emit(decision);\n }\n\n toggleFeedback(): void {\n this.feedbackOpen.update(open => !open);\n }\n\n onFeedbackSaved(): void {\n this.feedbackSaved.set(true);\n }\n\n /** Collapses the question and returns focus to the action that opened it. */\n onFeedbackDismissed(): void {\n this.feedbackOpen.set(false);\n this.feedbackToggle()?.nativeElement.focus();\n }\n}\n","<section class=\"card\" [attr.aria-label]=\"'nh-assistant.approval.title' | translate\">\n <header class=\"header\">\n <nh-assistant-icon [name]=\"leftForApprovers() ? 'users' : actionable() ? 'warning' : succeeded() ? 'check' : 'x'\" />\n <h3>{{ 'nh-assistant.approval.title' | translate }}</h3>\n <span class=\"status\">{{ statusKey() | translate }}</span>\n </header>\n\n @if (staleExplanation(); as explanation) {\n <p class=\"stale-explanation\">{{ explanation }}</p>\n }\n\n <!-- Another agent the assistant consulted proposes this; the person who asked decides it here. -->\n @if (consultation(); as origin) {\n <p class=\"consultation-origin\" data-consultation-origin>\n <nh-assistant-icon name=\"users\" />\n <span>{{ 'nh-assistant.approval.consultation.origin' | translate: { agent: (consultedAgentKeys() | nhAssistantTranslate: origin.agentId), subject: consultedSubject() } }}</span>\n </p>\n }\n\n @if (approval().presentation; as presentation) {\n <p class=\"tool-name\">{{ presentation.toolDisplayName }}</p>\n <p class=\"summary\">{{ presentation.summary }}</p>\n @if (presentation.fields.length > 0) {\n <dl class=\"presentation-fields\">\n @for (field of presentation.fields; track $index) {\n <div>\n <dt>{{ field.label }}</dt>\n <dd>{{ field.value }}</dd>\n </div>\n }\n </dl>\n }\n @if (presentation.notice) {\n <p class=\"notice\">{{ presentation.notice }}</p>\n }\n } @else {\n <p class=\"summary\">{{ 'nh-assistant.approval.fallback-summary' | translate }}</p>\n }\n\n @if (rationale(); as why) {\n <p class=\"rationale\">{{ 'nh-assistant.approval.rationale' | translate: { rationale: why } }}</p>\n }\n\n @if (consultation(); as origin) {\n @if (origin.answer) {\n <details class=\"consultation-answer\" data-consultation-answer>\n <summary>{{ 'nh-assistant.approval.consultation.answer' | translate: { agent: (consultedAgentKeys() | nhAssistantTranslate: origin.agentId) } }}</summary>\n <p>{{ origin.answer }}</p>\n </details>\n }\n @if (leftForApprovers()) {\n <p class=\"consultation-moved\" role=\"status\" data-consultation-moved>\n <nh-assistant-icon name=\"users\" />\n <span>{{ 'nh-assistant.approval.consultation.moved' | translate: { subject: consultedSubject() } }}</span>\n </p>\n }\n }\n\n <details class=\"technical-details\">\n <summary>{{ 'nh-assistant.approval.technical-details' | translate }}</summary>\n <p class=\"label\">{{ 'nh-assistant.approval.tool-id' | translate }}</p>\n <code>{{ approval().toolId }}</code>\n @if (approval().targets.length > 0) {\n <p class=\"label\">{{ 'nh-assistant.approval.targets' | translate }}</p>\n <ul class=\"targets\">\n @for (target of approval().targets; track $index) {\n <li>{{ target }}</li>\n }\n </ul>\n }\n @if (approval().argumentsPreview) {\n <p class=\"label\">{{ 'nh-assistant.approval.arguments' | translate }}</p>\n <pre>{{ approval().argumentsPreview }}</pre>\n }\n </details>\n\n @if (actionable() && !canDecide()) {\n <p class=\"waiting-for-other\" role=\"status\">\n <nh-assistant-icon name=\"users\" />\n {{ waitingKey() | translate: { name: decisionOwner() } }}\n </p>\n } @else if (actionable()) {\n @if (consultation()) {\n <p class=\"consultation-rights\" data-consultation-rights>{{ 'nh-assistant.approval.consultation.own-rights' | translate }}</p>\n }\n <p class=\"expiry\" aria-live=\"off\">\n <nh-assistant-icon name=\"clock\" />\n {{ 'nh-assistant.approval.expires-in' | translate: { time: countdown() } }}\n </p>\n <div class=\"actions\">\n <button\n class=\"reject\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.approval.reject-label' | translate: { summary: presentedSummary() ?? ('nh-assistant.approval.fallback-summary' | translate) }\"\n (click)=\"choose('reject')\">\n {{ 'nh-assistant.approval.reject' | translate }}\n </button>\n <button\n class=\"approve\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.approval.approve-label' | translate: { summary: presentedSummary() ?? ('nh-assistant.approval.fallback-summary' | translate) }\"\n (click)=\"choose('approve')\">\n {{ 'nh-assistant.approval.approve' | translate }}\n </button>\n </div>\n <!-- The person may leave a consulted agent's proposal for the subject's approvers instead. -->\n @if (leaveRoute(); as route) {\n <div class=\"leave-for-approvers\">\n <p class=\"leave-explanation\" [id]=\"leaveHintId\">{{ 'nh-assistant.approval.consultation.leave-explain.' + route | translate: { subject: consultedSubject() } }}</p>\n <button\n class=\"leave\"\n type=\"button\"\n data-leave\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.approval.consultation.leave-label' | translate: { summary: presentedSummary() ?? ('nh-assistant.approval.fallback-summary' | translate) }\"\n [attr.aria-describedby]=\"leaveHintId\"\n (click)=\"choose('leave')\">\n {{ 'nh-assistant.approval.consultation.leave' | translate }}\n </button>\n </div>\n }\n @if (deciding()) {\n <p class=\"deciding\" role=\"status\">{{ 'nh-assistant.approval.deciding' | translate }}</p>\n }\n } @else if (expired()) {\n <p class=\"expiry\">{{ 'nh-assistant.approval.expired' | translate }}</p>\n }\n\n <!-- The user approved it in this chat and whether the application took it is unknown. -->\n @if (resolvable()) {\n <div class=\"resolve\" data-resolve>\n <p class=\"resolve-explanation\" [id]=\"resolveHintId\">{{ 'nh-assistant.approval.resolve.explanation' | translate }}</p>\n <div class=\"actions\">\n <button\n class=\"mark-resolved\"\n type=\"button\"\n data-mark-resolved\n [disabled]=\"resolveDisabled()\"\n [attr.aria-describedby]=\"resolveHintId\"\n (click)=\"chooseResolution('mark-resolved')\">\n {{ 'nh-assistant.approval.resolve.mark-resolved' | translate }}\n </button>\n <button\n class=\"hand-again\"\n type=\"button\"\n data-hand-to-application\n [disabled]=\"resolveDisabled()\"\n [attr.aria-describedby]=\"resolveHintId\"\n (click)=\"chooseResolution('hand-to-application')\">\n {{ 'nh-assistant.approval.resolve.hand-to-application' | translate }}\n </button>\n </div>\n @if (deciding()) {\n <p class=\"deciding\" role=\"status\">{{ 'nh-assistant.approval.resolve.resolving' | translate }}</p>\n }\n </div>\n }\n\n @if (feedbackAvailable()) {\n @if (!feedbackSaved()) {\n <button\n #feedbackToggle\n class=\"feedback-toggle\"\n type=\"button\"\n [attr.aria-expanded]=\"feedbackOpen()\"\n [attr.aria-controls]=\"feedbackOpen() ? feedbackPanelId : null\"\n (click)=\"toggleFeedback()\">\n {{ 'nh-assistant.approval.give-feedback' | translate }}\n </button>\n }\n @if (feedbackOpen()) {\n <nh-assistant-proposal-feedback\n class=\"feedback\"\n [attr.id]=\"feedbackPanelId\"\n [approvalIds]=\"feedbackIds()\"\n (saved)=\"onFeedbackSaved()\"\n (dismissed)=\"onFeedbackDismissed()\" />\n }\n }\n</section>\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, effect, inject, input, output, signal, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Subscription } from 'rxjs';\nimport { ConnectionRequiredPart } from '../../models/assistant-api.models';\nimport { nhAssistantErrorKeys, nhAssistantErrorOf, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantMcpConnectService, NhAssistantMcpReturnOutcome } from '../../services/nh-assistant-mcp-connect.service';\nimport { NhAssistantError } from '../../services/nh-assistant.store';\n\nlet nextId = 0;\n\n/**\n * The card of a turn that went on without an MCP server the person who asked has to connect. It\n * connects the viewer's own account, in a popup or by redirect as the host configured, and then\n * offers to ask again. After a redirect the page returns to, the card of that server shows how the\n * connection ended: connected, or the failure with its translated code.\n */\n@Component({\n selector: 'nh-assistant-connection-required',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-connection-required.component.html',\n styleUrl: './nh-assistant-connection-required.component.scss',\n host: { '[attr.data-state]': 'state()' }\n})\nexport class NhAssistantConnectionRequiredComponent {\n private readonly connections = inject(NhAssistantMcpConnectService);\n private subscription?: Subscription;\n\n readonly part = input.required<ConnectionRequiredPart>();\n /** Whether \"Ask again\" is offered once the account is connected. */\n readonly canRetry = input(true);\n /** Asks the question of the turn again after the account was connected. */\n readonly retry = output<void>();\n\n readonly id = `nh-assistant-connection-${nextId++}`;\n readonly state = signal<'idle' | 'connecting' | 'connected' | 'failed'>('idle');\n /** Why connecting failed, as a code and translation key. */\n readonly error = signal<NhAssistantError | null>(null);\n /** The code of `error`. */\n readonly errorCode = computed(() => this.error()?.code ?? null);\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n /** The connect button names connecting again when the person had connected before. */\n readonly again = computed(() => this.part().reason !== 'not-connected');\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());\n // The page returned from connecting this card's server in redirect mode.\n effect(() => {\n const returned = this.connections.returned();\n const serverId = this.part().serverId;\n if (returned && serverOf(returned) === serverId) {\n untracked(() => this.showReturned(returned));\n }\n });\n }\n\n connect(): void {\n if (this.state() === 'connecting') {\n return;\n }\n this.state.set('connecting');\n this.error.set(null);\n this.subscription?.unsubscribe();\n this.subscription = this.connections.connect(this.part().serverId).subscribe({\n next: () => this.state.set('connected'),\n error: (error: unknown) => {\n this.state.set('failed');\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n private showReturned(returned: NhAssistantMcpReturnOutcome): void {\n if (this.state() === 'connecting') {\n return;\n }\n if (returned.completion) {\n this.state.set('connected');\n this.error.set(null);\n return;\n }\n\n this.state.set('failed');\n this.error.set(nhAssistantErrorOf(returned.code));\n }\n}\n\n/** The server a returned outcome belongs to: the connected one, or the one the page left for. */\nfunction serverOf(returned: NhAssistantMcpReturnOutcome): string | null {\n return returned.completion?.serverId ?? returned.serverId ?? null;\n}\n","<section class=\"card\" role=\"group\" [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"state() === 'connecting'\">\n <div class=\"header\">\n <nh-assistant-icon [name]=\"state() === 'connected' ? 'check' : 'link'\" />\n <h3 [id]=\"id + '-title'\">{{ 'nh-assistant.connection.title' | translate: { name: part().displayName } }}</h3>\n </div>\n <p class=\"text\">{{ 'nh-assistant.connection.' + part().reason | translate: { name: part().displayName } }}</p>\n\n <div class=\"actions\" aria-live=\"polite\">\n @switch (state()) {\n @case ('connected') {\n <p class=\"done\" role=\"status\"><nh-assistant-icon name=\"check\" />{{ 'nh-assistant.connection.connected' | translate: { name: part().displayName } }}</p>\n @if (canRetry()) {\n <button class=\"primary\" type=\"button\" (click)=\"retry.emit()\">{{ 'nh-assistant.connection.retry' | translate }}</button>\n }\n }\n @case ('connecting') {\n <button class=\"primary\" type=\"button\" disabled>{{ 'nh-assistant.connection.connecting' | translate }}</button>\n }\n @default {\n <button class=\"primary\" type=\"button\" (click)=\"connect()\">\n {{ (again() ? 'nh-assistant.connection.connect-again' : 'nh-assistant.connection.connect') | translate }}\n </button>\n }\n }\n </div>\n\n @if (error(); as failure) {\n <p class=\"error\" role=\"alert\" data-connection-error><nh-assistant-icon name=\"warning\" />{{ errorKeys() | nhAssistantTranslate: failure.code }}</p>\n }\n</section>\n","import { ChangeDetectionStrategy, Component, computed, effect, input, output, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { QuestionPart, QuestionStatus } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent, NhAssistantIconName } from '../../internal/nh-assistant-icon.component';\nimport { formatNhAssistantCountdown } from '../approval-card/nh-assistant-approval-card.component';\n\nlet nextId = 0;\n\nconst statusIcons: Record<QuestionStatus, NhAssistantIconName> = {\n pending: 'clock',\n answered: 'check',\n expired: 'x',\n cancelled: 'stop'\n};\n\n/**\n * A question the agent asked with `ask_question`: the question with one button per choice for the\n * person it is addressed to (`canAnswer`), and read-only for everyone else, who sees whom it waits\n * for. It counts down to the end of its wait. Once answered it marks the chosen answer; an expired or\n * cancelled question says so. An answer is emitted at most once until the host reports that it is no\n * longer answering.\n */\n@Component({\n selector: 'nh-assistant-question-card',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-question-card.component.html',\n styleUrl: './nh-assistant-question-card.component.scss',\n host: {\n '[attr.data-status]': 'effectiveStatus()'\n }\n})\nexport class NhAssistantQuestionCardComponent {\n readonly question = input.required<QuestionPart>();\n /** True when the current user is the addressee and may answer, for example `NhAssistantStore.canAnswer`. */\n readonly canAnswer = input(false);\n /** Name of the person the question is addressed to, shown to everyone else; `null` when unknown. */\n readonly addresseeName = input<string | null>(null);\n /** True while the host submits an answer; disables the choices. */\n readonly answering = input(false);\n /** The zero-based index of the chosen answer. */\n readonly answer = output<number>();\n\n readonly questionId = `nh-assistant-question-${nextId++}`;\n private readonly now = signal(Date.now());\n private readonly submitted = signal(false);\n\n readonly remainingMs = computed(() => Date.parse(this.question().expiresAt) - this.now());\n /** A pending question whose wait ended reads as expired before the server says so. */\n readonly effectiveStatus = computed<QuestionStatus>(() =>\n this.question().status === 'pending' && this.remainingMs() <= 0 ? 'expired' : this.question().status);\n readonly actionable = computed(() => this.effectiveStatus() === 'pending');\n readonly statusIcon = computed(() => statusIcons[this.effectiveStatus()]);\n readonly disabled = computed(() => !this.actionable() || !this.canAnswer() || this.answering() || this.submitted());\n readonly chosen = computed(() => this.question().answerIndex ?? null);\n readonly chosenText = computed(() => {\n const index = this.chosen();\n return index === null ? null : this.question().choices[index] ?? null;\n });\n readonly countdown = computed(() => formatNhAssistantCountdown(this.remainingMs()));\n\n constructor() {\n // Tick only while the question waits.\n effect(onCleanup => {\n if (this.question().status !== 'pending') {\n return;\n }\n\n const expiresAt = Date.parse(this.question().expiresAt);\n const timer = setInterval(() => {\n this.now.set(Date.now());\n if (Date.now() >= expiresAt) {\n clearInterval(timer);\n }\n }, 1000);\n onCleanup(() => clearInterval(timer));\n });\n\n // Allow another attempt once the host finished and the question still waits.\n effect(() => {\n if (!this.answering() && this.question().status === 'pending') {\n this.submitted.set(false);\n }\n });\n }\n\n /** Emits the chosen answer once. */\n choose(index: number): void {\n if (this.disabled() || index < 0 || index >= this.question().choices.length) {\n return;\n }\n\n this.submitted.set(true);\n this.answer.emit(index);\n }\n}\n","<section class=\"card\" [attr.aria-labelledby]=\"questionId\">\n <header class=\"header\">\n <nh-assistant-icon [name]=\"statusIcon()\" />\n <h3>{{ 'nh-assistant.question.title' | translate }}</h3>\n <span class=\"status\">{{ 'nh-assistant.question.status.' + effectiveStatus() | translate }}</span>\n </header>\n\n <p class=\"question\" [id]=\"questionId\">{{ question().question }}</p>\n\n @if (actionable() && canAnswer()) {\n <div class=\"choices\" role=\"group\" [attr.aria-labelledby]=\"questionId\">\n @for (choice of question().choices; track $index) {\n <button\n class=\"choice\"\n type=\"button\"\n data-choice\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.question.choose-label' | translate: { choice }\"\n (click)=\"choose($index)\">\n {{ choice }}\n </button>\n }\n </div>\n <p class=\"expiry\" aria-live=\"off\">\n <nh-assistant-icon name=\"clock\" />\n {{ 'nh-assistant.question.expires-in' | translate: { time: countdown() } }}\n </p>\n @if (answering()) {\n <p class=\"answering\" role=\"status\">{{ 'nh-assistant.question.answering' | translate }}</p>\n }\n } @else {\n <ul class=\"choices read-only\" [attr.aria-label]=\"'nh-assistant.question.choices' | translate\">\n @for (choice of question().choices; track $index) {\n <li class=\"choice\" [attr.data-chosen]=\"$index === chosen() ? 'true' : null\">\n @if ($index === chosen()) {\n <nh-assistant-icon name=\"check\" />\n }\n <span>{{ choice }}</span>\n </li>\n }\n </ul>\n @switch (effectiveStatus()) {\n @case ('pending') {\n <p class=\"waiting-for-other\" role=\"status\" data-waiting-for>\n <nh-assistant-icon name=\"users\" />\n @if (addresseeName(); as name) {\n {{ 'nh-assistant.question.waiting-for' | translate: { name } }}\n } @else {\n {{ 'nh-assistant.question.waiting-for-participant' | translate }}\n }\n </p>\n }\n @case ('answered') {\n @if (chosenText(); as text) {\n <p class=\"outcome\" data-answer>{{ 'nh-assistant.question.answered' | translate: { choice: text } }}</p>\n }\n }\n @case ('expired') {\n <p class=\"outcome\">{{ 'nh-assistant.question.expired' | translate }}</p>\n }\n @case ('cancelled') {\n <p class=\"outcome\">{{ 'nh-assistant.question.cancelled' | translate }}</p>\n }\n }\n }\n</section>\n","import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ToolCallPart } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent, NhAssistantIconName } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\n\nlet nextId = 0;\n\nconst statusIcons: Record<ToolCallPart['status'], NhAssistantIconName> = {\n running: 'tool',\n succeeded: 'check',\n failed: 'warning',\n 'awaiting-approval': 'clock',\n // An ask_question call waits for the person it asked.\n 'awaiting-answer': 'clock',\n rejected: 'x',\n // Ended without running: its proposal expired, was withdrawn or became stale.\n 'not-executed': 'stop'\n};\n\n/** Shows one tool invocation with its status and expandable input and result previews. */\n@Component({\n selector: 'nh-assistant-tool-call-card',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-tool-call-card.component.html',\n styleUrl: './nh-assistant-tool-call-card.component.scss',\n host: {\n '[attr.data-status]': 'part().status'\n }\n})\nexport class NhAssistantToolCallCardComponent {\n readonly part = input.required<ToolCallPart>();\n\n readonly detailsId = `nh-assistant-tool-call-${nextId++}`;\n readonly expanded = signal(false);\n readonly statusIcon = computed(() => statusIcons[this.part().status]);\n readonly hasDetails = computed(() => !!this.part().toolId);\n\n toggle(): void {\n this.expanded.update(expanded => !expanded);\n }\n}\n","<article class=\"card\" [attr.aria-label]=\"'nh-assistant.tool-call.label' | translate: { name: part().displayName }\">\n <header class=\"header\">\n <span class=\"status-icon\" [class.spinning]=\"part().status === 'running'\">\n <nh-assistant-icon [name]=\"statusIcon()\" />\n </span>\n <span class=\"title\">{{ part().displayName }}</span>\n @if (part().grantSource; as grantSource) {\n <span class=\"grant\" [attr.title]=\"'nh-assistant.tool-call.grant-source.' + grantSource + '-hint' | translate\">\n {{ 'nh-assistant.tool-call.grant-source.' + grantSource | translate }}\n </span>\n }\n <span class=\"status\">{{ 'nh-assistant.tool-call.status.' + part().status | translate }}</span>\n @if (hasDetails()) {\n <button\n class=\"toggle\"\n type=\"button\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n [attr.aria-label]=\"(expanded() ? 'nh-assistant.tool-call.hide-details' : 'nh-assistant.tool-call.show-details') | translate\"\n [attr.title]=\"(expanded() ? 'nh-assistant.tool-call.hide-details' : 'nh-assistant.tool-call.show-details') | translate\"\n (click)=\"toggle()\">\n <nh-assistant-icon name=\"chevron-down\" [class.rotated]=\"expanded()\" />\n </button>\n }\n </header>\n\n @if (part().resultCode; as resultCode) {\n <p class=\"result-code\">\n {{ ['nh-assistant.result-codes.' + resultCode, 'nh-assistant.errors.' + resultCode] | nhAssistantTranslate: resultCode }}\n </p>\n }\n\n @if (hasDetails()) {\n <div class=\"details\" [id]=\"detailsId\" [hidden]=\"!expanded()\">\n <p class=\"label\">{{ 'nh-assistant.tool-call.tool-id' | translate }}</p>\n <code>{{ part().toolId }}</code>\n @if (part().argumentsPreview; as argumentsPreview) {\n <p class=\"label\">{{ 'nh-assistant.tool-call.arguments' | translate }}</p>\n <pre>{{ argumentsPreview }}</pre>\n }\n @if (part().resultPreview; as resultPreview) {\n <p class=\"label\">{{ 'nh-assistant.tool-call.result' | translate }}</p>\n <pre>{{ resultPreview }}</pre>\n } @else if (part().restricted) {\n <p class=\"label\">{{ 'nh-assistant.tool-call.result' | translate }}</p>\n <p class=\"restricted\">{{ 'nh-assistant.tool-call.restricted' | translate }}</p>\n }\n </div>\n }\n</article>\n","import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ToolCallPart } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent, NhAssistantIconName } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantToolCallCardComponent } from '../tool-call-card/nh-assistant-tool-call-card.component';\n\nlet nextId = 0;\n\n/**\n * Overall state of a run of tool calls, from most to least urgent. `not-executed` means that every\n * call finished and at least one ended without running, because its proposal expired, was\n * withdrawn or became stale. `awaiting-answer` waits for the answer to a question the agent asked.\n */\nexport type NhAssistantToolCallGroupState = 'awaiting-approval' | 'awaiting-answer' | 'running' | 'failed' | 'not-executed' | 'succeeded';\n\nconst stateIcons: Record<NhAssistantToolCallGroupState, NhAssistantIconName> = {\n 'awaiting-approval': 'clock',\n 'awaiting-answer': 'clock',\n running: 'tool',\n failed: 'warning',\n 'not-executed': 'stop',\n succeeded: 'check'\n};\n\n/**\n * Summarizes consecutive tool calls in one collapsed line that counts along live: the\n * tool that runs now while the assistant works, and how many tools were used and failed\n * afterwards. Expanding it shows every call as a card.\n */\n@Component({\n selector: 'nh-assistant-tool-call-group',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent, NhAssistantToolCallCardComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-tool-call-group.component.html',\n styleUrl: './nh-assistant-tool-call-group.component.scss',\n host: {\n '[attr.data-status]': 'state()'\n }\n})\nexport class NhAssistantToolCallGroupComponent {\n readonly calls = input.required<readonly ToolCallPart[]>();\n\n readonly callsId = `nh-assistant-tool-call-group-${nextId++}`;\n readonly expanded = signal(false);\n\n /** The call that currently needs attention or runs; the latest one when several do. */\n readonly current = computed(() => {\n const calls = this.calls();\n return findLast(calls, call => call.status === 'awaiting-approval' || call.status === 'awaiting-answer')\n ?? findLast(calls, call => call.status === 'running')\n ?? null;\n });\n readonly total = computed(() => this.calls().length);\n readonly finished = computed(() => this.calls().filter(call => !isActive(call)).length);\n readonly failed = computed(() => this.calls().filter(call => call.status === 'failed').length);\n /** Calls that finished without running; they never wait. */\n readonly notExecuted = computed(() => this.calls().filter(call => call.status === 'not-executed').length);\n readonly state = computed<NhAssistantToolCallGroupState>(() => {\n const current = this.current();\n if (current) {\n return current.status === 'awaiting-approval' || current.status === 'awaiting-answer' ? current.status : 'running';\n }\n\n if (this.failed() > 0) {\n return 'failed';\n }\n\n return this.notExecuted() > 0 ? 'not-executed' : 'succeeded';\n });\n readonly stateIcon = computed(() => stateIcons[this.state()]);\n\n toggle(): void {\n this.expanded.update(expanded => !expanded);\n }\n}\n\nfunction isActive(call: ToolCallPart): boolean {\n return call.status === 'running' || call.status === 'awaiting-approval' || call.status === 'awaiting-answer';\n}\n\nfunction findLast(calls: readonly ToolCallPart[], predicate: (call: ToolCallPart) => boolean): ToolCallPart | undefined {\n for (let index = calls.length - 1; index >= 0; index--) {\n if (predicate(calls[index])) {\n return calls[index];\n }\n }\n\n return undefined;\n}\n","<section class=\"group\">\n <button\n class=\"summary\"\n type=\"button\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"callsId\"\n [attr.title]=\"(expanded() ? 'nh-assistant.tool-group.hide-calls' : 'nh-assistant.tool-group.show-calls') | translate\"\n (click)=\"toggle()\">\n <span class=\"status-icon\" [class.spinning]=\"state() === 'running'\">\n <nh-assistant-icon [name]=\"stateIcon()\" />\n </span>\n <span class=\"title\">\n @switch (state()) {\n @case ('running') {\n {{ 'nh-assistant.tool-group.running' | translate: { name: current()?.displayName } }}\n }\n @case ('awaiting-approval') {\n {{ 'nh-assistant.tool-group.awaiting-approval' | translate: { name: current()?.displayName } }}\n }\n @case ('awaiting-answer') {\n {{ 'nh-assistant.tool-group.awaiting-answer' | translate }}\n }\n @default {\n {{ (total() === 1 ? 'nh-assistant.tool-group.used-one' : 'nh-assistant.tool-group.used-many') | translate: { count: total() } }}\n }\n }\n </span>\n @if (state() === 'running' || state() === 'awaiting-approval' || state() === 'awaiting-answer') {\n <span class=\"count\">{{ 'nh-assistant.tool-group.progress' | translate: { finished: finished(), total: total() } }}</span>\n } @else {\n @if (failed() > 0) {\n <span class=\"count failed\">{{ 'nh-assistant.tool-group.failed' | translate: { count: failed() } }}</span>\n }\n @if (notExecuted() > 0) {\n <span class=\"count not-executed\">{{ 'nh-assistant.tool-group.not-executed' | translate: { count: notExecuted() } }}</span>\n }\n }\n <nh-assistant-icon class=\"chevron\" name=\"chevron-down\" [class.rotated]=\"expanded()\" />\n </button>\n\n <div class=\"calls\" [id]=\"callsId\" [hidden]=\"!expanded()\">\n @if (expanded()) {\n @for (call of calls(); track call.invocationId) {\n <nh-assistant-tool-call-card [part]=\"call\" />\n }\n }\n </div>\n</section>\n","import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe, TranslateService } from '@ngx-translate/core';\nimport { ApprovalDecision, ApprovalPart, ApprovalResolution, ConversationMember, FilePart, Message, QuestionPart } from '../../models/assistant-api.models';\nimport { nhAssistantFileTypeLabel, nhAssistantFormatFileSize } from '../../internal/nh-assistant-files';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantMarkdownPipe } from '../../internal/nh-assistant-markdown.pipe';\nimport { NhAssistantMessageLinkComponent } from '../../internal/nh-assistant-message-link.component';\nimport { NhAssistantPartGroupsPipe } from '../../internal/nh-assistant-part-groups';\nimport { NhAssistantApprovalCardComponent } from '../approval-card/nh-assistant-approval-card.component';\nimport { NhAssistantConnectionRequiredComponent } from '../connection-required/nh-assistant-connection-required.component';\nimport { NhAssistantQuestionCardComponent } from '../question-card/nh-assistant-question-card.component';\nimport { NhAssistantToolCallGroupComponent } from '../tool-call-group/nh-assistant-tool-call-group.component';\nimport type { NhAssistantApprovalRight } from '../../services/nh-assistant.store';\n\n/** A decision about one approval of the thread. */\nexport interface NhAssistantApprovalChoice {\n approvalId: string;\n decision: ApprovalDecision;\n}\n\n/** The answer the user chose for a question of the thread. */\nexport interface NhAssistantQuestionAnswer {\n questionId: string;\n /** The zero-based index of the chosen answer. */\n choice: number;\n}\n\n/** How the user resolves the uncertain hand-off of one approval they made in this chat. */\nexport interface NhAssistantApprovalResolutionChoice {\n approvalId: string;\n resolution: ApprovalResolution;\n}\n\n/** Above this number of messages the thread renders through CDK virtual scrolling. */\nexport const NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD = 200;\n\n/** Distance from the bottom, in pixels, within which new content keeps the thread pinned to the end. */\nconst stickToBottomDistance = 120;\n\n/**\n * The messages of a conversation as a live log. Assistant text renders as sanitized\n * Markdown, consecutive tool calls as one collapsible group that counts along, and\n * approvals as cards. The files a person attached show by name, type and size. Messages a\n * trigger wrote into an agent thread read as events, not as a person, and a message the application\n * posted reads as the application's, with its sender, title, Markdown text and link, and a label when\n * the assistant follows it as an instruction. While a turn runs without visible progress, a working\n * indicator shows the elapsed time: under the answer `writingMessageId` names, also when the\n * application's or another person's message arrived after it, and at the end without it. The thread\n * follows new content while the user is at the bottom.\n */\n@Component({\n selector: 'nh-assistant-thread',\n standalone: true,\n imports: [\n NgTemplateOutlet,\n ScrollingModule,\n TranslatePipe,\n NhAssistantIconComponent,\n NhAssistantMarkdownPipe,\n NhAssistantMessageLinkComponent,\n NhAssistantPartGroupsPipe,\n NhAssistantToolCallGroupComponent,\n NhAssistantApprovalCardComponent,\n NhAssistantConnectionRequiredComponent,\n NhAssistantQuestionCardComponent\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-thread.component.html',\n styleUrl: './nh-assistant-thread.component.scss'\n})\nexport class NhAssistantThreadComponent {\n private readonly injector = inject(Injector);\n private readonly translate = inject(TranslateService, { optional: true });\n\n /** The type and size of an attached file, in the current language. */\n fileMeta(file: FilePart): { type: string; size: string } {\n return {\n type: nhAssistantFileTypeLabel(file.mediaType),\n size: nhAssistantFormatFileSize(file.size, this.translate?.getCurrentLang())\n };\n }\n\n readonly messages = input.required<readonly Message[]>();\n readonly streaming = input(false);\n readonly deciding = input(false);\n readonly markdown = input(true);\n /** The owner and participants of a shared conversation; empty while it is not shared. */\n readonly members = input<readonly ConversationMember[]>([]);\n /** The current user, to tell their own messages from those of others. */\n readonly currentActorId = input<string | null>(null);\n /** False when the pending approval belongs to another participant's turn. */\n readonly canDecide = input(true);\n /** Name of the participant who decides the pending approval, when it is someone else. */\n readonly decisionOwner = input<string | null>(null);\n /**\n * Who may decide each pending approval, by approval id, for example `NhAssistantStore.approvalRights`.\n * An agent thread can hold several open proposals that the subject's approvers decide. Approvals\n * without an entry use `canDecide` and `decisionOwner`. An entry with `canGiveFeedback` lets the\n * card of a rejected proposal ask what was wrong.\n */\n readonly approvalRights = input<ReadonlyMap<string, NhAssistantApprovalRight> | null>(null);\n /**\n * The answer the running turn writes, for example `NhAssistantStore.writingMessageId`. The working\n * indicator stays under that answer, also when the application's or a colleague's message arrives\n * after it during the turn. Without it, or when it names no message of `messages`, the indicator\n * shows at the end of the thread.\n */\n readonly writingMessageId = input<string | null>(null);\n /** The decision about an approval card, without the approval it belongs to. */\n readonly approvalDecision = output<ApprovalDecision>();\n /** The decision about an approval card together with its approval id. */\n readonly approvalChoice = output<NhAssistantApprovalChoice>();\n /** How the user resolves an uncertain hand-off they approved in this chat, with its approval id. */\n readonly approvalResolution = output<NhAssistantApprovalResolutionChoice>();\n /**\n * The answer the user chose for a question addressed to them, for example for\n * `NhAssistantStore.answerQuestion`. Only the addressee of a pending question gets choice buttons.\n */\n readonly questionAnswer = output<NhAssistantQuestionAnswer>();\n /**\n * The question to ask again after the viewer connected an MCP server from a connection card: the\n * text of the user message the card answered. The panel sends it.\n */\n readonly retryMessage = output<string>();\n\n private readonly names = computed(() => new Map(this.members().map(member => [member.actorId, member.displayName])));\n\n /** Asks the question again that the assistant message with a connection card answered. */\n retryAfterConnect(message: Message): void {\n const messages = this.messages();\n const index = messages.findIndex(item => item.id === message.id);\n for (let position = index - 1; position >= 0; position--) {\n const candidate = messages[position];\n if (candidate.role !== 'user') {\n continue;\n }\n const text = candidate.parts.map(part => part.type === 'text' ? part.text : '').join('').trim();\n if (text.length > 0) {\n this.retryMessage.emit(text);\n }\n return;\n }\n }\n\n readonly virtualThreshold = NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD;\n readonly virtual = computed(() => this.messages().length > NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD);\n /**\n * True while the turn runs and nothing else shows progress: before the first part and\n * between tool calls while the model decides what to do next. Streaming text and a\n * running tool group show their own progress; an approval waits for the user. With\n * `writingMessageId`, the answer it names decides, as if the messages after it were not there.\n */\n readonly working = computed(() => {\n if (!this.streaming()) {\n return false;\n }\n\n const messages = this.messages();\n const last = this.answerBeingWritten() ?? messages[messages.length - 1];\n if (!last || last.role === 'user' || last.role === 'application' || last.parts.length === 0) {\n return true;\n }\n\n const lastPart = last.parts[last.parts.length - 1];\n return lastPart.type === 'tool-call'\n && lastPart.status !== 'running'\n && lastPart.status !== 'awaiting-approval'\n && lastPart.status !== 'awaiting-answer';\n });\n /**\n * The message in whose row the working indicator shows: the answer `writingMessageId` names.\n * `null` puts the indicator at the end of the thread.\n */\n readonly workingAfterId = computed(() => this.answerBeingWritten()?.id ?? null);\n /** While a turn runs: the answer `writingMessageId` names, when `messages` holds it. */\n private readonly answerBeingWritten = computed<Message | null>(() => {\n const writingMessageId = this.writingMessageId();\n if (!this.streaming() || !writingMessageId) {\n return null;\n }\n\n return this.messages().find(message => message.id === writingMessageId) ?? null;\n });\n /** Whole seconds since the running turn started. */\n readonly elapsedSeconds = computed(() => {\n const startedAt = this.turnStartedAt();\n return startedAt === null ? 0 : Math.max(0, Math.floor((this.now() - startedAt) / 1000));\n });\n\n private readonly turnStartedAt = signal<number | null>(null);\n private readonly now = signal(Date.now());\n\n private readonly scroller = viewChild<ElementRef<HTMLElement>>('scroller');\n private readonly viewport = viewChild(CdkVirtualScrollViewport);\n\n constructor() {\n effect(onCleanup => {\n if (!this.streaming()) {\n this.turnStartedAt.set(null);\n return;\n }\n\n untracked(() => {\n const now = Date.now();\n this.now.set(now);\n if (this.turnStartedAt() === null) {\n this.turnStartedAt.set(now);\n }\n });\n const timer = setInterval(() => this.now.set(Date.now()), 1000);\n onCleanup(() => clearInterval(timer));\n });\n\n effect(() => {\n this.messages();\n this.working();\n const element = this.scrollElement();\n const pinned = !element || element.scrollHeight - element.scrollTop - element.clientHeight <= stickToBottomDistance;\n if (pinned) {\n afterNextRender(() => this.scrollToEnd(), { injector: this.injector });\n }\n });\n }\n\n trackMessage(_index: number, message: Message): string {\n return message.id;\n }\n\n /** True for a user message a trigger wrote into an agent thread. */\n isTrigger(message: Message): boolean {\n return message.role === 'user' && message.authorKind === 'trigger';\n }\n\n /** True for a message the application posted into the conversation. */\n isApplication(message: Message): boolean {\n return message.role === 'application';\n }\n\n /** True for an assistant message the agent's rules wrote without a model. */\n isRule(message: Message): boolean {\n return message.role === 'assistant' && message.authorKind === 'rule';\n }\n\n /** True for a user message written by another person in a shared conversation. */\n isOthers(message: Message): boolean {\n return message.role === 'user'\n && !this.isTrigger(message)\n && !!message.authorActorId\n && !!this.currentActorId()\n && message.authorActorId !== this.currentActorId();\n }\n\n /** Whether and why the current user may decide an approval card. */\n rightFor(approval: ApprovalPart): NhAssistantApprovalRight {\n return this.approvalRights()?.get(approval.approvalId) ?? {\n canDecide: this.canDecide(),\n waitingFor: 'turn',\n decisionOwner: this.decisionOwner()\n };\n }\n\n choose(approval: ApprovalPart, decision: ApprovalDecision): void {\n this.approvalDecision.emit(decision);\n this.approvalChoice.emit({ approvalId: approval.approvalId, decision });\n }\n\n resolveApproval(approval: ApprovalPart, resolution: ApprovalResolution): void {\n this.approvalResolution.emit({ approvalId: approval.approvalId, resolution });\n }\n\n /** Whether the current user may answer the question: it waits and is addressed to them. */\n canAnswer(question: QuestionPart): boolean {\n const currentActorId = this.currentActorId();\n return question.status === 'pending' && !!currentActorId && question.addresseeActorId === currentActorId;\n }\n\n /** The name of the person a question is addressed to, or `null` when the application provides none. */\n addresseeName(question: QuestionPart): string | null {\n return this.names().get(question.addresseeActorId) ?? null;\n }\n\n answerQuestion(question: QuestionPart, choice: number): void {\n this.questionAnswer.emit({ questionId: question.questionId, choice });\n }\n\n /** Display name of another person's message, or `null` when the application provides none. */\n authorName(message: Message): string | null {\n return message.authorActorId ? this.names().get(message.authorActorId) ?? null : null;\n }\n\n private scrollElement(): HTMLElement | null {\n return this.viewport()?.elementRef.nativeElement ?? this.scroller()?.nativeElement ?? null;\n }\n\n private scrollToEnd(): void {\n const viewport = this.viewport();\n if (viewport) {\n viewport.scrollToIndex(this.messages().length - 1);\n viewport.scrollTo({ bottom: 0 });\n return;\n }\n\n const element = this.scroller()?.nativeElement;\n if (element) {\n element.scrollTop = element.scrollHeight;\n }\n }\n}\n","<div class=\"log\" role=\"log\" aria-live=\"polite\" [attr.aria-label]=\"'nh-assistant.thread.label' | translate\" [attr.aria-busy]=\"streaming()\">\n @if (virtual()) {\n <cdk-virtual-scroll-viewport class=\"scroller\" itemSize=\"120\" minBufferPx=\"1200\" maxBufferPx=\"2400\">\n <div class=\"row\" *cdkVirtualFor=\"let message of messages(); trackBy: trackMessage\">\n <ng-container [ngTemplateOutlet]=\"messageTemplate\" [ngTemplateOutletContext]=\"{ $implicit: message }\" />\n @if (working() && message.id === workingAfterId()) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </div>\n @if (working() && workingAfterId() === null) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </cdk-virtual-scroll-viewport>\n } @else {\n <div class=\"scroller\" #scroller tabindex=\"0\">\n @for (message of messages(); track message.id) {\n <div class=\"row\">\n <ng-container [ngTemplateOutlet]=\"messageTemplate\" [ngTemplateOutletContext]=\"{ $implicit: message }\" />\n <!-- The answer a turn still writes (writingMessageId) keeps the indicator under it, also when messages arrived after it. -->\n @if (working() && message.id === workingAfterId()) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </div>\n }\n @if (working() && workingAfterId() === null) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </div>\n }\n</div>\n\n<ng-template #messageTemplate let-message>\n <article\n class=\"message\"\n [attr.data-role]=\"message.role\"\n [attr.data-others]=\"isOthers(message) ? 'true' : null\"\n [attr.data-author]=\"isTrigger(message) ? 'trigger' : isRule(message) ? 'rule' : isApplication(message) ? 'application' : null\"\n [attr.aria-label]=\"isApplication(message) ? ('nh-assistant.thread.application-label' | translate) : null\">\n @if (isTrigger(message)) {\n <p class=\"author\">{{ 'nh-assistant.thread.trigger' | translate }}</p>\n } @else if (isRule(message)) {\n <p class=\"author\">{{ 'nh-assistant.thread.rule' | translate }}</p>\n } @else if (isApplication(message)) {\n <!-- The application's message reads as the application's, also when it names who in the application posted it. -->\n <p class=\"author\">\n <nh-assistant-icon class=\"author-icon\" name=\"bell\" />\n @if (message.application?.senderName; as sender) {\n <!-- The space keeps the sender and the tag apart for screen readers; the flex gap shows it. -->\n <span>{{ sender }}</span>{{ ' ' }}<span class=\"tag\">{{ 'nh-assistant.thread.application' | translate }}</span>\n } @else {\n <span>{{ 'nh-assistant.thread.application' | translate }}</span>\n }\n @if (message.application?.trusted) {\n <!-- People see which of the application's messages the assistant follows as an instruction. -->\n {{ ' ' }}<span class=\"tag trusted\">{{ 'nh-assistant.thread.application-trusted' | translate }}</span>\n }\n </p>\n @if (message.application?.title; as title) {\n <p class=\"application-title\">{{ title }}</p>\n }\n } @else if (isOthers(message)) {\n <p class=\"author\">{{ authorName(message) ?? ('nh-assistant.thread.participant' | translate) }}</p>\n } @else {\n <p class=\"author\">{{ 'nh-assistant.thread.' + (message.role === 'user' ? 'you' : message.role) | translate }}</p>\n }\n @for (group of message.parts | nhAssistantPartGroups; track group.key) {\n @switch (group.kind) {\n @case ('text') {\n @if ((message.role === 'assistant' || isApplication(message)) && markdown()) {\n <div class=\"bubble markdown\" [innerHTML]=\"group.part.text | nhAssistantMarkdown\"></div>\n } @else {\n <div class=\"bubble plain\">{{ group.part.text }}</div>\n }\n }\n @case ('tools') {\n <nh-assistant-tool-call-group class=\"part\" [calls]=\"group.calls\" />\n }\n @case ('files') {\n <ul class=\"files\" [attr.aria-label]=\"'nh-assistant.thread.files' | translate\">\n @for (file of group.files; track $index) {\n <li class=\"file\">\n <nh-assistant-icon class=\"file-icon\" name=\"file\" />\n <span class=\"file-name\" [attr.title]=\"file.name\">{{ file.name }}</span>\n <span class=\"file-meta\">{{ 'nh-assistant.thread.file-meta' | translate: fileMeta(file) }}</span>\n </li>\n }\n </ul>\n }\n @case ('connection') {\n <nh-assistant-connection-required\n class=\"part\"\n [part]=\"group.part\"\n [canRetry]=\"!streaming()\"\n (retry)=\"retryAfterConnect(message)\" />\n }\n @case ('approval') {\n <nh-assistant-approval-card\n class=\"part\"\n [approval]=\"group.part\"\n [deciding]=\"deciding()\"\n [canDecide]=\"rightFor(group.part).canDecide\"\n [decisionOwner]=\"rightFor(group.part).decisionOwner\"\n [waitingFor]=\"rightFor(group.part).waitingFor\"\n [canGiveFeedback]=\"rightFor(group.part).canGiveFeedback === true\"\n (decide)=\"choose(group.part, $event)\"\n (resolve)=\"resolveApproval(group.part, $event)\" />\n }\n @case ('question') {\n <nh-assistant-question-card\n class=\"part\"\n [question]=\"group.part\"\n [canAnswer]=\"canAnswer(group.part)\"\n [addresseeName]=\"addresseeName(group.part)\"\n [answering]=\"deciding()\"\n (answer)=\"answerQuestion(group.part, $event)\" />\n }\n }\n }\n @if (isApplication(message) && message.application?.link; as link) {\n <nh-assistant-message-link\n class=\"application-link\"\n [url]=\"link.url\"\n [label]=\"link.label || ('nh-assistant.thread.application-link' | translate)\" />\n }\n </article>\n</ng-template>\n\n<ng-template #workingTemplate>\n <p class=\"working\" role=\"status\">\n <span class=\"dots\" aria-hidden=\"true\"><span></span><span></span><span></span></span>\n {{ 'nh-assistant.thread.working' | translate }}\n @if (elapsedSeconds() > 0) {\n <span class=\"elapsed\">{{ 'nh-assistant.thread.elapsed' | translate: { seconds: elapsedSeconds() } }}</span>\n }\n </p>\n</ng-template>\n","import { TemplatePortal } from '@angular/cdk/portal';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n OnDestroy,\n TemplateRef,\n ViewContainerRef,\n computed,\n effect,\n inject,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { NavigationEnd, Router, RouterLink } from '@angular/router';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ApprovalDecision, ClientContext, FileReference } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NH_ASSISTANT_CONFIG } from '../../nh-assistant.config';\nimport { NhAssistantPanelService } from '../../services/nh-assistant-panel.service';\nimport { NhAssistantError, NhAssistantStore } from '../../services/nh-assistant.store';\nimport { describeNhAssistantClientContext } from '../../services/nh-assistant-page-context';\nimport { NhAssistantPushService } from '../../services/nh-assistant-push.service';\nimport { NhAssistantActivityComponent } from '../activity/nh-assistant-activity.component';\nimport { NhAssistantAgentPickerComponent } from '../agent-picker/nh-assistant-agent-picker.component';\nimport { NhAssistantComposerComponent } from '../composer/nh-assistant-composer.component';\nimport { NhAssistantConversationListComponent } from '../conversation-list/nh-assistant-conversation-list.component';\nimport { NhAssistantPreferencesComponent } from '../preferences/nh-assistant-preferences.component';\nimport { NhAssistantShareComponent } from '../share/nh-assistant-share.component';\nimport {\n NH_ASSISTANT_CONVERSATION_FRAGMENT,\n NH_ASSISTANT_JOIN_FRAGMENT,\n NH_ASSISTANT_RUN_FRAGMENT\n} from '../../services/nh-assistant-share-link';\nimport {\n NhAssistantApprovalChoice,\n NhAssistantApprovalResolutionChoice,\n NhAssistantQuestionAnswer,\n NhAssistantThreadComponent\n} from '../thread/nh-assistant-thread.component';\nimport { nhAssistantErrorKeys, toNhAssistantError } from '../../internal/nh-assistant-errors';\n\nlet nextId = 0;\n\n/**\n * The assistant drawer. Place it once in the application layout; it renders nothing in\n * place and appears as an overlay when `NhAssistantPanelService.open()` is called. It opens\n * by itself for an invitation link (`#nh-assistant-join=...`) and for a clicked notification.\n */\n@Component({\n selector: 'nh-assistant-panel',\n standalone: true,\n imports: [\n RouterLink,\n TranslatePipe,\n NhAssistantTranslatePipe,\n NhAssistantIconComponent,\n NhAssistantActivityComponent,\n NhAssistantAgentPickerComponent,\n NhAssistantComposerComponent,\n NhAssistantConversationListComponent,\n NhAssistantPreferencesComponent,\n NhAssistantShareComponent,\n NhAssistantThreadComponent\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-panel.component.html',\n styleUrl: './nh-assistant-panel.component.scss'\n})\nexport class NhAssistantPanelComponent implements AfterViewInit, OnDestroy {\n readonly store = inject(NhAssistantStore);\n readonly panel = inject(NhAssistantPanelService);\n readonly push = inject(NhAssistantPushService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly router = inject(Router, { optional: true });\n private readonly drawer = viewChild.required<TemplateRef<unknown>>('drawer');\n private portal?: TemplatePortal;\n\n readonly titleId = `nh-assistant-panel-title-${nextId++}`;\n readonly markdown = this.config.markdown?.enabled ?? true;\n readonly showConversations = signal(false);\n readonly showPreferences = signal(false);\n readonly showShare = signal(false);\n readonly shareSection = signal<'all' | 'link' | 'members'>('all');\n readonly notificationError = signal<NhAssistantError | null>(null);\n readonly notificationsLabel = computed(() => this.push.settings()?.pushEnabled\n ? 'nh-assistant.panel.notifications-off' : 'nh-assistant.panel.notifications-on');\n readonly adminRoute = this.config.adminRoute ?? null;\n readonly conversation = this.store.activeConversation;\n private readonly conversationId = computed(() => this.conversation()?.id ?? null);\n readonly messages = computed(() => this.conversation()?.messages ?? []);\n /** An archived conversation takes no new messages. A failed one does: the person asks again. */\n readonly closed = computed(() => this.conversation()?.status === 'archived');\n readonly busy = computed(() => this.store.streaming() || this.conversation()?.status === 'running');\n /**\n * The last turn failed and no error bar explains it, for example after the conversation was\n * reopened. The panel then says so, while the composer stays available.\n */\n readonly lastTurnFailed = computed(() => this.conversation()?.status === 'failed'\n && !this.busy() && this.store.error() === null);\n readonly composerDisabled = computed(() => !this.store.canSubmit());\n readonly editingQueuedId = signal<string | null>(null);\n readonly queuedDraft = signal('');\n private resumeAfterEditing = false;\n readonly validQueuedDraft = computed(() => this.queuedDraft().trim().length > 0\n && this.queuedDraft().trim().length <= (this.store.limits()?.maxMessageChars ?? Infinity));\n readonly composerStatus = computed<'running' | 'waiting-for-approval' | 'waiting-for-answer' | null>(() => {\n if (this.store.streaming() || this.conversation()?.status === 'running') {\n return 'running';\n }\n if (this.conversation()?.status !== 'waiting-for-approval' || this.store.waitExpired()) {\n // A wait whose lifetime passed holds nothing back: the next message is sent and closes it.\n return null;\n }\n // A turn that asked a question waits for its answer, not for an approval.\n return this.conversation()?.pendingQuestion ? 'waiting-for-answer' : 'waiting-for-approval';\n });\n /**\n * Who the composer says the conversation waits for, when it is someone else: the addressee of a\n * pending question, otherwise the person whose turn waits.\n */\n readonly composerStatusActor = computed(() => {\n if (this.composerStatus() === 'waiting-for-answer') {\n const addressee = this.store.questionAddressee();\n return addressee ? addressee.displayName ?? '' : null;\n }\n return this.activeMemberName();\n });\n /** Name of another participant whose turn runs or waits, or `null`. */\n readonly activeMemberName = computed(() => {\n const member = this.store.activeMember();\n return member ? member.displayName ?? '' : null;\n });\n /** The owner and the person who started the turn may stop it. */\n readonly canStop = computed(() => this.store.isOwner() || this.store.activeMember() === null);\n readonly shared = computed(() => this.store.members().some(member => member.role === 'participant'));\n readonly canShare = computed(() => this.conversation() !== null && !!this.store.collaboration());\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.notificationError() ?? this.store.error()));\n readonly noticeKeys = computed(() => nhAssistantErrorKeys(this.store.notice()));\n\n constructor() {\n // Opening, creating or leaving a conversation returns from the list to the thread.\n effect(() => {\n if (this.conversationId() !== undefined) {\n untracked(() => {\n this.showConversations.set(false);\n this.showPreferences.set(false);\n this.showShare.set(false);\n });\n }\n });\n\n // The open thread counts as seen only while the drawer shows it.\n effect(() => {\n const viewing = this.panel.isOpen() && !this.showConversations() && !this.showPreferences() && !this.showShare();\n untracked(() => this.store.setViewing(viewing));\n });\n\n // A clicked notification opens its conversation in this window.\n const notifications = this.push.openConversation$.subscribe(conversationId => this.panel.open(conversationId));\n inject(DestroyRef).onDestroy(() => notifications.unsubscribe());\n\n effect(() => {\n if (this.panel.isOpen()) {\n untracked(() => {\n void this.store.initialize().then(() => this.store.refreshConversations());\n this.refreshPageContext();\n });\n }\n });\n\n // The drawer stays open while the user navigates; keep the page-context control current.\n const navigation = this.router?.events.subscribe(event => {\n if (event instanceof NavigationEnd && this.panel.isOpen()) {\n this.refreshPageContext();\n }\n });\n inject(DestroyRef).onDestroy(() => navigation?.unsubscribe());\n }\n\n ngAfterViewInit(): void {\n this.portal = new TemplatePortal(this.drawer(), this.viewContainerRef);\n this.panel.registerPanel(this.portal);\n this.openFromLocation();\n }\n\n ngOnDestroy(): void {\n if (this.portal) {\n this.panel.unregisterPanel(this.portal);\n }\n }\n\n refreshPageContext(): void {\n void this.store.refreshPageContext();\n }\n\n describeContext(context: ClientContext): string {\n return describeNhAssistantClientContext(context);\n }\n\n toggleConversations(): void {\n this.showPreferences.set(false);\n this.showShare.set(false);\n this.showConversations.update(show => !show);\n }\n\n togglePreferences(): void {\n this.showConversations.set(false);\n this.showShare.set(false);\n this.showPreferences.update(show => !show);\n }\n\n toggleShare(section: 'all' | 'link' | 'members' = 'all'): void {\n this.showConversations.set(false);\n this.showPreferences.set(false);\n const close = this.showShare() && this.shareSection() === section;\n this.shareSection.set(section);\n this.showShare.set(!close);\n }\n\n /** Applies the notification choice immediately, including browser permission handling. */\n async toggleNotifications(): Promise<void> {\n if (this.push.busy() || this.push.state() === 'unavailable') {\n return;\n }\n this.notificationError.set(null);\n try {\n await this.push.setEnabled(!this.push.settings()?.pushEnabled);\n } catch (error) {\n this.notificationError.set(toNhAssistantError(error));\n }\n }\n\n newConversation(): void {\n this.store.startNewConversation();\n this.showConversations.set(false);\n }\n\n openConversation(conversationId: string): void {\n void this.store.openConversation(conversationId);\n this.showConversations.set(false);\n }\n\n deleteConversation(conversationId: string): void {\n void this.store.deleteConversation(conversationId);\n }\n\n send(text: string): void {\n this.showConversations.set(false);\n this.showPreferences.set(false);\n this.showShare.set(false);\n void this.store.submit(text, this.store.attachedFiles());\n }\n\n /** Uploads the files the person attached to the next message. */\n attach(files: File[]): void {\n void this.store.attach(files);\n }\n\n /** The names of the files a queued message carries, as the queue lists them. */\n fileNames(files: readonly FileReference[]): string {\n return files.map(file => file.name).join(', ');\n }\n\n editQueuedMessage(id: string, text: string): void {\n this.resumeAfterEditing = !this.store.queuePaused();\n this.store.pauseQueue();\n this.editingQueuedId.set(id);\n this.queuedDraft.set(text);\n }\n\n changeQueuedDraft(event: Event): void {\n this.queuedDraft.set((event.target as HTMLTextAreaElement).value);\n }\n\n saveQueuedMessage(id: string): void {\n if (this.store.updateQueuedMessage(id, this.queuedDraft())) {\n this.cancelQueueEdit();\n }\n }\n\n cancelQueueEdit(): void {\n this.editingQueuedId.set(null);\n if (this.resumeAfterEditing && !this.store.error()) {\n this.store.resumeQueue();\n }\n }\n\n /**\n * Opens the panel for an invitation link or a clicked notification in the URL fragment and\n * removes the fragment, so a reload or a shared screenshot does not reuse the token. A clicked\n * notification about the proposals of a run goes to `NhAssistantPushService.openRun$` while the\n * application subscribes, and otherwise opens its conversation.\n */\n private openFromLocation(): void {\n const location = globalThis.location;\n const hash = location?.hash?.replace(/^#/, '') ?? '';\n const separatorIndex = hash.indexOf('=');\n const name = separatorIndex < 0 ? hash : hash.slice(0, separatorIndex);\n const value = separatorIndex < 0 ? '' : hash.slice(separatorIndex + 1);\n if (!value || (name !== NH_ASSISTANT_JOIN_FRAGMENT && name !== NH_ASSISTANT_CONVERSATION_FRAGMENT && name !== NH_ASSISTANT_RUN_FRAGMENT)) {\n return;\n }\n\n globalThis.history?.replaceState(globalThis.history.state, '', location.pathname + location.search);\n if (name === NH_ASSISTANT_CONVERSATION_FRAGMENT) {\n this.panel.open(decodeURIComponent(value));\n return;\n }\n\n const tokenIndex = value.indexOf('.');\n if (tokenIndex <= 0) {\n return;\n }\n if (name === NH_ASSISTANT_RUN_FRAGMENT) {\n this.push.openNotification(decodeURIComponent(value.slice(tokenIndex + 1)), decodeURIComponent(value.slice(0, tokenIndex)));\n return;\n }\n const conversationId = decodeURIComponent(value.slice(0, tokenIndex));\n const token = decodeURIComponent(value.slice(tokenIndex + 1));\n this.panel.open();\n void this.store.initialize().then(() => this.store.joinConversation(conversationId, token));\n }\n\n decide(decision: ApprovalDecision): void {\n this.store.decide(decision);\n }\n\n /** Decides the approval of a card; in an agent thread several proposals can be open. */\n decideApproval(choice: NhAssistantApprovalChoice): void {\n this.store.decide(choice.decision, undefined, choice.approvalId);\n }\n\n resolveApproval(choice: NhAssistantApprovalResolutionChoice): void {\n void this.store.resolveApproval(choice.approvalId, choice.resolution);\n }\n\n /** Answers the question the conversation waits for; only its addressee gets the choices. */\n answerQuestion(answer: NhAssistantQuestionAnswer): void {\n this.store.answerQuestion(answer.questionId, answer.choice);\n }\n\n cancel(): void {\n void this.store.cancel();\n }\n}\n","<ng-template #drawer>\n <section class=\"drawer\" role=\"dialog\" aria-modal=\"false\" [attr.aria-labelledby]=\"titleId\">\n <header class=\"header\">\n <div class=\"heading\">\n <h2 [id]=\"titleId\">{{ 'nh-assistant.panel.title' | translate }}</h2>\n </div>\n <div class=\"header-actions\">\n @if (store.enabled()) {\n @if (push.state() !== 'unavailable') {\n <button\n class=\"icon-button notification-button\"\n type=\"button\"\n [class.active]=\"push.state() === 'on'\"\n [class.off]=\"!push.settings()?.pushEnabled\"\n [class.blocked]=\"push.state() === 'blocked'\"\n [disabled]=\"push.busy()\"\n [attr.aria-pressed]=\"push.settings()?.pushEnabled === true\"\n [attr.aria-label]=\"notificationsLabel() | translate\"\n [attr.title]=\"('nh-assistant.preferences.notifications-state.' + push.state() | translate) + ' · ' + (notificationsLabel() | translate)\"\n (click)=\"toggleNotifications()\">\n <nh-assistant-icon name=\"bell\" />\n </button>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [class.active]=\"showConversations()\"\n [attr.aria-expanded]=\"showConversations()\"\n [attr.aria-label]=\"(showConversations() ? 'nh-assistant.panel.hide-conversations' : 'nh-assistant.panel.show-conversations') | translate\"\n [attr.title]=\"(showConversations() ? 'nh-assistant.panel.hide-conversations' : 'nh-assistant.panel.show-conversations') | translate\"\n (click)=\"toggleConversations()\">\n <nh-assistant-icon name=\"list\" />\n </button>\n <button\n class=\"icon-button\"\n type=\"button\"\n [class.active]=\"showPreferences()\"\n [attr.aria-expanded]=\"showPreferences()\"\n [attr.aria-label]=\"'nh-assistant.panel.open-preferences' | translate\"\n [attr.title]=\"'nh-assistant.panel.open-preferences' | translate\"\n (click)=\"togglePreferences()\">\n <nh-assistant-icon name=\"settings\" />\n </button>\n @if (adminRoute && store.canAdminister()) {\n <a\n class=\"icon-button\"\n [routerLink]=\"adminRoute\"\n [attr.aria-label]=\"'nh-assistant.panel.open-admin' | translate\"\n [attr.title]=\"'nh-assistant.panel.open-admin' | translate\"\n (click)=\"panel.close()\">\n <nh-assistant-icon name=\"admin\" />\n </a>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.new-conversation' | translate\"\n [attr.title]=\"'nh-assistant.panel.new-conversation' | translate\"\n (click)=\"newConversation()\">\n <nh-assistant-icon name=\"plus\" />\n </button>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.close' | translate\"\n [attr.title]=\"'nh-assistant.panel.close' | translate\"\n (click)=\"panel.close()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </div>\n </header>\n\n @if (store.enabled()) {\n <nh-assistant-activity [items]=\"store.activity()\" (conversationSelect)=\"openConversation($event)\" />\n }\n\n <div class=\"body\">\n @if (store.statusLoading() && !store.enabled()) {\n <div class=\"state\" role=\"status\">\n <p class=\"state-title\">{{ 'nh-assistant.panel.loading' | translate }}</p>\n </div>\n } @else if (!store.enabled()) {\n <div class=\"state\">\n <nh-assistant-icon class=\"state-icon\" name=\"warning\" />\n <p class=\"state-title\">{{ 'nh-assistant.panel.unavailable-title' | translate }}</p>\n <p>{{ 'nh-assistant.panel.unavailable-description' | translate }}</p>\n </div>\n } @else {\n @if (showPreferences()) {\n <nh-assistant-preferences class=\"overlay-view\" (closed)=\"showPreferences.set(false)\" />\n }\n\n @if (showShare()) {\n <nh-assistant-share class=\"overlay-view\" [section]=\"shareSection()\" (closed)=\"showShare.set(false)\" />\n }\n\n @if (showConversations()) {\n <nh-assistant-conversation-list\n class=\"overlay-view\"\n [conversations]=\"store.conversations()\"\n [total]=\"store.conversationsTotal()\"\n [activeConversationId]=\"conversation()?.id ?? null\"\n [loading]=\"store.conversationsLoading()\"\n (conversationSelect)=\"openConversation($event)\"\n (conversationDelete)=\"deleteConversation($event)\"\n (conversationCreate)=\"newConversation()\" />\n }\n\n @if (store.conversationLoading()) {\n <div class=\"state\" role=\"status\">\n <p class=\"state-title\">{{ 'nh-assistant.thread.loading' | translate }}</p>\n </div>\n } @else if (messages().length === 0 && !store.streaming()) {\n <div class=\"state\">\n <nh-assistant-icon class=\"state-icon\" name=\"assistant\" />\n <p class=\"state-title\">{{ 'nh-assistant.panel.empty-title' | translate }}</p>\n <p>{{ 'nh-assistant.panel.empty-description' | translate }}</p>\n </div>\n } @else {\n <nh-assistant-thread\n class=\"thread\"\n [attr.inert]=\"showPreferences() || showShare() || showConversations() ? '' : null\"\n [messages]=\"messages()\"\n [streaming]=\"busy()\"\n [deciding]=\"store.deciding()\"\n [markdown]=\"markdown\"\n [members]=\"store.members()\"\n [currentActorId]=\"conversation()?.currentActorId ?? null\"\n [canDecide]=\"store.canDecide()\"\n [decisionOwner]=\"activeMemberName()\"\n [approvalRights]=\"store.approvalRights()\"\n [writingMessageId]=\"store.writingMessageId()\"\n (approvalChoice)=\"decideApproval($event)\"\n (approvalResolution)=\"resolveApproval($event)\"\n (questionAnswer)=\"answerQuestion($event)\"\n (retryMessage)=\"store.send($event)\" />\n }\n }\n </div>\n\n @if (notificationError() ?? store.error(); as error) {\n <div class=\"error\" role=\"alert\">\n <nh-assistant-icon name=\"warning\" />\n <p>{{ errorKeys() | nhAssistantTranslate: error.code }}</p>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.dismiss-error' | translate\"\n [attr.title]=\"'nh-assistant.panel.dismiss-error' | translate\"\n (click)=\"store.clearError(); notificationError.set(null)\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </div>\n } @else if (store.notice(); as notice) {\n <div class=\"turn-notice\" role=\"status\">\n <nh-assistant-icon name=\"warning\" />\n <p>{{ noticeKeys() | nhAssistantTranslate: notice.code }}</p>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.dismiss-error' | translate\"\n [attr.title]=\"'nh-assistant.panel.dismiss-error' | translate\"\n (click)=\"store.clearNotice()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </div>\n }\n\n @if (store.enabled() && !showPreferences() && !showShare()) {\n <footer class=\"footer\" (focusin)=\"refreshPageContext()\">\n @if (closed()) {\n <p class=\"notice\">{{ 'nh-assistant.panel.conversation-closed' | translate }}</p>\n } @else if (lastTurnFailed()) {\n <p class=\"notice\">{{ 'nh-assistant.panel.last-turn-failed' | translate }}</p>\n }\n @if (store.collaboration() || store.pageContext()) {\n <div class=\"conversation-actions\">\n @if (store.collaboration()) {\n @if (!conversation() || store.isOwner()) {\n <button class=\"icon-button\" type=\"button\" [disabled]=\"!canShare()\"\n [attr.aria-label]=\"'nh-assistant.panel.share' | translate\"\n [attr.title]=\"'nh-assistant.panel.share' | translate\"\n [attr.aria-expanded]=\"showShare() && shareSection() === 'link'\"\n (click)=\"toggleShare('link')\">\n <nh-assistant-icon name=\"link\" />\n </button>\n }\n <button class=\"icon-button\" type=\"button\" [disabled]=\"!canShare()\"\n [class.active]=\"shared()\"\n [attr.aria-label]=\"(store.isOwner() || !conversation() ? 'nh-assistant.panel.add-members' : 'nh-assistant.panel.members') | translate\"\n [attr.title]=\"(store.isOwner() || !conversation() ? 'nh-assistant.panel.add-members' : 'nh-assistant.panel.members') | translate\"\n [attr.aria-expanded]=\"showShare() && shareSection() === 'members'\"\n (click)=\"toggleShare('members')\">\n <nh-assistant-icon name=\"users\" />\n </button>\n }\n @if (store.pageContext(); as context) {\n <button\n class=\"icon-button page-context-button\"\n [class.active]=\"!store.pageContextExcluded()\"\n type=\"button\"\n [attr.aria-pressed]=\"!store.pageContextExcluded()\"\n [attr.aria-label]=\"(store.pageContextExcluded() ? 'nh-assistant.page-context.include' : 'nh-assistant.page-context.exclude') | translate: { page: describeContext(context) }\"\n [attr.title]=\"(store.pageContextExcluded() ? 'nh-assistant.page-context.include' : 'nh-assistant.page-context.exclude') | translate: { page: describeContext(context) }\"\n (click)=\"store.setPageContextExcluded(!store.pageContextExcluded())\">\n <nh-assistant-icon name=\"page\" />\n </button>\n }\n </div>\n }\n @if (store.queuedMessages().length > 0) {\n <section class=\"message-queue\" [attr.aria-label]=\"'nh-assistant.queue.title' | translate: { count: store.queuedMessages().length }\">\n <div class=\"queue-heading\">\n <span aria-live=\"polite\">{{ 'nh-assistant.queue.title' | translate: { count: store.queuedMessages().length } }}</span>\n @if (store.queuePaused()) {\n <button type=\"button\" class=\"queue-resume\" [disabled]=\"editingQueuedId() !== null\" (click)=\"store.resumeQueue()\">\n {{ 'nh-assistant.queue.resume' | translate }}\n </button>\n }\n </div>\n <ol class=\"queue-items\">\n @for (item of store.queuedMessages(); track item.id) {\n <li class=\"queue-item\" [class.failed]=\"item.state === 'failed'\">\n @if (editingQueuedId() === item.id && item.state !== 'sending') {\n <div class=\"queue-edit\">\n <textarea rows=\"2\" [value]=\"queuedDraft()\" (input)=\"changeQueuedDraft($event)\"\n [attr.aria-label]=\"'nh-assistant.queue.edit' | translate\"></textarea>\n <div class=\"queue-buttons\">\n <button type=\"button\" class=\"icon-button\" [disabled]=\"!validQueuedDraft()\"\n [attr.aria-label]=\"'nh-assistant.queue.save' | translate\" [attr.title]=\"'nh-assistant.queue.save' | translate\"\n (click)=\"saveQueuedMessage(item.id)\"><nh-assistant-icon name=\"check\" /></button>\n <button type=\"button\" class=\"icon-button\" [attr.aria-label]=\"'nh-assistant.queue.cancel-edit' | translate\"\n [attr.title]=\"'nh-assistant.queue.cancel-edit' | translate\"\n (click)=\"cancelQueueEdit()\"><nh-assistant-icon name=\"close\" /></button>\n </div>\n </div>\n } @else {\n <div class=\"queue-message\">\n <p [title]=\"item.text\">{{ item.text }}</p>\n @if (item.files?.length) {\n <span class=\"queue-state queue-files\" data-queue-files>{{ 'nh-assistant.queue.files' | translate: { count: item.files!.length, names: fileNames(item.files!) } }}</span>\n }\n @if (item.state !== 'queued') {\n <span class=\"queue-state\">{{ 'nh-assistant.queue.state.' + item.state | translate }}</span>\n }\n </div>\n <div class=\"queue-buttons\">\n @if (store.canSteer() && item.state === 'queued') {\n <button type=\"button\" class=\"queue-steer\" [disabled]=\"editingQueuedId() !== null\"\n [attr.title]=\"'nh-assistant.queue.steer-hint' | translate\"\n (click)=\"store.steerQueuedMessage(item.id)\">{{ 'nh-assistant.queue.steer' | translate }}</button>\n }\n <button type=\"button\" class=\"icon-button\" [disabled]=\"item.state === 'sending'\"\n [attr.aria-label]=\"'nh-assistant.queue.edit' | translate\" [attr.title]=\"'nh-assistant.queue.edit' | translate\"\n (click)=\"editQueuedMessage(item.id, item.text)\"><nh-assistant-icon name=\"edit\" /></button>\n <button type=\"button\" class=\"icon-button\" [disabled]=\"item.state === 'sending'\"\n [attr.aria-label]=\"'nh-assistant.queue.remove' | translate\" [attr.title]=\"'nh-assistant.queue.remove' | translate\"\n (click)=\"store.removeQueuedMessage(item.id)\"><nh-assistant-icon name=\"close\" /></button>\n </div>\n }\n </li>\n }\n </ol>\n </section>\n }\n <nh-assistant-composer\n [disabled]=\"closed()\"\n [sendDisabled]=\"composerDisabled()\"\n [busy]=\"busy()\"\n [queueWhileBusy]=\"true\"\n [status]=\"composerStatus()\"\n [statusActor]=\"composerStatusActor()\"\n [canStop]=\"canStop()\"\n [maxLength]=\"store.limits()?.maxMessageChars ?? null\"\n [restore]=\"store.restoredDraft()\"\n [uploads]=\"store.uploads()\"\n [attachments]=\"store.attachments()\"\n (restored)=\"store.consumeRestoredDraft()\"\n (send)=\"send($event)\"\n (attach)=\"attach($event)\"\n (removeAttachment)=\"store.removeAttachment($event)\"\n (cancel)=\"cancel()\">\n @if (store.agents().length > 1) {\n <nh-assistant-agent-picker\n nhAssistantComposerControls\n [compact]=\"true\"\n [agents]=\"store.agents()\"\n [selectedAgentId]=\"store.selectedAgentId()\"\n (agentChange)=\"store.selectAgent($event)\" />\n }\n </nh-assistant-composer>\n </footer>\n }\n </section>\n</ng-template>\n","import { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { AgentSubjectSummary } from '../../models/assistant-agent-run.models';\nimport { NhAssistantSubjectSummaryService } from '../../services/nh-assistant-subject-summary.service';\n\n/**\n * A compact count of the agent work on one subject, for example on each row of a project list.\n * It shows nothing while the subject has no work. Otherwise it shows the number of proposals the\n * viewer may decide in the accent color, or, when they may decide none, a neutral count of the\n * open proposals, and a small working indicator while an agent works on the subject. Its tooltip\n * and accessible name say both counts. Badges on one page share one summary request per tick and\n * refresh on live agent-work updates of their subject; see `NhAssistantSubjectSummaryService`.\n */\n@Component({\n selector: 'nh-assistant-subject-badge',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (work(); as summary) {\n @let proposals = proposalsKey() ? (proposalsKey()! | translate: { toDecide: summary.proposalsToDecide, open: summary.openProposals }) : '';\n @let working = summary.runActive ? ('nh-assistant.subject-badge.working' | translate) : '';\n @let label = proposals && working ? proposals + ' ' + working : proposals || working;\n <span\n class=\"subject-badge\"\n [attr.data-state]=\"summary.proposalsToDecide > 0 ? 'decide' : summary.openProposals > 0 ? 'open' : 'working'\"\n [attr.title]=\"label\">\n <nh-assistant-icon name=\"assistant\" />\n @if (count() > 0) {\n <span class=\"count\" aria-hidden=\"true\">{{ countLabel() }}</span>\n }\n @if (summary.runActive) {\n <span class=\"working\" aria-hidden=\"true\"></span>\n }\n <span class=\"visually-hidden\">{{ label }}</span>\n </span>\n }\n `,\n styleUrl: './nh-assistant-subject-badge.component.scss'\n})\nexport class NhAssistantSubjectBadgeComponent {\n private readonly summaries = inject(NhAssistantSubjectSummaryService);\n private readonly summary = signal<AgentSubjectSummary | null>(null);\n\n /** The application's kind of subject, for example `project`. */\n readonly subjectType = input.required<string>();\n readonly subjectId = input.required<string>();\n\n /** The summary while the subject has work to show; `null` otherwise. */\n readonly work = computed(() => {\n const summary = this.summary();\n return summary && (summary.openProposals > 0 || summary.runActive) ? summary : null;\n });\n readonly count = computed(() => {\n const summary = this.work();\n if (!summary) {\n return 0;\n }\n return summary.proposalsToDecide > 0 ? summary.proposalsToDecide : summary.openProposals;\n });\n readonly countLabel = computed(() => this.count() > 99 ? '99+' : String(this.count()));\n readonly proposalsKey = computed(() => {\n const summary = this.work();\n if (!summary || summary.openProposals === 0) {\n return null;\n }\n return summary.proposalsToDecide > 0 ? 'nh-assistant.subject-badge.to-decide' : 'nh-assistant.subject-badge.open';\n });\n\n constructor() {\n effect(onCleanup => {\n const subjectType = this.subjectType();\n const subjectId = this.subjectId();\n const subscription = untracked(() =>\n this.summaries.summary(subjectType, subjectId).subscribe(summary => this.summary.set(summary)));\n onCleanup(() => subscription.unsubscribe());\n });\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\nimport createDOMPurify, { DOMPurify } from 'dompurify';\nimport { Marked, Renderer, Token, Tokens, TokensList } from 'marked';\nimport { NhAssistantDocumentHeading } from '../models/assistant-document.models';\nimport { nhAssistantEscapeHtml, nhAssistantMarkdownAttributes, nhAssistantMarkdownTags } from './nh-assistant-markdown';\n\n/** Links that leave the bundle: only these schemes, and they open in a new tab. */\nexport const nhAssistantExternalLinkPattern = /^(?:https?:|mailto:)/i;\nconst externalProtocols = new Set(['http:', 'https:', 'mailto:']);\nconst schemePattern = /^[a-z][a-z0-9+.-]*:/i;\nconst controlCharacters = /[\\u0000-\\u001f\\u007f]/;\nconst maxDiagramReason = 300;\n\n/** The options of one rendering of a document. */\nexport interface NhAssistantDocumentRenderOptions {\n /** The document's own path in its bundle; relative links resolve from its folder. */\n readonly path: string | null;\n /** The other documents of the bundle that links may lead to. */\n readonly siblingPaths: readonly string[];\n /** The fenced code languages that are diagrams, in lower case. */\n readonly diagramLanguages: readonly string[];\n /** Prefixes every heading id, so two documents on one page never share an id. */\n readonly idPrefix: string;\n}\n\nexport type NhAssistantDocumentSegment =\n | { readonly kind: 'html'; readonly html: string }\n | { readonly kind: 'diagram'; readonly language: string; readonly source: string };\n\nexport interface NhAssistantRenderedDocument {\n readonly segments: readonly NhAssistantDocumentSegment[];\n readonly headings: readonly NhAssistantDocumentHeading[];\n}\n\nfunction decodeOrNull(value: string, decode: (text: string) => string): string | null {\n try {\n return decode(value);\n } catch {\n return null;\n }\n}\n\n/**\n * The normalized form of a bundle path: forward slashes only, without `.` and `..` segments and\n * without a leading slash. `null` for a path that names a scheme, escapes the bundle's root or\n * holds a backslash or control character.\n */\nexport function nhAssistantBundlePath(path: string): string | null {\n const trimmed = path.trim();\n if (!trimmed || trimmed.includes('\\\\') || controlCharacters.test(trimmed) || schemePattern.test(trimmed) || trimmed.startsWith('//')) {\n return null;\n }\n\n const segments: string[] = [];\n for (const segment of trimmed.split('/')) {\n if (segment === '' || segment === '.') {\n continue;\n }\n\n if (segment === '..') {\n if (segments.length === 0) {\n return null;\n }\n segments.pop();\n continue;\n }\n\n segments.push(segment);\n }\n\n return segments.length > 0 ? segments.join('/') : null;\n}\n\n/**\n * Resolves a relative link of the document at `base` within its bundle: from the document's\n * folder, or from the bundle's root when it starts with `/`. The query is ignored.\n */\nexport function nhAssistantResolveBundleLink(base: string | null, href: string): { path: string; fragment: string | null } | null {\n const hashIndex = href.indexOf('#');\n const target = hashIndex >= 0 ? href.slice(0, hashIndex) : href;\n const fragment = hashIndex >= 0 ? decodeOrNull(href.slice(hashIndex + 1), decodeURIComponent) : null;\n const pathPart = decodeOrNull(target.split('?')[0], decodeURI);\n if (pathPart === null || pathPart.trim() === '' || (hashIndex >= 0 && fragment === null)) {\n return null;\n }\n\n const folder = base ? base.split('/').slice(0, -1).join('/') : '';\n const joined = pathPart.startsWith('/') || !folder ? pathPart : `${folder}/${pathPart}`;\n const path = schemePattern.test(pathPart) || pathPart.startsWith('//') ? null : nhAssistantBundlePath(joined);\n return path ? { path, fragment: fragment || null } : null;\n}\n\n/** The fragment of a heading: lower case, punctuation removed, spaces as dashes. */\nfunction slugOf(text: string): string {\n const slug = text\n .toLowerCase()\n .trim()\n .replace(/[^\\p{L}\\p{N}\\s_-]/gu, '')\n .replace(/\\s+/g, '-');\n return slug || 'section';\n}\n\n/** The state of one rendering, which the Markdown renderer and the sanitizer hooks share. */\nclass DocumentRendering {\n readonly headings: NhAssistantDocumentHeading[] = [];\n /** The bundle hrefs this rendering wrote, the only relative hrefs the sanitizer keeps. */\n readonly bundleHrefs = new Set<string>();\n private readonly siblings: Set<string>;\n private readonly ownPath: string | null;\n private readonly slugs = new Map<string, number>();\n\n constructor(readonly options: NhAssistantDocumentRenderOptions) {\n this.ownPath = options.path ? nhAssistantBundlePath(options.path) : null;\n this.siblings = new Set(options.siblingPaths\n .map(path => nhAssistantBundlePath(path))\n .filter((path): path is string => !!path));\n }\n\n addHeading(text: string, level: number): NhAssistantDocumentHeading {\n const base = slugOf(text);\n const seen = this.slugs.get(base) ?? 0;\n this.slugs.set(base, seen + 1);\n const fragment = seen === 0 ? base : `${base}-${seen}`;\n const heading = { id: `${this.options.idPrefix}${fragment}`, fragment, level, text };\n this.headings.push(heading);\n return heading;\n }\n\n /**\n * The href to write for a link, or `null` to show only its text: a fragment of this\n * document, an `https:`, `http:` or `mailto:` address, or a sibling of the bundle. Every\n * other scheme, such as `javascript:`, `data:` or `file:`, and every path outside the bundle\n * is refused.\n */\n hrefOf(raw: string): string | null {\n const href = raw.trim();\n if (!href || controlCharacters.test(href)) {\n return null;\n }\n\n if (href.startsWith('#')) {\n return href.length > 1 ? href : null;\n }\n\n if (nhAssistantExternalLinkPattern.test(href)) {\n return this.externalHref(href);\n }\n\n const resolved = schemePattern.test(href) || href.startsWith('//') ? null : nhAssistantResolveBundleLink(this.ownPath, href);\n if (!resolved) {\n return null;\n }\n\n const fragment = resolved.fragment ? `#${encodeURIComponent(resolved.fragment)}` : '';\n if (resolved.path === this.ownPath) {\n return fragment || null;\n }\n\n if (!this.siblings.has(resolved.path)) {\n return null;\n }\n\n const bundleHref = `${encodeURI(resolved.path)}${fragment}`;\n this.bundleHrefs.add(bundleHref);\n return bundleHref;\n }\n\n private externalHref(href: string): string | null {\n try {\n const url = new URL(href);\n return externalProtocols.has(url.protocol) ? url.href : null;\n } catch {\n return null;\n }\n }\n}\n\n/** CSS that could run code or load something, which a diagram's styles may not contain. */\nfunction isUnsafeCss(css: string): boolean {\n if (/\\\\|@import|@font-face|expression\\s*\\(|-moz-binding|behavior\\s*:|image-set\\s*\\(|\\bimage\\s*\\(|cross-fade\\s*\\(|\\bsrc\\s*\\(/i.test(css)) {\n return true;\n }\n\n return hasExternalReference(css);\n}\n\n/** `url(...)` that names anything but a fragment of the diagram itself, such as `url(#arrow)`. */\nfunction hasExternalReference(value: string): boolean {\n for (const match of value.matchAll(/url\\s*\\(\\s*(['\"]?)\\s*([^)'\"]*)/gi)) {\n if (!match[2].trim().startsWith('#')) {\n return true;\n }\n }\n\n return false;\n}\n\n/** The reason a renderer gave, as one short line; empty when it gave none. */\nexport function nhAssistantDiagramReason(error: unknown): string {\n const text = error instanceof Error ? error.message : typeof error === 'string' ? error : '';\n const line = text.replace(/\\s+/g, ' ').trim();\n return line.length > maxDiagramReason ? `${line.slice(0, maxDiagramReason - 1)}…` : line;\n}\n\n/**\n * Renders untrusted Markdown documents of a bundle with the assistant's safety defaults: inline\n * HTML shows as text, images as their alt text, links only to fragments, `https:`, `http:`,\n * `mailto:` and sibling documents, and DOMPurify sanitizes the result. Top-level fenced code\n * blocks of a diagram language become diagram segments. Internal to `nh-assistant-document`.\n */\n@Injectable({ providedIn: 'root' })\nexport class NhAssistantDocumentMarkdownRenderer {\n private readonly document = inject(DOCUMENT);\n private documentPurifier: DOMPurify | null = null;\n private diagramPurifier: DOMPurify | null = null;\n /** The rendering being sanitized; the purifier's hooks read it. */\n private current: DocumentRendering | null = null;\n\n render(markdown: string, options: NhAssistantDocumentRenderOptions): NhAssistantRenderedDocument {\n const rendering = new DocumentRendering(options);\n const purifier = this.getDocumentPurifier();\n if (!purifier) {\n return { segments: [{ kind: 'html', html: `<p>${nhAssistantEscapeHtml(markdown)}</p>` }], headings: [] };\n }\n\n const marked = this.createMarked(rendering);\n const tokens = marked.lexer(markdown);\n const diagramLanguages = new Set(options.diagramLanguages.map(language => language.toLowerCase()));\n const segments: NhAssistantDocumentSegment[] = [];\n let pending: Token[] = [];\n\n const flush = () => {\n if (pending.length === 0) {\n return;\n }\n\n const html = marked.parser(Object.assign(pending, { links: tokens.links }) as TokensList);\n segments.push({ kind: 'html', html: this.sanitize(purifier, rendering, html) });\n pending = [];\n };\n\n for (const token of tokens) {\n const language = token.type === 'code' ? (token as Tokens.Code).lang?.trim().split(/\\s+/)[0]?.toLowerCase() : undefined;\n if (language && diagramLanguages.has(language)) {\n flush();\n segments.push({ kind: 'diagram', language, source: (token as Tokens.Code).text });\n continue;\n }\n\n pending.push(token);\n }\n flush();\n\n return { segments, headings: rendering.headings };\n }\n\n /**\n * Sanitizes a renderer's SVG: SVG and its filters only, without scripts, event handlers,\n * links, images, `use`, foreign content, external references or CSS that could load or run\n * anything. `null` when the result is not one SVG element.\n */\n sanitizeDiagram(svg: string): SVGSVGElement | null {\n const purifier = this.getDiagramPurifier();\n if (!purifier) {\n return null;\n }\n\n const fragment = purifier.sanitize(svg, {\n USE_PROFILES: { svg: true, svgFilters: true },\n FORBID_TAGS: ['a', 'image', 'use', 'feImage', 'foreignObject', 'script', 'iframe'],\n FORBID_ATTR: ['href', 'xlink:href'],\n ALLOW_DATA_ATTR: false,\n RETURN_DOM_FRAGMENT: true\n });\n const elements = Array.from(fragment.children);\n const root = elements[0];\n if (elements.length !== 1 || root.namespaceURI !== 'http://www.w3.org/2000/svg' || root.localName !== 'svg') {\n return null;\n }\n\n return root as SVGSVGElement;\n }\n\n private createMarked(rendering: DocumentRendering): Marked {\n return new Marked({\n gfm: true,\n breaks: false,\n async: false,\n renderer: {\n html(token: Tokens.HTML | Tokens.Tag): string {\n return nhAssistantEscapeHtml(token.text);\n },\n image(token: Tokens.Image): string {\n return nhAssistantEscapeHtml(token.text);\n },\n heading(this: Renderer, token: Tokens.Heading): string {\n const text = this.parser.parseInline(token.tokens, this.parser.textRenderer);\n const heading = rendering.addHeading(text, token.depth);\n return `<h${token.depth} id=\"${nhAssistantEscapeHtml(heading.id)}\">${this.parser.parseInline(token.tokens)}</h${token.depth}>\\n`;\n },\n link(this: Renderer, token: Tokens.Link): string {\n const label = this.parser.parseInline(token.tokens);\n const href = rendering.hrefOf(token.href);\n if (!href) {\n return label;\n }\n\n const title = token.title ? ` title=\"${nhAssistantEscapeHtml(token.title)}\"` : '';\n return `<a href=\"${nhAssistantEscapeHtml(href)}\"${title}>${label}</a>`;\n }\n }\n });\n }\n\n private sanitize(purifier: DOMPurify, rendering: DocumentRendering, html: string): string {\n this.current = rendering;\n try {\n return purifier.sanitize(html, {\n ALLOWED_TAGS: [...nhAssistantMarkdownTags],\n ALLOWED_ATTR: [...nhAssistantMarkdownAttributes, 'id'],\n ALLOWED_URI_REGEXP: /^(?:https?:|mailto:|#)/i,\n ALLOW_DATA_ATTR: false,\n ALLOW_ARIA_ATTR: false\n });\n } finally {\n this.current = null;\n }\n }\n\n private createPurifier(): DOMPurify | null {\n const view = this.document.defaultView;\n if (!view) {\n return null;\n }\n\n const purifier = createDOMPurify(view);\n return purifier.isSupported ? purifier : null;\n }\n\n private getDocumentPurifier(): DOMPurify | null {\n if (this.documentPurifier) {\n return this.documentPurifier;\n }\n\n const purifier = this.createPurifier();\n if (!purifier) {\n return null;\n }\n\n purifier.addHook('uponSanitizeAttribute', (_node, event) => {\n const rendering = this.current;\n if (event.attrName === 'href' && rendering?.bundleHrefs.has(event.attrValue)) {\n // A sibling document this rendering resolved itself; the URI pattern knows no paths.\n event.forceKeepAttr = true;\n } else if (event.attrName === 'id' && !(rendering && event.attrValue.startsWith(rendering.options.idPrefix))) {\n event.keepAttr = false;\n }\n });\n purifier.addHook('afterSanitizeAttributes', node => {\n const href = node.tagName === 'A' ? node.getAttribute('href') : null;\n if (href && nhAssistantExternalLinkPattern.test(href)) {\n node.setAttribute('target', '_blank');\n node.setAttribute('rel', 'noopener noreferrer');\n }\n });\n\n this.documentPurifier = purifier;\n return purifier;\n }\n\n private getDiagramPurifier(): DOMPurify | null {\n if (this.diagramPurifier) {\n return this.diagramPurifier;\n }\n\n const purifier = this.createPurifier();\n if (!purifier) {\n return null;\n }\n\n purifier.addHook('uponSanitizeElement', (node, event) => {\n if (event.tagName === 'style' && isUnsafeCss(node.textContent ?? '')) {\n node.textContent = '';\n }\n });\n purifier.addHook('uponSanitizeAttribute', (_node, event) => {\n const unsafe = event.attrName === 'style' ? isUnsafeCss(event.attrValue) : hasExternalReference(event.attrValue);\n if (unsafe) {\n event.keepAttr = false;\n }\n });\n\n this.diagramPurifier = purifier;\n return purifier;\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n PLATFORM_ID,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantDocumentMarkdownRenderer, nhAssistantDiagramReason } from '../../internal/nh-assistant-document-markdown';\nimport { NhAssistantDiagramRenderer } from '../../models/assistant-document.models';\n\ntype DiagramState =\n | { readonly kind: 'source' }\n | { readonly kind: 'drawing' }\n | { readonly kind: 'drawn' }\n | { readonly kind: 'failed'; readonly reason: string; readonly reasonKey: string | null };\n\n/** Sizes the drawing inside its own shadow root, where the diagram's styles stay contained. */\nconst canvasStyles = ':host { display: block; } svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }';\n\n/**\n * One diagram of a document: the source while it is drawn or when no renderer draws it, the\n * sanitized SVG once drawn, and the source with the reason when it cannot be drawn. The SVG\n * goes into a shadow root, so its styles never reach the page. Internal to\n * `nh-assistant-document`.\n */\n@Component({\n selector: 'nh-assistant-document-diagram',\n standalone: true,\n imports: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <figure class=\"diagram\" [attr.data-diagram-state]=\"state().kind\" [attr.aria-busy]=\"state().kind === 'drawing'\">\n <div #canvas class=\"canvas\" [hidden]=\"state().kind !== 'drawn'\"></div>\n @if (state().kind !== 'drawn') {\n <pre class=\"source\"><code>{{ source() }}</code></pre>\n }\n @if (failure(); as failed) {\n <figcaption class=\"failure\" role=\"note\">\n {{ 'nh-assistant.document.diagram-failed' | translate: { reason: failed.reasonKey ? (failed.reasonKey | translate) : failed.reason } }}\n </figcaption>\n }\n </figure>\n `,\n styles: `\n :host { display: block; margin: 0 0 12px; }\n .diagram { margin: 0; }\n .canvas { overflow-x: auto; }\n .source {\n margin: 0;\n overflow-x: auto;\n border-radius: 8px;\n padding: 8px;\n background: var(--nha-surface-strong);\n font-family: var(--nha-mono);\n font-size: 12.5px;\n }\n .failure { margin-top: 6px; color: var(--nha-danger); font-size: 13px; }\n `\n})\nexport class NhAssistantDocumentDiagramComponent {\n private readonly markdown = inject(NhAssistantDocumentMarkdownRenderer);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly canvas = viewChild.required<ElementRef<HTMLElement>>('canvas');\n private generation = 0;\n\n /** The block's text. */\n readonly source = input.required<string>();\n /** The block's language in lower case. */\n readonly language = input.required<string>();\n readonly renderer = input<NhAssistantDiagramRenderer | null>(null);\n\n readonly state = signal<DiagramState>({ kind: 'source' });\n\n failure(): Extract<DiagramState, { kind: 'failed' }> | null {\n const state = this.state();\n return state.kind === 'failed' ? state : null;\n }\n\n constructor() {\n effect(() => {\n const source = this.source();\n const language = this.language();\n const renderer = this.renderer();\n untracked(() => {\n void this.draw(source, language, renderer);\n });\n });\n }\n\n private async draw(source: string, language: string, renderer: NhAssistantDiagramRenderer | null): Promise<void> {\n const generation = ++this.generation;\n if (!this.browser || !renderer) {\n this.state.set({ kind: 'source' });\n return;\n }\n\n this.state.set({ kind: 'drawing' });\n let svg: unknown;\n try {\n svg = await renderer.render(source, language);\n } catch (error) {\n if (generation === this.generation) {\n const reason = nhAssistantDiagramReason(error);\n this.state.set({ kind: 'failed', reason, reasonKey: reason ? null : 'nh-assistant.document.diagram-no-reason' });\n }\n return;\n }\n\n if (generation !== this.generation) {\n return;\n }\n\n const drawing = typeof svg === 'string' ? this.markdown.sanitizeDiagram(svg) : null;\n if (!drawing) {\n this.state.set({ kind: 'failed', reason: '', reasonKey: 'nh-assistant.document.diagram-not-svg' });\n return;\n }\n\n this.paint(drawing);\n this.state.set({ kind: 'drawn' });\n }\n\n private paint(drawing: SVGSVGElement): void {\n const canvas = this.canvas().nativeElement;\n const shadow = canvas.shadowRoot ?? canvas.attachShadow({ mode: 'open' });\n const style = canvas.ownerDocument.createElement('style');\n style.textContent = canvasStyles;\n shadow.replaceChildren(style, drawing);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n afterRenderEffect,\n computed,\n inject,\n input,\n output\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport {\n NhAssistantDocumentMarkdownRenderer,\n nhAssistantExternalLinkPattern\n} from '../../internal/nh-assistant-document-markdown';\nimport {\n NhAssistantDiagramRenderer,\n NhAssistantDocumentHeading,\n NhAssistantDocumentLinkEvent\n} from '../../models/assistant-document.models';\nimport { NhAssistantDocumentDiagramComponent } from './nh-assistant-document-diagram.component';\n\nlet nextDocumentId = 0;\n\ntype DocumentPart =\n | { readonly kind: 'html'; readonly html: SafeHtml }\n | { readonly kind: 'diagram'; readonly language: string; readonly source: string };\n\nfunction decoded(value: string, decode: (text: string) => string): string {\n try {\n return decode(value);\n } catch {\n return value;\n }\n}\n\n/**\n * Renders an untrusted Markdown document, for example one file of a skill or knowledge bundle,\n * with the assistant's safety defaults: inline HTML shows as text, images as their alt text, and\n * a link keeps its address only for a heading of the document, a sibling of the bundle or an\n * `https:`, `http:` or `mailto:` address; `javascript:`, `data:` and every other scheme show as\n * text. Relative links resolve from the document's `path` against `siblingPaths`.\n *\n * Fenced code blocks of the languages of `diagramRenderer` become diagrams: the application's\n * renderer draws them, the document sanitizes its SVG and shows it in a shadow root, and a block\n * it cannot draw shows its source with the reason. Without a renderer they stay code.\n *\n * `linkClick` reports every link the reader activates; `headingsChange` the headings once they\n * are in the page. The texts are `nh-assistant.document.*`, which `provideNhAssistant` merges;\n * an application without it starts `NhAssistantTranslationMerger` or translates the keys itself.\n */\n@Component({\n selector: 'nh-assistant-document',\n standalone: true,\n imports: [NhAssistantDocumentDiagramComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-document.component.html',\n styleUrl: './nh-assistant-document.component.scss',\n host: {\n class: 'nh-assistant-document',\n '(click)': 'onClick($event)'\n }\n})\nexport class NhAssistantDocumentComponent {\n private readonly markdownRenderer = inject(NhAssistantDocumentMarkdownRenderer);\n private readonly sanitizer = inject(DomSanitizer);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly idPrefix = `nh-document-${++nextDocumentId}-`;\n\n /** The document's Markdown. Treated as untrusted. */\n readonly markdown = input.required<string>();\n /** The document's own path in its bundle, for example `guides/setup.md`. */\n readonly path = input<string | null>(null);\n /** The paths of the other documents in the bundle that its links may open. */\n readonly siblingPaths = input<readonly string[]>([]);\n /** Draws the bundle's diagrams; the application loads its drawing library lazily. */\n readonly diagramRenderer = input<NhAssistantDiagramRenderer | null>(null);\n\n /** A link the reader activated; see `NhAssistantDocumentLinkEvent`. */\n readonly linkClick = output<NhAssistantDocumentLinkEvent>();\n /** The headings, in document order, each time they changed and are in the page. */\n readonly headingsChange = output<readonly NhAssistantDocumentHeading[]>();\n\n private readonly rendered = computed(() => this.markdownRenderer.render(this.markdown() ?? '', {\n path: this.path(),\n siblingPaths: this.siblingPaths() ?? [],\n diagramLanguages: this.diagramRenderer()?.languages ?? [],\n idPrefix: this.idPrefix\n }));\n\n /** The headings of the rendered document. */\n readonly headings = computed(() => this.rendered().headings);\n\n readonly parts = computed<readonly DocumentPart[]>(() => this.rendered().segments.map(segment => {\n if (segment.kind === 'diagram') {\n return segment;\n }\n\n // DOMPurify sanitized the HTML; Angular's own sanitizer would drop the heading ids.\n return { kind: 'html', html: this.sanitizer.bypassSecurityTrustHtml(segment.html) };\n }));\n\n constructor() {\n afterRenderEffect(() => {\n this.headingsChange.emit(this.headings());\n });\n }\n\n /**\n * Scrolls to a heading of the document by its fragment and focuses it; false when the\n * document has no such heading.\n */\n scrollToHeading(fragment: string): boolean {\n const heading = this.headings().find(item => item.fragment === fragment);\n const element = heading ? this.host.nativeElement.querySelector<HTMLElement>(`[id=\"${CSS.escape(heading.id)}\"]`) : null;\n if (!element) {\n return false;\n }\n\n if (!element.hasAttribute('tabindex')) {\n element.setAttribute('tabindex', '-1');\n }\n element.scrollIntoView({ block: 'start' });\n element.focus({ preventScroll: true });\n return true;\n }\n\n onClick(event: MouseEvent): void {\n const target = event.target instanceof Element ? event.target : null;\n const anchor = target?.closest('a[href]');\n if (!anchor || !this.host.nativeElement.contains(anchor)) {\n return;\n }\n\n const href = anchor.getAttribute('href') ?? '';\n if (href.startsWith('#')) {\n const fragment = decoded(href.slice(1), decodeURIComponent);\n event.preventDefault();\n this.scrollToHeading(fragment);\n this.linkClick.emit({ kind: 'anchor', href, path: null, fragment, event });\n return;\n }\n\n if (nhAssistantExternalLinkPattern.test(href)) {\n this.linkClick.emit({ kind: 'external', href, path: null, fragment: null, event });\n return;\n }\n\n // A sibling of the bundle: the application opens it, the browser does not navigate.\n event.preventDefault();\n const hashIndex = href.indexOf('#');\n const path = decoded(hashIndex >= 0 ? href.slice(0, hashIndex) : href, decodeURI);\n const fragment = hashIndex >= 0 ? decoded(href.slice(hashIndex + 1), decodeURIComponent) : null;\n this.linkClick.emit({ kind: 'document', href, path, fragment, event });\n }\n}\n","@for (part of parts(); track $index) {\n @if (part.kind === 'html') {\n <div class=\"document-part markdown\" [innerHTML]=\"part.html\"></div>\n } @else {\n <nh-assistant-document-diagram [source]=\"part.source\" [language]=\"part.language\" [renderer]=\"diagramRenderer()\" />\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n computed,\n inject,\n input,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Observable, Subscription } from 'rxjs';\nimport { NhAssistantError } from '../services/nh-assistant.store';\nimport { nhAssistantErrorKeys, toNhAssistantError } from './nh-assistant-errors';\nimport { NhAssistantIconComponent } from './nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from './nh-assistant-translate.pipe';\n\n/** One choice of a picker: the stored value, its name and what it means. */\nexport interface NhAssistantPickerOption {\n value: string;\n label: string;\n description?: string | null;\n}\n\nlet nextId = 0;\nconst searchDelayMs = 250;\n\n/**\n * A searchable choice for the administration (internal): a combobox with a listbox popup in the ARIA\n * 1.2 pattern. Typing filters the options on name and description, the arrow keys move, Enter\n * chooses and Escape closes. With `search` it asks the server instead, after `minQueryLength`\n * characters; a failed search says why below the field, with its translated code, and offers to\n * search again instead of claiming that nothing was found. `noneLabel` adds an explicit empty\n * choice, emitted as `''`.\n */\n@Component({\n selector: 'nh-assistant-picker',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-picker.component.html',\n styleUrl: './nh-assistant-picker.component.scss'\n})\nexport class NhAssistantPickerComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private searchTimer?: ReturnType<typeof setTimeout>;\n private searchSubscription?: Subscription;\n /** The text of the latest search, for searching again after a failure. */\n private lastQuery = '';\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('field');\n\n /** The id of the text field, for the label's `for`. */\n readonly inputId = input.required<string>();\n readonly options = input<readonly NhAssistantPickerOption[]>([]);\n readonly value = input<string | null>(null);\n /** The name to show for a value that is not among the options, such as a found account. */\n readonly selectedLabel = input<string | null>(null);\n /** The label of the empty choice; without it there is none. */\n readonly noneLabel = input<string | null>(null);\n readonly placeholder = input<string | null>(null);\n /** Searches the server; the options are ignored while it is set. */\n readonly search = input<((query: string) => Observable<NhAssistantPickerOption[]>) | null>(null);\n readonly minQueryLength = input(2);\n readonly invalid = input(false);\n readonly describedBy = input<string | null>(null);\n readonly disabled = input(false);\n\n readonly valueChange = output<string>();\n /** The chosen option, also for a search result the options do not contain. */\n readonly optionChange = output<NhAssistantPickerOption | null>();\n\n readonly listId = `nh-assistant-picker-${nextId++}`;\n readonly open = signal(false);\n /** The text typed since the list opened; `null` shows the chosen option's name. */\n readonly query = signal<string | null>(null);\n readonly active = signal(-1);\n readonly searching = signal(false);\n readonly results = signal<NhAssistantPickerOption[]>([]);\n /** Why the latest search failed; `null` after a search that answered. */\n readonly searchError = signal<NhAssistantError | null>(null);\n readonly searchErrorKeys = computed(() => nhAssistantErrorKeys(this.searchError()));\n readonly searchErrorId = `${this.listId}-search-error`;\n /** The field describes itself with the host's ids and, after a failed search, with its reason. */\n readonly fieldDescribedBy = computed(() =>\n [this.describedBy(), this.searchError() ? this.searchErrorId : null].filter(Boolean).join(' ') || null);\n private readonly chosen = signal<NhAssistantPickerOption | null>(null);\n\n readonly selected = computed<NhAssistantPickerOption | null>(() => {\n const value = this.value();\n if (value === null || value === '') {\n return null;\n }\n const known = this.options().find(option => option.value === value)\n ?? this.results().find(option => option.value === value)\n ?? (this.chosen()?.value === value ? this.chosen() : null);\n return known ?? { value, label: this.selectedLabel() ?? value };\n });\n\n readonly inputText = computed(() => this.query() ?? this.selected()?.label ?? (this.value() === '' ? this.noneLabel() ?? '' : ''));\n\n readonly visible = computed<NhAssistantPickerOption[]>(() => {\n if (this.search()) {\n return this.results();\n }\n const none = this.noneLabel();\n const all = none === null ? [...this.options()] : [{ value: '', label: none }, ...this.options()];\n const text = this.query()?.trim().toLocaleLowerCase() ?? '';\n return text.length === 0\n ? all\n : all.filter(option =>\n option.label.toLocaleLowerCase().includes(text)\n || option.value.toLocaleLowerCase().includes(text)\n || (option.description ?? '').toLocaleLowerCase().includes(text));\n });\n\n /** Why the list is empty: still typing, searching, the search failed, or nothing found. */\n readonly emptyKey = computed(() => {\n if (this.searching()) {\n return 'nh-assistant.picker.searching';\n }\n if (this.searchError()) {\n return 'nh-assistant.picker.search-failed';\n }\n if (this.search() && (this.query()?.trim().length ?? 0) < this.minQueryLength()) {\n return 'nh-assistant.picker.type-more';\n }\n return 'nh-assistant.picker.no-results';\n });\n\n readonly activeId = computed(() => this.open() && this.active() >= 0 && this.active() < this.visible().length\n ? this.optionId(this.active())\n : null);\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.searchTimer);\n this.searchSubscription?.unsubscribe();\n });\n }\n\n optionId(index: number): string {\n return `${this.listId}-option-${index}`;\n }\n\n /** Moves the focus to the text field, for example after a refused save. */\n focus(): void {\n this.field().nativeElement.focus();\n }\n\n toggle(): void {\n if (this.open()) {\n this.close();\n } else {\n this.openList();\n this.focus();\n }\n }\n\n openList(): void {\n if (this.disabled() || this.open()) {\n return;\n }\n this.open.set(true);\n const index = this.visible().findIndex(option => option.value === (this.value() ?? ''));\n this.active.set(index);\n }\n\n onInput(event: Event): void {\n const text = (event.target as HTMLInputElement).value;\n this.query.set(text);\n this.open.set(true);\n this.active.set(this.search() ? -1 : 0);\n if (this.search()) {\n this.startSearch(text);\n }\n }\n\n onKeydown(event: KeyboardEvent): void {\n const count = this.visible().length;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.open()) {\n this.openList();\n }\n this.active.set(Math.min(this.active() + 1, count - 1));\n this.scrollActiveIntoView();\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.active.set(Math.max(this.active() - 1, 0));\n this.scrollActiveIntoView();\n break;\n case 'Enter':\n if (this.open()) {\n event.preventDefault();\n const option = this.visible()[this.active()];\n if (option) {\n this.choose(option);\n } else {\n this.close();\n }\n }\n break;\n case 'Escape':\n if (this.open()) {\n event.preventDefault();\n event.stopPropagation();\n this.close();\n }\n break;\n case 'Tab':\n this.close();\n break;\n }\n }\n\n onBlur(): void {\n this.close();\n }\n\n /** Searches the latest text again after a failed search and shows the list. */\n retrySearch(): void {\n if (!this.search() || this.disabled()) {\n return;\n }\n this.query.set(this.lastQuery);\n this.open.set(true);\n this.active.set(-1);\n this.startSearch(this.lastQuery);\n this.focus();\n }\n\n choose(option: NhAssistantPickerOption): void {\n this.searchError.set(null);\n this.chosen.set(option.value === '' ? null : option);\n this.valueChange.emit(option.value);\n this.optionChange.emit(option.value === '' ? null : option);\n this.close();\n }\n\n private close(): void {\n this.open.set(false);\n this.query.set(null);\n this.active.set(-1);\n }\n\n private startSearch(text: string): void {\n clearTimeout(this.searchTimer);\n this.searchSubscription?.unsubscribe();\n this.lastQuery = text;\n this.searchError.set(null);\n const search = this.search();\n const query = text.trim();\n if (!search || query.length < this.minQueryLength()) {\n this.results.set([]);\n this.searching.set(false);\n return;\n }\n this.searching.set(true);\n this.searchTimer = setTimeout(() => {\n this.searchSubscription = search(query).subscribe({\n next: results => {\n this.results.set(results);\n this.searching.set(false);\n this.active.set(results.length > 0 ? 0 : -1);\n },\n error: (error: unknown) => {\n this.results.set([]);\n this.searching.set(false);\n this.searchError.set(toNhAssistantError(error));\n }\n });\n }, searchDelayMs);\n }\n\n private scrollActiveIntoView(): void {\n const id = this.activeId();\n if (id) {\n queueMicrotask(() => this.host.nativeElement.querySelector(`#${id}`)?.scrollIntoView?.({ block: 'nearest' }));\n }\n }\n}\n","<div class=\"picker\" [class.open]=\"open()\">\n <div class=\"control\">\n <input\n #field\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n [id]=\"inputId()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-invalid]=\"invalid() ? true : null\"\n [attr.aria-describedby]=\"fieldDescribedBy()\"\n [attr.placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [value]=\"inputText()\"\n (input)=\"onInput($event)\"\n (click)=\"openList()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\" />\n <button\n type=\"button\"\n class=\"toggle\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.picker.toggle' | translate\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"toggle()\">\n <nh-assistant-icon name=\"chevron-down\" />\n </button>\n </div>\n @if (searchError(); as failure) {\n <!-- A failed search says why and offers to search again; the list never claims nothing was found. -->\n <p class=\"field-error search-error\" role=\"alert\" data-search-error [id]=\"searchErrorId\">\n <nh-assistant-icon name=\"warning\" />\n <span>{{ searchErrorKeys() | nhAssistantTranslate: failure.code }}</span>\n <button\n type=\"button\"\n class=\"link\"\n data-search-retry\n [disabled]=\"disabled()\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"retrySearch()\">{{ 'nh-assistant.picker.search-again' | translate }}</button>\n </p>\n }\n @if (open()) {\n <ul class=\"listbox\" role=\"listbox\" [id]=\"listId\">\n @for (option of visible(); track option.value; let index = $index) {\n <li\n role=\"option\"\n [id]=\"optionId(index)\"\n [class.active]=\"index === active()\"\n [attr.aria-selected]=\"option.value === (value() ?? '')\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"active.set(index)\"\n (click)=\"choose(option)\">\n <span class=\"label\">{{ option.label }}</span>\n @if (option.description) {\n <span class=\"description\">{{ option.description }}</span>\n }\n </li>\n } @empty {\n <li class=\"state\" role=\"presentation\">{{ emptyKey() | translate }}</li>\n }\n </ul>\n } @else if (selected()?.description; as description) {\n <p class=\"chosen\">{{ description }}</p>\n }\n</div>\n","/*\n * Public API surface of @newheap/platform-ai-chat.\n */\nexport * from './lib/models/assistant-api.models';\nexport * from './lib/models/assistant-sse.models';\nexport * from './lib/models/assistant-live.models';\nexport * from './lib/models/assistant-admin.models';\nexport * from './lib/models/assistant-agent-run.models';\nexport * from './lib/models/assistant-hand-off.models';\nexport * from './lib/models/assistant-agent-package.models';\nexport * from './lib/models/assistant-document.models';\nexport * from './lib/nh-assistant.config';\nexport * from './lib/provide-nh-assistant';\nexport { NH_ASSISTANT_TRANSLATIONS, NhAssistantTranslationMerger } from './lib/i18n/nh-assistant-translations';\nexport * from './lib/i18n/nh-assistant-error-codes';\nexport * from './lib/services/nh-assistant-sse-parser';\nexport { NhAssistantStatusCodes } from './lib/services/nh-assistant-transport';\nexport * from './lib/services/nh-assistant-api.service';\nexport * from './lib/services/nh-assistant-admin-api.service';\nexport * from './lib/services/nh-assistant-agent-run-api.service';\nexport * from './lib/services/nh-assistant-reducer';\nexport * from './lib/services/nh-assistant-page-context';\nexport * from './lib/services/nh-assistant.store';\nexport { NhAssistantLiveService, NhAssistantLiveState } from './lib/services/nh-assistant-live.service';\nexport { NhAssistantPushService, NhAssistantPushState } from './lib/services/nh-assistant-push.service';\nexport * from './lib/services/nh-assistant-panel.service';\nexport * from './lib/services/nh-assistant-subject-summary.service';\nexport * from './lib/services/nh-assistant-share-link';\nexport * from './lib/services/nh-assistant-mcp-authorization';\nexport * from './lib/services/nh-assistant-mcp-connect.service';\nexport { toNhAssistantError } from './lib/internal/nh-assistant-errors';\nexport { NH_ASSISTANT_ICONS, NhAssistantIconName } from './lib/internal/nh-assistant-icon.component';\nexport * from './lib/components/launcher/nh-assistant-launcher.component';\nexport * from './lib/components/panel/nh-assistant-panel.component';\nexport * from './lib/components/conversation-list/nh-assistant-conversation-list.component';\nexport * from './lib/components/thread/nh-assistant-thread.component';\nexport * from './lib/components/composer/nh-assistant-composer.component';\nexport * from './lib/components/tool-call-card/nh-assistant-tool-call-card.component';\nexport * from './lib/components/tool-call-group/nh-assistant-tool-call-group.component';\nexport * from './lib/components/approval-card/nh-assistant-approval-card.component';\nexport * from './lib/components/question-card/nh-assistant-question-card.component';\nexport * from './lib/components/proposal-feedback/nh-assistant-proposal-feedback.component';\nexport * from './lib/components/agent-picker/nh-assistant-agent-picker.component';\nexport * from './lib/components/preferences/nh-assistant-preferences.component';\nexport * from './lib/components/preferences/nh-assistant-mcp-connections.component';\nexport * from './lib/components/connection-required/nh-assistant-connection-required.component';\nexport * from './lib/components/share/nh-assistant-share.component';\nexport * from './lib/components/activity/nh-assistant-activity.component';\nexport * from './lib/components/subject-badge/nh-assistant-subject-badge.component';\nexport * from './lib/components/document/nh-assistant-document.component';\n\n/*\n * Internal building blocks shared with the secondary entry points. Not part of the public\n * API; they may change without notice.\n */\nexport { NhAssistantIconComponent as ɵNhAssistantIconComponent } from './lib/internal/nh-assistant-icon.component';\nexport { NhAssistantTranslatePipe as ɵNhAssistantTranslatePipe } from './lib/internal/nh-assistant-translate.pipe';\nexport {\n nhAssistantReloadOnAgentWork as ɵnhAssistantReloadOnAgentWork,\n nhAssistantWatchAgentWork as ɵnhAssistantWatchAgentWork\n} from './lib/internal/nh-assistant-agent-work';\nexport {\n NhAssistantPickerComponent as ɵNhAssistantPickerComponent,\n type NhAssistantPickerOption as ɵNhAssistantPickerOption\n} from './lib/internal/nh-assistant-picker.component';\nexport { NhAssistantSubjectLinkComponent as ɵNhAssistantSubjectLinkComponent } from './lib/internal/nh-assistant-subject-link.component';\nexport { NhAssistantMarkdownPipe as ɵNhAssistantMarkdownPipe } from './lib/internal/nh-assistant-markdown.pipe';\n// The merge of bundled texts, shared with the administration, which brings its own texts.\nexport { nhAssistantMergeTranslations as ɵnhAssistantMergeTranslations } from './lib/i18n/nh-assistant-translations';\n// The upload media type rule, shared with the mock API of the testing entry point.\nexport { nhAssistantMediaTypeOf as ɵnhAssistantMediaTypeOf } from './lib/internal/nh-assistant-files';\nexport {\n NH_ASSISTANT_DASH_CASE as ɵNH_ASSISTANT_DASH_CASE,\n nhAssistantCodeKeys as ɵnhAssistantCodeKeys,\n nhAssistantErrorKeys as ɵnhAssistantErrorKeys,\n nhAssistantErrorOf as ɵnhAssistantErrorOf,\n // Kept for the secondary entry points and earlier callers; `toNhAssistantError` is public.\n toNhAssistantError as ɵtoNhAssistantError\n} from './lib/internal/nh-assistant-errors';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["withQuery","nextId","searchDelayMs","statusIcons"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;AAMG;;ACmGI,MAAM,4BAA4B,GAAuC;IAC9E,cAAc;IACd,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,qBAAqB;IACrB,gBAAgB;IAChB;;AAGF;;;AAGG;AACI,MAAM,2BAA2B,GAAG;AACzC,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,eAAe,EAAE,2BAA2B;AAC5C,IAAA,SAAS,EAAE,qBAAqB;AAChC,IAAA,QAAQ,EAAE,qBAAqB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AA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEnDnF;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"newheap-platform-ai-chat.mjs","sources":["../../../projects/nh-ai-chat/src/lib/models/assistant-api.models.ts","../../../projects/nh-ai-chat/src/lib/models/assistant-sse.models.ts","../../../projects/nh-ai-chat/src/lib/models/assistant-agent-run.models.ts","../../../projects/nh-ai-chat/src/lib/models/assistant-agent-package.models.ts","../../../projects/nh-ai-chat/src/lib/nh-assistant.config.ts","../../../projects/nh-ai-chat/src/lib/i18n/nh-assistant-translations.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-sse-parser.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-transport.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-api.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-admin-api.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-agent-run-api.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-live.service.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-errors.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-mcp-authorization.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-mcp-connect.service.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-push.service.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-files.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-reducer.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-page-context.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-ui-state.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant.store.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-panel.service.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-agent-work.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-subject-summary.service.ts","../../../projects/nh-ai-chat/src/lib/provide-nh-assistant.ts","../../../projects/nh-ai-chat/src/lib/i18n/nh-assistant-error-codes.ts","../../../projects/nh-ai-chat/src/lib/services/nh-assistant-share-link.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-icon.component.ts","../../../projects/nh-ai-chat/src/lib/components/launcher/nh-assistant-launcher.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-translate.pipe.ts","../../../projects/nh-ai-chat/src/lib/components/activity/nh-assistant-activity.component.ts","../../../projects/nh-ai-chat/src/lib/components/agent-picker/nh-assistant-agent-picker.component.ts","../../../projects/nh-ai-chat/src/lib/components/composer/nh-assistant-composer.component.ts","../../../projects/nh-ai-chat/src/lib/components/composer/nh-assistant-composer.component.html","../../../projects/nh-ai-chat/src/lib/components/conversation-list/nh-assistant-conversation-list.component.ts","../../../projects/nh-ai-chat/src/lib/components/conversation-list/nh-assistant-conversation-list.component.html","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-mcp-connections.component.ts","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-mcp-connections.component.html","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-preferences.component.ts","../../../projects/nh-ai-chat/src/lib/components/preferences/nh-assistant-preferences.component.html","../../../projects/nh-ai-chat/src/lib/components/share/nh-assistant-share.component.ts","../../../projects/nh-ai-chat/src/lib/components/share/nh-assistant-share.component.html","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-markdown.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-markdown.pipe.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-subject-link.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-message-link.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-part-groups.ts","../../../projects/nh-ai-chat/src/lib/components/proposal-feedback/nh-assistant-proposal-feedback.component.ts","../../../projects/nh-ai-chat/src/lib/components/proposal-feedback/nh-assistant-proposal-feedback.component.html","../../../projects/nh-ai-chat/src/lib/components/approval-card/nh-assistant-approval-card.component.ts","../../../projects/nh-ai-chat/src/lib/components/approval-card/nh-assistant-approval-card.component.html","../../../projects/nh-ai-chat/src/lib/components/connection-required/nh-assistant-connection-required.component.ts","../../../projects/nh-ai-chat/src/lib/components/connection-required/nh-assistant-connection-required.component.html","../../../projects/nh-ai-chat/src/lib/components/question-card/nh-assistant-question-card.component.ts","../../../projects/nh-ai-chat/src/lib/components/question-card/nh-assistant-question-card.component.html","../../../projects/nh-ai-chat/src/lib/components/tool-call-card/nh-assistant-tool-call-card.component.ts","../../../projects/nh-ai-chat/src/lib/components/tool-call-card/nh-assistant-tool-call-card.component.html","../../../projects/nh-ai-chat/src/lib/components/tool-call-group/nh-assistant-tool-call-group.component.ts","../../../projects/nh-ai-chat/src/lib/components/tool-call-group/nh-assistant-tool-call-group.component.html","../../../projects/nh-ai-chat/src/lib/components/thread/nh-assistant-thread.component.ts","../../../projects/nh-ai-chat/src/lib/components/thread/nh-assistant-thread.component.html","../../../projects/nh-ai-chat/src/lib/components/panel/nh-assistant-panel.component.ts","../../../projects/nh-ai-chat/src/lib/components/panel/nh-assistant-panel.component.html","../../../projects/nh-ai-chat/src/lib/components/subject-badge/nh-assistant-subject-badge.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-document-markdown.ts","../../../projects/nh-ai-chat/src/lib/components/document/nh-assistant-document-diagram.component.ts","../../../projects/nh-ai-chat/src/lib/components/document/nh-assistant-document.component.ts","../../../projects/nh-ai-chat/src/lib/components/document/nh-assistant-document.component.html","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-picker.component.ts","../../../projects/nh-ai-chat/src/lib/internal/nh-assistant-picker.component.html","../../../projects/nh-ai-chat/src/public-api.ts","../../../projects/nh-ai-chat/src/newheap-platform-ai-chat.ts"],"sourcesContent":["/*\n * Wire models of the NewHeap assistant HTTP API.\n *\n * These interfaces are a literal translation of the assistant API contract. Keep the\n * field names identical to the JSON the server returns (camelCase, ISO-8601 UTC dates,\n * GUID strings for ids).\n */\n\nimport type { AgentSubjectRole } from './assistant-agent-run.models';\n\nexport interface AssistantStatus {\n enabled: boolean;\n agents: AgentSummary[];\n limits: {\n maxMessageChars: number;\n maxToolCallsPerTurn: number;\n };\n /** True when the caller also passes the admin policy and may use the `admin/*` endpoints. */\n canAdminister: boolean;\n /** Sharing, live update and notification features; missing on servers without them. */\n collaboration?: AssistantCollaboration | null;\n}\n\nexport interface AssistantCollaboration {\n /** Owners can invite colleagues directly through the application's directory. */\n directory: boolean;\n /** Path of the SignalR hub for live updates, for example `/hub/assistant`; `null` when off. */\n hubPath: string | null;\n /** Web Push notifications are configured on the server. */\n push: boolean;\n /** Maximum participants per conversation, not counting the owner. */\n maxParticipants: number;\n}\n\n/** The caller's relation to a conversation. */\nexport type ConversationRole = 'owner' | 'participant';\n\nexport interface AgentSummary {\n id: string;\n version: number;\n displayNameKey: string;\n descriptionKey: string;\n canMutate: boolean;\n /**\n * What people may attach to a message to this agent; `null` or missing when they can attach\n * nothing: the application keeps no files for the assistant, accepts no uploads, or the agent\n * accepts no files.\n */\n uploads?: AgentUploads | null;\n}\n\n/** What people may upload with `POST conversations/{id}/files` and attach to one message to an agent. */\nexport interface AgentUploads {\n /** Lowercase media types, for example `application/pdf`. */\n acceptedMediaTypes: string[];\n /** The largest file in bytes. */\n maxFileBytes: number;\n /** The most files of one message. */\n maxFiles: number;\n /**\n * The file name extensions the application mapped to one of `acceptedMediaTypes`\n * (`NhAssistantUploadOptions.MapExtension` on the server). A file without a usable type takes the\n * type of its extension from them before the platform's table, as on the server, and the file picker\n * offers them. Empty, or missing from an older server, when the application maps none.\n */\n mappedExtensions?: AgentUploadExtension[] | null;\n}\n\n/** A file name extension the application mapped to an accepted media type for uploads. */\nexport interface AgentUploadExtension {\n /** The extension in lowercase with its dot, for example `.dwg`. */\n extension: string;\n /** The accepted media type it names, for example `application/acad`. */\n mediaType: string;\n}\n\n/**\n * A file the application keeps, as the upload endpoint returns it and a message names it in\n * `files`. It never carries content.\n */\nexport interface FileReference {\n id: string;\n name: string;\n mediaType: string;\n size: number;\n /** The application's hash of the content, when it keeps one. */\n hash?: string | null;\n}\n\nexport interface ConversationSummary {\n id: string;\n agentId: string;\n title: string | null;\n status: ConversationStatus;\n createdAt: string;\n updatedAt: string;\n /** Default `owner` for servers without sharing. */\n role?: ConversationRole;\n /** People the owner shared the conversation with. */\n participantCount?: number;\n /** Sequence of the latest message. */\n lastMessageSequence?: number;\n /** The caller's read position; the conversation is unread while it is lower than `lastMessageSequence`. */\n lastReadSequence?: number;\n /** The owner or participant whose turn runs or waits for approval. */\n activeActorId?: string | null;\n}\n\nexport interface Conversation extends ConversationSummary {\n agentVersion: number;\n messages: Message[];\n pendingApproval: ApprovalPart | null;\n /**\n * The question the waiting turn asked with `ask_question` and waits for (`run.AllowQuestions()` on\n * the server); missing when the conversation waits for no question and on older servers.\n */\n pendingQuestion?: QuestionPart | null;\n /** The owner followed by the participants; empty while the conversation is not shared. */\n members?: ConversationMember[];\n /** The current invitation-link token; only for the owner. */\n shareToken?: string | null;\n /** The caller's actor id, to recognize the caller's own messages. */\n currentActorId?: string | null;\n /** Default `chat` for servers without agent runs. */\n kind?: ConversationKind;\n /**\n * The subject of an agent thread and the caller's standing in it, including who may decide its\n * open proposals; `null` for a chat.\n */\n thread?: ConversationThread | null;\n}\n\n/** `chat` for a conversation people start; `thread` for the durable thread of an agent about one subject. */\nexport type ConversationKind = 'chat' | 'thread';\n\n/**\n * The subject of an agent thread as the caller sees it. In a thread the subject's approvers decide\n * the agent's proposals, not the author of a turn. The server checks the role on every request.\n */\nexport interface ConversationThread {\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n /** The caller's live role on the subject. */\n role: AgentSubjectRole;\n /** Each open proposal of the thread and whether the caller may decide it now, oldest first. */\n decisions: ConversationThreadDecision[];\n /** The name of the subject type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n /** Where the application shows the subject, when the type has a link template. */\n subjectLink?: string | null;\n}\n\n/**\n * The caller's right to decide one open proposal of an agent thread, checked like the decision\n * itself: the approval policy, four-eyes and the tool's approve policy.\n */\nexport interface ConversationThreadDecision {\n approvalId: string;\n /**\n * The run that proposed it; such a proposal is decided with `POST approvals/{id}/decisions`.\n * `null` for a proposal of a person's turn in the thread, decided in the conversation.\n */\n runId: string | null;\n canDecide: boolean;\n /** Why the caller may not decide, for example `assistant-four-eyes-required`; `null` when they may. */\n reasonCode: string | null;\n}\n\nexport type ConversationStatus = 'idle' | 'running' | 'waiting-for-approval' | 'failed' | 'archived';\n\n/** The owner or a participant of a shared conversation. */\nexport interface ConversationMember {\n actorId: string;\n /** `null` when the application provides no name. */\n displayName: string | null;\n role: ConversationRole;\n joinedAt: string;\n}\n\nexport interface Message {\n id: string;\n /** `application` for a message the application posted into the conversation. */\n role: 'user' | 'assistant' | 'tool' | 'application';\n createdAt: string;\n parts: MessagePart[];\n /** Position in the conversation; missing on optimistic messages and old servers. */\n sequence?: number;\n /** The writer of a user message. */\n authorActorId?: string | null;\n /**\n * Who wrote the message: a person or a trigger of an agent for user messages, `rule` for the\n * summary an agent's rules wrote instead of the model, `application` for a message the\n * application posted; missing on old servers.\n */\n authorKind?: MessageAuthorKind | null;\n /** The title, sender, link and trusted flag of a message the application posted; missing for other messages. */\n application?: ApplicationMessageDetails | null;\n /**\n * The skill an agent message of a person's chat worked in at its end (`run.SkillsInChat()` on the\n * server); missing for a message without a skill.\n */\n skillId?: string | null;\n}\n\n/**\n * `person` for a message a person wrote; `trigger` for one a trigger wrote into an agent thread;\n * `rule` for an assistant message the agent's rules wrote without a model; `application` for a\n * message the application posted into the conversation.\n */\nexport type MessageAuthorKind = 'person' | 'trigger' | 'rule' | 'application';\n\n/**\n * What the application said about a message it posted, besides its text: an optional heading, who in\n * the application posted it, where people continue and whether the assistant follows it. The text is\n * the message's `text` part.\n */\nexport interface ApplicationMessageDetails {\n title: string | null;\n senderName: string | null;\n link: ApplicationMessageLink | null;\n /**\n * The assistant follows the message as the application's instruction (`Trusted` on the server);\n * `false` for a message the assistant reads as information. The thread labels a trusted message.\n */\n trusted: boolean;\n}\n\n/** A path within the application, which the chat opens through the router, or an `https` address. */\nexport interface ApplicationMessageLink {\n url: string;\n /** The text of the link; the chat shows its own text without one. */\n label: string | null;\n}\n\nexport type MessagePart = TextPart | ToolCallPart | ApprovalPart | ConnectionRequiredPart | FilePart | QuestionPart;\n\n/**\n * `pending` while the turn waits for the answer; `answered` once the addressee chose; `expired` when\n * nobody answered within the turn's wait limit; `cancelled` when the turn was stopped.\n */\nexport type QuestionStatus = 'pending' | 'answered' | 'expired' | 'cancelled';\n\n/**\n * A question the agent asked with `ask_question` in a person's chat. Only the addressee answers it,\n * with `NhAssistantApiService.answerQuestion`; the turn waits for the answer as for an approval and\n * continues with it. Everyone else sees it read-only.\n */\nexport interface QuestionPart {\n type: 'question';\n questionId: string;\n question: string;\n /** Two to six answers, in order; the answer names the index of one. */\n choices: string[];\n /** The person who answers: by default the person whose turn asked. */\n addresseeActorId: string;\n /** After this moment an answer is refused with `assistant-question-expired`. */\n expiresAt: string;\n status: QuestionStatus;\n /** The zero-based index of the chosen answer; only sent once it was answered. */\n answerIndex?: number | null;\n /** When it was answered, expired or cancelled; only sent then. */\n closedAt?: string | null;\n}\n\n/** Body of `POST conversations/{id}/questions/{questionId}/answer`. */\nexport interface AnswerQuestionRequest {\n /** The zero-based index of the chosen answer. */\n choice: number;\n}\n\n/**\n * A file a person attached to a message: its name, media type and size in bytes, never its content.\n * The application keeps the file; a later turn opens it again with the rights of that turn.\n */\nexport interface FilePart {\n type: 'file';\n name: string;\n mediaType: string;\n size: number;\n}\n\n/**\n * Why a turn asks the person to connect an MCP server: never connected, the connection ended, or\n * the server asked for permissions the connection lacks.\n */\nexport type ConnectionRequiredReason = 'not-connected' | 'reauthorization-required' | 'insufficient-scope';\n\n/**\n * An MCP server, which each person connects to with their own account, that the person who asked had\n * to connect before the agent could use it. The turn went on without its tools; the card connects\n * the viewer's own account.\n */\nexport interface ConnectionRequiredPart {\n type: 'connection-required';\n serverId: string;\n displayName: string;\n reason: ConnectionRequiredReason;\n}\n\nexport interface TextPart {\n type: 'text';\n text: string;\n}\n\n/**\n * `awaiting-approval` waits for a person. A call whose agent proposal closed without running ends\n * as `rejected`, as `not-executed` when the proposal expired, was withdrawn or became stale, or as\n * `failed` when its execution failed before it started; its `resultCode` is then\n * `assistant-proposal-<approval status>`, for example `assistant-proposal-expired`. An `ask_question`\n * call waits as `awaiting-answer` for the person it asked.\n */\nexport type ToolCallStatus = 'running' | 'succeeded' | 'failed' | 'awaiting-approval' | 'awaiting-answer' | 'rejected' | 'not-executed';\n\nexport interface ToolCallPart {\n type: 'tool-call';\n invocationId: string;\n toolId: string;\n toolVersion: number;\n displayName: string;\n status: ToolCallStatus;\n argumentsPreview: string | null;\n resultPreview: string | null;\n resultCode: string | null;\n /**\n * `delegated`, `agent` or `delegated-read` when an agent used rights beyond the caller's own:\n * the initiator's, its own grant, or a person's through a gateway read.\n */\n grantSource?: 'delegated' | 'agent' | 'delegated-read' | 'accountable' | null;\n /** The result came from rights this viewer does not have and is shielded from them. */\n restricted?: boolean;\n}\n\n/**\n * Chat approvals are `pending`, `approved`, `rejected` or `expired`; proposals of agents that run on\n * their own continue through execution (`executing`, `executed`, `execution-failed`,\n * `execution-unknown`, `resolved`, and `awaiting-application` while the application executes the\n * proposal of a tool it declared with `ExecuteInApplication`) or end as `withdrawn`, `stale` or `shadow`;\n * a shadow proposal that a newer one for the same objects replaced is `shadow-superseded`.\n */\nexport type ApprovalStatus =\n | 'pending'\n | 'approved'\n | 'rejected'\n | 'expired'\n | 'withdrawn'\n | 'stale'\n | 'executing'\n | 'awaiting-application'\n | 'executed'\n | 'execution-failed'\n | 'execution-unknown'\n | 'resolved'\n | 'shadow'\n | 'shadow-superseded';\n\nexport interface ApprovalPresentationField {\n label: string;\n value: string;\n}\n\nexport interface ApprovalPresentation {\n toolDisplayName: string;\n summary: string;\n fields: ApprovalPresentationField[];\n notice: string | null;\n}\n\n/**\n * Why a stale proposal no longer fits: the work was already done another way, what it was based on\n * changed, or it no longer applies.\n */\nexport type StaleKind = 'already-done' | 'changed' | 'not-applicable';\n\nexport interface ApprovalPart {\n type: 'approval';\n approvalId: string;\n proposalId: string;\n proposalHash: string;\n toolId: string;\n summary: string;\n /** Trusted server-side presentation. Missing on old events and when no presenter handled the tool. */\n presentation?: ApprovalPresentation | null;\n argumentsPreview: string;\n targets: string[];\n expiresAt: string;\n status: ApprovalStatus;\n /** Why a stale proposal no longer fits. Only sent for stale proposals; missing on older servers. */\n staleKind?: StaleKind;\n /** The application's explanation of a stale proposal in the reader's language, such as who did the work. */\n staleExplanation?: string;\n /** Why the agent's rules proposed it, in the reader's language. Only sent for rule proposals. */\n rationale?: string;\n /** The newer proposal for the same objects that replaced this withdrawn one. Only sent then. */\n supersededByApprovalId?: string;\n /**\n * The consultation that proposed it, when the conversation's assistant consulted another agent and\n * the person who asked decides that agent's proposal here (`asker-decides`). Approving executes it\n * in the person's own request with their own rights. Missing for the conversation's own proposals.\n */\n consultation?: ApprovalConsultation | null;\n /**\n * The result of the execution, such as the application's code or `report-overdue`. Only sent once the\n * proposal executed or was handed to the application; missing on older servers.\n */\n executionResultCode?: string;\n /** Until when the application's report is due, for a proposal handed to the application. Only sent then. */\n executionReportDueAt?: string;\n /**\n * `true` when the current user may resolve this uncertain execution in the chat (`resolveApproval`):\n * they approved it here, it was handed to the application and its outcome is unknown. Only sent then.\n */\n canResolve?: boolean;\n}\n\n/**\n * How the person who approved a proposal in their chat resolves its uncertain hand-off: hand it to the\n * application again, with a new attempt and report deadline, or confirm its outcome without running it.\n */\nexport type ApprovalResolution = 'hand-to-application' | 'mark-resolved';\n\n/** Body of `POST conversations/{id}/approvals/{approvalId}/resolve`. */\nexport interface ResolveApprovalRequest {\n action: ApprovalResolution;\n /** Why, at most 500 characters. */\n reason?: string;\n}\n\n/**\n * How a consulted agent's proposal is decided and whose rights execute it: `asker-decides`, the person\n * who asked decides it in their own chat and it runs with their own rights; `subject-agent-rights`, the\n * subject's approvers other than the asker decide it and it runs with the agent's own rights;\n * `subject-asker-rights`, the subject's approvers decide it and it runs with the asker's rights.\n */\nexport type NhAssistantConsultationRoute = 'asker-decides' | 'subject-agent-rights' | 'subject-asker-rights';\n\n/** The routes at the subject a person may leave a consulted agent's proposal for (`decision: 'leave'`). */\nexport type NhAssistantConsultationLeaveRoute = Exclude<NhAssistantConsultationRoute, 'asker-decides'>;\n\n/** Where a proposal the person who asked decides in their own conversation comes from. */\nexport interface ApprovalConsultation {\n /** The consultation record in the consulted agent's thread. */\n consultationId: string;\n /** The consulted agent that proposed it. */\n agentId: string;\n subjectType: string;\n subjectId: string;\n /** The subject's name as the consulted agent's thread knows it; `null` when unknown. */\n subjectDisplayName: string | null;\n /**\n * The route at the subject the person may leave the pending proposal for with the decision `leave`;\n * `null` when they can only approve or reject it.\n */\n leaveRoute: NhAssistantConsultationLeaveRoute | null;\n /** The consulted agent's answer, bounded, when the consultation's classification allows a preview. */\n answer: string | null;\n /** The proposal that waits at the subject since the person left this one for its approvers. */\n movedToApprovalId: string | null;\n}\n\n/** Response of `GET conversations?page=&itemsPerPage=`. */\nexport interface ConversationPage {\n items: ConversationSummary[];\n total: number;\n}\n\n/** Body of `POST conversations`. */\nexport interface CreateConversationRequest {\n agentId: string;\n title?: string;\n}\n\n/** An entity the user has open, for example `{ type: 'project', id: 'AA09027', label: 'Project AA09027' }`. */\nexport interface ClientContextEntity {\n /** Dash-case, for example `order-group`. */\n type: string;\n /** At most 64 characters. */\n id: string;\n /** At most 120 characters. */\n label?: string | null;\n}\n\n/**\n * What the user has open when sending a message. Untrusted page data for the model:\n * entity ids are search hints only and never grant access.\n */\nexport interface ClientContext {\n /** For example `/order-group/123`; at most 200 characters. */\n route: string;\n /** Page title; at most 120 characters. */\n title?: string | null;\n /** At most 5 entities. */\n entities?: ClientContextEntity[];\n}\n\n/** Library name of the contract's `ClientContext`. */\nexport type NhAssistantClientContext = ClientContext;\n\n/** Body of `POST conversations/{id}/messages`. */\nexport interface SendMessageRequest {\n text: string;\n clientMessageId: string;\n /** Page context of this message; `null` when the user left it out. */\n clientContext?: ClientContext | null;\n /** Files the person attaches, as `POST conversations/{id}/files` returned them. */\n files?: FileReference[];\n}\n\n/**\n * `approve` or `reject`; for a consulted agent's proposal with a `consultation.leaveRoute` also\n * `leave`, which leaves it for the subject's approvers instead of deciding it.\n */\nexport type ApprovalDecision = 'approve' | 'reject' | 'leave';\n\n/** Body of `POST conversations/{id}/approvals/{approvalId}/decide`. */\nexport interface DecideApprovalRequest {\n decision: ApprovalDecision;\n expectedProposalHash: string;\n reason?: string;\n}\n\n/** Response of `POST conversations/{id}/share-link`. */\nexport interface ShareLink {\n token: string;\n}\n\n/** A person the owner may invite, from the application's directory. */\nexport interface DirectoryEntry {\n actorId: string;\n displayName: string;\n detail: string | null;\n}\n\n/** Response of `GET` and `PUT notifications`. */\nexport interface NotificationSettings {\n /** The caller's choice; on by default. */\n pushEnabled: boolean;\n /** The server has Web Push configured. */\n pushAvailable: boolean;\n /** The VAPID key browsers subscribe with. */\n publicKey: string | null;\n}\n\n/** Body of `PUT notifications/push-subscription`: `PushSubscription.toJSON()` plus the text language. */\nexport interface PushSubscriptionRequest {\n endpoint: string;\n keys: { p256dh: string; auth: string };\n language?: string;\n}\n","import { AgentTriggerReceipt } from './assistant-agent-run.models';\nimport { ApprovalPart, ConnectionRequiredReason, QuestionPart } from './assistant-api.models';\n\n/*\n * Server-sent events of an assistant turn.\n *\n * Every event arrives as `event: <name>` plus `data: <JSON>` followed by an empty line.\n * The stream closes after `turn.completed` or `error`.\n */\n\nexport interface TurnStartedEvent {\n turnId: string;\n userMessageId: string;\n assistantMessageId: string;\n}\n\nexport interface MessageDeltaEvent {\n messageId: string;\n text: string;\n}\n\nexport interface ToolStartedEvent {\n invocationId: string;\n toolId: string;\n toolVersion: number;\n displayName: string;\n argumentsPreview: string | null;\n}\n\nexport interface ToolCompletedEvent {\n invocationId: string;\n status: 'succeeded' | 'failed';\n resultCode: string | null;\n resultPreview: string | null;\n}\n\nexport type ApprovalRequiredEvent = ApprovalPart;\n\n/** The agent asked a person of the conversation a question; the turn waits for the answer. */\nexport type QuestionAskedEvent = QuestionPart;\n\n/** The addressee answered the question; the turn continues with the answer. */\nexport type QuestionAnsweredEvent = QuestionPart;\n\n/** The person who asked has to connect an MCP server before the agent can use it. */\nexport interface ConnectionRequiredEvent {\n serverId: string;\n displayName: string;\n reason: ConnectionRequiredReason;\n}\n\nexport type TurnCompletionStatus = 'completed' | 'waiting-for-approval' | 'cancelled' | 'failed';\n\nexport interface TurnUsage {\n inputTokens: number;\n outputTokens: number;\n toolCalls: number;\n}\n\nexport interface TurnCompletedEvent {\n turnId: string;\n status: TurnCompletionStatus;\n usage: TurnUsage;\n errorCode: string | null;\n}\n\nexport interface AssistantErrorEvent {\n code: string;\n messageKey: string;\n}\n\n/**\n * The server accepted a message for the next run of the agent that works in the thread, with its\n * files, instead of starting a turn: it answered `202` with the trigger receipt. The client emits it\n * in place of a stream, which then ends; a server never streams it.\n */\nexport type MessageQueuedEvent = AgentTriggerReceipt;\n\n/** Map from SSE event name to its data payload. */\nexport interface NhAssistantSseEventMap {\n 'turn.started': TurnStartedEvent;\n 'message.delta': MessageDeltaEvent;\n 'tool.started': ToolStartedEvent;\n 'tool.completed': ToolCompletedEvent;\n 'approval.required': ApprovalRequiredEvent;\n 'question.asked': QuestionAskedEvent;\n 'question.answered': QuestionAnsweredEvent;\n 'connection.required': ConnectionRequiredEvent;\n 'turn.completed': TurnCompletedEvent;\n 'error': AssistantErrorEvent;\n}\n\nexport type NhAssistantSseEventType = keyof NhAssistantSseEventMap;\n\n/** One parsed assistant event, discriminated by its SSE event name. */\nexport type NhAssistantSseEvent = {\n [K in NhAssistantSseEventType]: { type: K; data: NhAssistantSseEventMap[K] };\n}[NhAssistantSseEventType];\n\n/**\n * What `NhAssistantApiService.sendMessage` emits: the events of the turn it started, or, when the\n * message waits for the next run of the agent working in the thread, one `message.queued` event.\n */\nexport type NhAssistantMessageEvent = NhAssistantSseEvent | { type: 'message.queued'; data: MessageQueuedEvent };\n\nexport const NH_ASSISTANT_SSE_EVENT_TYPES: readonly NhAssistantSseEventType[] = [\n 'turn.started',\n 'message.delta',\n 'tool.started',\n 'tool.completed',\n 'approval.required',\n 'question.asked',\n 'question.answered',\n 'connection.required',\n 'turn.completed',\n 'error'\n];\n\n/**\n * Stable client-side failure codes. The client emits these as `error` events when the\n * transport fails before the server could send its own `error` event.\n */\nexport const NhAssistantClientErrorCodes = {\n network: 'assistant-network',\n unauthenticated: 'assistant-unauthenticated',\n forbidden: 'assistant-forbidden',\n notFound: 'assistant-not-found',\n conversationBusy: 'assistant-conversation-busy',\n validation: 'assistant-validation',\n versionConflict: 'assistant-version-conflict',\n invalidResponse: 'assistant-invalid-response',\n streamInterrupted: 'assistant-stream-interrupted',\n server: 'assistant-server',\n /** The open conversation was deleted by its owner, or the user left or was removed. */\n conversationRemoved: 'assistant-conversation-removed',\n /** The person closed the authorization window of an MCP connection before it finished. */\n mcpAuthorizationCancelled: 'assistant-mcp-authorization-cancelled',\n /** The browser blocked the authorization window of an MCP connection. */\n mcpPopupBlocked: 'assistant-mcp-popup-blocked'\n} as const;\n\nexport type NhAssistantClientErrorCode = typeof NhAssistantClientErrorCodes[keyof typeof NhAssistantClientErrorCodes];\n","import { ApprovalPresentation, NhAssistantConsultationRoute, StaleKind } from './assistant-api.models';\n\n/**\n * Contracts of the agent-run endpoints of `NewHeap.Platform.AI.Chat.AspNet`: threads about a\n * subject, runs, proposals, the approval inbox, working memory and artifacts.\n */\n\n/** The caller's role on the subject of a thread. */\nexport type AgentSubjectRole = 'none' | 'reader' | 'participant' | 'approver';\n\nexport type AgentRunStatus = 'queued' | 'running' | 'waiting-for-approval' | 'completed' | 'failed' | 'cancelled';\n\nexport type AgentProposalStatus =\n | 'pending'\n | 'approved'\n | 'rejected'\n | 'expired'\n | 'withdrawn'\n | 'stale'\n | 'executing'\n | 'awaiting-application'\n | 'executed'\n | 'execution-failed'\n | 'execution-unknown'\n | 'resolved'\n | 'shadow'\n | 'shadow-superseded';\n\nexport type AgentGrantSource = 'none' | 'delegated' | 'agent' | 'delegated-read' | 'accountable';\n\n/**\n * How a run worked: `model` through the language model, `rule` through the agent's rules without a\n * model, `rule-then-model` when the rules handed the run over to the model.\n */\nexport type AgentRunKind = 'model' | 'rule' | 'rule-then-model';\n\n/**\n * Who chose the skill a run worked in; `follow-up` continues in the skill of the run whose\n * proposal people decided.\n */\nexport type AgentSkillChooser = 'trigger' | 'rules' | 'triage' | 'model' | 'follow-up';\n\nexport interface AgentRun {\n id: string;\n conversationId: string;\n triggerId: string;\n status: AgentRunStatus;\n failureClass: string | null;\n failureCode: string | null;\n initiatorActorId: string | null;\n accountableOwnerId: string;\n attempt: number;\n agentVersion: number;\n toolCalls: number;\n inputTokens: number;\n outputTokens: number;\n proposalCount: number;\n summary: string | null;\n shadow: boolean;\n createdAt: string;\n startedAt: string | null;\n endedAt: string | null;\n backgroundOperationId: string | null;\n /** How the run worked. Missing on older servers, which only ran the model. */\n kind?: AgentRunKind;\n /** The skill of the agent the run worked in; missing or null for the agent's own tools. */\n skill?: string | null;\n skillChosenBy?: AgentSkillChooser | null;\n /** The version of a skill defined as data the run worked in; absent for a skill in code. */\n skillVersion?: number | null;\n /** The run evaluated a candidate version of its skill in the shadow thread. */\n skillCandidate?: boolean;\n /** The version of the trigger defined as data that started the run; absent for a trigger in code. */\n triggerVersion?: number | null;\n /** The run evaluated a candidate version of its data trigger in the shadow thread. */\n triggerCandidate?: boolean;\n /** The agent that handed the run's work off; missing or null for a run no agent asked for. */\n requestedByAgentId?: string | null;\n /**\n * The thread of the run that handed the work off, only in a thread's run list and only when the\n * reader may open it.\n */\n requestedByConversationId?: string | null;\n /** How many hand-offs led to the run; 0 or missing for a run no agent asked for. */\n handOffDepth?: number;\n}\n\nexport interface AgentRunList {\n items: AgentRun[];\n total: number;\n}\n\nexport interface AgentThread {\n conversationId: string;\n agentId: string;\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n accountability: string;\n accountableOwnerId: string;\n role: AgentSubjectRole;\n activeRun: AgentRun | null;\n waitingInputs: number;\n /**\n * The thread holds the agent's shadow work about the subject: only administrators see it,\n * nobody is notified and nothing proposed in it executes.\n */\n shadow?: boolean;\n /**\n * The name of the subject type in the caller's language, such as \"Project\", when the application\n * named the type; `null` or missing otherwise.\n */\n subjectTypeName?: string | null;\n /**\n * Where the application shows the subject, from the type's link template; `null` or missing\n * without one. `provideNhAssistant({ subjectLinks })` may replace it with a router link.\n */\n subjectLink?: string | null;\n}\n\nexport interface AgentThreadLookup {\n thread: AgentThread | null;\n canStart: boolean;\n role: AgentSubjectRole;\n}\n\n/** The caller's live right to decide one open proposal; the server checks every decision again. */\nexport interface AgentProposalDecisionRight {\n canDecide: boolean;\n /**\n * Why the caller may not decide, for example `assistant-four-eyes-required`,\n * `assistant-approval-policy-denied` or `assistant-consult-asker-decides` for a consultation's\n * proposal that the person who asked decides in their own chat; `null` when they may.\n */\n reasonCode: string | null;\n}\n\n/** One agent on a subject: its thread, `null` before it worked on the subject, and whether the caller may start it. */\nexport interface AgentSubjectWorkAgent {\n agentId: string;\n /**\n * The agent's name: a translation key for an agent in code, the text itself for an agent created in\n * the administration. It names an agent kept out of the chat as well, which the status does not list;\n * missing from servers before it was added.\n */\n displayNameKey?: string | null;\n thread: AgentThread | null;\n canStart: boolean;\n /**\n * For administrators, the agent's shadow thread about the subject while the agent or one of its\n * skills works in shadow; missing or `null` otherwise.\n */\n shadowThread?: AgentThread | null;\n}\n\n/**\n * A proposal on a subject with the caller's live decision right. Only a pending proposal can be\n * decided; for every other status `canDecide` is `false` and `reasonCode` is `null`.\n */\nexport interface AgentSubjectWorkProposal extends AgentProposalDecisionRight {\n proposal: AgentProposal;\n}\n\n/** The most proposals one `POST approvals/lookup` reads. */\nexport const NH_ASSISTANT_MAX_PROPOSAL_LOOKUP = 100;\n\n/**\n * Response of `POST approvals/lookup`: the requested proposals the caller may see, in the order of\n * the request. Ids the caller may not see, or that do not exist, are left out.\n */\nexport interface AgentProposalLookup {\n items: AgentSubjectWorkProposal[];\n}\n\n/**\n * All agent work on one subject as the caller may see it (`GET subjects/{type}/{id}/work`): every\n * agent with a thread on the subject plus the requested agent, and the pending proposals of all\n * those threads, the earliest expiry first.\n */\nexport interface AgentSubjectWork {\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n /**\n * The name of the subject type in the caller's language, such as \"Project\", when the application\n * named the type; `null` or missing otherwise.\n */\n subjectTypeName?: string | null;\n /**\n * Where the application shows the subject, from the type's link template; `null` or missing\n * without one. `provideNhAssistant({ subjectLinks })` may replace it with a router link.\n */\n subjectLink?: string | null;\n /** The caller's live role. Without a role the server answers `404 assistant-subject-not-found`. */\n role: Exclude<AgentSubjectRole, 'none'>;\n agents: AgentSubjectWorkAgent[];\n openProposals: AgentSubjectWorkProposal[];\n}\n\n/** The agent work on one subject for a list view (`POST subjects/{type}/summary`). */\nexport interface AgentSubjectSummary {\n subjectId: string;\n /** Proposals that wait for a decision on the subject. */\n openProposals: number;\n /** The open proposals the caller may decide, counted like the approval inbox. */\n proposalsToDecide: number;\n /** An agent works on the subject now. */\n runActive: boolean;\n}\n\n/** One summary per requested subject, in request order; subjects without visible work count zero. */\nexport interface AgentSubjectSummaryList {\n subjectType: string;\n items: AgentSubjectSummary[];\n}\n\n/** Maximum number of subjects one `POST subjects/{type}/summary` request accepts. */\nexport const NH_ASSISTANT_MAX_SUBJECT_SUMMARY = 200;\n\n/** One subject a search found (`GET subjects/{type}/search`). */\nexport interface AgentSubjectSearchResult {\n type: string;\n id: string;\n /** The name the application gives the subject; show the id without one. */\n displayName: string | null;\n /** The subject's isolation key: `tenant:…`, `division:…` or `global`. */\n scopeKey: string;\n divisionId: string | null;\n /** Where the application shows the subject; `null` without a link template. */\n link?: string | null;\n}\n\n/** The subjects of one type a search found that the caller may read, in the application's order. */\nexport interface AgentSubjectSearch {\n subjectType: string;\n items: AgentSubjectSearchResult[];\n}\n\n/** The shortest and longest text `searchSubjects` accepts, and the most results it returns. */\nexport const NH_ASSISTANT_SUBJECT_SEARCH = { minQueryLength: 2, maxQueryLength: 100, maxLimit: 50 } as const;\n\n/** The platform's subject type of the whole application, which the server registers itself. */\nexport const NH_ASSISTANT_SYSTEM_SUBJECT_TYPE = 'nh-system';\n\n/** The whole application as one subject, for an agent that works app-wide. */\nexport const NH_ASSISTANT_SYSTEM_GLOBAL_ID = 'global';\n\n/** The most characters of a run's result that `getObjectAgents` returns for its latest run. */\nexport const NH_ASSISTANT_RESULT_PREVIEW_LENGTH = 300;\n\n/** The newest run of an agent on a subject, with the beginning of its result. */\nexport interface AgentLatestRun {\n runId: string;\n conversationId: string;\n triggerId: string;\n status: AgentRunStatus;\n failureCode: string | null;\n /** When the run ended, or started, or was queued. */\n at: string;\n /**\n * The first `NH_ASSISTANT_RESULT_PREVIEW_LENGTH` characters of the run's stored answer: model\n * output, to show as text. For a run without one, such as a run that ended before runs kept their\n * answer, the summary it ended with; `null` while the run has none. `getRunResult` returns all of it.\n */\n result: string | null;\n /** The result is longer than `result`. */\n resultTruncated: boolean;\n /** The run worked in the agent's shadow thread, which only administrators see. */\n shadow: boolean;\n}\n\n/** One agent that works on a subject, as `getObjectAgents` lists it. */\nexport interface AgentObjectAgent {\n agentId: string;\n /** A translation key for an agent in code, the text itself for one created in the administration. */\n displayNameKey: string;\n descriptionKey: string;\n /** Whether the caller may run the agent on the subject now. */\n canStart: boolean;\n /** The agent's thread about the subject that people open; `null` before it worked on it. */\n conversationId: string | null;\n /** The agent's newest run on the subject; `null` before its first. */\n latestRun: AgentLatestRun | null;\n /** The agent's proposals on the subject that wait for a decision. */\n openProposals: number;\n}\n\n/**\n * The agents that work on one subject and that the caller may use (`GET subjects/{type}/{id}/agents`),\n * ordered by id. The subject is an object or the whole application.\n */\nexport interface AgentObjectAgents {\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n subjectTypeName?: string | null;\n subjectLink?: string | null;\n /** The caller's live role. Without a role the server answers `404 assistant-subject-not-found`. */\n role: Exclude<AgentSubjectRole, 'none'>;\n agents: AgentObjectAgent[];\n}\n\n/** The most characters of a run's answer that `getRunResult` returns; a longer answer is cut. */\nexport const NH_ASSISTANT_RUN_RESULT_MAX_LENGTH = 20_000;\n\n/** The most runs one page of a run history holds. */\nexport const NH_ASSISTANT_RUN_HISTORY_MAX_PAGE = 50;\n\n/**\n * Which runs a run history lists. Every part is optional: an agent, a subject type (`nh-system` for\n * the whole application) or one subject of it, a status, and a period by when runs were created\n * (`from` inclusive, `to` exclusive, ISO 8601). `page` starts at 1; `itemsPerPage` is 1 to\n * `NH_ASSISTANT_RUN_HISTORY_MAX_PAGE` (default 20).\n */\nexport interface AgentRunFilter {\n agentId?: string;\n subjectType?: string;\n subjectId?: string;\n status?: AgentRunStatus;\n from?: string;\n to?: string;\n page?: number;\n itemsPerPage?: number;\n}\n\n/**\n * A personal MCP server a background run left out, and why: `assistant-mcp-consent-required` (the\n * person has not allowed background use), `assistant-mcp-connection-required` or\n * `assistant-mcp-reauthorization-required` (the person's connection is missing or ended), or\n * `assistant-mcp-initiator-only` (the run acted for someone other than the person who asked). The\n * person whose consent or connection is missing is told once a day.\n */\nexport interface AgentRunMcpSkip {\n serverId: string;\n /** The server's name when the run left it out. */\n serverDisplayName: string;\n code: string;\n}\n\n/** One run in a run history: its agent, subject, trigger, status, usage, times and result preview. */\nexport interface AgentRunHistoryItem {\n id: string;\n conversationId: string;\n agentId: string;\n /**\n * The agent's name: a translation key for an agent in code, the text itself for one created in the\n * administration; `null` for an agent that no longer exists.\n */\n agentDisplayNameKey?: string | null;\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n subjectTypeName?: string | null;\n subjectLink?: string | null;\n triggerId: string;\n status: AgentRunStatus;\n failureClass: string | null;\n failureCode: string | null;\n kind: AgentRunKind;\n skill: string | null;\n initiatorActorId: string | null;\n toolCalls: number;\n modelCalls: number;\n inputTokens: number;\n outputTokens: number;\n proposalCount: number;\n /**\n * The first `NH_ASSISTANT_RESULT_PREVIEW_LENGTH` characters of the run's answer, model output to\n * show as text; for a run without a stored answer, the summary it ended with.\n */\n result: string | null;\n /** The answer is longer than `result`. */\n resultTruncated: boolean;\n /** The run worked in the agent's shadow thread: nothing it proposed executes. */\n shadow: boolean;\n createdAt: string;\n startedAt: string | null;\n endedAt: string | null;\n /** The personal MCP servers the run left out; missing on older servers. */\n mcpConnectionSkips?: AgentRunMcpSkip[];\n}\n\n/**\n * A page of a run history, newest first (`getRunHistory` for people, the administration's\n * `getAgentRuns` for every run of an agent).\n */\nexport interface AgentRunHistory {\n items: AgentRunHistoryItem[];\n /** The runs that match the filter and that the caller may see. */\n total: number;\n /**\n * People's history considered only the agent threads with the most recent matching runs; a\n * narrower filter, such as one object or a period, reaches older ones.\n */\n limited: boolean;\n}\n\n/** One run with its whole result, its proposals and its files (`getRunResult`). */\nexport interface AgentRunResult {\n run: AgentRunHistoryItem;\n /**\n * The run's whole answer as Markdown, at most `NH_ASSISTANT_RUN_RESULT_MAX_LENGTH` characters:\n * model output, untrusted. Render it only with the assistant's safe Markdown rendering\n * (`nh-assistant-run-result` does), never as HTML. `null` while the run has none.\n */\n result: string | null;\n /** The answer was longer and `result` is its beginning. */\n resultTruncated: boolean;\n /** The bounded summary the run ended with, which the agent's next runs start from. */\n summary: string | null;\n /** The proposals the caller may see: in the run's own thread and placed at objects the caller reads. */\n proposals: AgentProposal[];\n /** The proposals the run placed at objects the caller may not read. */\n hiddenProposals: number;\n /** The files the run saved; `restricted` ones cannot be downloaded by the caller. */\n artifacts: AgentArtifact[];\n /** Whether the caller may open the run's thread conversation. */\n canOpenConversation: boolean;\n}\n\nexport interface StartAgentRequest {\n agentId: string;\n subjectType: string;\n subjectId: string;\n message?: string | null;\n}\n\n/**\n * What became of a start by hand (`POST threads/start`, `POST runs/{id}/retry` with `restart`):\n * `started`, `queued`, `coalesced` with a run about to start, `superseded` the current run,\n * `ignored` or `deduplicated`; `waiting` while the agent or its skill is paused (`reasonCode`\n * `assistant-agent-paused` or `assistant-skill-paused`), so the run starts when it resumes; and\n * `deferred` until the application's transaction commits, without a run or thread yet. A refused\n * start is an HTTP error with its code, never a receipt.\n */\nexport type AgentTriggerOutcome =\n | 'started'\n | 'queued'\n | 'coalesced'\n | 'superseded'\n | 'ignored'\n | 'deduplicated'\n | 'waiting'\n | 'deferred';\n\nexport interface AgentTriggerReceipt {\n triggerId: string;\n outcome: AgentTriggerOutcome;\n runId: string | null;\n conversationId: string | null;\n /** Why the run did not start yet, such as `assistant-agent-paused` with `waiting`; `null` otherwise. */\n reasonCode: string | null;\n}\n\nexport interface AgentProposal {\n approvalId: string;\n proposalId: string;\n proposalHash: string;\n conversationId: string;\n runId: string | null;\n agentId: string;\n subjectType: string;\n subjectId: string;\n subjectDisplayName: string | null;\n /**\n * The name of the subject type in the caller's language, such as \"Project\", when the application\n * named the type; `null` or missing otherwise.\n */\n subjectTypeName?: string | null;\n /**\n * Where the application shows the subject, from the type's link template; `null` or missing\n * without one. `provideNhAssistant({ subjectLinks })` may replace it with a router link.\n */\n subjectLink?: string | null;\n toolId: string;\n summary: string;\n /**\n * The application's localized explanation, written when the proposal was recorded. Show it\n * instead of `argumentsPreview`; `null` when no presenter handled the tool.\n */\n presentation: ApprovalPresentation | null;\n argumentsPreview: string;\n targets: string[];\n status: AgentProposalStatus;\n mode: 'inline' | 'deferred';\n policyId: string | null;\n grantSource: AgentGrantSource;\n createdAt: string;\n expiresAt: string;\n initiatorActorId: string | null;\n decidedByActorId: string | null;\n /**\n * The name of `decidedByActorId` from the subject's member snapshot; `null` when the snapshot\n * does not know the person. Show `decidedByActorId` then. Missing on older servers.\n */\n decidedByDisplayName?: string | null;\n decidedAt: string | null;\n executionResultCode: string | null;\n executedAt: string | null;\n /**\n * For a proposal the application executes (`ExecuteInApplication`), until when its report of the\n * latest hand-off is due: while it is `awaiting-application` the moment it becomes\n * `execution-unknown`, afterwards the sign that an approver resolves it with `hand-to-application`\n * instead of `re-execute`. `null` for a proposal never handed to the application; missing on older\n * servers.\n */\n executionReportDueAt?: string | null;\n /**\n * The consultation that proposed it, when another assistant consulted the agent for\n * `initiatorActorId`; `consultationRoute` says who decides it and whose rights execute it.\n */\n consultationId?: string | null;\n /**\n * How a consultation's proposal is decided and whose rights execute it: `asker-decides`, the person\n * who asked (`initiatorActorId`) decides it in their own chat, nobody decides it here;\n * `subject-asker-rights`, the subject's approvers decide it and it runs with the asker's rights;\n * `subject-agent-rights`, the subject's approvers other than the asker decide it and it runs with the\n * agent's own rights (`grantSource`). `null` for a run's proposal; missing on older servers.\n */\n consultationRoute?: NhAssistantConsultationRoute | null;\n /** The caller's own feedback on the proposal; `null` when they gave none. Missing on older servers. */\n feedback?: AgentProposalFeedback | null;\n /**\n * Whether the caller may give or change feedback: the proposal was rejected, expired, withdrawn or\n * closed as stale, and the caller decided it or is an approver of the subject. Missing on older servers.\n */\n canGiveFeedback?: boolean;\n /**\n * Why a stale proposal no longer fits; `null` for other statuses. Its reason code is\n * `executionResultCode`. Missing on older servers.\n */\n staleKind?: StaleKind | null;\n /**\n * The application's explanation of a stale proposal in the caller's language, such as who already\n * did the work; `null` when it gave none. Missing on older servers.\n */\n staleExplanation?: string | null;\n /**\n * Who made the proposal stale, when the application's guard named them; `null` otherwise.\n * Missing on older servers.\n */\n staleByActorId?: string | null;\n /** The name of `staleByActorId` from the subject's member snapshot; `null` when unknown. */\n staleByDisplayName?: string | null;\n /**\n * The application objects the proposal changes, as its guards named them, so lists can group\n * proposals by object. `targets` holds execution scopes instead. Missing on older servers.\n */\n objects?: AgentProposalObject[];\n /**\n * The newer proposal for the same objects that replaced this withdrawn one; `null` otherwise.\n * Missing on older servers.\n */\n supersededByApprovalId?: string | null;\n /**\n * Why the agent's rules proposed it, in the caller's language; `null` for proposals of the model.\n * Missing on older servers.\n */\n rationale?: string | null;\n /**\n * The run that placed this proposal here from another subject, such as a run for the whole\n * application; `null` for a proposal made in this thread. Missing on older servers.\n */\n placedBy?: AgentProposalOrigin | null;\n /**\n * The subject the proposal's subject belonged to when the proposal was made, such as the project of\n * a task, as the application described it; `null` without one. The grouped inbox groups by it.\n * Missing on older servers.\n */\n parent?: AgentProposalParent | null;\n}\n\n/**\n * The subject a proposal's subject belonged to when the proposal was made. The name is the one recorded\n * then; the type's name and the link follow the application's registration of the type.\n */\nexport interface AgentProposalParent {\n subjectType: string;\n subjectId: string;\n displayName: string | null;\n /** The name of the parent's type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n /** Where the application shows the parent; `null` without a link template. */\n subjectLink?: string | null;\n}\n\n/**\n * The run that placed a proposal at another object than its own, and the thread it ran in. Its subject\n * is named only for the whole application (`subjectType` `nh-system`); for another object only its kind\n * is known, because a reader of this object may not read that one.\n */\nexport interface AgentProposalOrigin {\n /** The thread of the run that placed the proposal; opening it checks the reader's access. */\n conversationId: string;\n runId: string | null;\n /** The run's subject type; `null` when its thread no longer exists. */\n subjectType: string | null;\n /** The run's subject id for the whole application (`global` or `division-…`); `null` otherwise. */\n subjectId?: string | null;\n /** The name of the whole application or its division in the caller's language; `null` otherwise. */\n subjectDisplayName?: string | null;\n /** The name of the run's subject type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n}\n\n/** An application object a proposal changes, such as `{ type: 'project-task', id: '4711' }`. */\nexport interface AgentProposalObject {\n type: string;\n id: string;\n}\n\n/**\n * Why a person rejected a proposal. `incorrect`, `wrong-value` and `not-needed` say the agent was\n * wrong; `not-now` and `already-done` say it was right but not at this moment; `not-allowed` says\n * it went beyond what the agent should do; `other` leaves the explanation to the text.\n */\nexport type AgentProposalFeedbackCategory =\n | 'incorrect'\n | 'wrong-value'\n | 'not-needed'\n | 'not-now'\n | 'already-done'\n | 'not-allowed'\n | 'other';\n\n/** The group of a feedback category. `right-but-not-now` never counts as \"the agent was wrong\". */\nexport type AgentProposalFeedbackGroup = 'wrong' | 'right-but-not-now' | 'not-allowed' | 'other';\n\n/** The feedback categories in the order people choose them. */\nexport const NH_ASSISTANT_FEEDBACK_CATEGORIES: readonly AgentProposalFeedbackCategory[] = [\n 'incorrect',\n 'wrong-value',\n 'not-needed',\n 'not-now',\n 'already-done',\n 'not-allowed',\n 'other'\n];\n\n/** The group of each feedback category, as the server reports it. */\nexport const NH_ASSISTANT_FEEDBACK_GROUPS: Readonly<Record<AgentProposalFeedbackCategory, AgentProposalFeedbackGroup>> = {\n incorrect: 'wrong',\n 'wrong-value': 'wrong',\n 'not-needed': 'wrong',\n 'not-now': 'right-but-not-now',\n 'already-done': 'right-but-not-now',\n 'not-allowed': 'not-allowed',\n other: 'other'\n};\n\n/** Maximum length of the text of a feedback. */\nexport const NH_ASSISTANT_MAX_FEEDBACK_TEXT = 1_000;\n\n/** Maximum number of proposals one `POST approvals/feedback` request accepts. */\nexport const NH_ASSISTANT_MAX_BULK_FEEDBACK = 50;\n\n/**\n * One person's feedback on a rejected or otherwise closed proposal. It is separate from the\n * decision's reason, arrives after the decision and can be changed by its author.\n */\nexport interface AgentProposalFeedback {\n approvalId: string;\n category: AgentProposalFeedbackCategory;\n group: AgentProposalFeedbackGroup;\n text: string | null;\n /** Given once for several proposals that were rejected together. */\n bulk: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\n/** The outcome of the feedback on one proposal of `POST approvals/feedback`. */\nexport interface AgentFeedbackOutcome {\n approvalId: string;\n succeeded: boolean;\n /** For example `assistant-feedback-not-accepted`; `null` when it succeeded. */\n code: string | null;\n}\n\nexport type AgentConsultationStatus = 'running' | 'completed' | 'failed';\n\n/**\n * One consultation of a thread's agent by another assistant. It names who asked and through which\n * assistant; the question and the answer stay in the asking conversation.\n */\nexport interface AgentConsultation {\n id: string;\n askerActorId: string;\n /** The asker's name from the subject's members, when known. */\n askerDisplayName: string | null;\n askingAgentId: string | null;\n depth: number;\n status: AgentConsultationStatus;\n failureCode: string | null;\n toolCalls: number;\n inputTokens: number;\n outputTokens: number;\n proposalCount: number;\n createdAt: string;\n endedAt: string | null;\n /**\n * The proposals the consultation left per route, such as `{ 'asker-decides': 1 }`; routes without\n * proposals are left out. Missing on older servers.\n */\n proposalsByRoute?: Partial<Record<NhAssistantConsultationRoute, number>>;\n}\n\nexport interface AgentConsultationList {\n items: AgentConsultation[];\n total: number;\n}\n\nexport interface AgentInbox {\n items: AgentProposal[];\n total: number;\n /** The status the page lists. Missing on older servers, which list pending proposals only. */\n status?: AgentInboxStatus;\n /**\n * The scope whose visits mark what is new: `global`, or `division:{id}` for an inbox filtered on a\n * division. Missing on older servers.\n */\n scopeKey?: string;\n /**\n * When the caller last looked at the inbox in this scope (`visitInbox`), before this read; `null`\n * before the first visit. Missing on older servers.\n */\n lastVisitedAt?: string | null;\n /**\n * The proposals on this page made after `lastVisitedAt`; before the first visit all of them.\n * Missing on older servers, which mark nothing as new.\n */\n newApprovalIds?: string[];\n /**\n * With `grouped: true`, the groups on this page in order. The items are contiguous per group and\n * subject: the first `count` items belong to the first group, and so on. `null` or missing for the\n * flat inbox.\n */\n groups?: AgentInboxGroup[] | null;\n}\n\n/**\n * One group on a page of the grouped inbox: the parent its proposals recorded, or the subject of\n * proposals without a parent, which holds that subject's own proposals and those of its children.\n */\nexport interface AgentInboxGroup {\n subjectType: string;\n subjectId: string;\n /** The group's name: its subject's own name, or the name its proposals recorded for the parent. */\n displayName: string | null;\n /** The name of the group's type in the caller's language, when the application named it. */\n subjectTypeName?: string | null;\n /** Where the application shows the group's subject; `null` without a link template. */\n subjectLink?: string | null;\n /** How many of the page's items belong to the group. */\n count: number;\n /** How many proposals of the inbox, with its filters, belong to the group. */\n total: number;\n /** The group started on the page before. */\n continuesFromPreviousPage: boolean;\n /** The group goes on on the page after. */\n continuesOnNextPage: boolean;\n /** The group's subjects on this page in order, the group's own subject first. */\n subjects: AgentInboxSubjectGroup[];\n}\n\n/** One subject within a group on a page of the grouped inbox; its name and link are those of its items. */\nexport interface AgentInboxSubjectGroup {\n subjectType: string;\n subjectId: string;\n count: number;\n total: number;\n continuesFromPreviousPage: boolean;\n continuesOnNextPage: boolean;\n}\n\n/**\n * What the approval inbox lists (`AgentInboxFilter.status`): proposals that wait for a decision\n * (the default), approved proposals of tools the application executes that wait for its report, and\n * proposals whose execution is uncertain until an approver resolves it.\n */\nexport type AgentInboxStatus = 'pending' | 'awaiting-application' | 'execution-unknown';\n\nexport interface AgentInboxFilter {\n /**\n * The status the inbox lists, with the same visibility: `pending` by expiry (the default),\n * `awaiting-application` by report deadline, `execution-unknown` by decision.\n */\n status?: AgentInboxStatus;\n subjectType?: string;\n agentId?: string;\n /** Only proposals on subjects of this division; the inbox's visits are then those of the division. */\n divisionId?: string;\n runId?: string;\n /** Groups the proposals by parent and subject (`AgentInbox.groups`) instead of by expiry alone. */\n grouped?: boolean;\n page?: number;\n itemsPerPage?: number;\n}\n\n/** A recorded visit of the inbox in one scope (`visitInbox`). */\nexport interface AgentInboxVisit {\n /** `global`, or `division:{id}` for the inbox of one division. */\n scopeKey: string;\n visitedAt: string;\n}\n\nexport type AgentProposalDecision = 'approve' | 'reject';\n\nexport interface AgentDecisionOutcome {\n approvalId: string;\n succeeded: boolean;\n code: string | null;\n status: AgentProposalStatus | null;\n}\n\nexport interface AgentThreadMemory {\n configured: boolean;\n schemaVersion: number;\n memory: unknown;\n updatedAt: string | null;\n}\n\nexport interface AgentArtifact {\n id: string;\n name: string;\n version: number;\n contentType: string;\n sizeBytes: number;\n createdAt: string;\n runId: string | null;\n restricted: boolean;\n}\n\n/** `resume` continues the run from its last checkpoint; `restart` starts a new run in the thread. */\nexport type AgentRunRetryMode = 'resume' | 'restart';\n\n/**\n * `re-execute` runs the proposal again; `hand-to-application` hands a proposal the application\n * executes (one with `executionReportDueAt`) to the application again; `mark-resolved` confirms its\n * outcome without running it.\n */\nexport type AgentExecutionResolution = 're-execute' | 'hand-to-application' | 'mark-resolved';\n\n/** A board of a group of agents the caller may open (`getBoards`). */\nexport interface AgentBoardSummary {\n /** The group id, such as `project-management`. */\n id: string;\n /** The group's name in the request's language. */\n name: string;\n /** What the group's agents do, when the application described it. */\n description: string | null;\n /** How many of the group's agents the caller sees on its board. */\n agentCount: number;\n}\n\n/** The boards the caller may open, ordered by name. */\nexport interface AgentBoardList {\n items: AgentBoardSummary[];\n}\n\n/** A kind of object as a board names it. */\nexport interface AgentBoardSubjectType {\n id: string;\n /** The name of one object in the request's language; the id without a name. */\n name: string;\n /** The name of several objects, when the application gave one. */\n pluralName: string | null;\n}\n\n/** What an agent on a board works on. */\nexport interface AgentBoardWorksOn {\n /** Every kind of object. */\n allObjects: boolean;\n /** The whole application. */\n application: boolean;\n /** Per division instead of app-wide. */\n perDivision: boolean;\n /** The kinds of objects it names, by id. */\n subjectTypes: AgentBoardSubjectType[];\n}\n\n/** One agent on a board. */\nexport interface AgentBoardAgent {\n agentId: string;\n /** A translation key for an agent in code, the text itself for one created in the administration. */\n displayNameKey: string;\n descriptionKey: string;\n worksOn: AgentBoardWorksOn;\n /**\n * `nh-system` when the agent works on the whole application in the board's scope; `null` for an\n * agent without such work there, which the board shows without a result or a start.\n */\n subjectType: string | null;\n /** `global` for an app-wide agent, `division-…` for a per-division agent on a division's board. */\n subjectId: string | null;\n /** The name of that subject in the request's language. */\n subjectDisplayName: string | null;\n /** Whether the caller may run the agent for that subject now. */\n canStart: boolean;\n /** The agent's thread of that subject, when the caller may open it. */\n conversationId: string | null;\n /** The agent's newest run for that subject; `null` before its first. */\n latestRun: AgentLatestRun | null;\n /** The open proposals of that thread. */\n openProposals: number;\n /**\n * Whether the latest run ended, or a proposal was made, after the caller's last visit of the board\n * in this scope; before the first visit everything shown is new.\n */\n isNew: boolean;\n}\n\n/** The board of one group in one scope (`getBoard`). */\nexport interface AgentBoard {\n id: string;\n name: string;\n description: string | null;\n /** `global`, or `division:{id}` for the board of one division. */\n scopeKey: string;\n divisionId: string | null;\n /** When the caller last looked at this board in this scope, before this read; `null` before the first visit. */\n lastVisitedAt: string | null;\n /** The group's agents the caller sees, ordered by id. */\n agents: AgentBoardAgent[];\n}\n\n/** A recorded visit of a board (`visitBoard`). */\nexport interface AgentBoardVisit {\n groupId: string;\n scopeKey: string;\n visitedAt: string;\n}\n","/**\n * Agent packages (S7-2): several agents with their configuration as data in one versioned package,\n * exported with `POST admin/agent-packages/export`, previewed and imported on another host with\n * `POST admin/agent-packages/preview` and `.../import` through the same validators as saving, and\n * parts the package locks against local changes until an administrator unlinks them with\n * `POST admin/agents/{id}/package/unlink`. The names are those of the server's JSON (camelCase).\n */\nimport {\n AgentAccountability,\n AgentElevatedReads,\n AssistantAutonomy,\n AssistantDataClassification,\n ConsultationSubjectRole,\n InstructionAssetReference,\n SkillApplyMode,\n TriggerConflict\n} from './assistant-admin.models';\nimport { NhAssistantConsultationRoute } from './assistant-api.models';\n\n/** The `format` of every agent package. */\nexport const NH_ASSISTANT_AGENT_PACKAGE_FORMAT = 'newheap.assistant.agent-package';\n\n/** The format version this library reads and writes; a newer one is refused. */\nexport const NH_ASSISTANT_AGENT_PACKAGE_FORMAT_VERSION = 1;\n\n/** The largest package in bytes of its UTF-8 JSON: 1 MB (`assistant-package-too-large` above). */\nexport const NH_ASSISTANT_AGENT_PACKAGE_MAX_BYTES = 1_048_576;\n\n/** The most agents of one package. */\nexport const NH_ASSISTANT_AGENT_PACKAGE_MAX_AGENTS = 20;\n\n/**\n * The kinds of part of an agent in a package. A part key is `agent`, `runSettings`, or\n * `{kind}:{id}` for a skill or trigger id, the subject type of a consultation or hand-off and the\n * name of an entry of agent metadata, such as `skill:triage`.\n */\nexport type AgentPackagePartKind = 'agent' | 'runSettings' | 'skill' | 'trigger' | 'consultation' | 'handOff' | 'metadata';\n\n/** The lock of a whole part, instead of a list of its fields. */\nexport const NH_ASSISTANT_PACKAGE_LOCK_ALL = '*';\n\n/**\n * The fields a package may lock per part kind (`NhAssistantPackageLockFields`). A save that changes a\n * locked field is refused with the field error `{field}: locked`, named as here; `worksOn`,\n * `dailyBudget`, `files` and `limits` each stand for the fields the forms show together. An agent in\n * code carries only the first six fields of `agent`.\n */\nexport const NH_ASSISTANT_PACKAGE_LOCK_FIELDS: Readonly<Record<AgentPackagePartKind, readonly string[]>> = {\n agent: ['displayName', 'description', 'instructions', 'toolSelectors', 'requiredPolicy', 'autonomy', 'offeredInChat', 'worksOn', 'profile', 'dataClassification'],\n runSettings: [\n 'accountability', 'delegateFromInitiator', 'allowGatewayReads', 'elevatedReads', 'approvalPolicy', 'retryCount', 'dailyBudget',\n 'maxConcurrentRuns', 'maxRunsPerSubjectPerDay', 'maxTokensPerRun', 'triageProfile', 'ruleHandler', 'files'\n ],\n skill: ['description', 'instructions', 'tools', 'profile', 'ruleHandler', 'maxTokensPerRun', 'dailyBudget', 'approvalPolicy', 'dataClassification', 'files'],\n trigger: ['skill', 'source', 'event', 'filters', 'cron', 'timeZone', 'subjectSet', 'message', 'conflict', 'debounceSeconds'],\n consultation: [\n 'description', 'instructions', 'minimumRole', 'askerPolicy', 'routes', 'proposalRole', 'proposalPolicy', 'toolSelectors', 'limits',\n 'allowRequests', 'exposeToMcp', 'dataClassification'\n ],\n handOff: ['sources', 'description', 'notifySource', 'maxPerSubjectPerDay'],\n metadata: ['value']\n};\n\n/**\n * A versioned agent package: several agents with what belongs to each of them as data. It never holds\n * history, candidates, runs, feedback, run state, shadow overrides, MCP server definitions, the\n * technical account or secrets; references travel as names. The server reads it strictly: an unknown\n * property, a missing required one, another `format` or a newer `formatVersion` is refused with\n * `assistant-package-format-unsupported`.\n */\nexport interface AgentPackage {\n /** Always `newheap.assistant.agent-package`. */\n format: string;\n formatVersion: number;\n package: AgentPackageInfo;\n /** 1 to 20 agents, each id once. */\n agents: PackageAgent[];\n}\n\n/** The identity of an agent package. */\nexport interface AgentPackageInfo {\n /** A dash-case id, at most 128 characters; by default the first agent's id. */\n id: string;\n /** 1 or higher; an upgrade of a linked package has a higher version. */\n version: number;\n /** What the package is for, at most 500 characters. */\n description?: string | null;\n}\n\n/**\n * One agent in a package: an agent created in the administration travels whole, an agent in code as\n * an overlay of what data may change on it, which the import applies to the same agent in code.\n */\nexport interface PackageAgent {\n /** The agent's id, kept on import. */\n id: string;\n /** `admin` for an agent created in the administration, `code` for an overlay of an agent in code. */\n source: 'admin' | 'code';\n /** The definition of an agent created here, or the overrides of an agent in code (part `agent`). */\n definition?: PackageAgentDefinition | null;\n /** The run settings of an agent created here, without the technical account (part `runSettings`). */\n runSettings?: PackageRunSettings | null;\n skills?: PackageSkill[] | null;\n triggers?: PackageTrigger[] | null;\n consultations?: PackageConsultation[] | null;\n /** The hand-offs defined as data that the agent accepts. */\n handOffs?: PackageHandOff[] | null;\n /** Its values of entries of agent metadata by name; for an agent in code only overrides of editable entries. */\n metadata?: Record<string, unknown> | null;\n /** The groups of agents it is in, by id. */\n groups?: string[] | null;\n /** The locked fields per part key, each `['*']` or fields of `NH_ASSISTANT_PACKAGE_LOCK_FIELDS`. */\n locks?: Record<string, string[]> | null;\n /** The SHA-256 of each part's canonical JSON by part key, lowercase hex; optional for a package a tool writes. */\n hashes?: Record<string, string> | null;\n}\n\n/**\n * The definition of an agent. For an agent in code only `displayName`, `description`, `instructions`,\n * `toolSelectors`, `requiredPolicy` and `autonomy` apply; a missing value keeps the code's.\n */\nexport interface PackageAgentDefinition {\n displayName?: string | null;\n description?: string | null;\n instructions?: string | null;\n instructionsAsset?: InstructionAssetReference | null;\n toolSelectors?: string[] | null;\n requiredPolicy?: string | null;\n autonomy?: AssistantAutonomy | null;\n offeredInChat?: boolean | null;\n worksOnSubjectTypes?: string[] | null;\n worksOnAllSubjects?: boolean | null;\n worksOnApplication?: boolean | null;\n perDivision?: boolean | null;\n runPolicy?: string | null;\n viewPolicy?: string | null;\n profile?: string | null;\n dataClassification?: AssistantDataClassification | null;\n /** For a new agent: it starts off. */\n startsOff?: boolean | null;\n /** For a new agent: it starts in shadow. */\n startsInShadow?: boolean | null;\n /** The live agent a data shadow variant belongs to: another agent of the package or one the host has. */\n shadowOf?: string | null;\n}\n\n/** The run settings of an agent created in the administration; the technical account never travels. */\nexport interface PackageRunSettings {\n accountability: AgentAccountability;\n delegateFromInitiator?: boolean;\n allowGatewayReads?: boolean;\n elevatedReads?: AgentElevatedReads | null;\n approvalPolicy?: string | null;\n retryCount?: number | null;\n dailyToolCalls?: number | null;\n dailyTokens?: number | null;\n maxConcurrentRuns?: number | null;\n maxRunsPerSubjectPerDay?: number | null;\n maxTokensPerRun?: number | null;\n triageProfile?: string | null;\n ruleHandler?: string | null;\n acceptsFiles?: boolean;\n maxFileBytes?: number | null;\n maxFilePages?: number | null;\n maxFilesPerTurn?: number | null;\n maxFileTokensPerTurn?: number | null;\n}\n\n/** The live version of a data skill. */\nexport interface PackageSkill {\n id: string;\n description: string;\n instructions?: string | null;\n instructionsAsset?: InstructionAssetReference | null;\n tools?: string[] | null;\n profile?: string | null;\n ruleHandler?: string | null;\n maxTokensPerRun?: number | null;\n dailyToolCalls?: number | null;\n dailyTokens?: number | null;\n approvalPolicy?: string | null;\n dataClassification?: AssistantDataClassification | null;\n acceptsFiles?: boolean;\n maxFileBytes?: number | null;\n maxFilePages?: number | null;\n maxFilesPerTurn?: number | null;\n maxFileTokensPerTurn?: number | null;\n /** For a new skill: it starts off. */\n startsOff?: boolean | null;\n}\n\n/** The live version of a data trigger; its id stays on import. */\nexport interface PackageTrigger {\n id: string;\n source: 'event' | 'schedule';\n skill?: string | null;\n event?: string | null;\n filters?: string[] | null;\n cron?: string | null;\n timeZone?: string | null;\n subjectSet?: string | null;\n message?: string | null;\n conflict?: TriggerConflict | null;\n debounceSeconds?: number | null;\n}\n\n/** A consultation defined as data. */\nexport interface PackageConsultation {\n subjectType: string;\n description: string;\n instructions?: string | null;\n minimumRole?: ConsultationSubjectRole | null;\n askerPolicy?: string | null;\n routes?: NhAssistantConsultationRoute[] | null;\n proposalRole?: ConsultationSubjectRole | null;\n proposalPolicy?: string | null;\n toolSelectors?: string[] | null;\n maxToolCalls?: number | null;\n timeoutSeconds?: number | null;\n maxAnswerChars?: number | null;\n maxHistoryMessages?: number | null;\n allowRequests?: boolean;\n exposeToMcp?: boolean;\n dataClassification?: AssistantDataClassification | null;\n /** For a new consultation: it starts off. */\n startsOff?: boolean | null;\n}\n\n/** A hand-off defined as data that the agent accepts; a source may be another agent of the package. */\nexport interface PackageHandOff {\n subjectType: string;\n sources: string[];\n description?: string | null;\n notifySource?: boolean;\n maxPerSubjectPerDay?: number | null;\n}\n\n/** How an export builds its package. */\nexport interface AgentPackageExportOptions {\n /** By default the id of the package the first agent is linked to, otherwise the first agent's id. */\n packageId?: string | null;\n /** By default the next version after the linked package's, otherwise 1. */\n version?: number | null;\n /** At most 500 characters. */\n description?: string | null;\n /** Per agent id, the locked fields per part key, each `['*']` or lockable fields of the part's kind. */\n locks?: Record<string, Record<string, string[]>> | null;\n}\n\n/** Body of `POST admin/agent-packages/export`. */\nexport interface AgentPackageExportRequest {\n /** The agents to export, 1 to 20; exactly these. */\n agentIds: string[];\n options?: AgentPackageExportOptions | null;\n}\n\n/** What a reference to an agent outside the exported selection is. */\nexport type AgentPackageWarningCode = 'hand-off-source' | 'shadow-of' | 'consultation-asker' | 'shadow-variant' | (string & {});\n\n/** A reference of an exported agent to an agent outside the selection, which must exist where the package is imported. */\nexport interface AgentPackageWarning {\n /** The exported agent. */\n agentId: string;\n /** The part that makes the reference, such as `handOff:project`. */\n part: string;\n code: AgentPackageWarningCode;\n /** The agent outside the selection. */\n referencedAgentId: string;\n}\n\n/**\n * An exported package as `exportAgentPackage` answers it: the package, its JSON exactly as the server\n * wrote it for the download, and the references to agents outside the selection.\n */\nexport interface AgentPackageExport {\n package: AgentPackage;\n /** The JSON of the download, `agent-package-{packageId}.json`. */\n json: string;\n /** Every reference to an agent outside the selection (header `X-NewHeap-Package-Warnings`). */\n warnings: AgentPackageWarning[];\n}\n\n/** A part of an agent; without `part` every part of the agent. */\nexport interface PackagePartReference {\n agentId: string;\n part?: string | null;\n}\n\n/** How an import applies a package. */\nexport interface AgentPackageImportOptions {\n /**\n * Per agent id, the technical account on this host for run settings that answer to one; without it\n * such run settings are refused with `serviceAccountActorId: required`.\n */\n serviceAccounts?: Record<string, string> | null;\n /**\n * `live` (default): a changed skill or trigger becomes its new live version; `shadow`: its candidate\n * next to the live version. New skills and triggers start in shadow either way.\n */\n apply?: SkillApplyMode | null;\n /** Unlinked parts that take the package's version again instead of staying `kept-local`. */\n relink?: PackagePartReference[] | null;\n}\n\n/** Body of `POST admin/agent-packages/preview` and `POST admin/agent-packages/import`. */\nexport interface AgentPackageImportRequest {\n /** The package as JSON; the server reads it strictly. */\n package: AgentPackage;\n options?: AgentPackageImportOptions | null;\n}\n\n/** What an import does or did with one part. */\nexport type AgentPackagePartOutcome = 'created' | 'changed' | 'unchanged' | 'kept-local' | 'left-behind' | 'refused';\n\n/** The outcome of one part in a preview or an import. */\nexport interface AgentPackagePart {\n agentId: string;\n /** The part key, such as `agent` or `skill:triage`. */\n part: string;\n outcome: AgentPackagePartOutcome;\n /** The host's part changed after the last import: the import overwrites its unlocked fields. */\n changedLocally: boolean;\n /** For a refused part without field errors: its failure code, such as `assistant-agent-exists`. */\n code: string | null;\n /** For a refused part: the field errors of the save validators, by field. */\n errors: Record<string, string[]> | null;\n /** The fields the package locks on the part, `['*']` for all. */\n lockedFields: string[];\n /** For a skill or trigger an import makes a candidate of (`apply: shadow`): the candidate's version. */\n candidateVersion?: number | null;\n}\n\n/** What an import would do: the parts per agent in dependency order, left-behind agents and parts last. */\nexport interface AgentPackagePreview {\n packageId: string;\n packageVersion: number;\n /** The version of the package the host has; `null` for a package it does not have. */\n installedVersion: number | null;\n /** No part is refused. */\n importable: boolean;\n parts: AgentPackagePart[];\n}\n\n/** What an import did: every part's outcome, as the preview showed it. */\nexport interface AgentPackageImport {\n packageId: string;\n packageVersion: number;\n /** The SHA-256 of the package's canonical JSON, lowercase hex, as audited. */\n hash: string;\n parts: AgentPackagePart[];\n}\n\n/** Body of `POST admin/agents/{id}/package/unlink`. */\nexport interface AgentPackageUnlinkRequest {\n /** The part key to unlink; `null` or missing unlinks the whole agent. */\n part?: string | null;\n /** At most 500 characters. */\n reason?: string | null;\n}\n\n/** The parts an unlink took out of their package. */\nexport interface AgentPackageUnlink {\n agentId: string;\n packageId: string;\n /** The part keys that are now local. */\n parts: string[];\n}\n\n/**\n * The package link of one part, as the administration shows it next to the part: the package it came\n * from and the fields that stay read-only.\n */\nexport interface PackagePartLink {\n part: string;\n packageId: string;\n /** The version of the package the part was imported from. */\n packageVersion: number;\n /** The locked fields, `['*']` for all; empty when the package locks none. */\n lockedFields: string[];\n /** The SHA-256 of the part's canonical JSON at import. */\n hash: string;\n /** The part changed after its import; the next upgrade overwrites its unlocked fields. */\n changedLocally: boolean;\n linkedAt: string;\n linkedBy: string;\n}\n\n/** The package an agent belongs to, with the link of every part that is still linked. */\nexport interface AgentPackageLink {\n packageId: string;\n /** The version of the package the host has. */\n packageVersion: number;\n /** The linked parts, ordered by part key. */\n parts: PackagePartLink[];\n}\n","import { InjectionToken, Type } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { ClientContext } from './models/assistant-api.models';\n\n/** Decides whether the current user may see and use the assistant. */\nexport interface NhAssistantAccessPolicy {\n canUse(): boolean | Observable<boolean>;\n}\n\nexport interface NhAssistantConfig {\n /** Base URL of the assistant endpoints, for example `environment.api.baseUrl + '/assistant'`. */\n apiBaseUrl: string;\n /**\n * Returns the caller's bearer token, or null when the request should be anonymous. It runs\n * in the injection context of the assistant scope before every request, so it may call\n * `inject(...)`, for example `() => inject(MyAuthService).getAuthorization()?.token ?? null`.\n */\n getAccessToken: () => string | null | Promise<string | null>;\n /**\n * Returns extra headers for every assistant request, for example the NewHeap active division:\n * `() => ({ 'X-NH-ActiveDivisionId': inject(MyAuthService).getAuthorization()?.activeDivision?.id ?? '' })`.\n * Runs in the assistant's injection context before every request, like `getAccessToken`, and\n * when the live-update connection starts. `Authorization`, `Accept`, `Accept-Language` and\n * `Content-Type` stay under the library's control, and empty values are left out. Browsers send\n * no custom headers with the WebSocket and server-sent event transports of the live connection;\n * pass what the hub needs with `getHubQueryParameters`. Default: none.\n */\n getRequestHeaders?: () => Record<string, string> | null | Promise<Record<string, string> | null>;\n /**\n * Returns query parameters for the live-update hub URL: the values the hub needs that browsers\n * cannot send as headers, because the WebSocket and server-sent event transports carry none.\n * Without them a hub that requires such a value refuses those transports and the connection\n * falls back to long polling. For example the NewHeap active division, which the platform's JWT\n * handler copies from `divisionId` to `X-NH-ActiveDivisionId` on `/hub` paths:\n * `() => ({ divisionId: inject(MyAuthService).getAuthorization()?.activeDivision?.id ?? '' })`.\n * Runs in the assistant's injection context each time the connection starts. `access_token`,\n * `id` and `negotiateVersion` stay under the control of the library and SignalR, empty values\n * are left out and a failing getter only leaves the parameters out. Never return a secret: URLs\n * appear in server and proxy logs. Default: none.\n */\n getHubQueryParameters?: () => Record<string, string> | null | Promise<Record<string, string> | null>;\n /**\n * Returns what the user has open, sent with each message as untrusted page context.\n * Runs in the assistant's injection context when the panel opens and before every\n * message, like `getAccessToken`. The library validates and truncates the result; a\n * failing getter or an invalid shape only leaves the context out. Default: none.\n */\n getPageContext?: () => ClientContext | null | Promise<ClientContext | null>;\n /**\n * Stable, non-secret identity for browser UI state (for example a user id plus tenant id).\n * Runs in the assistant injection context. Return null on sign-out. Without this callback\n * the assistant keeps UI state in memory only. Never return an access token.\n */\n getStateScope?: () => string | null | Promise<string | null>;\n /** Injectable access policy. Default: always allowed. */\n accessPolicy?: Type<NhAssistantAccessPolicy>;\n /** Agent selected when the user has not chosen one. Default: the first agent the server lists. */\n defaultAgentId?: string;\n /** `'bundled'` merges the library's `en` and `nl` texts into `TranslateService`; `'host'` leaves translations to the host. Default `'bundled'`. */\n translations?: 'bundled' | 'host';\n /**\n * Router link of the host's assistant administration page. The panel shows a link to it\n * only when the server reports `canAdminister`. Default: no link.\n */\n adminRoute?: string | any[];\n /** Renders assistant text as sanitized Markdown. Default `{ enabled: true }`. */\n markdown?: { enabled: boolean };\n /**\n * Live updates of shared and parallel conversations through the server's SignalR hub, which\n * `GET status` reports. Uses `@microsoft/signalr`, loaded on first use. Default `true`; when off\n * or unavailable the assistant reloads snapshots instead.\n */\n liveUpdates?: boolean;\n /**\n * Base the server's hub path is appended to, for example `'/api'` when a proxy serves the API\n * below a prefix, as for the NewHeap background operation hub. Default: the origin of `apiBaseUrl`.\n */\n hubBaseUrl?: string;\n /**\n * Web Push notifications for people who are away. Copy the bundled worker from\n * `node_modules/@newheap/platform-ai-chat/push` into the application's assets and point\n * `serviceWorkerUrl` to it. Without this setting the assistant never subscribes the browser.\n */\n push?: NhAssistantPushConfig;\n /**\n * Builds the invitation link an owner copies. Default: the current page with\n * `#nh-assistant-join=<conversationId>.<token>`; the panel joins when the page opens with it.\n */\n buildShareLink?: (conversationId: string, token: string) => string;\n /**\n * Replaces the server's links to subjects, which come from the link template of the subject type\n * (`AddSubjectType(...).OpenAt(\"/projects/{id}\")`), with the host's own routes, per subject type:\n * for example `{ project: subject => ['/projects', subject.id] }`. Return router commands or a URL\n * within the application, `null` to show no link, or `undefined` to keep the server's link.\n * Runs in the assistant's injection context. Default: the server's links.\n */\n subjectLinks?: Record<string, NhAssistantSubjectLinkBuilder>;\n /**\n * How MCP authorizations open. `popup` (default) opens a window from the click and stays on the\n * page. `redirect` sends the page to the authorization server and back to `mcpConnectReturnUrl`,\n * where the assistant completes the connection; its origin must be in\n * `NewHeap:AI:Assistant:Mcp:OAuth:ReturnOrigins`.\n */\n mcpConnectMode?: 'popup' | 'redirect';\n /** The page a redirect-mode authorization returns to. Default: the current address without its fragment. */\n mcpConnectReturnUrl?: () => string;\n}\n\n/** A subject an agent works on, by its type and id. */\nexport interface NhAssistantSubjectRef {\n type: string;\n id: string;\n}\n\n/**\n * Builds the link to one subject in the host application: router commands such as\n * `['/projects', subject.id]`, a URL such as `/projects/7`, `null` for no link, or `undefined` to keep\n * the server's link.\n */\nexport type NhAssistantSubjectLinkBuilder = (subject: NhAssistantSubjectRef) => readonly unknown[] | string | null | undefined;\n\nexport interface NhAssistantPushConfig {\n /** URL of the bundled worker, for example `/nh-assistant/nh-assistant-push-worker.js`. */\n serviceWorkerUrl: string;\n /**\n * Scope of the worker. Default: the worker's folder. Keep it apart from an application service\n * worker; the assistant worker only shows notifications and never controls pages.\n */\n scope?: string;\n /** Page a notification opens when no window of the application is open. Default `/`. */\n openUrl?: string;\n /** Icon URL of the notifications. */\n icon?: string;\n}\n\nexport const NH_ASSISTANT_CONFIG = new InjectionToken<NhAssistantConfig>('NH_ASSISTANT_CONFIG');\n\nexport const NH_ASSISTANT_ACCESS_POLICY = new InjectionToken<NhAssistantAccessPolicy>('NH_ASSISTANT_ACCESS_POLICY');\n\n/** The `fetch` function type the assistant client uses. */\nexport type NhAssistantFetch = (input: string, init: RequestInit) => Promise<Response>;\n\n/**\n * Transport used by the assistant client. It is deliberately independent of the host's\n * `HttpClient` and interceptors, because streaming responses need `fetch` and the access\n * token comes from `NhAssistantConfig.getAccessToken`. Tests and the mock API from\n * `@newheap/platform-ai-chat/testing` replace it.\n */\nexport const NH_ASSISTANT_FETCH = new InjectionToken<NhAssistantFetch>('NH_ASSISTANT_FETCH', {\n providedIn: 'root',\n factory: () => (input: string, init: RequestInit) => globalThis.fetch(input, init)\n});\n\n/** One file upload of the assistant client, which reports how much of the body was sent. */\nexport interface NhAssistantUploadRequest {\n url: string;\n /** The request headers; never `Content-Type`, which the browser sets with the multipart boundary. */\n headers: Record<string, string>;\n body: FormData;\n signal: AbortSignal;\n /** Called while the body is sent, with the bytes sent so far and the total. */\n onProgress: (loaded: number, total: number) => void;\n}\n\n/** Sends an upload and resolves with the server's response; rejects when the request did not reach the server. */\nexport type NhAssistantUpload = (request: NhAssistantUploadRequest) => Promise<Response>;\n\n/**\n * Sends the uploads of the assistant client. The default uses `XMLHttpRequest`, because `fetch` does\n * not report upload progress. The mock API from `@newheap/platform-ai-chat/testing` replaces it.\n */\nexport const NH_ASSISTANT_UPLOAD = new InjectionToken<NhAssistantUpload>('NH_ASSISTANT_UPLOAD', {\n providedIn: 'root',\n factory: () => nhAssistantXhrUpload\n});\n\n/** The default upload: `XMLHttpRequest` with upload progress, answered as a `Response`. */\nexport function nhAssistantXhrUpload(request: NhAssistantUploadRequest): Promise<Response> {\n return new Promise<Response>((resolve, reject) => {\n if (request.signal.aborted) {\n reject(new DOMException('The upload was aborted.', 'AbortError'));\n return;\n }\n\n const xhr = new XMLHttpRequest();\n const abort = () => xhr.abort();\n request.signal.addEventListener('abort', abort, { once: true });\n const finish = () => request.signal.removeEventListener('abort', abort);\n\n xhr.open('POST', request.url);\n for (const [name, value] of Object.entries(request.headers)) {\n xhr.setRequestHeader(name, value);\n }\n xhr.upload.onprogress = event => {\n if (event.lengthComputable) {\n request.onProgress(event.loaded, event.total);\n }\n };\n xhr.onload = () => {\n finish();\n const contentType = xhr.getResponseHeader('content-type');\n resolve(new Response(xhr.status === 204 ? null : xhr.responseText, {\n status: xhr.status,\n headers: contentType ? { 'content-type': contentType } : {}\n }));\n };\n xhr.onerror = () => {\n finish();\n reject(new TypeError('The upload did not reach the server.'));\n };\n xhr.onabort = () => {\n finish();\n reject(new DOMException('The upload was aborted.', 'AbortError'));\n };\n xhr.send(request.body);\n });\n}\n\n/** Default policy: every user who can reach the host may use the assistant. */\nexport class NhAssistantAllowAllAccessPolicy implements NhAssistantAccessPolicy {\n canUse(): boolean {\n return true;\n }\n}\n","import { DestroyRef, Injectable, inject } from '@angular/core';\nimport { TranslateService, TranslationObject } from '@ngx-translate/core';\nimport { merge } from 'rxjs';\nimport en from './en.json';\nimport nl from './nl.json';\n\n/** Translation bundles of one entry point, keyed by language. All keys live under `nh-assistant.`. */\ntype NhAssistantTranslationBundles = Readonly<Record<'en' | 'nl', TranslationObject>>;\n\n/**\n * The library's own translation bundles, keyed by language. All keys live under `nh-assistant.`.\n * The administration's `nh-assistant.admin.` texts come with `@newheap/platform-ai-chat/admin` as\n * `NH_ASSISTANT_ADMIN_TRANSLATIONS`, so they load with the administration instead of with the panel.\n */\nexport const NH_ASSISTANT_TRANSLATIONS: NhAssistantTranslationBundles = { en, nl };\n\ntype TranslationTree = { [key: string]: unknown };\n\nconst rootKey = 'nh-assistant';\n\nfunction isTree(value: unknown): value is TranslationTree {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** Deep merge where values of `override` win. */\nfunction mergeTrees(base: TranslationTree, override: TranslationTree): TranslationTree {\n const result: TranslationTree = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const current = result[key];\n result[key] = isTree(current) && isTree(value) ? mergeTrees(current, value) : value;\n }\n return result;\n}\n\n/**\n * The bundle of a language: its own, else that of its base language, so a regional tag such as\n * `nl-NL`, `nl_BE` or `en-GB` gets the `nl` or `en` texts, else English.\n */\nfunction bundleOf(bundles: NhAssistantTranslationBundles, language: string): TranslationTree {\n for (const candidate of [language, language.split(/[-_]/)[0]].map(tag => tag.toLowerCase())) {\n if (Object.hasOwn(bundles, candidate)) {\n return bundles[candidate as keyof NhAssistantTranslationBundles] as TranslationTree;\n }\n }\n return bundles.en as TranslationTree;\n}\n\nfunction hasAllKeys(bundle: TranslationTree, candidate: unknown): boolean {\n if (!isTree(candidate)) {\n return false;\n }\n\n return Object.entries(bundle).every(([key, value]) =>\n isTree(value) ? hasAllKeys(value, candidate[key]) : key in candidate\n );\n}\n\nfunction ensure(translate: TranslateService, bundles: NhAssistantTranslationBundles, language: string, existing: unknown): void {\n const bundleRoot = bundleOf(bundles, language)[rootKey] as TranslationTree;\n if (hasAllKeys(bundleRoot, existing)) {\n return;\n }\n\n const merged = mergeTrees(bundleRoot, isTree(existing) ? existing : {});\n translate.setTranslation(language, { [rootKey]: merged } as TranslationObject, true);\n}\n\n/**\n * Merges `bundles` into `TranslateService` whenever the host loads or replaces a language, and\n * into the current language at once, until `destroyRef` is destroyed. Keys the host defines under\n * `nh-assistant.` win. Shared with the secondary entry points that bring texts of their own.\n */\nexport function nhAssistantMergeTranslations(\n translate: TranslateService,\n bundles: NhAssistantTranslationBundles,\n destroyRef: DestroyRef\n): void {\n const subscription = merge(translate.onTranslationChange, translate.onLangChange).subscribe(event => {\n if (event.lang && isTree(event.translations)) {\n ensure(translate, bundles, event.lang, event.translations[rootKey]);\n }\n });\n destroyRef.onDestroy(() => subscription.unsubscribe());\n\n // The current language is loaded or already requested by the host, so merging into it\n // never pre-empts the host loader; a later load triggers a new merge.\n const current = translate.getCurrentLang();\n if (current) {\n ensure(translate, bundles, current, translate.instant(rootKey));\n }\n}\n\n/**\n * Merges the bundled texts into `TranslateService` whenever the host loads or replaces a\n * language. Host loaders never lose the library texts, the library never pre-empts the\n * host loader, and keys the host defines under `nh-assistant.` (agent names, overrides)\n * win over the bundle. A regional language such as `nl-NL` receives the texts of its base\n * language; languages without a bundle receive the English texts.\n */\n@Injectable({ providedIn: 'root' })\nexport class NhAssistantTranslationMerger {\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n private started = false;\n\n start(): void {\n const translate = this.translate;\n if (this.started || !translate) {\n return;\n }\n this.started = true;\n\n nhAssistantMergeTranslations(translate, NH_ASSISTANT_TRANSLATIONS, this.destroyRef);\n }\n}\n","/** One raw server-sent event before its data is interpreted. */\nexport interface NhAssistantRawSseMessage {\n event: string;\n data: string;\n}\n\n/**\n * Incremental parser for the `text/event-stream` format.\n *\n * Feed decoded text chunks in arrival order. Chunks may split lines, fields and line\n * terminators anywhere. Comment lines (starting with `:`, such as the `: keep-alive`\n * heartbeat) are ignored; `id` and `retry` fields are accepted and ignored. An event is\n * dispatched at the empty line that terminates it. An unterminated event at the end of\n * the stream is discarded, as the SSE specification requires.\n */\nexport class NhAssistantSseParser {\n private buffer = '';\n private eventName = '';\n private dataLines: string[] = [];\n\n push(chunk: string): NhAssistantRawSseMessage[] {\n this.buffer += chunk;\n\n const messages: NhAssistantRawSseMessage[] = [];\n let lineStart = 0;\n\n for (let index = 0; index < this.buffer.length; index++) {\n const character = this.buffer[index];\n if (character !== '\\n' && character !== '\\r') {\n continue;\n }\n\n if (character === '\\r' && index === this.buffer.length - 1) {\n // A trailing CR may be the first half of a CRLF split across chunks.\n break;\n }\n\n const line = this.buffer.slice(lineStart, index);\n if (character === '\\r' && this.buffer[index + 1] === '\\n') {\n index++;\n }\n lineStart = index + 1;\n\n const message = this.processLine(line);\n if (message) {\n messages.push(message);\n }\n }\n\n this.buffer = this.buffer.slice(lineStart);\n return messages;\n }\n\n /** Signals the end of the stream and returns an event that a trailing CR completed. */\n end(): NhAssistantRawSseMessage[] {\n const messages: NhAssistantRawSseMessage[] = [];\n if (this.buffer.endsWith('\\r')) {\n const message = this.processLine(this.buffer.slice(0, -1));\n if (message) {\n messages.push(message);\n }\n }\n\n this.buffer = '';\n this.eventName = '';\n this.dataLines = [];\n return messages;\n }\n\n private processLine(line: string): NhAssistantRawSseMessage | null {\n if (line.length === 0) {\n return this.dispatch();\n }\n\n if (line.startsWith(':')) {\n return null;\n }\n\n const colonIndex = line.indexOf(':');\n const field = colonIndex < 0 ? line : line.slice(0, colonIndex);\n let value = colonIndex < 0 ? '' : line.slice(colonIndex + 1);\n if (value.startsWith(' ')) {\n value = value.slice(1);\n }\n\n if (field === 'event') {\n this.eventName = value;\n } else if (field === 'data') {\n this.dataLines.push(value);\n }\n\n return null;\n }\n\n private dispatch(): NhAssistantRawSseMessage | null {\n const hasData = this.dataLines.length > 0;\n const message: NhAssistantRawSseMessage = {\n event: this.eventName || 'message',\n data: this.dataLines.join('\\n')\n };\n\n this.eventName = '';\n this.dataLines = [];\n\n return hasData ? message : null;\n }\n}\n","import { EnvironmentInjector, Injectable, inject, runInInjectionContext } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { Observable, Subscriber } from 'rxjs';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NH_ASSISTANT_CONFIG, NH_ASSISTANT_FETCH, NH_ASSISTANT_UPLOAD, NhAssistantConfig } from '../nh-assistant.config';\n\n/**\n * The request header every upload carries. A browser cannot send it with a cross-site form, so the\n * upload endpoint keeps the posture of the JSON endpoints.\n */\nexport const NH_ASSISTANT_UPLOAD_HEADER = 'X-NH-Assistant-Upload';\n\n/** A failed JSON request of the assistant API. Carries a stable code, never response text. */\nexport class NhAssistantApiError extends Error {\n constructor(\n readonly status: number,\n readonly code: string,\n readonly messageKey: string,\n /**\n * The field errors of the error body, whatever its code (for example `assistant-validation` or\n * `assistant-run-filter-invalid`): camelCase field names, dotted for nested settings such as\n * `oauth.clientId`, with stable values such as `required`, `invalid`, `too-long` or `not-found`.\n * Empty when the body names none.\n */\n readonly fieldErrors: Readonly<Record<string, readonly string[]>> = {}\n ) {\n super(code);\n this.name = 'NhAssistantApiError';\n }\n}\n\n/** Translation key that belongs to a failure code. */\nexport function nhAssistantErrorMessageKey(code: string): string {\n return `nh-assistant.errors.${code}`;\n}\n\n/** Maps an HTTP status of the assistant API to a stable client failure code. */\nexport function nhAssistantCodeForStatus(status: number): string {\n if (status === 0) {\n return NhAssistantClientErrorCodes.network;\n }\n if (status === 400) {\n return NhAssistantClientErrorCodes.validation;\n }\n if (status === 401) {\n return NhAssistantClientErrorCodes.unauthenticated;\n }\n if (status === 403) {\n return NhAssistantClientErrorCodes.forbidden;\n }\n if (status === 404) {\n return NhAssistantClientErrorCodes.notFound;\n }\n if (status === 409) {\n return NhAssistantClientErrorCodes.conversationBusy;\n }\n\n return NhAssistantClientErrorCodes.server;\n}\n\n/** Status-specific codes that replace the generic mapping for one endpoint. */\nexport type NhAssistantStatusCodes = Partial<Record<number, string>>;\n\n/** A file the assistant API answered, as its text with the response's headers (internal). */\nexport interface NhAssistantFileResponse {\n text: string;\n headers: Headers;\n}\n\nconst safeCode = /^[a-z0-9][a-z0-9.-]{0,79}$/;\nconst safeField = /^[a-zA-Z][a-zA-Z0-9.]{0,63}$/;\n/** A field of one item of a list, such as `readers[0].toolName`. */\nconst safeItemField = /^[a-zA-Z][a-zA-Z0-9]{0,31}\\[\\d{1,4}\\](\\.[a-zA-Z][a-zA-Z0-9]{0,31})?$/;\n\n/**\n * Whether a value the server or a callback page sent is a code the library may show: lowercase\n * letters, digits, dots and dashes, at most 80 characters. Every reader of untrusted codes uses this\n * one check, so a code never carries free text into a translation key.\n */\nexport function nhAssistantIsSafeCode(value: unknown): value is string {\n return typeof value === 'string' && safeCode.test(value);\n}\n\n/**\n * Shared transport of the assistant services: `fetch` with the host's token, the current\n * language and stable failure codes. Internal to the library.\n */\n@Injectable()\nexport class NhAssistantTransport {\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly fetchFn = inject(NH_ASSISTANT_FETCH);\n private readonly uploadFn = inject(NH_ASSISTANT_UPLOAD);\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly injector = inject(EnvironmentInjector);\n\n /** A cold JSON request that aborts on unsubscribe and errors with `NhAssistantApiError`. */\n json<T>(method: string, path: string, body?: unknown, statusCodes: NhAssistantStatusCodes = {}): Observable<T> {\n return new Observable<T>(subscriber => {\n const abort = new AbortController();\n\n void this.executeJson<T>(method, path, body, statusCodes, abort.signal, subscriber);\n\n return () => abort.abort();\n });\n }\n\n /**\n * A cold request with a JSON body that answers the response's text and headers, for an endpoint that\n * answers a file with details in a header, such as the export of an agent package. It aborts on\n * unsubscribe and errors as `json` does: with the code and field errors of a refused request's error\n * body, the endpoint's status mapping without one, and `assistant-network` when the request did not\n * reach the server.\n */\n file(method: string, path: string, body: unknown, accept: string, statusCodes: NhAssistantStatusCodes = {}): Observable<NhAssistantFileResponse> {\n return new Observable<NhAssistantFileResponse>(subscriber => {\n const abort = new AbortController();\n\n void this.executeFile(method, path, body, accept, statusCodes, abort.signal, subscriber);\n\n return () => abort.abort();\n });\n }\n\n async fetch(method: string, path: string, accept: string, body: unknown, signal: AbortSignal): Promise<Response> {\n const init = await this.createInit(method, accept, body, signal);\n return this.fetchFn(this.url(path), init);\n }\n\n /**\n * Uploads `form` with progress and resolves with the parsed JSON answer. Rejects with\n * `NhAssistantApiError`, never with raw text: the code of a refused upload's error body, the\n * generic status mapping without one and `assistant-network` when it did not reach the server.\n * An aborted upload rejects with an `AbortError`.\n */\n async upload<T>(path: string, form: FormData, onProgress: (loaded: number, total: number) => void, signal: AbortSignal): Promise<T> {\n const headers = await this.headers('application/json');\n headers[NH_ASSISTANT_UPLOAD_HEADER] = '1';\n let response: Response;\n try {\n response = await this.uploadFn({ url: this.url(path), headers, body: form, signal, onProgress });\n } catch (error) {\n if (signal.aborted) {\n throw error;\n }\n throw createApiError(0, nhAssistantCodeForStatus(0));\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, {});\n throw createApiError(response.status, failure.code, failure.fieldErrors);\n }\n\n try {\n return JSON.parse(await response.text()) as T;\n } catch {\n throw createApiError(response.status, NhAssistantClientErrorCodes.invalidResponse);\n }\n }\n\n /**\n * Downloads a file of the assistant API. Rejects with `NhAssistantApiError`, never with raw text:\n * the code and field errors of a refused request's error body (whatever its content type), the\n * endpoint's status mapping without one, `assistant-network` when the request did not reach the\n * server and `assistant-stream-interrupted` when the file broke off while it was read.\n */\n async download(path: string, accept: string, statusCodes: NhAssistantStatusCodes = {}): Promise<Blob> {\n let response: Response;\n try {\n response = await this.fetch('GET', path, accept, undefined, new AbortController().signal);\n } catch {\n throw createApiError(0, nhAssistantCodeForStatus(0));\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, statusCodes);\n throw createApiError(response.status, failure.code, failure.fieldErrors);\n }\n\n try {\n return await response.blob();\n } catch {\n throw createApiError(response.status, NhAssistantClientErrorCodes.streamInterrupted);\n }\n }\n\n /**\n * The failure code of a response: a safe `code` field of a JSON error body wins, then the\n * endpoint's status mapping, then the generic mapping. Response text is never used.\n */\n async failureCode(response: Response, statusCodes: NhAssistantStatusCodes = {}): Promise<string> {\n return (await this.failure(response, statusCodes)).code;\n }\n\n /**\n * The failure code of a response and the field errors of its body, both checked against safe\n * patterns. Response text is never used.\n */\n private async failure(\n response: Response,\n statusCodes: NhAssistantStatusCodes\n ): Promise<{ code: string; fieldErrors: Record<string, string[]> }> {\n const fieldErrors: Record<string, string[]> = {};\n try {\n const text = await response.text();\n const body = text.length > 0 ? JSON.parse(text) as unknown : null;\n const record = body && typeof body === 'object' ? body as Record<string, unknown> : null;\n const errors = record?.['errors'];\n if (errors && typeof errors === 'object' && !Array.isArray(errors)) {\n for (const [field, values] of Object.entries(errors as Record<string, unknown>)) {\n const safe = Array.isArray(values) ? values.filter(nhAssistantIsSafeCode) : [];\n if ((safeField.test(field) || safeItemField.test(field)) && safe.length > 0) {\n fieldErrors[field] = safe;\n }\n }\n }\n const code = record?.['code'];\n if (nhAssistantIsSafeCode(code)) {\n return { code, fieldErrors };\n }\n } catch {\n // A non-JSON error body carries no code.\n }\n\n return { code: statusCodes[response.status] ?? nhAssistantCodeForStatus(response.status), fieldErrors };\n }\n\n private async executeFile(\n method: string,\n path: string,\n body: unknown,\n accept: string,\n statusCodes: NhAssistantStatusCodes,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantFileResponse>\n ): Promise<void> {\n let response: Response;\n try {\n response = await this.fetch(method, path, accept, body, signal);\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(0, nhAssistantCodeForStatus(0)));\n }\n return;\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, statusCodes);\n subscriber.error(createApiError(response.status, failure.code, failure.fieldErrors));\n return;\n }\n\n try {\n const text = await response.text();\n subscriber.next({ text, headers: response.headers });\n subscriber.complete();\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(response.status, NhAssistantClientErrorCodes.streamInterrupted));\n }\n }\n }\n\n private async executeJson<T>(\n method: string,\n path: string,\n body: unknown,\n statusCodes: NhAssistantStatusCodes,\n signal: AbortSignal,\n subscriber: Subscriber<T>\n ): Promise<void> {\n let response: Response;\n try {\n response = await this.fetch(method, path, 'application/json', body, signal);\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(0, nhAssistantCodeForStatus(0)));\n }\n return;\n }\n\n if (!response.ok) {\n const failure = await this.failure(response, statusCodes);\n subscriber.error(createApiError(response.status, failure.code, failure.fieldErrors));\n return;\n }\n\n try {\n const text = response.status === 204 ? '' : await response.text();\n subscriber.next((text.length > 0 ? JSON.parse(text) : undefined) as T);\n subscriber.complete();\n } catch {\n if (!signal.aborted) {\n subscriber.error(createApiError(response.status, NhAssistantClientErrorCodes.invalidResponse));\n }\n }\n }\n\n private async createInit(method: string, accept: string, body: unknown, signal: AbortSignal): Promise<RequestInit> {\n const headers = await this.headers(accept);\n if (body !== undefined) {\n headers['Content-Type'] = 'application/json';\n }\n\n return {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal,\n cache: 'no-store'\n };\n }\n\n /** The host's extra headers, `Accept`, the bearer token and the current language. */\n private async headers(accept: string): Promise<Record<string, string>> {\n const headers: Record<string, string> = await nhAssistantRequestHeaders(this.config, this.injector);\n headers['Accept'] = accept;\n\n const token = await runInInjectionContext(this.injector, () => this.config.getAccessToken());\n if (token) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n\n const language = this.translate?.getCurrentLang();\n if (language) {\n headers['Accept-Language'] = language;\n }\n\n return headers;\n }\n\n private url(path: string): string {\n const base = this.config.apiBaseUrl.replace(/\\/+$/, '');\n return `${base}/${path}`;\n }\n}\n\nfunction createApiError(status: number, code: string, fieldErrors: Record<string, string[]> = {}): NhAssistantApiError {\n return new NhAssistantApiError(status, code, nhAssistantErrorMessageKey(code), fieldErrors);\n}\n\nconst reservedRequestHeaders = new Set(['authorization', 'accept', 'accept-language', 'content-type']);\n\n/**\n * The host's extra request headers from `NhAssistantConfig.getRequestHeaders`, without the\n * headers the library sets itself and without empty values.\n */\nexport async function nhAssistantRequestHeaders(\n config: NhAssistantConfig,\n injector: EnvironmentInjector\n): Promise<Record<string, string>> {\n const headers: Record<string, string> = {};\n if (!config.getRequestHeaders) {\n return headers;\n }\n\n const extra = await runInInjectionContext(injector, () => config.getRequestHeaders!());\n for (const [name, value] of Object.entries(extra ?? {})) {\n if (typeof value === 'string' && value.length > 0 && !reservedRequestHeaders.has(name.toLowerCase())) {\n headers[name] = value;\n }\n }\n return headers;\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Observable, Subscriber } from 'rxjs';\nimport {\n AssistantPreferences,\n McpAuthorizationStart,\n McpAuthorizeRequest,\n McpCompleteRequest,\n McpCompletion,\n McpConnection,\n UpdateMcpConnectionRequest\n} from '../models/assistant-admin.models';\nimport { AgentTriggerOutcome, AgentTriggerReceipt } from '../models/assistant-agent-run.models';\nimport {\n AgentSummary,\n AnswerQuestionRequest,\n AssistantStatus,\n Conversation,\n ConversationPage,\n CreateConversationRequest,\n DecideApprovalRequest,\n DirectoryEntry,\n FileReference,\n NotificationSettings,\n PushSubscriptionRequest,\n ResolveApprovalRequest,\n SendMessageRequest,\n ShareLink\n} from '../models/assistant-api.models';\nimport {\n NH_ASSISTANT_SSE_EVENT_TYPES,\n NhAssistantClientErrorCodes,\n NhAssistantMessageEvent,\n NhAssistantSseEvent,\n NhAssistantSseEventType\n} from '../models/assistant-sse.models';\nimport { NhAssistantSseParser } from './nh-assistant-sse-parser';\nimport { NhAssistantTransport, nhAssistantErrorMessageKey, nhAssistantIsSafeCode } from './nh-assistant-transport';\n\nexport {\n NH_ASSISTANT_UPLOAD_HEADER,\n NhAssistantApiError,\n nhAssistantCodeForStatus,\n nhAssistantErrorMessageKey\n} from './nh-assistant-transport';\n\nconst knownEventTypes = new Set<string>(NH_ASSISTANT_SSE_EVENT_TYPES);\n\n/** The outcomes of a trigger receipt with which the next run takes a waiting message. */\nconst queuedOutcomes = new Set<string>(['started', 'queued', 'coalesced', 'superseded', 'waiting', 'deferred'] satisfies AgentTriggerOutcome[]);\n\n/** The progress of one upload, then the file the application stored. */\nexport type NhAssistantUploadEvent =\n | { type: 'progress'; loaded: number; total: number }\n | { type: 'uploaded'; file: FileReference };\n\n/**\n * Client for the assistant HTTP API. JSON endpoints return cold observables that abort\n * their request on unsubscribe. Streaming endpoints emit every contract event and complete\n * after `turn.completed` or `error`; transport failures become an `error` event with a\n * client failure code instead of an observable error.\n */\n@Injectable()\nexport class NhAssistantApiService {\n private readonly transport = inject(NhAssistantTransport);\n\n status(): Observable<AssistantStatus> {\n return this.transport.json<AssistantStatus>('GET', 'status');\n }\n\n agents(): Observable<AgentSummary[]> {\n return this.transport.json<AgentSummary[]>('GET', 'agents');\n }\n\n listConversations(page = 1, itemsPerPage = 20): Observable<ConversationPage> {\n const query = `page=${encodeURIComponent(page)}&itemsPerPage=${encodeURIComponent(itemsPerPage)}`;\n return this.transport.json<ConversationPage>('GET', `conversations?${query}`);\n }\n\n createConversation(request: CreateConversationRequest): Observable<Conversation> {\n return this.transport.json<Conversation>('POST', 'conversations', request);\n }\n\n getConversation(conversationId: string): Observable<Conversation> {\n return this.transport.json<Conversation>('GET', `conversations/${encodeURIComponent(conversationId)}`);\n }\n\n deleteConversation(conversationId: string): Observable<void> {\n return this.transport.json<void>('DELETE', `conversations/${encodeURIComponent(conversationId)}`);\n }\n\n sendMessage(conversationId: string, request: SendMessageRequest): Observable<NhAssistantMessageEvent> {\n return this.requestStream(`conversations/${encodeURIComponent(conversationId)}/messages`, request, true);\n }\n\n /**\n * Uploads one file to a conversation as `multipart/form-data` (`POST conversations/{id}/files`):\n * emits the progress while the file is sent and then the stored file, whose reference a message\n * carries in `files`. Fails with `NhAssistantApiError`; unsubscribing aborts the upload. The\n * media type of `file` is the one the upload declares.\n */\n uploadFile(conversationId: string, file: Blob, name: string): Observable<NhAssistantUploadEvent> {\n return new Observable<NhAssistantUploadEvent>(subscriber => {\n const abort = new AbortController();\n const form = new FormData();\n form.append('file', file, name);\n\n this.transport.upload<FileReference>(\n `conversations/${encodeURIComponent(conversationId)}/files`,\n form,\n (loaded, total) => subscriber.next({ type: 'progress', loaded, total }),\n abort.signal\n ).then(\n reference => {\n subscriber.next({ type: 'uploaded', file: reference });\n subscriber.complete();\n },\n error => {\n if (!abort.signal.aborted) {\n subscriber.error(error);\n }\n }\n );\n\n return () => abort.abort();\n });\n }\n\n decideApproval(conversationId: string, approvalId: string, request: DecideApprovalRequest): Observable<NhAssistantSseEvent> {\n const path = `conversations/${encodeURIComponent(conversationId)}/approvals/${encodeURIComponent(approvalId)}/decide`;\n return this.requestStream(path, request, false);\n }\n\n /**\n * Answers the question the chat's waiting turn asked with `ask_question` with the index of one of\n * its choices, and streams the resumed turn like a decision. Only the question's addressee answers;\n * the server refuses others with `assistant-question-forbidden` and a question whose wait ended with\n * `assistant-question-expired`.\n */\n answerQuestion(conversationId: string, questionId: string, request: AnswerQuestionRequest): Observable<NhAssistantSseEvent> {\n const path = `conversations/${encodeURIComponent(conversationId)}/questions/${encodeURIComponent(questionId)}/answer`;\n return this.requestStream(path, request, false);\n }\n\n /**\n * Resolves an uncertain hand-off of a proposal the caller approved in this chat (`canResolve`):\n * `hand-to-application` hands it to the application again, `mark-resolved` confirms its outcome.\n * Returns the conversation as it is afterwards.\n */\n resolveApproval(conversationId: string, approvalId: string, request: ResolveApprovalRequest): Observable<Conversation> {\n const path = `conversations/${encodeURIComponent(conversationId)}/approvals/${encodeURIComponent(approvalId)}/resolve`;\n return this.transport.json<Conversation>('POST', path, request);\n }\n\n cancel(conversationId: string): Observable<void> {\n return this.transport.json<void>('POST', `conversations/${encodeURIComponent(conversationId)}/cancel`);\n }\n\n /** Raises the caller's read position to `sequence`, or to the latest message when omitted. */\n markRead(conversationId: string, sequence?: number): Observable<void> {\n return this.transport.json<void>(\n 'POST',\n `conversations/${encodeURIComponent(conversationId)}/read`,\n sequence === undefined ? {} : { sequence }\n );\n }\n\n /** Owner only: creates a new invitation link; an earlier link stops working. */\n createShareLink(conversationId: string): Observable<ShareLink> {\n return this.transport.json<ShareLink>('POST', `conversations/${encodeURIComponent(conversationId)}/share-link`);\n }\n\n /** Owner only: the invitation link stops working; people who joined stay. */\n revokeShareLink(conversationId: string): Observable<void> {\n return this.transport.json<void>('DELETE', `conversations/${encodeURIComponent(conversationId)}/share-link`);\n }\n\n /** Joins a shared conversation with the token of its invitation link. */\n joinConversation(conversationId: string, token: string): Observable<Conversation> {\n return this.transport.json<Conversation>('POST', `conversations/${encodeURIComponent(conversationId)}/join`, { token });\n }\n\n /** Owner only: searches the application's directory for people to invite. */\n searchParticipantCandidates(conversationId: string, query: string): Observable<DirectoryEntry[]> {\n const path = `conversations/${encodeURIComponent(conversationId)}/participant-candidates?query=${encodeURIComponent(query)}`;\n return this.transport.json<DirectoryEntry[]>('GET', path);\n }\n\n /** Owner only: invites a person the directory returned. */\n inviteParticipant(conversationId: string, actorId: string): Observable<void> {\n return this.transport.json<void>('POST', `conversations/${encodeURIComponent(conversationId)}/participants`, { actorId });\n }\n\n /** The owner removes a participant, or a participant passes their own id to leave. */\n removeParticipant(conversationId: string, actorId: string): Observable<void> {\n const path = `conversations/${encodeURIComponent(conversationId)}/participants/${encodeURIComponent(actorId)}`;\n return this.transport.json<void>('DELETE', path);\n }\n\n /** The caller's notification choice and the server's Web Push key. */\n getNotificationSettings(): Observable<NotificationSettings> {\n return this.transport.json<NotificationSettings>('GET', 'notifications');\n }\n\n /** Turns push notifications on or off for every browser of the caller. */\n updateNotificationSettings(pushEnabled: boolean): Observable<NotificationSettings> {\n return this.transport.json<NotificationSettings>('PUT', 'notifications', { pushEnabled });\n }\n\n /** Registers this browser's push subscription for the caller. */\n subscribePush(subscription: PushSubscriptionRequest): Observable<void> {\n return this.transport.json<void>('PUT', 'notifications/push-subscription', subscription);\n }\n\n /** Removes this browser's push subscription. */\n unsubscribePush(endpoint: string): Observable<void> {\n return this.transport.json<void>('DELETE', 'notifications/push-subscription', { endpoint });\n }\n\n /** The caller's own assistant preferences. */\n getPreferences(): Observable<AssistantPreferences> {\n return this.transport.json<AssistantPreferences>('GET', 'preferences');\n }\n\n /** Replaces the caller's own assistant preferences and returns the stored values. */\n updatePreferences(preferences: AssistantPreferences): Observable<AssistantPreferences> {\n return this.transport.json<AssistantPreferences>('PUT', 'preferences', preferences);\n }\n\n /** MCP servers that agents may use in background runs with the caller's own account. */\n getMcpConnections(): Observable<McpConnection[]> {\n return this.transport.json<McpConnection[]>('GET', 'mcp-connections');\n }\n\n /** Allows or withdraws background use of an MCP server with the caller's own account. */\n updateMcpConnection(serverId: string, request: UpdateMcpConnectionRequest): Observable<McpConnection> {\n return this.transport.json<McpConnection>('PUT', `mcp-connections/${encodeURIComponent(serverId)}`, request);\n }\n\n /**\n * Starts the caller's authorization of a server each person connects to. Prefer\n * `NhAssistantMcpConnectService.connect`, which opens and completes it.\n */\n authorizeMcpConnection(serverId: string, request: McpAuthorizeRequest = {}): Observable<McpAuthorizationStart> {\n return this.transport.json<McpAuthorizationStart>('POST', `mcp-connections/${encodeURIComponent(serverId)}/authorize`, request);\n }\n\n /** Removes the caller's own connection of a server and revokes its tokens. */\n disconnectMcpConnection(serverId: string): Observable<void> {\n return this.transport.json<void>('DELETE', `mcp-connections/${encodeURIComponent(serverId)}`);\n }\n\n /** Activates the connection of an authorization the caller started, with the callback's completion code. */\n completeMcpAuthorization(request: McpCompleteRequest): Observable<McpCompletion> {\n return this.transport.json<McpCompletion>('POST', 'mcp-connections/complete', request);\n }\n\n /**\n * Streams a turn. With `queuedReceipt` a `202` answer with a trigger receipt becomes\n * `message.queued`; without it, a stream is required.\n */\n private requestStream(path: string, body: unknown, queuedReceipt: true): Observable<NhAssistantMessageEvent>;\n private requestStream(path: string, body: unknown, queuedReceipt: false): Observable<NhAssistantSseEvent>;\n private requestStream(path: string, body: unknown, queuedReceipt: boolean): Observable<NhAssistantMessageEvent> {\n return new Observable<NhAssistantMessageEvent>(subscriber => {\n const abort = new AbortController();\n\n void this.executeStream(path, body, queuedReceipt, abort.signal, subscriber);\n\n return () => abort.abort();\n });\n }\n\n private async executeStream(\n path: string,\n body: unknown,\n queuedReceipt: boolean,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantMessageEvent>\n ): Promise<void> {\n let response: Response;\n try {\n response = await this.transport.fetch('POST', path, 'text/event-stream', body, signal);\n } catch {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.network);\n return;\n }\n\n if (!response.ok) {\n this.emitClientError(subscriber, signal, await this.transport.failureCode(response));\n return;\n }\n if (queuedReceipt && response.status === 202) {\n await this.readQueuedReceipt(response, signal, subscriber);\n return;\n }\n\n const contentType = response.headers.get('content-type') ?? '';\n if (!response.body || !contentType.toLowerCase().startsWith('text/event-stream')) {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.invalidResponse);\n return;\n }\n\n await this.readStream(response.body, signal, subscriber);\n }\n\n /**\n * A message to an agent's thread whose run works waits for the next run: the server answers `202`\n * with the trigger receipt instead of a stream. A receipt the run takes the message with becomes\n * `message.queued`; one that refused it becomes an `error` with its code.\n */\n private async readQueuedReceipt(\n response: Response,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantMessageEvent>\n ): Promise<void> {\n let receipt: AgentTriggerReceipt | null;\n try {\n receipt = JSON.parse(await response.text()) as AgentTriggerReceipt | null;\n } catch {\n receipt = null;\n }\n if (signal.aborted || subscriber.closed) {\n return;\n }\n if (!receipt || typeof receipt.outcome !== 'string') {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.invalidResponse);\n return;\n }\n if (!queuedOutcomes.has(receipt.outcome)) {\n this.emitClientError(\n subscriber,\n signal,\n nhAssistantIsSafeCode(receipt.reasonCode) ? receipt.reasonCode : NhAssistantClientErrorCodes.conversationBusy);\n return;\n }\n\n subscriber.next({ type: 'message.queued', data: receipt });\n subscriber.complete();\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n subscriber: Subscriber<NhAssistantMessageEvent>\n ): Promise<void> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n const parser = new NhAssistantSseParser();\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n const text = done ? decoder.decode() : decoder.decode(value, { stream: true });\n const messages = done ? [...parser.push(text), ...parser.end()] : parser.push(text);\n\n for (const message of messages) {\n if (!knownEventTypes.has(message.event)) {\n continue;\n }\n\n let data: unknown;\n try {\n data = JSON.parse(message.data);\n } catch {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.invalidResponse);\n return;\n }\n\n const event = { type: message.event as NhAssistantSseEventType, data } as NhAssistantSseEvent;\n subscriber.next(event);\n\n if (event.type === 'turn.completed' || event.type === 'error') {\n subscriber.complete();\n return;\n }\n }\n\n if (done) {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.streamInterrupted);\n return;\n }\n }\n } catch {\n this.emitClientError(subscriber, signal, NhAssistantClientErrorCodes.streamInterrupted);\n } finally {\n // Releases the connection once a terminal event arrived or the consumer unsubscribed.\n reader.cancel().catch(() => undefined);\n }\n }\n\n private emitClientError(subscriber: Subscriber<NhAssistantMessageEvent>, signal: AbortSignal, code: string): void {\n if (signal.aborted || subscriber.closed) {\n return;\n }\n\n subscriber.next({ type: 'error', data: { code, messageKey: nhAssistantErrorMessageKey(code) } });\n subscriber.complete();\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Observable, forkJoin, map, of } from 'rxjs';\nimport {\n AdminAgent,\n AdminAgentGroups,\n AgentMetadata,\n AgentMetadataRequest,\n AdminAgentInput,\n AgentRunConfiguration,\n AgentRunSettings,\n AgentRunSettingsRequest,\n AgentEvaluation,\n AgentEvaluationFilter,\n AgentFeedbackExportFilter,\n AgentFeedbackFilter,\n AgentFeedbackList,\n AgentFeedbackListFilter,\n AgentFeedbackSummary,\n AgentReplay,\n AgentReplayList,\n AgentReplayRequest,\n AgentSkillState,\n AgentState,\n ApplicationContext,\n DataSkill,\n DataSkillRequest,\n DataSkillVersion,\n DataConsultation,\n DataConsultationRequest,\n DataConsultationStateRequest,\n DataTrigger,\n DataTriggerRequest,\n DataTriggerShadowRequest,\n DataTriggerVersion,\n ApplicationContextVersion,\n McpAuthorizationStart,\n McpAuthorizeRequest,\n McpCompleteRequest,\n McpCompletion,\n McpConnectionsSummary,\n McpDiscovery,\n McpOrganizationConnection,\n McpCustomAuthMode,\n McpServer,\n McpServerInput,\n McpServerTestResult,\n McpTool,\n AssistantAccount,\n InstructionAssetList,\n InstructionAssetText,\n RunCatalog,\n RunConfigurationRemoval,\n SetAgentConsultationRoutesRequest,\n SetAgentServiceAccountRequest,\n SetAgentShadowRequest,\n SetAgentStateRequest,\n SkillCandidateRequest,\n SkillComparison,\n SkillComparisonFilter,\n ToolCatalogEntry,\n TriggerCandidateRequest,\n TriggerComparison,\n UpdateAdminAgentRequest,\n UpdateApplicationContextRequest,\n UpdateMcpToolRequest\n} from '../models/assistant-admin.models';\nimport {\n AgentPackage,\n AgentPackageExport,\n AgentPackageExportOptions,\n AgentPackageImport,\n AgentPackageImportOptions,\n AgentPackagePreview,\n AgentPackageUnlink,\n AgentPackageUnlinkRequest,\n AgentPackageWarning\n} from '../models/assistant-agent-package.models';\nimport { AgentRunFilter, AgentRunHistory } from '../models/assistant-agent-run.models';\nimport {\n AgentHandOffs,\n AgentShadowVariants,\n DataHandOff,\n DataHandOffRequest,\n ShadowVariantPromotion,\n ShadowVariantPromotionRequest\n} from '../models/assistant-hand-off.models';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantApiService } from './nh-assistant-api.service';\nimport { NhAssistantApiError, NhAssistantStatusCodes, NhAssistantTransport, nhAssistantErrorMessageKey, nhAssistantIsSafeCode } from './nh-assistant-transport';\n\n/** In the admin endpoints a 409 means a stale `expectedVersion` or a forbidden state change. */\nconst adminStatusCodes: NhAssistantStatusCodes = {\n 409: NhAssistantClientErrorCodes.versionConflict\n};\n\n/** The most account ids one `GET admin/accounts?ids=` reads; `getAccounts` asks for more in parts. */\nconst maxAccountIds = 50;\n\n/** The longest account id the server reads; a longer id names no account. */\nconst maxAccountIdLength = 256;\n\n/** The header of the agent package export that lists the references to agents outside the selection. */\nconst packageWarningsHeader = 'X-NewHeap-Package-Warnings';\n\n/**\n * Client for the assistant administration endpoints (`admin/*`). The server requires the\n * access policy and the admin policy; show the administration only when\n * `NhAssistantStore.canAdminister()` is true. Failures error with `NhAssistantApiError`.\n * Secrets are write-only: `McpServer` only reports `hasSecret`.\n */\n@Injectable()\nexport class NhAssistantAdminApiService {\n private readonly transport = inject(NhAssistantTransport);\n private readonly api = inject(NhAssistantApiService);\n\n getContext(): Observable<ApplicationContext> {\n return this.request<ApplicationContext>('GET', 'admin/context');\n }\n\n /** Saves a new context version; fails with `assistant-version-conflict` when `expectedVersion` is stale. */\n updateContext(request: UpdateApplicationContextRequest): Observable<ApplicationContext> {\n return this.request<ApplicationContext>('PUT', 'admin/context', request);\n }\n\n getContextVersions(): Observable<ApplicationContextVersion[]> {\n return this.request<ApplicationContextVersion[]>('GET', 'admin/context/versions');\n }\n\n /** Local, bridge and MCP tools, for choosing tool selectors. */\n getTools(): Observable<ToolCatalogEntry[]> {\n return this.request<ToolCatalogEntry[]>('GET', 'admin/tools');\n }\n\n getAgents(): Observable<AdminAgent[]> {\n return this.request<AdminAgent[]>('GET', 'admin/agents');\n }\n\n createAgent(input: AdminAgentInput): Observable<AdminAgent> {\n return this.request<AdminAgent>('POST', 'admin/agents', input);\n }\n\n /**\n * Saves an agent's definition when `expectedVersion` is current. Omit `mcpServerIds` to keep its MCP\n * assignments, which `assignMcpServer` and `unassignMcpServer` change one by one; `[]` removes them.\n */\n updateAgent(agentId: string, request: UpdateAdminAgentRequest): Observable<AdminAgent> {\n return this.request<AdminAgent>('PUT', `admin/agents/${encodeURIComponent(agentId)}`, request);\n }\n\n /** Restores a code agent to its definition in code. The run state stays as it is. */\n resetAgent(agentId: string): Observable<AdminAgent> {\n return this.request<AdminAgent>('POST', `admin/agents/${encodeURIComponent(agentId)}/reset`);\n }\n\n getAgentState(agentId: string): Observable<AgentState> {\n return this.request<AgentState>('GET', `admin/agents/${encodeURIComponent(agentId)}/state`);\n }\n\n /**\n * Pauses, stops or resumes an agent without changing its definition. A code-disabled agent\n * cannot be resumed (`assistant-agent-configured-off`).\n */\n setAgentState(agentId: string, request: SetAgentStateRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/state`, request);\n }\n\n /**\n * Pauses, stops or resumes one skill of an agent; its other skills keep working.\n */\n setSkillState(agentId: string, skillId: string, request: SetAgentStateRequest): Observable<AgentSkillState> {\n return this.request<AgentSkillState>(\n 'POST',\n `admin/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}/state`,\n request);\n }\n\n /**\n * Puts an agent in shadow, live, or back to the mode in code. A shadow variant cannot change\n * (`assistant-shadow-variant`).\n */\n setAgentShadow(agentId: string, request: SetAgentShadowRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/shadow`, request);\n }\n\n /** Puts one skill of an agent in shadow, live, or back to the mode in code. */\n setSkillShadow(agentId: string, skillId: string, request: SetAgentShadowRequest): Observable<AgentSkillState> {\n return this.request<AgentSkillState>(\n 'POST',\n `admin/agents/${encodeURIComponent(agentId)}/skills/${encodeURIComponent(skillId)}/shadow`,\n request);\n }\n\n /**\n * Changes the technical account that answers for the agent's new runs, or with `actorId: null`\n * uses the account in code again. Fails with `assistant-service-account-not-found` for an\n * account that does not exist or may not sign in, and with `assistant-service-account-not-permitted`\n * for an account that would lend the agent rights the administrator does not hold.\n */\n setServiceAccount(agentId: string, request: SetAgentServiceAccountRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/service-account`, request);\n }\n\n /**\n * Switches the routes of the agent's consultations on, off or back to the setting in code; a route\n * left out keeps its switch. Code is the ceiling: switching on a route that no consultation in code\n * allows fails with `assistant-consult-route-not-allowed`. Returns the agent's state with its\n * `consultationRoutes`.\n */\n setConsultationRoutes(agentId: string, request: SetAgentConsultationRoutesRequest): Observable<AgentState> {\n return this.request<AgentState>('POST', `admin/agents/${encodeURIComponent(agentId)}/consultation-routes`, request);\n }\n\n /**\n * Puts an agent, in code or created here, in exactly `groups` of the run catalog's `agentGroups`\n * and out of the others. The choice wins over the agent's `InGroup` in code. Fails with a field error\n * on `groups` for an unknown group and with `assistant-shadow-variant` for a shadow variant.\n */\n setAgentGroups(agentId: string, groups: readonly string[]): Observable<AdminAgentGroups> {\n return this.request<AdminAgentGroups>('PUT', `admin/agents/${encodeURIComponent(agentId)}/groups`, { groups });\n }\n\n /**\n * Every entry of agent metadata the application registers, with the agent's value in effect, where\n * it comes from and whether it changes here (`GET admin/agents/{id}/metadata`).\n */\n getAgentMetadata(agentId: string): Observable<AgentMetadata[]> {\n return this.request<AgentMetadata[]>('GET', `${agentPath(agentId)}/metadata`);\n }\n\n /**\n * Saves the agent's value of one metadata entry after the checks in code: field errors `value` or\n * `value.<field>`. For an agent created here it makes the agent's next version (`expectedVersion` is\n * the agent's version); for an agent in code only an editable entry changes, as an override with a\n * version of its own (`assistant-metadata-read-only` otherwise).\n */\n saveAgentMetadata(agentId: string, name: string, request: AgentMetadataRequest): Observable<AgentMetadata> {\n return this.request<AgentMetadata>('PUT', metadataPath(agentId, name), request);\n }\n\n /**\n * Removes the agent's stored value of one metadata entry, so an agent in code uses its value in code\n * again; answers the entry as it is now.\n */\n removeAgentMetadata(agentId: string, name: string, expectedVersion: number | null): Observable<AgentMetadata> {\n return this.request<AgentMetadata>('DELETE', withQuery(metadataPath(agentId, name), { expectedVersion }));\n }\n\n /** Deletes an admin agent. Code agents cannot be deleted; stop them instead. */\n deleteAgent(agentId: string): Observable<void> {\n return this.request<void>('DELETE', `admin/agents/${encodeURIComponent(agentId)}`);\n }\n\n getMcpServers(): Observable<McpServer[]> {\n return this.request<McpServer[]>('GET', 'admin/mcp-servers');\n }\n\n /**\n * The authentication modes the application registered in code (`GET admin/mcp-auth-modes`), which\n * administrators choose next to the built-in modes.\n */\n getMcpAuthModes(): Observable<McpCustomAuthMode[]> {\n return this.request<McpCustomAuthMode[]>('GET', 'admin/mcp-auth-modes');\n }\n\n createMcpServer(input: McpServerInput): Observable<McpServer> {\n return this.request<McpServer>('POST', 'admin/mcp-servers', input);\n }\n\n /** Omit `secret` to keep the stored secret; send `\"\"` to clear it. */\n updateMcpServer(serverId: string, input: McpServerInput): Observable<McpServer> {\n return this.request<McpServer>('PUT', `admin/mcp-servers/${encodeURIComponent(serverId)}`, input);\n }\n\n deleteMcpServer(serverId: string): Observable<void> {\n return this.request<void>('DELETE', `admin/mcp-servers/${encodeURIComponent(serverId)}`);\n }\n\n testMcpServer(serverId: string): Observable<McpServerTestResult> {\n return this.request<McpServerTestResult>('POST', `admin/mcp-servers/${encodeURIComponent(serverId)}/test`);\n }\n\n /** Reads the remote tool list. New tools start disabled; a changed input schema disables a tool. */\n syncMcpServer(serverId: string): Observable<McpTool[]> {\n return this.request<McpTool[]>('POST', `admin/mcp-servers/${encodeURIComponent(serverId)}/sync`);\n }\n\n getMcpTools(serverId: string): Observable<McpTool[]> {\n return this.request<McpTool[]>('GET', `admin/mcp-servers/${encodeURIComponent(serverId)}/tools`);\n }\n\n /**\n * Reads the protected resource metadata of a server address and its authorization server without\n * storing anything. Save the server with `oauth.confirmAuthorization` to pin what was found.\n */\n discoverMcpServer(url: string): Observable<McpDiscovery> {\n return this.request<McpDiscovery>('POST', 'admin/mcp-servers/discover', { url });\n }\n\n /** The organization's OAuth connection of a server, without tokens. */\n getMcpOrganizationConnection(serverId: string): Observable<McpOrganizationConnection> {\n return this.request<McpOrganizationConnection>('GET', `${mcpServerPath(serverId)}/connection`);\n }\n\n /**\n * Starts the administrator's authorization of the organization connection. Open\n * `authorizationUrl` in the administrator's browser, then complete with `completeMcpAuthorization`.\n */\n authorizeMcpOrganizationConnection(serverId: string, request: McpAuthorizeRequest = {}): Observable<McpAuthorizationStart> {\n return this.request<McpAuthorizationStart>('POST', `${mcpServerPath(serverId)}/connection/authorize`, request);\n }\n\n /** Removes the organization connection and revokes its tokens. */\n disconnectMcpOrganizationConnection(serverId: string): Observable<void> {\n return this.request<void>('DELETE', `${mcpServerPath(serverId)}/connection`);\n }\n\n /** The personal connections of a server per status. */\n getMcpConnectionsSummary(serverId: string): Observable<McpConnectionsSummary> {\n return this.request<McpConnectionsSummary>('GET', `${mcpServerPath(serverId)}/connections/summary`);\n }\n\n /** Revokes every person's connection of a server; each person connects again. */\n revokeMcpConnections(serverId: string): Observable<void> {\n return this.request<void>('DELETE', `${mcpServerPath(serverId)}/connections`);\n }\n\n /**\n * Activates the connection of an authorization the caller started with the completion code the\n * callback handed to the browser. An organization connection also needs the admin policy. The same\n * call as `NhAssistantApiService.completeMcpAuthorization`, with the same failure codes.\n */\n completeMcpAuthorization(request: McpCompleteRequest): Observable<McpCompletion> {\n return this.api.completeMcpAuthorization(request);\n }\n\n /**\n * Enables or disables a tool, sets its effect and its description. A remote name that no sync has\n * seen yet stores these reviewed settings as a tool that awaits its sync (`awaitingSync`).\n */\n updateMcpTool(serverId: string, remoteName: string, request: UpdateMcpToolRequest): Observable<McpTool> {\n const path = `admin/mcp-servers/${encodeURIComponent(serverId)}/tools/${encodeURIComponent(remoteName)}`;\n return this.request<McpTool>('PUT', path, request);\n }\n\n /**\n * Assigns a server to an agent (`PUT admin/mcp-servers/{id}/agents/{agentId}`). Only the assignment\n * changes, never the agent's definition or version; assigning an assigned server changes nothing.\n * Answers the server with its `assignedAgentIds`.\n */\n assignMcpServer(serverId: string, agentId: string): Observable<McpServer> {\n return this.request<McpServer>('PUT', `${mcpServerPath(serverId)}/agents/${encodeURIComponent(agentId)}`);\n }\n\n /**\n * Removes a server's assignment to an agent (`DELETE admin/mcp-servers/{id}/agents/{agentId}`); the\n * agent's definition and version stay. Answers the server with its `assignedAgentIds`.\n */\n unassignMcpServer(serverId: string, agentId: string): Observable<McpServer> {\n return this.request<McpServer>('DELETE', `${mcpServerPath(serverId)}/agents/${encodeURIComponent(agentId)}`);\n }\n\n /**\n * The agent's proposals per tool and agent version in the period: decisions, the rejection rate,\n * feedback per category and the number of different people who gave it.\n */\n getAgentFeedbackSummary(agentId: string, filter: AgentFeedbackFilter = {}): Observable<AgentFeedbackSummary> {\n return this.request<AgentFeedbackSummary>('GET', withQuery(`${feedbackPath(agentId)}/summary`, filter));\n }\n\n /** The feedback on the agent's proposals with the proposal as approvers read it, newest change first. */\n getAgentFeedback(agentId: string, filter: AgentFeedbackListFilter = {}): Observable<AgentFeedbackList> {\n return this.request<AgentFeedbackList>('GET', withQuery(feedbackPath(agentId), filter));\n }\n\n /**\n * Downloads the feedback as JSON Lines with the tool input of each proposal. The file holds\n * subject data and the server audits the export. Rejects with `NhAssistantApiError`.\n */\n exportAgentFeedback(agentId: string, filter: AgentFeedbackExportFilter = {}): Promise<Blob> {\n return this.download(withQuery(`${feedbackPath(agentId)}/export`, filter));\n }\n\n /**\n * Compares a shadow variant with its live agent over a period: the runs that handled the same\n * events, the proposals per tool with what people decided about the live ones, cost and routing.\n */\n getAgentEvaluation(agentId: string, filter: AgentEvaluationFilter): Observable<AgentEvaluation> {\n return this.request<AgentEvaluation>('GET', withQuery(`${agentPath(agentId)}/evaluation`, filter));\n }\n\n /**\n * Downloads the paired runs of the comparison as JSON Lines: identifiers, statuses, usage and\n * proposal identities, no content. The server audits the export. Rejects with `NhAssistantApiError`.\n */\n exportAgentEvaluation(agentId: string, filter: AgentEvaluationFilter): Promise<Blob> {\n return this.download(withQuery(`${agentPath(agentId)}/evaluation/export`, filter));\n }\n\n /**\n * Replays the recorded runs of another agent in a period into a shadow variant, against today's\n * state of each subject. One replay runs per variant (`assistant-replay-active`).\n */\n startAgentReplay(variantId: string, request: AgentReplayRequest): Observable<AgentReplay> {\n return this.request<AgentReplay>('POST', `${agentPath(variantId)}/replay`, request);\n }\n\n /** The latest replays into a shadow variant, newest first. */\n getAgentReplays(variantId: string): Observable<AgentReplayList> {\n return this.request<AgentReplayList>('GET', `${agentPath(variantId)}/replays`);\n }\n\n /** The building blocks in code that run settings, skills and triggers defined as data can name. */\n getRunCatalog(): Observable<RunCatalog> {\n return this.request<RunCatalog>('GET', 'admin/run-catalog');\n }\n\n /**\n * The application's assets an administrator may choose as instructions, without their content\n * (`GET admin/instruction-assets`). Fails with `assistant-instructions-asset-unavailable` when the\n * application's source fails.\n */\n listInstructionAssets(): Observable<InstructionAssetList> {\n return this.request<InstructionAssetList>('GET', 'admin/instruction-assets');\n }\n\n /**\n * The text of one asset, read-only, with the hash a reference stores. Fails with\n * `assistant-instructions-asset-not-found` for an asset or version the application does not have.\n */\n getInstructionAsset(assetId: string, version: number): Observable<InstructionAssetText> {\n return this.request<InstructionAssetText>(\n 'GET',\n `admin/instruction-assets/${encodeURIComponent(assetId)}/versions/${encodeURIComponent(String(version))}`\n );\n }\n\n /**\n * Accounts whose name or e-mail address contains `query` (2 to 100 characters), at most `limit`.\n * Fails with `assistant-account-search-unavailable` when the application offers no search; the\n * run catalog's `accountSearch` tells beforehand.\n */\n searchAccounts(query: string, limit?: number): Observable<AssistantAccount[]> {\n return this.request<AssistantAccount[]>('GET', withQuery('admin/accounts', { query, limit }));\n }\n\n /**\n * The names the application knows for these account ids; unknown ids are left out. The server reads\n * at most 50 ids per request, so more ids are asked for in parts of 50 and the answers merged in\n * the order of the ids. Fails with `NhAssistantApiError` when any part fails.\n */\n getAccounts(actorIds: readonly string[]): Observable<AssistantAccount[]> {\n // An empty id or one longer than the server reads names no account.\n const ids = [...new Set(actorIds.filter(id => id.trim().length > 0 && id.length <= maxAccountIdLength))];\n if (ids.length === 0) {\n return of([]);\n }\n\n const parts: Observable<AssistantAccount[]>[] = [];\n for (let start = 0; start < ids.length; start += maxAccountIds) {\n const part = ids.slice(start, start + maxAccountIds);\n parts.push(this.request<AssistantAccount[]>('GET', withQuery('admin/accounts', { ids: part.join(',') })));\n }\n\n return forkJoin(parts).pipe(map(answers => answers.flat()));\n }\n\n /**\n * The agent's run settings, skills and triggers, in code and as data, and the data that no longer\n * fits the code. An agent in code without a run configuration answers `assistant-agent-not-found`.\n */\n getAgentConfiguration(agentId: string): Observable<AgentRunConfiguration> {\n return this.request<AgentRunConfiguration>('GET', `${agentPath(agentId)}/configuration`);\n }\n\n /**\n * Adds or changes the run settings of an agent created in the administration. An agent in code\n * fails with `assistant-run-settings-in-code`; an unknown technical account with\n * `assistant-service-account-not-found`, and one that would lend the agent rights the\n * administrator does not hold with `assistant-service-account-not-permitted`.\n */\n saveRunSettings(agentId: string, request: AgentRunSettingsRequest): Observable<AgentRunSettings> {\n return this.request<AgentRunSettings>('PUT', `${agentPath(agentId)}/run-settings`, request);\n }\n\n /**\n * Every run of the agent, live and shadow, newest first, for its runs view. Read one run's whole\n * result with `NhAssistantAgentRunApiService.getRunResult`. The server checks the filter first:\n * `assistant-run-filter-invalid` with the refused parts in `fieldErrors`, then\n * `assistant-agent-not-found` for an unknown agent.\n */\n getAgentRuns(agentId: string, filter: Omit<AgentRunFilter, 'agentId'> = {}): Observable<AgentRunHistory> {\n return this.request<AgentRunHistory>('GET', withQuery(`${agentPath(agentId)}/runs`, filter));\n }\n\n /**\n * Removes the run settings; while data skills, triggers, consultations or hand-offs defined as data\n * belong to the agent, `assistant-run-settings-in-use`.\n */\n removeRunSettings(agentId: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(`${agentPath(agentId)}/run-settings`, removal));\n }\n\n /**\n * Adds a skill defined as data, which starts in shadow, or stores its next version: with `apply`\n * `live` at once, with `shadow` as the candidate that runs in shadow next to the live version.\n */\n saveDataSkill(agentId: string, skillId: string, request: DataSkillRequest): Observable<DataSkill> {\n return this.request<DataSkill>('PUT', skillPath(agentId, skillId), request);\n }\n\n /** Takes a skill defined as data out of effect; while a data trigger names it, `assistant-skill-in-use`. */\n removeDataSkill(agentId: string, skillId: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(skillPath(agentId, skillId), removal));\n }\n\n /** Every version of a skill defined as data, newest first. */\n getDataSkillVersions(agentId: string, skillId: string): Observable<DataSkillVersion[]> {\n return this.request<DataSkillVersion[]>('GET', `${skillPath(agentId, skillId)}/versions`);\n }\n\n /** Makes the candidate the live version of its skill. */\n promoteSkillCandidate(agentId: string, skillId: string, request: SkillCandidateRequest): Observable<DataSkill> {\n return this.request<DataSkill>('POST', `${skillPath(agentId, skillId)}/candidate/promote`, request);\n }\n\n /** Discards the candidate; it stays as history. */\n discardSkillCandidate(agentId: string, skillId: string, request: SkillCandidateRequest): Observable<void> {\n return this.request<void>('POST', `${skillPath(agentId, skillId)}/candidate/discard`, request);\n }\n\n /** Compares the candidate with the live version on the runs they made in the period. */\n compareSkillCandidate(agentId: string, skillId: string, filter: SkillComparisonFilter = {}): Observable<SkillComparison> {\n return this.request<SkillComparison>('GET', withQuery(`${skillPath(agentId, skillId)}/candidate/comparison`, filter));\n }\n\n /**\n * Adds a trigger defined as data, which starts in shadow, or stores its next version: with `apply`\n * `live` (default) it takes effect at once in the trigger's mode; with `shadow` it becomes the\n * candidate that fires next to the live version until it is promoted or discarded.\n */\n saveDataTrigger(agentId: string, triggerId: string, request: DataTriggerRequest): Observable<DataTrigger> {\n return this.request<DataTrigger>('PUT', triggerPath(agentId, triggerId), request);\n }\n\n /** Every version of a trigger defined as data, newest first, with its definition. */\n getDataTriggerVersions(agentId: string, triggerId: string): Observable<DataTriggerVersion[]> {\n return this.request<DataTriggerVersion[]>('GET', `${triggerPath(agentId, triggerId)}/versions`);\n }\n\n /** Makes the candidate the live version of its trigger, in the trigger's mode. */\n promoteTriggerCandidate(agentId: string, triggerId: string, request: TriggerCandidateRequest): Observable<DataTrigger> {\n return this.request<DataTrigger>('POST', `${triggerPath(agentId, triggerId)}/candidate/promote`, request);\n }\n\n /** Discards the candidate of a trigger; it stays as history and fires no more. */\n discardTriggerCandidate(agentId: string, triggerId: string, request: TriggerCandidateRequest): Observable<void> {\n return this.request<void>('POST', `${triggerPath(agentId, triggerId)}/candidate/discard`, request);\n }\n\n /** Compares the trigger's candidate with its live version on the runs they started in the period. */\n compareTriggerCandidate(agentId: string, triggerId: string, filter: SkillComparisonFilter = {}): Observable<TriggerComparison> {\n return this.request<TriggerComparison>('GET', withQuery(`${triggerPath(agentId, triggerId)}/candidate/comparison`, filter));\n }\n\n removeDataTrigger(agentId: string, triggerId: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(triggerPath(agentId, triggerId), removal));\n }\n\n /** Puts a trigger defined as data in shadow or live. */\n setDataTriggerShadow(agentId: string, triggerId: string, request: DataTriggerShadowRequest): Observable<DataTrigger> {\n return this.request<DataTrigger>('POST', `${triggerPath(agentId, triggerId)}/shadow`, request);\n }\n\n /**\n * Adds or changes the consultation defined as data of an agent about one subject type, within the\n * agent's `consultationCeiling`. It is in effect once saved and answers when an asking agent selects\n * its consult tool. An agent that may get none fails with `assistant-consultations-not-allowed`, an\n * agent created here without run settings with `assistant-agent-not-configured`, a type the agent\n * allows consultation about in code with `assistant-consultation-in-code`, more than the ceiling's\n * `maxConsultations` with `assistant-configuration-limit`, a stale `expectedVersion` with\n * `assistant-version-conflict` and invalid input with field errors, such as `routes: not-allowed` for\n * a route outside the ceiling.\n */\n saveDataConsultation(agentId: string, subjectType: string, request: DataConsultationRequest): Observable<DataConsultation> {\n return this.request<DataConsultation>('PUT', consultationPath(agentId, subjectType), request);\n }\n\n /**\n * Switches a consultation defined as data on or off, without a new version. Off, it is not offered,\n * while its recorded proposals can still be decided. Fails with `assistant-consultation-not-found`\n * without one and with `assistant-consultation-in-code` for a consultation in code.\n */\n setDataConsultationState(agentId: string, subjectType: string, request: DataConsultationStateRequest): Observable<DataConsultation> {\n return this.request<DataConsultation>('POST', `${consultationPath(agentId, subjectType)}/state`, request);\n }\n\n /**\n * Removes a consultation defined as data: its tools disappear, while its recorded proposals can still\n * be decided. Fails with `assistant-consultation-not-found` without one and with\n * `assistant-consultation-in-code` for a consultation in code.\n */\n removeDataConsultation(agentId: string, subjectType: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(consultationPath(agentId, subjectType), removal));\n }\n\n /**\n * The hand-offs the agent accepts, in code and as data with their problems, and what the ceiling in\n * code (`UseHandOffsAsData`) lets administrators add; `ceiling` is `null` when it may accept none.\n */\n getAgentHandOffs(agentId: string): Observable<AgentHandOffs> {\n return this.request<AgentHandOffs>('GET', `${agentPath(agentId)}/hand-offs`);\n }\n\n /**\n * Adds or changes the hand-off defined as data that the agent accepts about one subject type, within\n * the ceiling: in effect once saved, as one in code. An agent the ceiling connects to no agent fails\n * with `assistant-handoffs-not-allowed`, a type it accepts in code with `assistant-handoff-in-code`,\n * an agent without run configuration with `assistant-agent-not-configured`, more than the ceiling's\n * `maxHandOffs` with `assistant-configuration-limit`, a stale `expectedVersion` with\n * `assistant-version-conflict` and invalid input with field errors, such as `sources: not-allowed`\n * for a source outside the ceiling.\n */\n saveDataHandOff(agentId: string, subjectType: string, request: DataHandOffRequest): Observable<DataHandOff> {\n return this.request<DataHandOff>('PUT', handOffPath(agentId, subjectType), request);\n }\n\n /**\n * Removes a hand-off defined as data; its tool disappears from the sources' next turns. Fails with\n * `assistant-handoff-not-found` without one and with `assistant-handoff-in-code` for one in code.\n */\n removeDataHandOff(agentId: string, subjectType: string, removal: RunConfigurationRemoval = {}): Observable<void> {\n return this.request<void>('DELETE', withQuery(handOffPath(agentId, subjectType), removal));\n }\n\n /**\n * The agent's shadow variants, in code and created as data, and whether administrators may create\n * more (`UseShadowVariantsAsData`). Create a data variant with `createAgent` and `shadowOf`.\n */\n getShadowVariants(agentId: string): Observable<AgentShadowVariants> {\n return this.request<AgentShadowVariants>('GET', `${agentPath(agentId)}/shadow-variants`);\n }\n\n /**\n * Promotes the data shadow variant `variantId` onto its live agent (`POST admin/agents/{id}/promote`):\n * its definition becomes the live agent's next version through the update path, with its checks,\n * locks and audit, its data skills move along when asked, and the variant is deleted. The live agent\n * keeps its name, MCP servers, metadata, run settings, triggers, state and shadow mode; an agent in\n * code takes only the fields it can override. Fails with `assistant-not-shadow-variant`,\n * `assistant-shadow-variants-not-allowed`, `assistant-version-conflict` and `assistant-skill-in-code`.\n */\n promoteShadowVariant(variantId: string, request: ShadowVariantPromotionRequest): Observable<ShadowVariantPromotion> {\n return this.request<ShadowVariantPromotion>('POST', `${agentPath(variantId)}/promote`, request);\n }\n\n /**\n * Exports exactly `agentIds` (1 to 20) as one agent package (`POST admin/agent-packages/export`):\n * agents created here whole, agents in code as an overlay of what data changes on them; never\n * history, candidates, runs, run state, shadow overrides, MCP servers, the technical account or\n * secrets. The options set the package id, version and locks; left out, the id of the package the\n * first agent is linked to and its next version, otherwise the first agent's id and 1. Answers the\n * package, its JSON exactly as the server wrote it for the download, and every reference to an agent\n * outside the selection, which must exist where the package is imported. Fails with\n * `assistant-agent-not-found` for an unknown agent and with field errors for invalid options; the\n * server audits the export.\n */\n exportAgentPackage(agentIds: readonly string[], options: AgentPackageExportOptions = {}): Observable<AgentPackageExport> {\n return this.transport.file('POST', 'admin/agent-packages/export', { agentIds: [...agentIds], options }, 'application/json', adminStatusCodes).pipe(\n map(file => {\n let agentPackage: AgentPackage;\n try {\n agentPackage = JSON.parse(file.text) as AgentPackage;\n } catch {\n throw new NhAssistantApiError(200, NhAssistantClientErrorCodes.invalidResponse, nhAssistantErrorMessageKey(NhAssistantClientErrorCodes.invalidResponse));\n }\n\n return { package: agentPackage, json: file.text, warnings: packageWarnings(file.headers.get(packageWarningsHeader)) };\n }));\n }\n\n /**\n * What importing the package would do, per agent and part (`POST admin/agent-packages/preview`):\n * `created`, `changed`, `unchanged`, `kept-local`, `left-behind` or `refused` with the field\n * errors of the save validators, after one check of the whole package against this host as it would\n * be after the import. Changes nothing. The server reads the package strictly: a package it does not\n * read fails with `assistant-package-format-unsupported`, one above 1 MB or 20 agents with\n * `assistant-package-too-large`.\n */\n previewAgentPackageImport(agentPackage: AgentPackage, options: AgentPackageImportOptions = {}): Observable<AgentPackagePreview> {\n return this.request<AgentPackagePreview>('POST', 'admin/agent-packages/preview', { package: agentPackage, options });\n }\n\n /**\n * Imports the package in one transaction (`POST admin/agent-packages/import`): every agent and part\n * of it, or nothing. Fails as `previewAgentPackageImport` does, and with `assistant-package-refused`\n * and the field error `parts: invalid` when the check refuses a part; preview again to see which part\n * and why. Every part is audited as its save.\n */\n importAgentPackage(agentPackage: AgentPackage, options: AgentPackageImportOptions = {}): Observable<AgentPackageImport> {\n return this.request<AgentPackageImport>('POST', 'admin/agent-packages/import', { package: agentPackage, options });\n }\n\n /**\n * Unlinks one part of the agent, or without `part` the whole agent, from its package\n * (`POST admin/agents/{id}/package/unlink`): its locks no longer hold and the next upgrade keeps it as\n * `kept-local` unless the import relinks it. Fails with `assistant-package-not-linked` for an agent\n * or part without a link and with the field error `part: invalid` for an unknown part key.\n */\n unlinkAgentPackage(agentId: string, request: AgentPackageUnlinkRequest = {}): Observable<AgentPackageUnlink> {\n return this.request<AgentPackageUnlink>('POST', `${agentPath(agentId)}/package/unlink`, request);\n }\n\n private download(path: string): Promise<Blob> {\n return this.transport.download(path, 'application/x-ndjson', adminStatusCodes);\n }\n\n private request<T>(method: string, path: string, body?: unknown): Observable<T> {\n return this.transport.json<T>(method, path, body, adminStatusCodes);\n }\n}\n\nfunction mcpServerPath(serverId: string): string {\n return `admin/mcp-servers/${encodeURIComponent(serverId)}`;\n}\n\nfunction feedbackPath(agentId: string): string {\n return `${agentPath(agentId)}/feedback`;\n}\n\nfunction agentPath(agentId: string): string {\n return `admin/agents/${encodeURIComponent(agentId)}`;\n}\n\nfunction skillPath(agentId: string, skillId: string): string {\n return `${agentPath(agentId)}/skills/${encodeURIComponent(skillId)}`;\n}\n\nfunction triggerPath(agentId: string, triggerId: string): string {\n return `${agentPath(agentId)}/triggers/${encodeURIComponent(triggerId)}`;\n}\n\nfunction consultationPath(agentId: string, subjectType: string): string {\n return `${agentPath(agentId)}/consultations/${encodeURIComponent(subjectType)}`;\n}\n\nfunction handOffPath(agentId: string, subjectType: string): string {\n return `${agentPath(agentId)}/hand-offs/${encodeURIComponent(subjectType)}`;\n}\n\nfunction metadataPath(agentId: string, name: string): string {\n return `${agentPath(agentId)}/metadata/${encodeURIComponent(name)}`;\n}\n\n/**\n * The references to agents outside an exported selection, from the export's header: a JSON array,\n * of which only entries with a safe code and string ids are kept. Without the header, none.\n */\nfunction packageWarnings(header: string | null): AgentPackageWarning[] {\n if (!header) {\n return [];\n }\n\n let items: unknown;\n try {\n items = JSON.parse(header);\n } catch {\n return [];\n }\n if (!Array.isArray(items)) {\n return [];\n }\n\n const warnings: AgentPackageWarning[] = [];\n for (const item of items) {\n const record = item && typeof item === 'object' ? item as Record<string, unknown> : null;\n if (record\n && typeof record['agentId'] === 'string'\n && typeof record['part'] === 'string'\n && typeof record['referencedAgentId'] === 'string'\n && nhAssistantIsSafeCode(record['code'])) {\n warnings.push({ agentId: record['agentId'], part: record['part'], code: record['code'], referencedAgentId: record['referencedAgentId'] });\n }\n }\n return warnings;\n}\n\n/** Appends the filter values that are set as query parameters. */\nfunction withQuery(path: string, filter: object): string {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null && value !== '') {\n query.set(key, String(value));\n }\n }\n\n const suffix = query.toString();\n return suffix ? `${path}?${suffix}` : path;\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport {\n AgentArtifact,\n AgentBoard,\n AgentBoardList,\n AgentBoardVisit,\n AgentConsultationList,\n AgentDecisionOutcome,\n AgentExecutionResolution,\n AgentFeedbackOutcome,\n AgentInbox,\n AgentInboxFilter,\n AgentInboxVisit,\n AgentObjectAgents,\n AgentProposal,\n AgentProposalDecision,\n AgentProposalFeedback,\n AgentProposalFeedbackCategory,\n AgentProposalLookup,\n AgentRunFilter,\n AgentRunHistory,\n AgentRunList,\n AgentRunResult,\n AgentRunRetryMode,\n AgentSubjectSearch,\n AgentSubjectSummaryList,\n AgentSubjectWork,\n AgentSubjectWorkProposal,\n AgentThreadLookup,\n AgentThreadMemory,\n AgentTriggerReceipt,\n StartAgentRequest\n} from '../models/assistant-agent-run.models';\nimport { NhAssistantTransport } from './nh-assistant-transport';\n\n/**\n * Client for the agent-run endpoints: the agent thread about a subject, its runs, proposals,\n * working memory and artifacts, and the approval inbox. Access follows the caller's role on the\n * subject, which the server checks on every request; failures error with `NhAssistantApiError`.\n */\n@Injectable()\nexport class NhAssistantAgentRunApiService {\n private readonly transport = inject(NhAssistantTransport);\n\n /** The agent's thread about the subject, the caller's role and whether the caller may start the agent. */\n getThread(agentId: string, subjectType: string, subjectId: string): Observable<AgentThreadLookup> {\n const query = new URLSearchParams({ agentId, subjectType, subjectId });\n return this.transport.json<AgentThreadLookup>('GET', `threads?${query.toString()}`);\n }\n\n /**\n * The agent's thread about the subject, created without starting a run when it is missing, so\n * the caller can open the conversation and type there. Creating a thread needs the participant\n * role; readers may open an existing one. Errors with `assistant-subject-access-denied` otherwise.\n */\n openThread(agentId: string, subjectType: string, subjectId: string): Observable<AgentThreadLookup> {\n return this.transport.json<AgentThreadLookup>('POST', 'threads/open', { agentId, subjectType, subjectId });\n }\n\n /**\n * Runs the agent now on the subject with the caller as initiator. On an object it needs the\n * participant role; on the whole application (`nh-system`) the agent's run policy, by default the\n * administration policy. The receipt says what became of the start (`AgentTriggerOutcome`), for\n * example `waiting` while the agent is paused. A refusal errors with `NhAssistantApiError`:\n * `assistant-agent-does-not-work-on`, `assistant-agent-stopped`, `assistant-trigger-rate-limited`\n * and the other conflicts (409), `assistant-subject-access-denied` or `assistant-agent-forbidden`\n * (403), `assistant-agent-not-found` or `assistant-subject-not-found` (404),\n * `assistant-subject-invalid` (400) and `assistant-trigger-rolled-back` (503).\n */\n startAgent(request: StartAgentRequest): Observable<AgentTriggerReceipt> {\n return this.transport.json<AgentTriggerReceipt>('POST', 'threads/start', request);\n }\n\n /**\n * All agent work on one subject: the caller's role, every agent with a thread on it plus\n * `agentId`, and the open proposals of all of them with the caller's live decision right. Errors\n * with `assistant-subject-not-found` when the caller has no role on the subject.\n */\n getSubjectWork(subjectType: string, subjectId: string, agentId?: string): Observable<AgentSubjectWork> {\n const path = `subjects/${encodeURIComponent(subjectType)}/${encodeURIComponent(subjectId)}/work`;\n const query = agentId ? `?${new URLSearchParams({ agentId }).toString()}` : '';\n return this.transport.json<AgentSubjectWork>('GET', path + query);\n }\n\n /**\n * The agents that work on the subject and that the caller may use, with whether the caller may run\n * each now, its newest run with the beginning of its result and its open proposals. The subject is\n * an object or the whole application (`nh-system`, `global` or `division-…`). Errors with\n * `assistant-subject-not-found` when the caller has no role on the subject.\n */\n getObjectAgents(subjectType: string, subjectId: string): Observable<AgentObjectAgents> {\n return this.transport.json<AgentObjectAgents>(\n 'GET',\n `subjects/${encodeURIComponent(subjectType)}/${encodeURIComponent(subjectId)}/agents`\n );\n }\n\n /**\n * Counts the agent work on at most `NH_ASSISTANT_MAX_SUBJECT_SUMMARY` subjects of one type in one\n * request, for badges in a list; one item per id in request order. `NhAssistantSubjectSummaryService`\n * batches and caches these requests for many badges.\n */\n summarizeSubjects(subjectType: string, subjectIds: readonly string[]): Observable<AgentSubjectSummaryList> {\n return this.transport.json<AgentSubjectSummaryList>('POST', `subjects/${encodeURIComponent(subjectType)}/summary`, {\n subjectIds\n });\n }\n\n /**\n * Finds subjects of one type by name, at most `limit` (default 20, at most 50), among those the\n * caller may read; `query` has 2 to 100 characters. Errors with `assistant-subject-search-unavailable`\n * for a type the application does not search (people then give the subject's id), with\n * `assistant-subject-type-unknown` for an unknown type and with `assistant-validation` for a\n * query of the wrong length.\n */\n searchSubjects(subjectType: string, query: string, limit?: number): Observable<AgentSubjectSearch> {\n const parameters = new URLSearchParams({ query });\n if (limit !== undefined) {\n parameters.set('limit', String(limit));\n }\n return this.transport.json<AgentSubjectSearch>(\n 'GET',\n `subjects/${encodeURIComponent(subjectType)}/search?${parameters.toString()}`\n );\n }\n\n getRuns(conversationId: string): Observable<AgentRunList> {\n return this.transport.json<AgentRunList>('GET', `threads/${encodeURIComponent(conversationId)}/runs`);\n }\n\n /** Who consulted the thread's agent through another assistant, newest first. */\n getConsultations(conversationId: string, page = 1, itemsPerPage = 20): Observable<AgentConsultationList> {\n const query = new URLSearchParams({ page: String(page), itemsPerPage: String(itemsPerPage) });\n return this.transport.json<AgentConsultationList>(\n 'GET',\n `threads/${encodeURIComponent(conversationId)}/consultations?${query.toString()}`\n );\n }\n\n getProposals(conversationId: string): Observable<AgentProposal[]> {\n return this.transport.json<AgentProposal[]>('GET', `threads/${encodeURIComponent(conversationId)}/proposals`);\n }\n\n /**\n * One proposal of an agent thread in any status, with the caller's live right to decide it, for\n * example the one an `AgentWorkChanged` update names. Fails with `assistant-approval-not-found`\n * for an unknown proposal and for one the caller may not see.\n */\n getProposal(approvalId: string): Observable<AgentSubjectWorkProposal> {\n return this.transport.json<AgentSubjectWorkProposal>('GET', `approvals/${encodeURIComponent(approvalId)}`);\n }\n\n /**\n * The proposals among at most `NH_ASSISTANT_MAX_PROPOSAL_LOOKUP` ids that the caller may see, in\n * the order of the ids, each with the caller's live right to decide it. The others are left out.\n */\n lookupProposals(approvalIds: readonly string[]): Observable<AgentProposalLookup> {\n return this.transport.json<AgentProposalLookup>('POST', 'approvals/lookup', { approvalIds });\n }\n\n getMemory(conversationId: string): Observable<AgentThreadMemory> {\n return this.transport.json<AgentThreadMemory>('GET', `threads/${encodeURIComponent(conversationId)}/memory`);\n }\n\n getArtifacts(conversationId: string): Observable<AgentArtifact[]> {\n return this.transport.json<AgentArtifact[]>('GET', `threads/${encodeURIComponent(conversationId)}/artifacts`);\n }\n\n /**\n * Downloads one artifact version with the host's credentials. Rejects with `NhAssistantApiError`,\n * for example `assistant-artifact-not-found` or `assistant-network`.\n */\n downloadArtifact(conversationId: string, artifactId: string): Promise<Blob> {\n const path = `threads/${encodeURIComponent(conversationId)}/artifacts/${encodeURIComponent(artifactId)}/content`;\n return this.transport.download(path, '*/*');\n }\n\n /**\n * The agent runs the caller may see, newest first: runs on objects the caller reads and runs for\n * the whole application whose agent's view policy the caller passes. Errors with\n * `assistant-run-filter-invalid` for an invalid filter, with the refused parts in `fieldErrors`\n * (`page`, `itemsPerPage`, `agentId`, `subjectType`, `subjectId`, `status`, `to`).\n */\n getRunHistory(filter: AgentRunFilter = {}): Observable<AgentRunHistory> {\n return this.transport.json<AgentRunHistory>('GET', withQuery('runs', filter));\n }\n\n /**\n * The boards of the groups of agents the caller sees at least one agent of, ordered by name: an\n * agent that works on the whole application by its view policy, another by its required policy.\n */\n getBoards(): Observable<AgentBoardList> {\n return this.transport.json<AgentBoardList>('GET', 'boards');\n }\n\n /**\n * The board of one group: per agent what it works on, its latest result for the whole application,\n * its open proposals, whether the caller may run it now and whether something is new since the\n * caller's last visit. `divisionId` opens the board of one division the caller may work in. Fails\n * with `assistant-board-not-found` for an unknown group or one the caller sees no agent of, and with\n * `assistant-board-scope-invalid` for a malformed division id.\n */\n getBoard(groupId: string, divisionId?: string | null): Observable<AgentBoard> {\n return this.transport.json<AgentBoard>('GET', withQuery(`boards/${encodeURIComponent(groupId)}`, { divisionId }));\n }\n\n /** Records that the caller looked at the board now, so it marks what is new after this visit. */\n visitBoard(groupId: string, divisionId?: string | null): Observable<AgentBoardVisit> {\n return this.transport.json<AgentBoardVisit>('POST', withQuery(`boards/${encodeURIComponent(groupId)}/visit`, { divisionId }));\n }\n\n /**\n * One run with its whole result, its proposals and its files. Fails with `assistant-run-not-found`\n * for an unknown run and for one the caller may not see.\n */\n getRunResult(runId: string): Observable<AgentRunResult> {\n return this.transport.json<AgentRunResult>('GET', `runs/${encodeURIComponent(runId)}`);\n }\n\n /**\n * Downloads one file a run saved, with the host's credentials. Rejects with `NhAssistantApiError`,\n * for example `assistant-artifact-not-found`, `assistant-run-not-found` or `assistant-network`.\n */\n downloadRunArtifact(runId: string, artifactId: string): Promise<Blob> {\n const path = `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/content`;\n return this.transport.download(path, '*/*');\n }\n\n /** Cancels a run at its next safe point and withdraws its open proposals; needs the participant role. */\n cancelRun(runId: string): Observable<void> {\n return this.transport.json<void>('POST', `runs/${encodeURIComponent(runId)}/cancel`);\n }\n\n /**\n * Resumes or restarts a failed or cancelled run; needs the approver role. A restart starts the agent\n * again like `startAgent`, with the same outcomes and refusals; a resume answers `queued`.\n */\n retryRun(runId: string, mode: AgentRunRetryMode): Observable<AgentTriggerReceipt> {\n return this.transport.json<AgentTriggerReceipt>('POST', `runs/${encodeURIComponent(runId)}/retry`, { mode });\n }\n\n /**\n * Pending proposals the caller may decide, sorted by expiry, or with `grouped` by parent and subject,\n * with what is new since the caller's last visit (`visitInbox`). `status` lists the proposals that\n * wait for the application's report (`awaiting-application`) or for an approver to resolve an\n * uncertain execution (`execution-unknown`) instead, with the same visibility.\n */\n getInbox(filter: AgentInboxFilter = {}): Observable<AgentInbox> {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null && value !== '') {\n query.set(key, String(value));\n }\n }\n const suffix = query.toString();\n return this.transport.json<AgentInbox>('GET', suffix ? `approvals/inbox?${suffix}` : 'approvals/inbox');\n }\n\n /**\n * Records that the caller looked at the inbox now, so it marks the proposals made after this visit\n * as new. `divisionId` records the visit of the inbox of one division the caller may work in;\n * otherwise of the whole inbox. Fails with `assistant-subject-not-found` for a division the caller\n * may not work in.\n */\n visitInbox(divisionId?: string | null): Observable<AgentInboxVisit> {\n return this.transport.json<AgentInboxVisit>('POST', withQuery('approvals/inbox/visit', { divisionId }));\n }\n\n /**\n * Decides one proposal, bound to the proposal hash the person saw; the server checks the approval\n * policy and the tool's approve policy again. Accepts an inbox proposal or the approval part of an\n * agent thread.\n */\n decide(\n proposal: Pick<AgentProposal, 'approvalId' | 'proposalHash'>,\n decision: AgentProposalDecision,\n reason?: string\n ): Observable<AgentProposal> {\n return this.transport.json<AgentProposal>('POST', `approvals/${encodeURIComponent(proposal.approvalId)}/decisions`, {\n decision,\n expectedProposalHash: proposal.proposalHash,\n reason: reason?.trim() || null\n });\n }\n\n /** Decides several proposals; each one is checked and decided on its own. */\n decideMany(approvalIds: string[], decision: AgentProposalDecision, reason?: string): Observable<{ results: AgentDecisionOutcome[] }> {\n return this.transport.json<{ results: AgentDecisionOutcome[] }>('POST', 'approvals/decisions', {\n approvalIds,\n decision,\n reason: reason?.trim() || null\n });\n }\n\n /** Resolves an execution whose outcome is unknown. */\n resolve(approvalId: string, action: AgentExecutionResolution, reason?: string): Observable<AgentProposal> {\n return this.transport.json<AgentProposal>('POST', `approvals/${encodeURIComponent(approvalId)}/resolve`, {\n action,\n reason: reason?.trim() || null\n });\n }\n\n /**\n * Gives or changes the caller's feedback on a closed proposal (`canGiveFeedback`). Feedback is\n * optional and separate from the decision; an empty text is sent as `null`. Fails with\n * `assistant-feedback-not-accepted` while the proposal is pending or after it was approved.\n */\n giveFeedback(\n approvalId: string,\n category: AgentProposalFeedbackCategory,\n text?: string | null\n ): Observable<AgentProposalFeedback> {\n return this.transport.json<AgentProposalFeedback>('PUT', `approvals/${encodeURIComponent(approvalId)}/feedback`, {\n category,\n text: text?.trim() || null\n });\n }\n\n /**\n * Gives the same feedback on at most `NH_ASSISTANT_MAX_BULK_FEEDBACK` proposals that were\n * rejected together. Each proposal is checked on its own and stored as bulk feedback.\n */\n giveFeedbackMany(\n approvalIds: readonly string[],\n category: AgentProposalFeedbackCategory,\n text?: string | null\n ): Observable<{ results: AgentFeedbackOutcome[] }> {\n return this.transport.json<{ results: AgentFeedbackOutcome[] }>('POST', 'approvals/feedback', {\n approvalIds,\n category,\n text: text?.trim() || null\n });\n }\n}\n\n/** Appends the filter values that are set as query parameters. */\nfunction withQuery(path: string, filter: object): string {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(filter)) {\n if (value !== undefined && value !== null && value !== '') {\n query.set(key, String(value));\n }\n }\n\n const suffix = query.toString();\n return suffix ? `${path}?${suffix}` : path;\n}\n","import { DestroyRef, EnvironmentInjector, Injectable, PLATFORM_ID, inject, runInInjectionContext, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport type { HubConnection } from '@microsoft/signalr';\nimport { Observable, Subject } from 'rxjs';\nimport {\n LiveAgentWorkChanged,\n LiveAgentWorkWatch,\n LiveConversationChanged,\n LiveConversationEvent,\n LiveConversationRead,\n LiveConversationRemoved\n} from '../models/assistant-live.models';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { nhAssistantRequestHeaders } from './nh-assistant-transport';\n\nexport type NhAssistantLiveState = 'off' | 'connecting' | 'connected' | 'reconnecting' | 'disconnected';\n\nconst reconnectDelaysMs = [0, 2_000, 5_000, 10_000, 30_000];\nconst restartDelayMs = 30_000;\n/** How long a watch of the whole application's agent work lasts when the server does not say. */\nconst defaultWatchRenewalSeconds = 300;\n/** The shortest renewal of a watch, whatever the server says. */\nconst minimumWatchRenewalSeconds = 30;\n/** Query parameters the library and SignalR set themselves. */\nconst reservedHubQueryParameters = new Set(['access_token', 'id', 'negotiateversion']);\n\n/**\n * Live updates of the assistant hub: conversation changes, read positions, removals, the turn\n * events of other sessions and changes to the work of agents that run on their own. Connects only\n * while the store asks for it, reconnects on its own and emits `resync` after every (re)connect,\n * because updates sent while disconnected are lost. The work of agents for the whole application\n * lists no members, so it arrives only while a screen watches it (`watchAgentWork`).\n */\n@Injectable()\nexport class NhAssistantLiveService {\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly injector = inject(EnvironmentInjector);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly changedSubject = new Subject<LiveConversationChanged>();\n private readonly readSubject = new Subject<LiveConversationRead>();\n private readonly removedSubject = new Subject<LiveConversationRemoved>();\n private readonly eventSubject = new Subject<LiveConversationEvent>();\n private readonly agentWorkSubject = new Subject<LiveAgentWorkChanged>();\n private readonly resyncSubject = new Subject<void>();\n private readonly stateSignal = signal<NhAssistantLiveState>('off');\n\n private connection?: HubConnection;\n private hubPath: string | null = null;\n private hubUrl: string | null = null;\n private revision = 0;\n private restartTimer?: ReturnType<typeof setTimeout>;\n /** The screens that watch the work of agents for the whole application. */\n private agentWorkWatchers = 0;\n private watchTimer?: ReturnType<typeof setTimeout>;\n\n readonly changed$: Observable<LiveConversationChanged> = this.changedSubject.asObservable();\n readonly read$: Observable<LiveConversationRead> = this.readSubject.asObservable();\n readonly removed$: Observable<LiveConversationRemoved> = this.removedSubject.asObservable();\n readonly events$: Observable<LiveConversationEvent> = this.eventSubject.asObservable();\n /**\n * A run, proposal or feedback of an agent thread changed. It carries no content; components\n * that show the thread reload it.\n */\n readonly agentWork$: Observable<LiveAgentWorkChanged> = this.agentWorkSubject.asObservable();\n /** Reload snapshots: emitted after every (re)connect. */\n readonly resync$: Observable<void> = this.resyncSubject.asObservable();\n readonly state = this.stateSignal.asReadonly();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.agentWorkWatchers = 0;\n void this.stop();\n this.changedSubject.complete();\n this.readSubject.complete();\n this.removedSubject.complete();\n this.eventSubject.complete();\n this.agentWorkSubject.complete();\n this.resyncSubject.complete();\n });\n }\n\n /**\n * Connects to the hub at `hubPath`, or disconnects when it is `null`. Calling it again with the\n * same path keeps the connection; another path or `restart` reconnects, for example after the\n * signed-in user changed.\n */\n async connect(hubPath: string | null, restart = false): Promise<void> {\n const url = this.browser && this.config.liveUpdates !== false && hubPath ? this.resolveUrl(hubPath) : null;\n if (!restart && url === this.hubUrl && this.connection) {\n return;\n }\n\n await this.stop();\n this.hubPath = url ? hubPath : null;\n this.hubUrl = url;\n if (!url) {\n return;\n }\n\n const revision = ++this.revision;\n this.stateSignal.set('connecting');\n try {\n const connection = await this.build(url);\n if (revision !== this.revision) {\n await connection.stop().catch(() => undefined);\n return;\n }\n this.connection = connection;\n await connection.start();\n if (revision === this.revision) {\n this.stateSignal.set('connected');\n this.resyncSubject.next();\n void this.renewAgentWorkWatch();\n }\n } catch {\n // Live updates are optional; snapshots keep the assistant correct. Try again later.\n if (revision === this.revision) {\n this.stateSignal.set('disconnected');\n this.scheduleRestart(revision);\n }\n }\n }\n\n /**\n * Follows the work of agents for the whole application, such as their proposals and runs, while the\n * returned function has not been called; a screen that shows it, such as the approval inbox or a\n * board, watches it while it is shown. The whole application lists no members, so the hub sends its\n * agents' work only to connections that watch it: it joins the work the server decides the person\n * may read, the agent's view policy included, renews the watch when the server says and after every\n * reconnect, and so checks the person's rights again. The watch ends when the last screen releases\n * it. Without a connection nothing arrives and screens keep their own reload.\n */\n watchAgentWork(): () => void {\n this.agentWorkWatchers++;\n if (this.agentWorkWatchers === 1) {\n void this.renewAgentWorkWatch();\n }\n\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n this.agentWorkWatchers = Math.max(0, this.agentWorkWatchers - 1);\n if (this.agentWorkWatchers === 0) {\n clearTimeout(this.watchTimer);\n const connection = this.connection;\n if (connection && this.stateSignal() === 'connected') {\n connection.invoke('UnwatchAgentWork').catch(() => undefined);\n }\n }\n };\n }\n\n async stop(): Promise<void> {\n this.revision++;\n this.hubUrl = null;\n clearTimeout(this.restartTimer);\n clearTimeout(this.watchTimer);\n const connection = this.connection;\n this.connection = undefined;\n this.stateSignal.set('off');\n if (connection) {\n await connection.stop().catch(() => undefined);\n }\n }\n\n private async build(url: string): Promise<HubConnection> {\n const signalR = await import('@microsoft/signalr');\n const headers = await nhAssistantRequestHeaders(this.config, this.injector);\n const hubUrl = await this.withQueryParameters(url);\n const connection = new signalR.HubConnectionBuilder()\n .withUrl(hubUrl, {\n accessTokenFactory: async () => (await this.token()) ?? '',\n headers\n })\n .withAutomaticReconnect(reconnectDelaysMs)\n .configureLogging(signalR.LogLevel.None)\n .build();\n\n connection.on('ConversationChanged', (message: LiveConversationChanged) => this.changedSubject.next(message));\n connection.on('ConversationRead', (message: LiveConversationRead) => this.readSubject.next(message));\n connection.on('ConversationRemoved', (message: LiveConversationRemoved) => this.removedSubject.next(message));\n connection.on('ConversationEvent', (message: LiveConversationEvent) => this.eventSubject.next(message));\n connection.on('AgentWorkChanged', (message: LiveAgentWorkChanged) => this.agentWorkSubject.next(message));\n connection.onreconnecting(() => this.stateSignal.set('reconnecting'));\n connection.onreconnected(() => {\n this.stateSignal.set('connected');\n this.resyncSubject.next();\n // A new connection belongs to no watch yet.\n void this.renewAgentWorkWatch();\n });\n connection.onclose(() => {\n if (this.connection === connection) {\n this.connection = undefined;\n this.stateSignal.set('disconnected');\n this.scheduleRestart(this.revision);\n }\n });\n return connection;\n }\n\n /**\n * Asks the hub to watch the work of agents for the whole application for the screens that watch it,\n * and schedules the renewal the server asks for. An older server without watching, or a failed call,\n * is tried again later; live updates stay optional.\n */\n private async renewAgentWorkWatch(): Promise<void> {\n clearTimeout(this.watchTimer);\n const connection = this.connection;\n if (this.agentWorkWatchers === 0 || !connection || this.stateSignal() !== 'connected') {\n return;\n }\n\n let seconds = defaultWatchRenewalSeconds;\n try {\n const watch = await connection.invoke<LiveAgentWorkWatch | null>('WatchAgentWork');\n if (typeof watch?.refreshAfterSeconds === 'number' && Number.isFinite(watch.refreshAfterSeconds)) {\n seconds = Math.max(minimumWatchRenewalSeconds, watch.refreshAfterSeconds);\n }\n } catch {\n // Tried again at the next renewal or reconnect.\n }\n\n if (connection === this.connection && this.agentWorkWatchers > 0) {\n clearTimeout(this.watchTimer);\n this.watchTimer = setTimeout(() => void this.renewAgentWorkWatch(), seconds * 1_000);\n }\n }\n\n /** Starts over after the automatic reconnect gave up or the first start failed. */\n private scheduleRestart(revision: number): void {\n clearTimeout(this.restartTimer);\n this.restartTimer = setTimeout(() => {\n if (revision === this.revision && this.hubPath) {\n void this.connect(this.hubPath, true);\n }\n }, restartDelayMs);\n }\n\n private async token(): Promise<string | null> {\n try {\n return await runInInjectionContext(this.injector, () => this.config.getAccessToken());\n } catch {\n return null;\n }\n }\n\n /**\n * The hub URL with the host's `getHubQueryParameters`, which reach the hub on every transport,\n * unlike headers on WebSockets and server-sent events.\n */\n private async withQueryParameters(url: string): Promise<string> {\n const getter = this.config.getHubQueryParameters;\n if (!getter) {\n return url;\n }\n\n let parameters: Record<string, string> | null;\n try {\n parameters = await runInInjectionContext(this.injector, () => getter());\n } catch {\n return url;\n }\n\n const target = new URL(url);\n for (const [name, value] of Object.entries(parameters ?? {})) {\n if (typeof value === 'string' && value.length > 0 && !reservedHubQueryParameters.has(name.toLowerCase())) {\n target.searchParams.set(name, value);\n }\n }\n return target.toString();\n }\n\n /** `hubBaseUrl` + `hubPath`, or the hub path on the origin of `apiBaseUrl`. */\n private resolveUrl(hubPath: string): string {\n const page = globalThis.location?.href ?? 'http://localhost';\n if (this.config.hubBaseUrl) {\n const base = new URL(this.config.hubBaseUrl, page).toString().replace(/\\/+$/, '');\n return `${base}/${hubPath.replace(/^\\/+/, '')}`;\n }\n return new URL(hubPath, new URL(this.config.apiBaseUrl, page).origin).toString();\n }\n}\n","import { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantError } from '../services/nh-assistant.store';\nimport { NhAssistantApiError, nhAssistantErrorMessageKey } from '../services/nh-assistant-transport';\n\n/** The text every error falls back to when neither its key nor its code has one. */\nconst genericErrorKey = 'nh-assistant.errors.generic';\n\n/** Converts any failure into a user-facing code and translation key, never raw text. */\nexport function toNhAssistantError(error: unknown): NhAssistantError {\n if (error instanceof NhAssistantApiError) {\n return Object.keys(error.fieldErrors).length > 0\n ? { code: error.code, messageKey: error.messageKey, fieldErrors: error.fieldErrors }\n : { code: error.code, messageKey: error.messageKey };\n }\n\n return nhAssistantErrorOf(NhAssistantClientErrorCodes.server);\n}\n\n/** The error of a code without a message key of its own, such as a code a callback page reported. */\nexport function nhAssistantErrorOf(code: string): NhAssistantError {\n return { code, messageKey: nhAssistantErrorMessageKey(code) };\n}\n\n/** Translation keys for an error, from the most to the least specific. */\nexport function nhAssistantErrorKeys(error: NhAssistantError | null): string[] {\n return error ? [error.messageKey, nhAssistantErrorMessageKey(error.code), genericErrorKey] : [];\n}\n\n/**\n * Translation keys for a bare failure code, such as a run's `failureCode`: the registered text of\n * the code, then the generic text. Empty without a code.\n */\nexport function nhAssistantCodeKeys(code: string | null | undefined): string[] {\n return code ? [nhAssistantErrorMessageKey(code), genericErrorKey] : [];\n}\n\n/** Dash-case identifiers as the contract requires for agent and MCP server ids. */\nexport const NH_ASSISTANT_DASH_CASE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n","import { DOCUMENT } from '@angular/common';\nimport { InjectionToken, inject } from '@angular/core';\nimport { Observable, catchError, switchMap, throwError } from 'rxjs';\nimport { McpAuthorizationStart, McpCompleteRequest, McpCompletion } from '../models/assistant-admin.models';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantApiError, nhAssistantErrorMessageKey, nhAssistantIsSafeCode } from './nh-assistant-transport';\n\n/** The `type` of the message the assistant's OAuth callback page posts to its opener. */\nexport const NH_ASSISTANT_MCP_AUTHORIZATION_MESSAGE = 'nh-assistant-mcp-authorization';\n\n/**\n * What an authorization window reports: the flow and its one-time completion code, which\n * `POST mcp-connections/complete` turns into the connection with the caller's own session, or the\n * failure code of the callback (for example `assistant-mcp-authorization-failed`).\n */\nexport type NhAssistantMcpAuthorizationOutcome =\n | { flowId: string; completionCode: string; code?: undefined }\n | { flowId: string | null; code: string; completionCode?: undefined };\n\n/** A window opened for one authorization. */\nexport interface NhAssistantMcpAuthorizationHandle {\n /** Shows the authorization and emits its outcome once, then completes. */\n authorize(start: McpAuthorizationStart): Observable<NhAssistantMcpAuthorizationOutcome>;\n /** Closes the window, for example when starting the authorization failed. */\n close(): void;\n}\n\n/**\n * Opens MCP authorizations in the person's browser. `open()` runs in the click handler, before the\n * authorization URL is known, so popup blockers allow the window.\n */\nexport interface NhAssistantMcpAuthorizationWindow {\n open(): NhAssistantMcpAuthorizationHandle;\n}\n\n/**\n * The authorization window of the assistant components. The default opens a popup and waits for the\n * callback page's message; the testing package replaces it for the mock back-end.\n */\nexport const NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW = new InjectionToken<NhAssistantMcpAuthorizationWindow>(\n 'NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW',\n { providedIn: 'root', factory: () => new NhAssistantMcpPopupAuthorizationWindow(inject(DOCUMENT)) }\n);\n\nconst safeToken = /^[A-Za-z0-9_-]{16,128}$/;\n/** The code of a callback whose own code cannot be shown. */\nconst authorizationFailed = 'assistant-mcp-authorization-failed';\nconst flowPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * Opens the authorization in a popup. Only a message from that popup, sent by the assistant's\n * callback page (`callbackOrigin`), with the started flow is accepted; the completion code is useless\n * without the starter's own session. A closed popup\n * without a message reports `assistant-mcp-authorization-cancelled`, a blocked one\n * `assistant-mcp-popup-blocked`.\n */\nexport class NhAssistantMcpPopupAuthorizationWindow implements NhAssistantMcpAuthorizationWindow {\n constructor(private readonly document: Document) {}\n\n open(): NhAssistantMcpAuthorizationHandle {\n const view = this.document.defaultView;\n // The callback page needs window.opener, so the popup cannot be opened with noopener.\n const popup = view?.open('about:blank', '_blank', 'popup=yes,width=560,height=720') ?? null;\n return new PopupHandle(view, popup);\n }\n}\n\nclass PopupHandle implements NhAssistantMcpAuthorizationHandle {\n constructor(\n private readonly view: Window | null,\n private readonly popup: Window | null\n ) {}\n\n authorize(start: McpAuthorizationStart): Observable<NhAssistantMcpAuthorizationOutcome> {\n return new Observable<NhAssistantMcpAuthorizationOutcome>(subscriber => {\n const view = this.view;\n const popup = this.popup;\n if (!view || !popup || popup.closed) {\n subscriber.next({ flowId: start.flowId, code: NhAssistantClientErrorCodes.mcpPopupBlocked });\n subscriber.complete();\n return undefined;\n }\n\n let finished = false;\n const finish = (outcome: NhAssistantMcpAuthorizationOutcome): void => {\n if (finished) {\n return;\n }\n finished = true;\n subscriber.next(outcome);\n subscriber.complete();\n };\n const onMessage = (event: MessageEvent): void => {\n if (event.source !== popup || event.origin !== start.callbackOrigin) {\n return;\n }\n const outcome = readMessage(event.data, start.flowId);\n if (outcome) {\n finish(outcome);\n }\n };\n view.addEventListener('message', onMessage);\n const closedCheck = view.setInterval(() => {\n if (popup.closed) {\n // The message is dispatched before the page closes itself; a later check finds nothing.\n finish({ flowId: start.flowId, code: NhAssistantClientErrorCodes.mcpAuthorizationCancelled });\n }\n }, 500);\n popup.location.replace(start.authorizationUrl);\n\n return () => {\n view.removeEventListener('message', onMessage);\n view.clearInterval(closedCheck);\n };\n });\n }\n\n close(): void {\n if (this.popup && !this.popup.closed) {\n this.popup.close();\n }\n }\n}\n\n/**\n * The outcome in a callback message for the started flow, or null for any other message. The message\n * is `{ type, flowId, completionCode, code, messageKey }`; the text of a failure comes from its code,\n * so the message key the page sends along is not needed.\n */\nfunction readMessage(data: unknown, flowId: string): NhAssistantMcpAuthorizationOutcome | null {\n if (!data || typeof data !== 'object') {\n return null;\n }\n const message = data as Record<string, unknown>;\n if (message['type'] !== NH_ASSISTANT_MCP_AUTHORIZATION_MESSAGE) {\n return null;\n }\n const messageFlow = message['flowId'];\n if (messageFlow !== null && messageFlow !== flowId) {\n return null;\n }\n const completionCode = message['completionCode'];\n if (messageFlow === flowId && typeof completionCode === 'string' && safeToken.test(completionCode)) {\n return { flowId, completionCode };\n }\n const code = message['code'];\n return { flowId, code: nhAssistantIsSafeCode(code) ? code : authorizationFailed };\n}\n\n/**\n * Reads the outcome of a redirect-mode authorization from a URL fragment\n * (`#nh-mcp-flow=…&nh-mcp-code=…` or `#nh-mcp-error=…&nh-mcp-message-key=…`); null when the fragment\n * has none. The text of a failure comes from its code. Remove the fragment from the address bar after\n * reading it.\n */\nexport function nhAssistantMcpAuthorizationFromFragment(fragment: string): NhAssistantMcpAuthorizationOutcome | null {\n const values = new URLSearchParams(fragment.startsWith('#') ? fragment.slice(1) : fragment);\n const flowId = values.get('nh-mcp-flow');\n const completionCode = values.get('nh-mcp-code');\n const error = values.get('nh-mcp-error');\n if (flowId && flowPattern.test(flowId) && completionCode && safeToken.test(completionCode)) {\n return { flowId, completionCode };\n }\n if (error) {\n return { flowId: flowId && flowPattern.test(flowId) ? flowId : null, code: nhAssistantIsSafeCode(error) ? error : authorizationFailed };\n }\n return null;\n}\n\n/**\n * Runs one authorization: starts it, shows it in the window opened before, and completes it with\n * the caller's own session. Errors with `NhAssistantApiError`, also for the window's failure codes.\n */\nexport function nhAssistantConnectMcp(\n handle: NhAssistantMcpAuthorizationHandle,\n start: Observable<McpAuthorizationStart>,\n complete: (request: McpCompleteRequest) => Observable<McpCompletion>\n): Observable<McpCompletion> {\n return start.pipe(\n catchError((error: unknown) => {\n handle.close();\n return throwError(() => error);\n }),\n switchMap(started => handle.authorize(started)),\n switchMap(outcome => outcome.completionCode !== undefined\n ? complete({ flowId: outcome.flowId, completionCode: outcome.completionCode })\n : throwError(() => new NhAssistantApiError(0, outcome.code, nhAssistantErrorMessageKey(outcome.code)))));\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { NEVER, Observable, catchError, map, of, switchMap } from 'rxjs';\nimport { toNhAssistantError } from '../internal/nh-assistant-errors';\nimport { McpAuthorizationStart, McpAuthorizeRequest, McpCompletion } from '../models/assistant-admin.models';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { NhAssistantApiService } from './nh-assistant-api.service';\nimport {\n NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW,\n nhAssistantConnectMcp,\n nhAssistantMcpAuthorizationFromFragment\n} from './nh-assistant-mcp-authorization';\n\n/**\n * The outcome of an authorization the page returned from in redirect mode: the activated connection,\n * or the failure code to show. `serverId` names the server whose connection the page left for, when\n * this browser tab remembered it, so a screen shows the outcome at that server only.\n */\nexport type NhAssistantMcpReturnOutcome =\n | { completion: McpCompletion; code?: undefined; serverId?: string | null }\n | { code: string; completion?: undefined; serverId?: string | null };\n\n/** Where this tab remembers the server whose connection it left for, until it returns. */\nconst leftForKey = 'nh-assistant.mcp-connect.server';\n\n/**\n * Connects MCP accounts the way the host configured (`mcpConnectMode`): in a popup that the click\n * opens, or by sending the page to the authorization server and back. Every authorization completes\n * with the caller's own session.\n */\n@Injectable()\nexport class NhAssistantMcpConnectService {\n private readonly api = inject(NhAssistantApiService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly authorizationWindow = inject(NH_ASSISTANT_MCP_AUTHORIZATION_WINDOW);\n private readonly document = inject(DOCUMENT);\n\n /**\n * The outcome of the redirect-mode authorization this page opened with, until a screen showed it.\n * `nh-assistant-connection-required` shows the outcome of its server without taking it; the\n * connection lists of the preferences and the administration show it and take it.\n */\n readonly returned = signal<NhAssistantMcpReturnOutcome | null>(null);\n\n /** Whether authorizations leave the page instead of opening a popup. */\n get redirects(): boolean {\n return this.config.mcpConnectMode === 'redirect';\n }\n\n /**\n * Connects the caller's own account to a server each person connects to. Call it in the click\n * handler, so the popup is allowed. In redirect mode the page leaves and the observable never\n * emits; the page completes the authorization when it returns.\n */\n connect(serverId: string, options: { allowBackgroundUse?: boolean } = {}): Observable<McpCompletion> {\n return this.run(\n request => this.api.authorizeMcpConnection(serverId, { ...request, allowBackgroundUse: options.allowBackgroundUse ?? null }),\n serverId);\n }\n\n /**\n * Runs any authorization start, for example an administrator's organization connection, in the\n * configured mode. `serverId` lets the page show the outcome at that server after a redirect.\n */\n run(start: (request: McpAuthorizeRequest) => Observable<McpAuthorizationStart>, serverId?: string): Observable<McpCompletion> {\n if (!this.redirects) {\n return nhAssistantConnectMcp(this.authorizationWindow.open(), start({}), request => this.api.completeMcpAuthorization(request));\n }\n\n const returnUrl = this.config.mcpConnectReturnUrl?.() ?? withoutFragment(this.document.location.href);\n return start({ returnUrl }).pipe(switchMap(started => {\n this.rememberLeftFor(serverId ?? null);\n this.navigate(started.authorizationUrl);\n return NEVER;\n }));\n }\n\n /** Leaves the page for an authorization in redirect mode. */\n navigate(url: string): void {\n this.document.location.assign(url);\n }\n\n /**\n * Completes a redirect-mode authorization when the page opened with its fragment, removes the\n * fragment from the address and records the outcome in `returned`: the connection, or the code of\n * whatever failed, also when completing it failed. Emits null without a fragment and never errors.\n */\n completeReturn(): Observable<NhAssistantMcpReturnOutcome | null> {\n const outcome = nhAssistantMcpAuthorizationFromFragment(this.document.location.hash);\n if (!outcome) {\n return of(null);\n }\n\n // The fragment carries a one-time code; it leaves the address before anything else happens.\n this.removeFragment();\n const serverId = this.takeLeftFor();\n\n if (outcome.completionCode === undefined) {\n return of(this.record({ code: outcome.code, serverId }));\n }\n\n const request = { flowId: outcome.flowId, completionCode: outcome.completionCode };\n return this.api.completeMcpAuthorization(request).pipe(\n map(completion => this.record({ completion, serverId: completion.serverId })),\n catchError((error: unknown) => of(this.record({ code: toNhAssistantError(error).code, serverId }))));\n }\n\n private record(outcome: NhAssistantMcpReturnOutcome): NhAssistantMcpReturnOutcome {\n this.returned.set(outcome);\n return outcome;\n }\n\n private removeFragment(): void {\n const view = this.document.defaultView;\n try {\n view?.history.replaceState(view.history.state, '', withoutFragment(this.document.location.href));\n } catch {\n // A page that may not change its history keeps the fragment; the code inside works only once.\n }\n }\n\n /** Remembers in this tab which server's connection the page leaves for. */\n private rememberLeftFor(serverId: string | null): void {\n try {\n const storage = this.document.defaultView?.sessionStorage;\n if (serverId) {\n storage?.setItem(leftForKey, serverId);\n } else {\n storage?.removeItem(leftForKey);\n }\n } catch {\n // Without session storage the outcome shows in the connection lists only.\n }\n }\n\n /** The server this tab left for, forgotten once read. */\n private takeLeftFor(): string | null {\n try {\n const storage = this.document.defaultView?.sessionStorage;\n const serverId = storage?.getItem(leftForKey) ?? null;\n storage?.removeItem(leftForKey);\n return serverId;\n } catch {\n return null;\n }\n }\n}\n\nfunction withoutFragment(url: string): string {\n const index = url.indexOf('#');\n return index < 0 ? url : url.slice(0, index);\n}\n","import { DestroyRef, Injectable, PLATFORM_ID, computed, inject, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { TranslateService } from '@ngx-translate/core';\nimport { Observable, Subject, firstValueFrom } from 'rxjs';\nimport { NotificationSettings } from '../models/assistant-api.models';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { NhAssistantApiService } from './nh-assistant-api.service';\n\n/**\n * Push state of this browser for the signed-in user:\n * - `unavailable`: the server, the browser or the host configuration does not support Web Push;\n * - `off`: the user turned notifications off;\n * - `prompt`: on, but the browser has not asked for permission yet (it asks on the next message sent);\n * - `blocked`: on, but the browser denied permission;\n * - `on`: this browser receives notifications.\n */\nexport type NhAssistantPushState = 'unavailable' | 'off' | 'prompt' | 'blocked' | 'on';\n\nconst openConversationMessage = 'nh-assistant.open-conversation';\n\n/**\n * Keeps this browser's Web Push subscription in line with the user's choice. Notifications are on\n * by default; because browsers only ask for permission after a user action, the assistant asks\n * when the user sends a message or turns notifications on. The bundled service worker shows a\n * notification only when no window of the application is focused.\n */\n@Injectable()\nexport class NhAssistantPushService {\n private readonly api = inject(NhAssistantApiService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly settingsState = signal<NotificationSettings | null>(null);\n private readonly permissionState = signal<NotificationPermission | 'unsupported'>('default');\n private readonly subscribedState = signal(false);\n private readonly busyState = signal(false);\n private readonly openSubject = new Subject<string>();\n private readonly openRunSubject = new Subject<string>();\n private registration?: Promise<ServiceWorkerRegistration>;\n private revision = 0;\n private readonly onWorkerMessage = (event: MessageEvent) => {\n const data = event.data as { type?: unknown; conversationId?: unknown; runId?: unknown } | null;\n if (data?.type === openConversationMessage && typeof data.conversationId === 'string') {\n this.openNotification(data.conversationId, typeof data.runId === 'string' ? data.runId : undefined);\n }\n };\n\n /** The caller's server-side choice, or `null` before it was loaded. */\n readonly settings = this.settingsState.asReadonly();\n readonly busy = this.busyState.asReadonly();\n /**\n * Conversations a clicked notification asks to open; the assistant panel opens them. A\n * notification about the proposals of a run goes to `openRun$` instead while the application\n * subscribes to it.\n */\n readonly openConversation$: Observable<string> = this.openSubject.asObservable();\n /**\n * Runs whose proposals a clicked notification is about, for the application to open its inbox of\n * the run, for example `nh-assistant-agent-inbox` with `[runId]`, which lists every proposal of the\n * run the person may decide. While the application subscribes, such a click emits the run here\n * instead of opening the conversation in the panel; without a subscriber it opens the conversation\n * as before. Subscribe in the application shell, so a notification that opens a new window finds\n * the subscription.\n */\n readonly openRun$: Observable<string> = this.openRunSubject.asObservable();\n readonly state = computed<NhAssistantPushState>(() => {\n const settings = this.settingsState();\n if (!settings?.pushAvailable || !this.isSupported()) {\n return 'unavailable';\n }\n if (!settings.pushEnabled) {\n return 'off';\n }\n const permission = this.permissionState();\n if (permission === 'denied' || permission === 'unsupported') {\n return 'blocked';\n }\n return permission === 'granted' && this.subscribedState() ? 'on' : 'prompt';\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n if (this.browser && this.isSupported()) {\n navigator.serviceWorker.removeEventListener('message', this.onWorkerMessage);\n }\n this.openSubject.complete();\n this.openRunSubject.complete();\n });\n if (this.browser && this.isSupported()) {\n navigator.serviceWorker.addEventListener('message', this.onWorkerMessage);\n navigator.serviceWorker.startMessages();\n }\n }\n\n /**\n * Opens what a clicked notification is about: the run through `openRun$` when the notification\n * names one and the application subscribes, otherwise the conversation through\n * `openConversation$`. The bundled worker and the panel's notification fragments call it.\n */\n openNotification(conversationId: string, runId?: string): void {\n if (runId && this.openRunSubject.observed) {\n this.openRunSubject.next(runId);\n return;\n }\n\n this.openSubject.next(conversationId);\n }\n\n /**\n * Loads the user's choice and, when permission was granted before, renews this browser's\n * subscription, which also moves it to the current user and to a rotated server key.\n */\n async activate(serverSupportsPush: boolean): Promise<void> {\n const revision = ++this.revision;\n if (!serverSupportsPush || !this.isSupported()) {\n this.settingsState.set(null);\n return;\n }\n\n try {\n const settings = await firstValueFrom(this.api.getNotificationSettings());\n if (revision !== this.revision) {\n return;\n }\n this.settingsState.set(settings);\n this.permissionState.set(Notification.permission);\n if (settings.pushEnabled && Notification.permission === 'granted') {\n await this.subscribe(settings);\n }\n } catch {\n // Notifications are optional; the assistant works without them.\n if (revision === this.revision) {\n this.settingsState.set(null);\n }\n }\n }\n\n /**\n * Forgets the user. The browser subscription is cancelled, so a previous user on a shared device\n * stops receiving notifications even when the server cannot be told.\n */\n async deactivate(): Promise<void> {\n this.revision++;\n this.settingsState.set(null);\n this.subscribedState.set(false);\n if (!this.isSupported()) {\n return;\n }\n try {\n const registration = await navigator.serviceWorker.getRegistration(this.scope());\n const subscription = await registration?.pushManager.getSubscription();\n await subscription?.unsubscribe();\n } catch {\n // Nothing to cancel.\n }\n }\n\n /** Asks for permission once, after a user action such as sending a message. */\n async onUserGesture(): Promise<void> {\n const settings = this.settingsState();\n if (!settings?.pushEnabled || !settings.pushAvailable || !this.isSupported() || Notification.permission !== 'default') {\n return;\n }\n const permission = await Notification.requestPermission();\n this.permissionState.set(permission);\n if (permission === 'granted') {\n await this.subscribe(settings);\n }\n }\n\n /** Turns notifications on or off for every browser of the user. Call it from a user action. */\n async setEnabled(enabled: boolean): Promise<void> {\n this.busyState.set(true);\n try {\n const settings = await firstValueFrom(this.api.updateNotificationSettings(enabled));\n this.settingsState.set(settings);\n if (!this.isSupported()) {\n return;\n }\n if (enabled) {\n if (Notification.permission === 'default') {\n this.permissionState.set(await Notification.requestPermission());\n }\n if (Notification.permission === 'granted') {\n await this.subscribe(settings);\n }\n return;\n }\n await this.unsubscribe();\n } finally {\n this.busyState.set(false);\n }\n }\n\n private async subscribe(settings: NotificationSettings): Promise<void> {\n if (!settings.publicKey) {\n return;\n }\n const revision = this.revision;\n const registration = await this.register();\n const key = decodeBase64Url(settings.publicKey);\n let subscription = await registration.pushManager.getSubscription();\n if (subscription && !sameKey(subscription.options.applicationServerKey, key)) {\n // The server rotated its key; a subscription for the old key would be refused.\n await subscription.unsubscribe();\n subscription = null;\n }\n subscription ??= await registration.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: key });\n const json = subscription.toJSON();\n if (!json.endpoint || !json.keys?.['p256dh'] || !json.keys['auth'] || revision !== this.revision) {\n return;\n }\n await firstValueFrom(this.api.subscribePush({\n endpoint: json.endpoint,\n keys: { p256dh: json.keys['p256dh'], auth: json.keys['auth'] },\n language: this.translate?.getCurrentLang() ?? navigator.language\n }), { defaultValue: undefined });\n if (revision === this.revision) {\n this.subscribedState.set(true);\n }\n }\n\n private async unsubscribe(): Promise<void> {\n this.subscribedState.set(false);\n const registration = await navigator.serviceWorker.getRegistration(this.scope());\n const subscription = await registration?.pushManager.getSubscription();\n if (!subscription) {\n return;\n }\n await firstValueFrom(this.api.unsubscribePush(subscription.endpoint), { defaultValue: undefined }).catch(() => undefined);\n await subscription.unsubscribe();\n }\n\n private register(): Promise<ServiceWorkerRegistration> {\n const push = this.config.push!;\n this.registration ??= (async () => {\n const url = new URL(push.serviceWorkerUrl, location.href);\n url.searchParams.set('app', new URL(push.openUrl ?? '/', location.href).href);\n if (push.icon) {\n url.searchParams.set('icon', new URL(push.icon, location.href).href);\n }\n return navigator.serviceWorker.register(url.href, { scope: this.scope() });\n })();\n return this.registration;\n }\n\n private scope(): string {\n const push = this.config.push;\n if (!push) {\n return '/';\n }\n return push.scope ?? new URL('./', new URL(push.serviceWorkerUrl, location.href)).pathname;\n }\n\n private isSupported(): boolean {\n return this.browser\n && !!this.config.push?.serviceWorkerUrl\n && globalThis.isSecureContext === true\n && 'serviceWorker' in navigator\n && 'PushManager' in globalThis\n && 'Notification' in globalThis;\n }\n}\n\nfunction decodeBase64Url(value: string): Uint8Array<ArrayBuffer> {\n const base64 = value.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(value.length / 4) * 4, '=');\n const binary = atob(base64);\n const bytes = new Uint8Array(new ArrayBuffer(binary.length));\n for (let index = 0; index < binary.length; index++) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytes;\n}\n\nfunction sameKey(current: ArrayBuffer | null, expected: Uint8Array): boolean {\n if (!current) {\n return false;\n }\n const bytes = new Uint8Array(current);\n return bytes.length === expected.length && bytes.every((byte, index) => byte === expected[index]);\n}\n","import { AgentUploadExtension, AgentUploads } from '../models/assistant-api.models';\n\n/** The longest file name a file reference takes. */\nexport const NH_ASSISTANT_MAX_FILE_NAME_LENGTH = 256;\n\nconst unknownMediaType = 'application/octet-stream';\n\nconst zipAliases = ['application/zip', 'application/x-zip-compressed'];\n\n/**\n * The media types the platform names, with the extensions a file picker offers and a short label.\n * The extensions are the same as the server's table of upload media types.\n */\nconst knownTypes: Record<string, { extensions: string[]; label: string }> = {\n 'application/pdf': { extensions: ['.pdf'], label: 'PDF' },\n 'image/png': { extensions: ['.png'], label: 'PNG' },\n 'image/jpeg': { extensions: ['.jpg', '.jpeg'], label: 'JPEG' },\n 'image/gif': { extensions: ['.gif'], label: 'GIF' },\n 'image/webp': { extensions: ['.webp'], label: 'WebP' },\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': { extensions: ['.docx'], label: 'Word' },\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': { extensions: ['.xlsx'], label: 'Excel' },\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation': { extensions: ['.pptx'], label: 'PowerPoint' },\n 'application/msword': { extensions: ['.doc'], label: 'Word' },\n 'application/vnd.ms-excel': { extensions: ['.xls'], label: 'Excel' },\n 'text/csv': { extensions: ['.csv'], label: 'CSV' },\n 'text/tab-separated-values': { extensions: ['.tsv'], label: 'TSV' },\n 'text/plain': { extensions: ['.txt'], label: 'Text' },\n 'text/markdown': { extensions: ['.md', '.markdown'], label: 'Markdown' },\n 'application/json': { extensions: ['.json'], label: 'JSON' },\n 'application/xml': { extensions: ['.xml'], label: 'XML' }\n};\n\n/** Types that say nothing about the content, whatever the file's extension. */\nconst genericTypes = new Set([unknownMediaType, 'binary/octet-stream', 'application/unknown']);\n\n/**\n * The types browsers commonly give a file of an extension instead of its own type: the program\n * that opens it, as Windows does with `application/vnd.ms-excel` for `.csv`, an outdated name or\n * the container format.\n */\nconst aliasesByExtension: Record<string, string[]> = {\n '.csv': [\n 'application/vnd.ms-excel',\n 'application/csv',\n 'application/x-csv',\n 'text/x-csv',\n 'text/comma-separated-values',\n 'text/x-comma-separated-values'\n ],\n '.md': ['text/x-markdown'],\n '.markdown': ['text/x-markdown'],\n '.jpg': ['image/jpg', 'image/pjpeg'],\n '.jpeg': ['image/jpg', 'image/pjpeg'],\n '.png': ['image/x-png'],\n '.docx': zipAliases,\n '.xlsx': zipAliases,\n '.pptx': zipAliases,\n // Browsers send the older name of XML; an application that accepts only it keeps receiving it.\n '.xml': ['text/xml']\n};\n\n/** The extension of a file name in lowercase, such as `.csv`; empty without one. */\nfunction extensionOf(name: string): string {\n const base = name.slice(Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\\\')) + 1);\n const dot = base.lastIndexOf('.');\n return dot > 0 || (dot === 0 && base.length > 1) ? base.slice(dot).toLowerCase() : '';\n}\n\n/** The application's extensions (`AgentUploads.mappedExtensions`) whose type is accepted, lowercase. */\nfunction acceptedMappings(\n acceptedMediaTypes: readonly string[],\n mappedExtensions: readonly AgentUploadExtension[] | null | undefined\n): AgentUploadExtension[] {\n return (mappedExtensions ?? [])\n .map(mapping => ({ extension: mapping.extension.toLowerCase(), mediaType: mapping.mediaType.toLowerCase() }))\n .filter(mapping => acceptedMediaTypes.includes(mapping.mediaType));\n}\n\n/** The platform's media type of an extension, or `null`. */\nfunction knownMediaTypeOf(extension: string): string | null {\n for (const [mediaType, known] of Object.entries(knownTypes)) {\n if (known.extensions.includes(extension)) {\n return mediaType;\n }\n }\n\n return null;\n}\n\n/**\n * The accepted type an extension names: the application's mapping, otherwise the platform's table;\n * `null` when neither names an accepted type.\n */\nfunction mediaTypeOfExtension(extension: string, acceptedMediaTypes: readonly string[], mappings: readonly AgentUploadExtension[]): string | null {\n if (extension.length === 0) {\n return null;\n }\n const mapped = mappings.find(mapping => mapping.extension === extension);\n if (mapped) {\n return mapped.mediaType;\n }\n\n const known = knownMediaTypeOf(extension);\n return known && acceptedMediaTypes.includes(known) ? known : null;\n}\n\n/**\n * The media type a chosen file uploads as, lowercase and without parameters, by the same rule as the\n * server. A browser gives no type, or a generic one, for a file its system does not know, and some\n * systems name an extension after the program that opens it, such as `application/vnd.ms-excel` for\n * a `.csv` file; the file name's extension then names the type, but only a type of\n * `acceptedMediaTypes`: the type the application mapped the extension to (`mappedExtensions`),\n * otherwise the platform's. A specific type stays as it is, so a type that is not accepted is refused\n * whatever the extension. Without a type and an accepted extension, `application/octet-stream`.\n */\nexport function nhAssistantMediaTypeOf(\n file: Pick<File, 'name' | 'type'>,\n acceptedMediaTypes: readonly string[],\n mappedExtensions?: readonly AgentUploadExtension[] | null\n): string {\n const declared = file.type.split(';')[0].trim().toLowerCase();\n const extension = extensionOf(file.name);\n if (declared.length === 0 || genericTypes.has(declared) || (aliasesByExtension[extension] ?? []).includes(declared)) {\n const derived = mediaTypeOfExtension(extension, acceptedMediaTypes, acceptedMappings(acceptedMediaTypes, mappedExtensions));\n if (derived) {\n return derived;\n }\n }\n\n return declared.length > 0 ? declared : unknownMediaType;\n}\n\n/**\n * The failure code of a file before it is uploaded, or `null` when it may be: the most files of one\n * message, an accepted media type, content and a usable name, and the largest size. `attached` counts\n * the files the message already carries.\n */\nexport function nhAssistantFileProblem(\n file: Pick<File, 'name' | 'size'>,\n mediaType: string,\n uploads: AgentUploads,\n attached: number\n): string | null {\n if (attached >= uploads.maxFiles) {\n return 'assistant-file-count-limit';\n }\n if (!uploads.acceptedMediaTypes.includes(mediaType)) {\n return 'assistant-file-type-not-accepted';\n }\n if (file.size === 0 || file.name.trim().length === 0 || file.name.length > NH_ASSISTANT_MAX_FILE_NAME_LENGTH) {\n return 'assistant-file-upload-invalid';\n }\n if (file.size > uploads.maxFileBytes) {\n return 'assistant-file-too-large';\n }\n\n return null;\n}\n\n/**\n * The `accept` attribute of a file input for these accepted media types: each type and the extensions\n * that name it, those the application mapped to it (`mappedExtensions`) and those of the platform's\n * table that the application did not map to another accepted type.\n */\nexport function nhAssistantAcceptAttribute(\n mediaTypes: readonly string[],\n mappedExtensions?: readonly AgentUploadExtension[] | null\n): string {\n const mappings = acceptedMappings(mediaTypes, mappedExtensions);\n const values = mediaTypes.flatMap(mediaType => [\n mediaType,\n ...mappings.filter(mapping => mapping.mediaType === mediaType).map(mapping => mapping.extension),\n ...(knownTypes[mediaType]?.extensions ?? []).filter(extension => !mappings.some(mapping => mapping.extension === extension))\n ]);\n return [...new Set(values)].join(',');\n}\n\n/** A short name of a media type, such as `PDF` or `Word`; otherwise its subtype in capitals. */\nexport function nhAssistantFileTypeLabel(mediaType: string): string {\n const known = knownTypes[mediaType];\n if (known) {\n return known.label;\n }\n\n const subtype = mediaType.split('/')[1] ?? mediaType;\n return subtype.split(/[.+]/).pop()!.toUpperCase();\n}\n\n/** A size in bytes as people read it, such as `820 KB` or `1.4 MB`, in the given language. */\nexport function nhAssistantFormatFileSize(bytes: number, language?: string | null): string {\n const units = ['B', 'KB', 'MB', 'GB'];\n let value = Math.max(0, bytes);\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) {\n value /= 1024;\n unit++;\n }\n\n let format: Intl.NumberFormat;\n try {\n format = new Intl.NumberFormat(language || undefined, { maximumFractionDigits: unit === 0 || value >= 10 ? 0 : 1 });\n } catch {\n format = new Intl.NumberFormat(undefined, { maximumFractionDigits: unit === 0 || value >= 10 ? 0 : 1 });\n }\n return `${format.format(value)} ${units[unit]}`;\n}\n","import {\n ApprovalDecision,\n ApprovalPart,\n Conversation,\n ConversationStatus,\n Message,\n MessagePart,\n QuestionPart,\n ToolCallPart\n} from '../models/assistant-api.models';\nimport { LiveConversationChanged, LiveConversationEvent } from '../models/assistant-live.models';\nimport { NH_ASSISTANT_SSE_EVENT_TYPES, NhAssistantSseEvent, TurnCompletionStatus } from '../models/assistant-sse.models';\n\n/**\n * Applies one assistant event to a conversation and returns the new conversation.\n * The input is never mutated, so the result can be stored in a signal directly.\n *\n * @param clientMessageId id of the optimistic user message of the current turn; its id is\n * replaced by the server's `userMessageId` when `turn.started` arrives.\n */\nexport function applyNhAssistantEvent(\n conversation: Conversation,\n event: NhAssistantSseEvent,\n clientMessageId?: string\n): Conversation {\n switch (event.type) {\n case 'turn.started': {\n let messages = conversation.messages.map(message =>\n clientMessageId && message.id === clientMessageId ? { ...message, id: event.data.userMessageId } : message\n );\n if (!messages.some(message => message.id === event.data.assistantMessageId)) {\n messages = [...messages, createAssistantMessage(event.data.assistantMessageId)];\n }\n\n return { ...conversation, status: 'running', messages };\n }\n\n case 'message.delta': {\n const messages = ensureMessage(conversation.messages, event.data.messageId);\n return {\n ...conversation,\n messages: messages.map(message =>\n message.id === event.data.messageId ? appendText(message, event.data.text) : message\n )\n };\n }\n\n case 'tool.started': {\n const data = event.data;\n if (findToolCall(conversation.messages, data.invocationId)) {\n return updateToolCall(conversation, data.invocationId, part => ({\n ...part,\n toolId: data.toolId,\n toolVersion: data.toolVersion,\n displayName: data.displayName,\n argumentsPreview: data.argumentsPreview,\n status: 'running'\n }));\n }\n\n const part: ToolCallPart = {\n type: 'tool-call',\n invocationId: data.invocationId,\n toolId: data.toolId,\n toolVersion: data.toolVersion,\n displayName: data.displayName,\n status: 'running',\n argumentsPreview: data.argumentsPreview,\n resultPreview: null,\n resultCode: null\n };\n return appendToCurrentAssistantMessage(conversation, part);\n }\n\n case 'tool.completed': {\n const data = event.data;\n return updateToolCall(conversation, data.invocationId, part => ({\n ...part,\n status: data.status,\n resultCode: data.resultCode,\n resultPreview: data.resultPreview\n }));\n }\n\n case 'approval.required': {\n const approval: ApprovalPart = { ...event.data, type: 'approval' };\n const withToolAwaiting = markLatestRunningToolAwaiting(\n conversation,\n approval.toolId,\n approval.presentation?.toolDisplayName);\n const exists = withToolAwaiting.messages.some(message =>\n message.parts.some(part => part.type === 'approval' && part.approvalId === approval.approvalId)\n );\n const withApproval = exists\n ? replaceApproval(withToolAwaiting, approval)\n : appendToCurrentAssistantMessage(withToolAwaiting, approval);\n\n return { ...withApproval, status: 'waiting-for-approval', pendingApproval: approval };\n }\n\n case 'question.asked': {\n const question: QuestionPart = { ...event.data, type: 'question' };\n // The ask_question call waits for the answer as a call waits for an approval.\n const withToolAwaiting = updateToolCall(conversation, question.questionId, part => ({ ...part, status: 'awaiting-answer' }));\n const withQuestion = hasQuestion(withToolAwaiting, question.questionId)\n ? replaceQuestion(withToolAwaiting, question)\n : appendToCurrentAssistantMessage(withToolAwaiting, question);\n\n return { ...withQuestion, status: 'waiting-for-approval', pendingQuestion: question };\n }\n\n case 'question.answered': {\n const question: QuestionPart = { ...event.data, type: 'question' };\n return {\n ...replaceQuestion(conversation, question),\n pendingQuestion: conversation.pendingQuestion?.questionId === question.questionId ? null : conversation.pendingQuestion ?? null\n };\n }\n\n case 'connection.required': {\n const data = event.data;\n // One card per server and answer, also when a live update repeats the event.\n const current = [...conversation.messages].reverse().find(message => message.role === 'assistant');\n if (current?.parts.some(part => part.type === 'connection-required' && part.serverId === data.serverId)) {\n return conversation;\n }\n return appendToCurrentAssistantMessage(conversation, {\n type: 'connection-required',\n serverId: data.serverId,\n displayName: data.displayName,\n reason: data.reason\n });\n }\n\n case 'turn.completed': {\n const status = conversationStatusFor(event.data.status);\n return {\n ...conversation,\n status,\n pendingApproval: status === 'waiting-for-approval' ? conversation.pendingApproval : null,\n pendingQuestion: status === 'waiting-for-approval' ? conversation.pendingQuestion ?? null : null\n };\n }\n\n case 'error':\n return {\n ...conversation,\n status: conversation.status === 'running' ? 'failed' : conversation.status\n };\n }\n}\n\n/**\n * Records the user's approval decision locally until the server state is reloaded. A consulted\n * agent's proposal that the user left for the subject's approvers (`leave`) closes here as the server\n * closes it, rejected in this conversation, and can no longer be left; the waiting tool call goes on.\n */\nexport function applyNhAssistantApprovalDecision(\n conversation: Conversation,\n approvalId: string,\n decision: ApprovalDecision\n): Conversation {\n const approval = conversation.messages\n .flatMap(message => message.parts)\n .find((part): part is ApprovalPart => part.type === 'approval' && part.approvalId === approvalId)\n ?? conversation.pendingApproval;\n const toolId = approval?.approvalId === approvalId ? approval.toolId : null;\n\n const messages = conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'approval' && part.approvalId === approvalId\n ? decidedApproval(part, decision)\n : part\n )\n }));\n\n let updated: Conversation = {\n ...conversation,\n messages,\n status: 'running',\n pendingApproval: null\n };\n\n if (toolId) {\n const awaiting = findLatestToolCall(updated.messages, part => part.toolId === toolId && part.status === 'awaiting-approval');\n if (awaiting) {\n updated = updateToolCall(updated, awaiting.invocationId, part => ({\n ...part,\n status: decision === 'reject' ? 'rejected' : 'running'\n }));\n }\n }\n\n return updated;\n}\n\n/**\n * Records the addressee's answer to a question locally until the server state is reloaded: the\n * question reads as answered with the chosen index and the turn runs again.\n */\nexport function applyNhAssistantQuestionAnswer(\n conversation: Conversation,\n questionId: string,\n choice: number\n): Conversation {\n const messages = conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'question' && part.questionId === questionId\n ? { ...part, status: 'answered' as const, answerIndex: choice }\n : part\n )\n }));\n\n return updateToolCall(\n { ...conversation, messages, status: 'running', pendingQuestion: null },\n questionId,\n part => ({ ...part, status: 'running' }));\n}\n\n/** An approval part after the user's decision. */\nfunction decidedApproval(part: ApprovalPart, decision: ApprovalDecision): ApprovalPart {\n const decided: ApprovalPart = { ...part, status: decision === 'approve' ? 'approved' : 'rejected' };\n if (decision === 'leave' && part.consultation) {\n decided.consultation = { ...part.consultation, leaveRoute: null };\n }\n return decided;\n}\n\n/**\n * Applies a live update of another session: `message.created` adds a participant's or the\n * application's message once, where its sequence number puts it; the turn events behave exactly\n * like the starting request's stream. Unknown types are ignored.\n */\nexport function applyNhAssistantLiveEvent(conversation: Conversation, event: LiveConversationEvent): Conversation {\n if (event.type === 'message.created') {\n const message = event.data as Message;\n if (!message?.id || conversation.messages.some(existing => existing.id === message.id)) {\n return conversation;\n }\n return { ...conversation, messages: insertBySequence(conversation.messages, message) };\n }\n\n if (!(NH_ASSISTANT_SSE_EVENT_TYPES as readonly string[]).includes(event.type)) {\n return conversation;\n }\n return applyNhAssistantEvent(conversation, { type: event.type, data: event.data } as NhAssistantSseEvent);\n}\n\n/** Applies the shared state of a conversation that a live update announced. */\nexport function applyNhAssistantConversationChange(conversation: Conversation, change: LiveConversationChanged): Conversation {\n return {\n ...conversation,\n status: change.status,\n title: change.title,\n updatedAt: change.updatedAt,\n activeActorId: change.activeActorId,\n lastMessageSequence: change.lastMessageSequence,\n participantCount: change.participantCount,\n pendingApproval: change.status === 'waiting-for-approval' ? conversation.pendingApproval : null,\n pendingQuestion: change.status === 'waiting-for-approval' ? conversation.pendingQuestion ?? null : null\n };\n}\n\n/**\n * True when an assistant message after the latest user message contains non-blank text,\n * so the latest turn produced a visible answer. Tool calls and approvals alone do not count.\n */\nexport function nhAssistantLatestTurnHasText(conversation: Conversation): boolean {\n for (let position = conversation.messages.length - 1; position >= 0; position--) {\n const message = conversation.messages[position];\n if (message.role === 'user') {\n return false;\n }\n if (message.role === 'assistant' && message.parts.some(part => part.type === 'text' && part.text.trim().length > 0)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction conversationStatusFor(status: TurnCompletionStatus): ConversationStatus {\n switch (status) {\n case 'completed':\n case 'cancelled':\n return 'idle';\n case 'waiting-for-approval':\n return 'waiting-for-approval';\n case 'failed':\n return 'failed';\n }\n}\n\n/**\n * Places a stored message before the messages at the end that have a higher sequence number. A\n * message without a number, such as an optimistic message or the answer a running turn is still\n * writing, counts as earlier: the server numbers a turn's messages when the turn starts, so a message\n * stored during the turn follows its answer. A message without a number of its own goes last.\n */\nfunction insertBySequence(messages: Message[], message: Message): Message[] {\n const sequence = message.sequence;\n let index = messages.length;\n if (typeof sequence === 'number' && sequence > 0) {\n while (index > 0) {\n const previous = messages[index - 1].sequence;\n if (typeof previous !== 'number' || previous <= sequence) {\n break;\n }\n index--;\n }\n }\n\n return [...messages.slice(0, index), message, ...messages.slice(index)];\n}\n\nfunction createAssistantMessage(id: string): Message {\n return { id, role: 'assistant', createdAt: new Date().toISOString(), parts: [] };\n}\n\nfunction ensureMessage(messages: Message[], messageId: string): Message[] {\n return messages.some(message => message.id === messageId)\n ? messages\n : [...messages, createAssistantMessage(messageId)];\n}\n\nfunction appendText(message: Message, text: string): Message {\n const last = message.parts[message.parts.length - 1];\n if (last?.type === 'text') {\n return { ...message, parts: [...message.parts.slice(0, -1), { type: 'text', text: last.text + text }] };\n }\n\n return { ...message, parts: [...message.parts, { type: 'text', text }] };\n}\n\nfunction appendToCurrentAssistantMessage(conversation: Conversation, part: MessagePart): Conversation {\n let index = -1;\n for (let position = conversation.messages.length - 1; position >= 0; position--) {\n if (conversation.messages[position].role === 'assistant') {\n index = position;\n break;\n }\n }\n\n if (index < 0) {\n const message = createAssistantMessage(`local-${partKey(part)}`);\n return { ...conversation, messages: [...conversation.messages, { ...message, parts: [part] }] };\n }\n\n return {\n ...conversation,\n messages: conversation.messages.map((message, position) =>\n position === index ? { ...message, parts: [...message.parts, part] } : message\n )\n };\n}\n\nfunction partKey(part: MessagePart): string {\n if (part.type === 'tool-call') {\n return part.invocationId;\n }\n if (part.type === 'approval') {\n return part.approvalId;\n }\n if (part.type === 'connection-required') {\n return `connection-${part.serverId}`;\n }\n if (part.type === 'question') {\n return `question-${part.questionId}`;\n }\n\n return 'text';\n}\n\nfunction hasQuestion(conversation: Conversation, questionId: string): boolean {\n return conversation.messages.some(message =>\n message.parts.some(part => part.type === 'question' && part.questionId === questionId));\n}\n\nfunction replaceQuestion(conversation: Conversation, question: QuestionPart): Conversation {\n return {\n ...conversation,\n messages: conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'question' && part.questionId === question.questionId ? question : part\n )\n }))\n };\n}\n\nfunction findToolCall(messages: Message[], invocationId: string): ToolCallPart | undefined {\n return findLatestToolCall(messages, part => part.invocationId === invocationId);\n}\n\nfunction findLatestToolCall(messages: Message[], predicate: (part: ToolCallPart) => boolean): ToolCallPart | undefined {\n for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex--) {\n const parts = messages[messageIndex].parts;\n for (let partIndex = parts.length - 1; partIndex >= 0; partIndex--) {\n const part = parts[partIndex];\n if (part.type === 'tool-call' && predicate(part)) {\n return part;\n }\n }\n }\n\n return undefined;\n}\n\nfunction updateToolCall(\n conversation: Conversation,\n invocationId: string,\n update: (part: ToolCallPart) => ToolCallPart\n): Conversation {\n return {\n ...conversation,\n messages: conversation.messages.map(message =>\n message.parts.some(part => part.type === 'tool-call' && part.invocationId === invocationId)\n ? {\n ...message,\n parts: message.parts.map(part =>\n part.type === 'tool-call' && part.invocationId === invocationId ? update(part) : part\n )\n }\n : message\n )\n };\n}\n\nfunction markLatestRunningToolAwaiting(\n conversation: Conversation,\n toolId: string,\n displayName?: string\n): Conversation {\n const running = findLatestToolCall(conversation.messages, part => part.toolId === toolId && part.status === 'running');\n if (!running) {\n return conversation;\n }\n\n return updateToolCall(conversation, running.invocationId, part => ({\n ...part,\n displayName: displayName ?? part.displayName,\n status: 'awaiting-approval'\n }));\n}\n\nfunction replaceApproval(conversation: Conversation, approval: ApprovalPart): Conversation {\n return {\n ...conversation,\n messages: conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part =>\n part.type === 'approval' && part.approvalId === approval.approvalId ? approval : part\n )\n }))\n };\n}\n","import { ClientContext, ClientContextEntity } from '../models/assistant-api.models';\n\n/** Limits of the page context (contract 15.2). */\nexport const NH_ASSISTANT_PAGE_CONTEXT_LIMITS = {\n route: 200,\n title: 120,\n entities: 5,\n entityId: 64,\n entityLabel: 120\n} as const;\n\nconst dashCase = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/**\n * Validates host-provided page context and truncates it to the contract limits.\n * Returns null for an invalid shape (not an object or no route), so the message is sent\n * without page context. Route, title and labels are truncated; entities beyond five are\n * dropped, and entities with a type that is not dash-case, an empty id or an id longer\n * than 64 characters are dropped because a truncated id would point at another entity.\n */\nexport function normalizeNhAssistantClientContext(value: unknown): ClientContext | null {\n if (!isRecord(value)) {\n return null;\n }\n\n const route = typeof value['route'] === 'string' ? value['route'].trim() : '';\n if (route.length === 0) {\n return null;\n }\n\n const result: ClientContext = { route: truncate(route, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.route) };\n\n const title = typeof value['title'] === 'string' ? value['title'].trim() : '';\n if (title.length > 0) {\n result.title = truncate(title, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.title);\n }\n\n if (Array.isArray(value['entities'])) {\n const entities = value['entities']\n .map(normalizeEntity)\n .filter((entity): entity is ClientContextEntity => entity !== null)\n .slice(0, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.entities);\n if (entities.length > 0) {\n result.entities = entities;\n }\n }\n\n return result;\n}\n\n/** Short text for the page-context chip: the first entity's label, the title or the route. */\nexport function describeNhAssistantClientContext(context: ClientContext): string {\n const entity = context.entities?.[0];\n if (entity) {\n return entity.label ?? `${entity.type} ${entity.id}`;\n }\n\n return context.title ?? context.route;\n}\n\nfunction normalizeEntity(value: unknown): ClientContextEntity | null {\n if (!isRecord(value)) {\n return null;\n }\n\n const type = typeof value['type'] === 'string' ? value['type'].trim() : '';\n const id = typeof value['id'] === 'string' ? value['id'].trim() : '';\n if (!dashCase.test(type) || id.length === 0 || id.length > NH_ASSISTANT_PAGE_CONTEXT_LIMITS.entityId) {\n return null;\n }\n\n const entity: ClientContextEntity = { type, id };\n const label = typeof value['label'] === 'string' ? value['label'].trim() : '';\n if (label.length > 0) {\n entity.label = truncate(label, NH_ASSISTANT_PAGE_CONTEXT_LIMITS.entityLabel);\n }\n return entity;\n}\n\nfunction truncate(value: string, max: number): string {\n return value.length <= max ? value : value.slice(0, max);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n","import { EnvironmentInjector, Injectable, inject, runInInjectionContext } from '@angular/core';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\n\ninterface AssistantUiState {\n agentId: string | null;\n conversationId: string | null;\n panelOpen: boolean;\n}\n\nconst emptyState: AssistantUiState = { agentId: null, conversationId: null, panelOpen: false };\nconst storagePrefix = 'nh-assistant-ui:v1:';\n\n/** Browser-only UI pointers. Messages, drafts, tokens and page context are never stored. */\n@Injectable()\nexport class NhAssistantUiState {\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly injector = inject(EnvironmentInjector);\n private key: string | null = null;\n private state: AssistantUiState = { ...emptyState };\n private activated = false;\n private activationRevision = 0;\n\n async activate(): Promise<{ changed: boolean; state: Readonly<AssistantUiState> }> {\n const revision = ++this.activationRevision;\n let scope: string | null = null;\n try {\n scope = await runInInjectionContext(this.injector, () => this.config.getStateScope?.() ?? null);\n } catch {\n scope = null;\n }\n\n if (revision !== this.activationRevision) {\n return { changed: false, state: this.state };\n }\n\n const normalized = typeof scope === 'string' ? scope.trim() : '';\n const key = normalized.length > 0 && normalized.length <= 256\n ? `${storagePrefix}${encodeURIComponent(this.config.apiBaseUrl)}:${encodeURIComponent(normalized)}`\n : null;\n if (this.activated && key === this.key) {\n return { changed: false, state: this.state };\n }\n\n this.activated = true;\n this.key = key;\n this.state = this.read();\n return { changed: true, state: this.state };\n }\n\n deactivate(): void {\n this.activationRevision++;\n this.activated = false;\n this.key = null;\n this.state = { ...emptyState };\n }\n\n update(patch: Partial<AssistantUiState>): void {\n this.state = { ...this.state, ...patch };\n if (!this.key) {\n return;\n }\n\n try {\n globalThis.localStorage?.setItem(this.key, JSON.stringify(this.state));\n } catch {\n // Storage can be unavailable or full; the live assistant remains usable.\n }\n }\n\n private read(): AssistantUiState {\n if (!this.key) {\n return { ...emptyState };\n }\n\n try {\n const raw = globalThis.localStorage?.getItem(this.key);\n const value: unknown = raw ? JSON.parse(raw) : null;\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return { ...emptyState };\n }\n\n const saved = value as Record<string, unknown>;\n return {\n agentId: validId(saved['agentId']),\n conversationId: validId(saved['conversationId']),\n panelOpen: saved['panelOpen'] === true\n };\n } catch {\n return { ...emptyState };\n }\n }\n}\n\nfunction validId(value: unknown): string | null {\n return typeof value === 'string' && value.length > 0 && value.length <= 256 ? value : null;\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n EnvironmentInjector,\n Injectable,\n PLATFORM_ID,\n computed,\n effect,\n inject,\n runInInjectionContext,\n signal,\n untracked\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Observable, Subscription, firstValueFrom, isObservable } from 'rxjs';\nimport {\n AgentSummary,\n AgentUploads,\n ApprovalDecision,\n ApprovalPart,\n ApprovalResolution,\n ApprovalStatus,\n AssistantStatus,\n ClientContext,\n Conversation,\n ConversationMember,\n ConversationStatus,\n ConversationSummary,\n DirectoryEntry,\n FileReference,\n Message,\n MessagePart\n} from '../models/assistant-api.models';\nimport { nhAssistantFileProblem, nhAssistantMediaTypeOf } from '../internal/nh-assistant-files';\nimport {\n LiveAgentWorkChanged,\n LiveConversationChanged,\n LiveConversationEvent,\n LiveConversationRead,\n LiveConversationRemoved\n} from '../models/assistant-live.models';\nimport { AgentProposalDecision } from '../models/assistant-agent-run.models';\nimport { NhAssistantClientErrorCodes, NhAssistantMessageEvent, NhAssistantSseEvent, TurnUsage } from '../models/assistant-sse.models';\nimport { NH_ASSISTANT_ACCESS_POLICY, NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\nimport { NhAssistantAgentRunApiService } from './nh-assistant-agent-run-api.service';\nimport { NhAssistantApiError, NhAssistantApiService, nhAssistantErrorMessageKey } from './nh-assistant-api.service';\nimport { NhAssistantLiveService } from './nh-assistant-live.service';\nimport { NhAssistantPushService } from './nh-assistant-push.service';\nimport {\n applyNhAssistantApprovalDecision,\n applyNhAssistantConversationChange,\n applyNhAssistantEvent,\n applyNhAssistantLiveEvent,\n applyNhAssistantQuestionAnswer,\n nhAssistantLatestTurnHasText\n} from './nh-assistant-reducer';\nimport { normalizeNhAssistantClientContext } from './nh-assistant-page-context';\nimport { NhAssistantUiState } from './nh-assistant-ui-state';\n\n/** A user-facing assistant failure: a stable code and a translation key, never raw server text. */\nexport interface NhAssistantError {\n code: string;\n messageKey: string;\n /** The field errors of an `assistant-validation` failure, by camelCase field name. */\n fieldErrors?: Readonly<Record<string, readonly string[]>>;\n}\n\n/**\n * A non-blocking remark about a turn that completed normally, for example a limit that cut the\n * answer short. The conversation stays usable; the notice only explains the answer.\n */\nexport type NhAssistantNotice = NhAssistantError;\n\n/** An unsent message held in this tab, scoped to its original conversation. */\nexport interface NhAssistantQueuedMessage {\n id: string;\n conversationId: string;\n text: string;\n state: 'preparing' | 'queued' | 'sending' | 'failed';\n /** The files the message carries, uploaded before it was queued. */\n files?: readonly FileReference[];\n}\n\n/**\n * A file the person attaches to the next message of the open conversation: while it uploads, once\n * the application stored it, or why it cannot be attached. Attachments live only in this tab's\n * memory.\n */\nexport interface NhAssistantAttachment {\n /** The attachment's id in this tab. */\n id: string;\n name: string;\n /** The media type the upload declares, lowercase. */\n mediaType: string;\n /** The size in bytes. */\n size: number;\n state: 'uploading' | 'uploaded' | 'failed';\n /** The share of the file sent so far, from 0 to 1. */\n progress: number;\n /** The stored file, once uploaded; the message carries its reference. */\n file: FileReference | null;\n /** Why the file is not attached, for a failed attachment. */\n error: NhAssistantError | null;\n}\n\ninterface QueuedMessage extends NhAssistantQueuedMessage {\n clientContext?: ClientContext | null;\n}\n\n/** Notice code for a completed turn that produced no answer text and no server code. */\nexport const NH_ASSISTANT_NO_ANSWER_NOTICE_CODE = 'assistant-no-answer';\n\n/**\n * Notice code for a message that waits for the next run of the agent working in its thread: the\n * server answered `202` with the trigger receipt, and the run adds the message, with its files.\n */\nexport const NH_ASSISTANT_MESSAGE_QUEUED_NOTICE_CODE = 'assistant-message-queued';\n\n/**\n * Who decides an approval the current user cannot decide: `turn`, the person whose turn created\n * it in a chat; `approver`, an approver of the agent thread's subject; `other-approver`, another\n * approver, because the current user started the work and four-eyes applies; `asker`, the person\n * who consulted the thread's agent, in their own chat.\n */\nexport type NhAssistantApprovalWaitingFor = 'turn' | 'approver' | 'other-approver' | 'asker';\n\n/** The current user's right to decide, or to give feedback on, one approval of the open conversation. */\nexport interface NhAssistantApprovalRight {\n canDecide: boolean;\n /** Who decides when the current user cannot. */\n waitingFor: NhAssistantApprovalWaitingFor;\n /** Name of the person who decides a `turn` approval; `null` when unknown. */\n decisionOwner: string | null;\n /**\n * True for an agent's proposal the current user rejected in this session, so the approval card\n * offers the optional feedback question. Chat approvals never offer feedback.\n */\n canGiveFeedback?: boolean;\n}\n\nconst fourEyesRequiredCode = 'assistant-four-eyes-required';\n\n/** A consultation's proposal in the consulted thread that the person who asked decides in their own chat. */\nconst askerDecidesCode = 'assistant-consult-asker-decides';\n\n\n/**\n * A conversation that needs attention outside the open thread: a turn runs, an approval waits or\n * there is something unread.\n */\nexport interface NhAssistantActivity {\n id: string;\n title: string | null;\n status: ConversationStatus;\n unread: boolean;\n shared: boolean;\n /** True for the conversation shown in the panel. */\n active: boolean;\n updatedAt: string;\n}\n\n/** True when a conversation has messages the caller has not read. A running turn is not unread yet. */\nexport function nhAssistantIsUnread(summary: Pick<ConversationSummary, 'status' | 'lastMessageSequence' | 'lastReadSequence'>): boolean {\n if (summary.status === 'running' || summary.lastReadSequence === undefined) {\n return false;\n }\n return (summary.lastMessageSequence ?? 0) > summary.lastReadSequence;\n}\n\n/** The state of one conversation this tab has opened. */\ninterface NhAssistantSession {\n conversation: Conversation;\n /** A request of this tab streams a turn of the conversation. */\n streaming: boolean;\n deciding: boolean;\n error: NhAssistantError | null;\n notice: NhAssistantNotice | null;\n lastUsage: TurnUsage | null;\n /**\n * The answer the running turn writes, from its `turn.started`: of the turn this tab streams or of\n * one it follows live; `null` between turns.\n */\n writingMessageId: string | null;\n}\n\n/**\n * True when the server accepts a new message in this conversation. A failed turn leaves the\n * conversation open: the person can ask again in the same conversation or agent thread. A chat whose\n * waiting question or approval passed its lifetime at `now` takes the message too (`waitExpired`).\n */\nfunction acceptsMessage(conversation: Conversation | null | undefined, now: number): boolean {\n const status = conversation?.status;\n return status === 'idle' || status === 'failed' || waitExpired(conversation, now);\n}\n\n/**\n * True when a chat waits for a question or an approval whose `expiresAt` passed at `now`. The server\n * closes it as expired when the next message arrives and then starts that message's turn (CS9), so the\n * client sends the message instead of queueing it. The server stays the judge: while its own clock\n * still counts the wait, it refuses the message as `assistant-conversation-busy`, which the client\n * handles as any refusal. An agent's thread keeps its own rules and never takes a message this way.\n */\nfunction waitExpired(conversation: Conversation | null | undefined, now: number): boolean {\n const expiresAt = waitExpiresAt(conversation);\n return expiresAt !== null && expiresAt <= now;\n}\n\n/** The end of the wait of a chat that waits for a question or an approval; `null` otherwise. */\nfunction waitExpiresAt(conversation: Conversation | null | undefined): number | null {\n if (!conversation || conversation.status !== 'waiting-for-approval' || conversation.kind === 'thread') {\n return null;\n }\n const value = conversation.pendingQuestion?.expiresAt ?? conversation.pendingApproval?.expiresAt;\n const expiresAt = value ? Date.parse(value) : Number.NaN;\n return Number.isFinite(expiresAt) ? expiresAt : null;\n}\n\nconst conversationPageSize = 50;\nconst cancelGracePeriodMs = 5_000;\nconst maxSessions = 20;\nconst refreshDelayMs = 300;\nconst newConversationKey = '';\n/** The longest the store sleeps before it looks at the end of a wait again; below the timer limit. */\nconst maxWaitCheckDelayMs = 60 * 60 * 1000;\n\n/**\n * Signal-based state of one assistant scope: availability, agents, the conversation list and\n * every conversation this tab has opened. Several conversations can run turns at the same time;\n * the public signals describe the conversation that is open in the panel. With live updates the\n * store follows turns of other people and of the user's other tabs.\n */\n@Injectable()\nexport class NhAssistantStore {\n private readonly api = inject(NhAssistantApiService);\n private readonly agentRuns = inject(NhAssistantAgentRunApiService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly injector = inject(EnvironmentInjector);\n private readonly accessPolicy = inject(NH_ASSISTANT_ACCESS_POLICY);\n private readonly uiState = inject(NhAssistantUiState);\n private readonly live = inject(NhAssistantLiveService);\n private readonly push = inject(NhAssistantPushService);\n private readonly document = inject(DOCUMENT);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly accessGrantedState = signal<boolean | null>(null);\n private readonly statusState = signal<AssistantStatus | null>(null);\n private readonly statusLoadingState = signal(false);\n private readonly selectedAgentIdState = signal<string | null>(null);\n private readonly conversationsState = signal<ConversationSummary[]>([]);\n private readonly conversationsTotalState = signal(0);\n private readonly conversationsLoadingState = signal(false);\n private readonly sessionsState = signal<ReadonlyMap<string, NhAssistantSession>>(new Map());\n private readonly activeIdState = signal<string | null>(null);\n private readonly conversationLoadingState = signal(false);\n /** The conversation a message is being prepared for; `''` while a new conversation is created. */\n private readonly sendingState = signal<string | null>(null);\n private readonly draftErrorState = signal<NhAssistantError | null>(null);\n private readonly restoredDraftState = signal<string | null>(null);\n private readonly pageContextState = signal<ClientContext | null>(null);\n private readonly pageContextExcludedState = signal(false);\n private readonly restorePanelOpenState = signal(false);\n private readonly viewingState = signal(false);\n private readonly pageVisibleState = signal(true);\n private readonly queuedState = signal<QueuedMessage[]>([]);\n private readonly pausedQueuesState = signal<ReadonlySet<string>>(new Set());\n private readonly queueDispatchState = signal<string | null>(null);\n private readonly steeringState = signal<string | null>(null);\n private readonly submittingState = signal(false);\n /**\n * The client's clock as the store last read it, moved forward when the wait of an open conversation\n * ends, so a message is sent instead of queued from then on.\n */\n private readonly clockState = signal(Date.now());\n /** Agent proposals the current user rejected in this session and may give feedback on. */\n private readonly feedbackApprovalsState = signal<ReadonlySet<string>>(new Set());\n /** The attachments of the next message per conversation; `''` for a new conversation. */\n private readonly attachmentsState = signal<ReadonlyMap<string, readonly NhAssistantAttachment[]>>(new Map());\n private destroyed = false;\n private readonly uploadSubscriptions = new Map<string, Subscription>();\n /** The conversation an attachment of a new conversation creates, once for every file chosen meanwhile. */\n private attachmentConversation: Promise<Conversation | null> | null = null;\n\n private readonly streams = new Map<string, Subscription>();\n private readonly cancelTimers = new Map<string, ReturnType<typeof setTimeout>>();\n /** Pending reloads of agent threads after live agent-work updates, per conversation. */\n private readonly agentWorkTimers = new Map<string, ReturnType<typeof setTimeout>>();\n private readonly pendingSendResolves = new Map<string, (accepted: boolean) => void>();\n private readonly markingRead = new Set<string>();\n private readonly liveSubscription = new Subscription();\n private accessSubscription?: Subscription;\n private refreshTimer?: ReturnType<typeof setTimeout>;\n private initialization?: Promise<void>;\n private statusRevision = 0;\n private accountRevision = 0;\n private collaborationKey: string | null = null;\n\n private readonly activeSession = computed(() => {\n const id = this.activeIdState();\n return id === null ? null : this.sessionsState().get(id) ?? null;\n });\n\n /** True when the access policy allows the user and the server reports the assistant as enabled. */\n readonly enabled = computed(() => this.accessGrantedState() === true && this.statusState()?.enabled === true);\n readonly accessGranted = this.accessGrantedState.asReadonly();\n /** True when the assistant is enabled and the server reports that the caller passes the admin policy. */\n readonly canAdminister = computed(() => this.enabled() && this.statusState()?.canAdminister === true);\n readonly statusLoading = this.statusLoadingState.asReadonly();\n readonly limits = computed(() => this.statusState()?.limits ?? null);\n readonly agents = computed<AgentSummary[]>(() => this.statusState()?.agents ?? []);\n /** Sharing, live update and notification features the server offers. */\n readonly collaboration = computed(() => this.statusState()?.collaboration ?? null);\n readonly selectedAgentId = this.selectedAgentIdState.asReadonly();\n readonly selectedAgent = computed(() =>\n this.agents().find(agent => agent.id === this.selectedAgentIdState()) ?? null\n );\n readonly conversations = this.conversationsState.asReadonly();\n readonly conversationsTotal = this.conversationsTotalState.asReadonly();\n readonly conversationsLoading = this.conversationsLoadingState.asReadonly();\n /** The conversation open in the panel, or `null` for a new one. */\n readonly activeConversation = computed(() => this.activeSession()?.conversation ?? null);\n readonly conversationLoading = this.conversationLoadingState.asReadonly();\n /** True while this tab sends a message or streams a turn of the open conversation. */\n readonly streaming = computed(() => {\n const sending = this.sendingState();\n const activeId = this.activeIdState();\n return (sending !== null && sending === (activeId ?? newConversationKey)) || this.activeSession()?.streaming === true;\n });\n readonly pendingApproval = computed(() => this.activeConversation()?.pendingApproval ?? null);\n readonly deciding = computed(() => this.activeSession()?.deciding === true);\n readonly error = computed(() => this.activeIdState() === null ? this.draftErrorState() : this.activeSession()?.error ?? null);\n /** Non-blocking remark about the latest completed turn; shown only while no error is shown. */\n readonly notice = computed(() => this.activeSession()?.notice ?? null);\n readonly lastUsage = computed(() => this.activeSession()?.lastUsage ?? null);\n /**\n * The answer the running turn of the open conversation writes, while this tab streams the turn or\n * follows it live; `null` otherwise. Pass it to `nh-assistant-thread` as `writingMessageId`, so\n * the working indicator stays under that answer when a message arrives after it during the turn.\n */\n readonly writingMessageId = computed(() => this.activeSession()?.writingMessageId ?? null);\n /** Text of a message the server did not accept, so the composer can offer it again. */\n readonly restoredDraft = this.restoredDraftState.asReadonly();\n /** Page context that the next message would send, for the transparency chip. */\n readonly pageContext = this.pageContextState.asReadonly();\n /** True when the user left the page context out of the next message. */\n readonly pageContextExcluded = this.pageContextExcludedState.asReadonly();\n /** Whether the drawer was open when this account last left the application. */\n readonly restorePanelOpen = this.restorePanelOpenState.asReadonly();\n /**\n * True while the user can send: enabled, an agent is chosen and no turn runs or waits. A\n * conversation whose last turn failed accepts a new message; an archived one does not.\n */\n readonly canSend = computed(() => {\n const conversation = this.activeConversation();\n const blocked = conversation !== null && !acceptsMessage(conversation, this.clockState());\n return this.enabled() && this.selectedAgentIdState() !== null && !this.streaming() && !this.conversationLoadingState() && !blocked;\n });\n /**\n * True while the open chat waits for a question or an approval whose lifetime passed by the\n * client's clock: a message is then sent at once, and the server closes the wait as expired before\n * the message's turn starts. The composer no longer says that the conversation waits.\n */\n readonly waitExpired = computed(() => waitExpired(this.activeConversation(), this.clockState()));\n /** Messages not yet accepted by the server, for the open conversation. Never persisted. */\n readonly queuedMessages = computed<readonly NhAssistantQueuedMessage[]>(() =>\n this.queuedState().filter(item => item.conversationId === this.activeIdState()));\n /** Sending or queueing is available during a turn and while an approval waits. */\n readonly canSubmit = computed(() => (this.canSend() && !this.submittingState()) || (this.enabled()\n && !this.conversationLoading() && this.activeConversation() !== null\n && ['idle', 'failed', 'running', 'waiting-for-approval'].includes(this.activeConversation()!.status)));\n readonly queuePaused = computed(() => this.pausedQueuesState().has(this.activeIdState() ?? '') || this.error() !== null);\n /** Steering cancels the active turn before sending the selected correction. */\n readonly canSteer = computed(() => {\n const conversation = this.activeConversation();\n const ownsTurn = conversation?.activeActorId && conversation.currentActorId\n ? conversation.activeActorId === conversation.currentActorId : this.activeSession()?.streaming === true;\n return this.enabled() && this.steeringState() === null && !this.submittingState()\n && this.queueDispatchState() === null\n && ['running', 'waiting-for-approval'].includes(conversation?.status ?? '')\n && (this.isOwner() || ownsTurn);\n });\n /**\n * What the person may attach to the next message: the uploads of the open conversation's agent, or\n * of the selected agent for a new conversation. `null` when nothing can be attached: the server\n * offers no uploads for the agent, the conversation is archived, or the person only reads the\n * agent's thread.\n */\n readonly uploads = computed<AgentUploads | null>(() => {\n const conversation = this.activeConversation();\n const thread = conversation?.thread;\n if (!this.enabled() || conversation?.status === 'archived'\n || (thread && thread.role !== 'participant' && thread.role !== 'approver')) {\n return null;\n }\n\n const agentId = conversation?.agentId ?? this.selectedAgentIdState();\n const uploads = this.agents().find(agent => agent.id === agentId)?.uploads ?? null;\n return uploads && uploads.acceptedMediaTypes.length > 0 && uploads.maxFiles > 0 ? uploads : null;\n });\n /** The attachments of the next message of the open conversation, in the order they were chosen. */\n readonly attachments = computed<readonly NhAssistantAttachment[]>(() =>\n this.attachmentsState().get(this.activeIdState() ?? newConversationKey) ?? []);\n /** The stored files of the open conversation's next message, for `submit`. */\n readonly attachedFiles = computed<FileReference[]>(() => this.attachments()\n .filter(attachment => attachment.state === 'uploaded' && attachment.file !== null)\n .map(attachment => attachment.file!));\n /** True while a file of the next message still uploads; the message waits for it. */\n readonly uploading = computed(() => this.attachments().some(attachment => attachment.state === 'uploading'));\n /** The owner and participants of the open conversation; empty while it is not shared. */\n readonly members = computed<ConversationMember[]>(() => this.activeConversation()?.members ?? []);\n /** True when the current user owns the open conversation (or it is new). */\n readonly isOwner = computed(() => (this.activeConversation()?.role ?? 'owner') === 'owner');\n /** True when the open conversation is the durable thread of an agent about a subject. */\n readonly isAgentThread = computed(() => this.activeConversation()?.kind === 'thread');\n /**\n * The current user's right to decide each pending approval of the open conversation, by approval\n * id. In a chat only the author of the waiting turn decides. In an agent thread the subject's\n * approvers decide, as the server reports per proposal: the approval policy, four-eyes and the\n * tool's approve policy, checked live. Proposals the user rejected in this session carry\n * `canGiveFeedback`.\n */\n readonly approvalRights = computed<ReadonlyMap<string, NhAssistantApprovalRight>>(() => {\n const conversation = this.activeConversation();\n const rights = new Map<string, NhAssistantApprovalRight>();\n if (!conversation) {\n return rights;\n }\n\n if (conversation.kind === 'thread') {\n const decisions = new Map((conversation.thread?.decisions ?? []).map(decision => [decision.approvalId, decision]));\n for (const approval of pendingApprovalParts(conversation)) {\n const decision = decisions.get(approval.approvalId);\n rights.set(approval.approvalId, {\n canDecide: decision?.canDecide === true,\n waitingFor: waitingForOf(decision?.reasonCode),\n decisionOwner: null\n });\n }\n\n const feedbackApprovals = this.feedbackApprovalsState();\n for (const approval of approvalParts(conversation)) {\n if (approval.status === 'rejected' && feedbackApprovals.has(approval.approvalId)) {\n rights.set(approval.approvalId, {\n canDecide: false,\n waitingFor: 'approver',\n decisionOwner: null,\n canGiveFeedback: true\n });\n }\n }\n return rights;\n }\n\n if (conversation.pendingApproval) {\n rights.set(conversation.pendingApproval.approvalId, {\n canDecide: !conversation.activeActorId || !conversation.currentActorId\n || conversation.activeActorId === conversation.currentActorId,\n waitingFor: 'turn',\n decisionOwner: this.activeMember()?.displayName ?? null\n });\n }\n return rights;\n });\n /**\n * True when the current user may decide the pending approval: in a chat it belongs to their own\n * turn, in an agent thread the server allows them as an approver.\n */\n readonly canDecide = computed(() => {\n const approval = this.activeConversation()?.pendingApproval;\n return approval ? this.approvalRights().get(approval.approvalId)?.canDecide === true : false;\n });\n /**\n * True when the current user may answer the question the open chat waits for: it is addressed to\n * them and still pending (`ask_question`, `run.AllowQuestions()` on the server).\n */\n readonly canAnswer = computed(() => {\n const conversation = this.activeConversation();\n const question = conversation?.pendingQuestion;\n return !!question && question.status === 'pending' && question.addresseeActorId === conversation?.currentActorId;\n });\n /** The member a pending question of the open conversation is addressed to, when it is someone else. */\n readonly questionAddressee = computed<ConversationMember | null>(() => {\n const conversation = this.activeConversation();\n const question = conversation?.pendingQuestion;\n if (!question || question.addresseeActorId === conversation?.currentActorId) {\n return null;\n }\n return conversation?.members?.find(member => member.actorId === question.addresseeActorId) ?? null;\n });\n /** The member whose turn runs or waits in the open conversation, when it is someone else. */\n readonly activeMember = computed<ConversationMember | null>(() => {\n const conversation = this.activeConversation();\n if (!conversation?.activeActorId || conversation.activeActorId === conversation.currentActorId) {\n return null;\n }\n return conversation.members?.find(member => member.actorId === conversation.activeActorId) ?? null;\n });\n /** Conversations that need attention: running, waiting for approval or unread. Most recent first. */\n readonly activity = computed<NhAssistantActivity[]>(() => {\n const sessions = this.sessionsState();\n const activeId = this.activeIdState();\n return this.conversationsState()\n .map(summary => {\n const session = sessions.get(summary.id);\n const status = session?.streaming ? session.conversation.status : summary.status;\n return {\n id: summary.id,\n title: summary.title,\n status,\n unread: nhAssistantIsUnread({ ...summary, status }),\n shared: (summary.participantCount ?? 0) > 0,\n active: summary.id === activeId,\n updatedAt: summary.updatedAt\n };\n })\n .filter(item => item.status === 'running' || item.status === 'waiting-for-approval' || item.unread);\n });\n readonly runningCount = computed(() => this.activity().filter(item => item.status === 'running').length);\n readonly waitingCount = computed(() => this.activity().filter(item => item.status === 'waiting-for-approval').length);\n readonly unreadCount = computed(() => this.activity().filter(item => item.unread).length);\n /** Live update connection state. */\n readonly liveState = this.live.state;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.accessSubscription?.unsubscribe();\n this.liveSubscription.unsubscribe();\n this.stopAllTurns();\n this.clearAgentWorkTimers();\n for (const upload of this.uploadSubscriptions.values()) {\n upload.unsubscribe();\n }\n clearTimeout(this.refreshTimer);\n });\n\n effect(() => {\n const queued = this.queuedState();\n const sessions = this.sessionsState();\n const paused = this.pausedQueuesState();\n const steering = this.steeringState();\n const steeringItem = queued.find(item => item.id === steering);\n const steeringSession = steeringItem ? sessions.get(steeringItem.conversationId) : null;\n if (steering && (!steeringItem || steeringSession?.error\n || (steeringSession?.conversation.status === 'idle' && !steeringSession.streaming))) {\n untracked(() => this.steeringState.set(null));\n }\n if (!this.enabled() || this.queueDispatchState() !== null || this.sendingState() !== null || this.submittingState()) {\n return;\n }\n const next = queued.find((item, index) => {\n const session = sessions.get(item.conversationId);\n return item.state === 'queued' && !paused.has(item.conversationId)\n && !queued.slice(0, index).some(previous => previous.conversationId === item.conversationId)\n && acceptsMessage(session?.conversation, this.clockState()) && !session?.streaming && !session?.deciding && !session?.error;\n });\n if (next) {\n untracked(() => void this.dispatchQueued(next));\n }\n });\n\n // The end of a wait moves the clock, so queued and new messages go out from then on.\n effect(onCleanup => {\n const clock = this.clockState();\n const sessions = this.sessionsState();\n const now = Date.now();\n let next: number | null = null;\n for (const session of sessions.values()) {\n const expiresAt = waitExpiresAt(session.conversation);\n if (expiresAt === null) {\n continue;\n }\n if (expiresAt > clock && expiresAt <= now) {\n // A wait ended while nothing looked, such as one the store read only now.\n untracked(() => this.clockState.set(now));\n return;\n }\n if (expiresAt > now && (next === null || expiresAt < next)) {\n next = expiresAt;\n }\n }\n if (next === null || !this.browser) {\n return;\n }\n const timer = setTimeout(() => this.clockState.set(Date.now()), Math.min(next - now + 1, maxWaitCheckDelayMs));\n onCleanup(() => clearTimeout(timer));\n });\n\n this.liveSubscription.add(this.live.changed$.subscribe(change => this.onLiveChanged(change)));\n this.liveSubscription.add(this.live.read$.subscribe(read => this.onLiveRead(read)));\n this.liveSubscription.add(this.live.removed$.subscribe(removed => this.onLiveRemoved(removed)));\n this.liveSubscription.add(this.live.events$.subscribe(event => this.onLiveEvent(event)));\n this.liveSubscription.add(this.live.agentWork$.subscribe(change => this.onLiveAgentWork(change)));\n this.liveSubscription.add(this.live.resync$.subscribe(() => this.resync()));\n\n if (this.browser) {\n const update = () => this.pageVisibleState.set(this.document.visibilityState === 'visible' && this.document.hasFocus());\n const visible = () => {\n update();\n if (this.document.visibilityState === 'visible' && this.enabled()) {\n // Without live updates, or on another instance, coming back reloads the list.\n void this.refreshConversations();\n }\n };\n this.document.addEventListener('visibilitychange', visible);\n globalThis.addEventListener?.('focus', update);\n globalThis.addEventListener?.('blur', update);\n destroyRef.onDestroy(() => {\n this.document.removeEventListener('visibilitychange', visible);\n globalThis.removeEventListener?.('focus', update);\n globalThis.removeEventListener?.('blur', update);\n });\n update();\n }\n\n // Marks the open conversation as read while the user looks at it.\n effect(() => {\n this.activeIdState();\n this.viewingState();\n this.pageVisibleState();\n this.conversationsState();\n this.sessionsState();\n untracked(() => this.markActiveReadWhenSeen());\n });\n }\n\n /** Evaluates the access policy and loads the server status once. Safe to call repeatedly. */\n initialize(): Promise<void> {\n this.initialization ??= this.startInitialization();\n return this.initialization;\n }\n\n /** Reloads the server status, for example after the host changed the signed-in user. */\n async reloadStatus(): Promise<void> {\n const revision = ++this.statusRevision;\n if (this.accessGrantedState() !== true) {\n this.resetAccount();\n this.statusState.set(null);\n this.selectedAgentIdState.set(null);\n this.restorePanelOpenState.set(false);\n this.uiState.deactivate();\n return;\n }\n\n this.statusLoadingState.set(true);\n try {\n const restored = await this.uiState.activate();\n if (revision !== this.statusRevision) {\n return;\n }\n if (restored.changed) {\n this.resetAccount();\n this.statusState.set(null);\n this.selectedAgentIdState.set(restored.state.agentId);\n this.restorePanelOpenState.set(restored.state.panelOpen);\n }\n\n const status = await firstValueFrom(this.api.status());\n if (revision !== this.statusRevision) {\n return;\n }\n this.statusState.set(status);\n if (status.enabled) {\n this.selectInitialAgent(status.agents);\n this.startCollaboration(status);\n if (this.activeIdState() === null && restored.state.conversationId) {\n await this.loadConversation(restored.state.conversationId, true);\n }\n }\n } catch {\n // An unavailable assistant endpoint hides the assistant instead of showing an error.\n if (revision === this.statusRevision) {\n this.statusState.set(null);\n }\n } finally {\n if (revision === this.statusRevision) {\n this.statusLoadingState.set(false);\n }\n }\n }\n\n async refreshConversations(): Promise<void> {\n if (!this.enabled()) {\n return;\n }\n\n const revision = this.accountRevision;\n this.conversationsLoadingState.set(true);\n try {\n const page = await firstValueFrom(this.api.listConversations(1, conversationPageSize));\n if (revision === this.accountRevision) {\n this.conversationsState.set(page.items.map(item => this.withLocalState(item)));\n this.conversationsTotalState.set(page.total);\n }\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(this.activeIdState(), error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.conversationsLoadingState.set(false);\n }\n }\n }\n\n /** Chooses the agent for the next new conversation. Switching away from the open conversation's agent starts a new one. */\n selectAgent(agentId: string): void {\n if (!this.agents().some(agent => agent.id === agentId)) {\n return;\n }\n\n this.selectedAgentIdState.set(agentId);\n this.uiState.update({ agentId });\n const active = this.activeConversation();\n if (active && active.agentId !== agentId) {\n this.startNewConversation();\n }\n }\n\n /**\n * Leaves the open conversation; the next message creates a new one. Turns of other\n * conversations keep running in the background.\n */\n startNewConversation(): void {\n this.activeIdState.set(null);\n this.uiState.update({ conversationId: null });\n this.draftErrorState.set(null);\n }\n\n /** Opens a conversation; one that this tab already follows opens immediately. */\n async openConversation(conversationId: string): Promise<void> {\n await this.loadConversation(conversationId, false);\n }\n\n /** Tells the store whether the user can see the open thread, so it can mark it as read. */\n setViewing(viewing: boolean): void {\n this.viewingState.set(viewing);\n }\n\n async deleteConversation(conversationId: string): Promise<void> {\n if (this.sessionsState().get(conversationId)?.streaming) {\n return;\n }\n\n const revision = this.accountRevision;\n try {\n await firstValueFrom(this.api.deleteConversation(conversationId), { defaultValue: undefined });\n if (revision !== this.accountRevision) {\n return;\n }\n this.forget(conversationId);\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(this.activeIdState(), error);\n }\n }\n }\n\n /**\n * Sends a user message. Creates a conversation with the selected agent when none is open,\n * shows the message optimistically and applies the streamed events. Other conversations keep\n * their own turns. Resolves `false` when the message was not accepted. `files` are uploaded\n * attachments, such as `attachedFiles()`; once the message is accepted, the attachments of the\n * conversation leave the composer.\n */\n async send(text: string, files: readonly FileReference[] = []): Promise<boolean> {\n // Browsers only ask for notification permission during a user action such as this one.\n void this.push.onUserGesture().catch(() => undefined);\n return this.sendMessage(text, undefined, files);\n }\n\n /**\n * Sends immediately when the conversation accepts a message, otherwise appends to the\n * conversation's FIFO queue. A shown error alone does not hold a message back while nothing is\n * queued: the person asks again, for example after a failed turn. Queued messages still wait\n * for an explicit `resumeQueue` after Stop or a failure. A queued message keeps its `files`.\n */\n async submit(text: string, files: readonly FileReference[] = []): Promise<boolean> {\n const stopped = this.pausedQueuesState().has(this.activeIdState() ?? newConversationKey);\n if (this.canSend() && this.queuedMessages().length === 0 && !stopped && !this.submittingState()) {\n const revision = this.accountRevision;\n this.submittingState.set(true);\n try {\n return await this.send(text, files);\n } finally {\n if (revision === this.accountRevision && !this.destroyed) {\n this.submittingState.set(false);\n }\n }\n }\n const conversationId = this.activeIdState();\n const trimmed = text.trim();\n if (!conversationId || !this.canSubmit() || !trimmed || trimmed.length > (this.limits()?.maxMessageChars ?? Infinity)) {\n return false;\n }\n void this.push.onUserGesture().catch(() => undefined);\n const revision = this.accountRevision;\n const item: QueuedMessage = {\n id: createClientMessageId(),\n conversationId,\n text: trimmed,\n state: 'preparing',\n ...(files.length > 0 ? { files: [...files] } : {})\n };\n this.queuedState.update(items => [...items, item]);\n this.releaseAttachments(conversationId, files);\n const clientContext = await this.contextForMessage();\n if (revision !== this.accountRevision || this.destroyed) {\n return false;\n }\n this.queuedState.update(items => items.map(current => current.id === item.id\n ? { ...current, state: 'queued', clientContext } : current));\n return true;\n }\n\n /** Edits an unsent queued message without replacing the composer's current draft. */\n updateQueuedMessage(id: string, text: string): boolean {\n const trimmed = text.trim();\n if (!trimmed || trimmed.length > (this.limits()?.maxMessageChars ?? Infinity)\n || !this.queuedMessages().some(item => item.id === id && item.state !== 'sending')) {\n return false;\n }\n this.queuedState.update(items => items.map(item => item.id === id ? { ...item, text: trimmed } : item));\n return true;\n }\n\n removeQueuedMessage(id: string): void {\n this.queuedState.update(items => items.filter(item => item.id !== id\n || item.conversationId !== this.activeIdState() || item.state === 'sending'));\n }\n\n /** Pauses automatic dispatch while keeping all unsent messages available. */\n pauseQueue(): void {\n const conversationId = this.activeIdState();\n if (conversationId) {\n this.pausedQueuesState.update(paused => new Set([...paused, conversationId]));\n }\n }\n\n /** Explicitly resumes after Stop or a failure; approval decisions remain separate. */\n resumeQueue(): void {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return;\n }\n this.pausedQueuesState.update(paused => new Set([...paused].filter(id => id !== conversationId)));\n this.patchSession(conversationId, session => ({ ...session, error: null }));\n this.queuedState.update(items => items.map(item => item.conversationId === conversationId && item.state === 'failed'\n ? { ...item, state: 'queued' } : item));\n }\n\n /** Prioritizes a queued correction and waits for confirmed cancellation before dispatch. */\n async steerQueuedMessage(id: string): Promise<void> {\n const item = this.queuedState().find(message => message.id === id && message.conversationId === this.activeIdState());\n if (!item || item.state !== 'queued' || !this.canSteer()) {\n return;\n }\n this.steeringState.set(id);\n this.queuedState.update(items => [item, ...items.filter(message => message.id !== id)]);\n this.resumeQueue();\n try {\n await this.cancelConversation(item.conversationId);\n } finally {\n if (this.steeringState() === id && this.sessionsState().get(item.conversationId)?.error) {\n this.steeringState.set(null);\n }\n }\n }\n\n private async dispatchQueued(item: QueuedMessage): Promise<void> {\n const revision = this.accountRevision;\n this.queueDispatchState.set(item.id);\n this.queuedState.update(items => items.map(current => current.id === item.id ? { ...current, state: 'sending' } : current));\n const accepted = await this.sendMessage(item.text, item, item.files ?? []);\n if (revision !== this.accountRevision || this.destroyed) {\n return;\n }\n this.queuedState.update(items => accepted ? items.filter(current => current.id !== item.id)\n : items.map(current => current.id === item.id ? { ...current, state: 'failed' } : current));\n if (!accepted) {\n this.pausedQueuesState.update(paused => new Set([...paused, item.conversationId]));\n }\n this.queueDispatchState.set(null);\n }\n\n private async sendMessage(text: string, queued: QueuedMessage | undefined, files: readonly FileReference[]): Promise<boolean> {\n const trimmed = text.trim();\n const accountRevision = this.accountRevision;\n await this.initialize();\n await this.reloadStatus();\n if (accountRevision !== this.accountRevision || this.destroyed) {\n return false;\n }\n let conversation = queued ? this.sessionsState().get(queued.conversationId)?.conversation ?? null : this.activeConversation();\n const session = queued ? this.sessionsState().get(queued.conversationId) : null;\n const available = queued ? this.enabled() && !this.pausedQueuesState().has(queued.conversationId)\n && acceptsMessage(conversation, this.clockState()) && !session?.streaming\n && !session?.deciding && this.agents().some(agent => agent.id === conversation?.agentId) : this.canSend();\n const maxChars = this.limits()?.maxMessageChars ?? Number.MAX_SAFE_INTEGER;\n if (trimmed.length === 0 || trimmed.length > maxChars || !available) {\n return false;\n }\n\n this.sendingState.set(conversation?.id ?? newConversationKey);\n if (!queued) {\n this.restoredDraftState.set(null);\n }\n this.draftErrorState.set(null);\n\n if (!conversation) {\n conversation = await this.createConversation();\n if (!conversation) {\n if (accountRevision === this.accountRevision) {\n this.sendingState.set(null);\n this.restoredDraftState.set(text);\n }\n return false;\n }\n this.sendingState.set(conversation.id);\n }\n\n const clientContext = queued ? queued.clientContext : await this.contextForMessage();\n if (accountRevision !== this.accountRevision) {\n return false;\n }\n const conversationId = conversation.id;\n const clientMessageId = createClientMessageId();\n const previousStatus = conversation.status;\n // A chat accepts a message while it waits only when the wait passed its lifetime; the server then\n // closes what it waited for, which the client reads again once the turn ended.\n const closesWait = previousStatus === 'waiting-for-approval';\n const parts: MessagePart[] = [\n { type: 'text', text: trimmed },\n ...files.map(file => ({ type: 'file' as const, name: file.name, mediaType: file.mediaType, size: file.size }))\n ];\n this.patchSession(conversationId, session => ({\n ...session,\n error: null,\n notice: null,\n conversation: {\n ...session.conversation,\n status: 'running',\n messages: [\n ...session.conversation.messages,\n {\n id: clientMessageId,\n role: 'user',\n createdAt: new Date().toISOString(),\n parts,\n authorActorId: session.conversation.currentActorId ?? null\n }\n ]\n }\n }));\n this.patchSummary(conversationId, { status: 'running', updatedAt: new Date().toISOString() });\n\n return new Promise<boolean>(resolve => {\n this.pendingSendResolves.set(conversationId, resolve);\n let started = false;\n let failedAfterStart = false;\n let waitsForRun = false;\n\n this.runStream(conversationId, this.api.sendMessage(conversationId, {\n text: trimmed,\n clientMessageId,\n ...(clientContext === undefined ? {} : { clientContext }),\n ...(files.length > 0 ? { files: [...files] } : {})\n }), {\n next: event => {\n if (event.type === 'message.queued') {\n // An agent's run works in the thread: the message, with its files, waits for the next run,\n // which adds it to the thread. Until then the notice says so.\n waitsForRun = true;\n this.removeMessage(conversationId, clientMessageId, previousStatus);\n this.releaseAttachments(conversationId, files);\n this.patchSession(conversationId, session => ({ ...session, notice: messageQueuedNotice(files.length) }));\n resolve(true);\n return;\n }\n if (event.type === 'error' && !started) {\n this.removeMessage(conversationId, clientMessageId, previousStatus);\n if (!queued && this.activeIdState() === conversationId) {\n this.restoredDraftState.set(text);\n }\n this.patchSession(conversationId, session => ({ ...session, error: event.data }));\n resolve(false);\n return;\n }\n\n if (event.type === 'turn.started') {\n started = true;\n // The message carries the files now; they leave the composer.\n this.releaseAttachments(conversationId, files);\n resolve(true);\n }\n if (event.type === 'error') {\n failedAfterStart = true;\n }\n\n this.applyEvent(conversationId, event, clientMessageId);\n },\n complete: () => {\n this.pendingSendResolves.delete(conversationId);\n resolve(started || waitsForRun);\n // A waiting message started no turn here: the thread's own state comes from the server, as\n // does the question or approval that an expired wait closed.\n this.afterTurn(conversationId, failedAfterStart || waitsForRun || closesWait);\n }\n });\n this.sendingState.set(null);\n });\n }\n\n /**\n * Approves or rejects an approval of the open conversation: `approvalId`, or the pending approval\n * when it is left out. A proposal of an agent's run is decided with its proposal hash through the\n * agent-run endpoint; other approvals resume their turn as a stream. `leave` leaves a consulted\n * agent's proposal that has a `consultation.leaveRoute` for the subject's approvers; it resumes the\n * turn like a decision and reads the conversation again, which then names the proposal that waits\n * at the subject. Ignores calls the current user may not make, `leave` for other approvals and\n * repeated calls while a decision is in flight.\n */\n decide(decision: ApprovalDecision, reason?: string, approvalId?: string): void {\n const session = this.activeSession();\n const conversation = session?.conversation;\n if (!session || !conversation || session.deciding || session.streaming) {\n return;\n }\n const approval = approvalId\n ? pendingApprovalParts(conversation).find(part => part.approvalId === approvalId) ?? null\n : conversation.pendingApproval;\n if (!approval || this.approvalRights().get(approval.approvalId)?.canDecide !== true) {\n return;\n }\n\n if (decision === 'leave' && !approval.consultation?.leaveRoute) {\n // Only a consulted agent's proposal with a route at the subject can be left for its approvers.\n return;\n }\n\n const proposal = conversation.thread?.decisions.find(item => item.approvalId === approval.approvalId);\n if (proposal?.runId) {\n if (decision !== 'leave') {\n void this.decideProposal(conversation.id, approval, decision, reason);\n }\n return;\n }\n if (conversation.pendingApproval?.approvalId !== approval.approvalId) {\n // Only the approval the conversation waits for resumes a turn.\n return;\n }\n\n const conversationId = conversation.id;\n this.patchSession(conversationId, current => ({ ...current, deciding: true, error: null, notice: null }));\n\n let accepted = false;\n let failed = false;\n const request = { decision, expectedProposalHash: approval.proposalHash, ...(reason ? { reason } : {}) };\n\n this.runStream(conversationId, this.api.decideApproval(conversationId, approval.approvalId, request), {\n next: event => {\n if (!accepted && event.type !== 'error') {\n accepted = true;\n this.patchSession(conversationId, current => ({\n ...current,\n conversation: applyNhAssistantApprovalDecision(current.conversation, approval.approvalId, decision)\n }));\n }\n if (event.type === 'error') {\n failed = true;\n if (!accepted) {\n this.patchSession(conversationId, current => ({ ...current, error: event.data }));\n return;\n }\n }\n\n this.applyEvent(conversationId, event);\n },\n complete: () => {\n this.patchSession(conversationId, current => ({ ...current, deciding: false }));\n // A proposal left for the subject's approvers names the one that waits there only once read again.\n this.afterTurn(conversationId, failed || decision === 'leave');\n }\n });\n }\n\n /**\n * Answers the question the open chat waits for with the choice at `choice` and streams the resumed\n * turn, as a decision does. Ignores another question, a question addressed to someone else, a choice\n * the question does not offer and calls while a turn or a decision is in flight. A refused answer,\n * such as an expired question, shows its error and reads the conversation again.\n */\n answerQuestion(questionId: string, choice: number): void {\n const session = this.activeSession();\n const conversation = session?.conversation;\n if (!session || !conversation || session.deciding || session.streaming || !this.canAnswer()) {\n return;\n }\n const question = conversation.pendingQuestion;\n if (!question || question.questionId !== questionId || !Number.isInteger(choice) || choice < 0 || choice >= question.choices.length) {\n return;\n }\n\n const conversationId = conversation.id;\n this.patchSession(conversationId, current => ({ ...current, deciding: true, error: null, notice: null }));\n\n let accepted = false;\n let failed = false;\n this.runStream(conversationId, this.api.answerQuestion(conversationId, questionId, { choice }), {\n next: event => {\n if (!accepted && event.type !== 'error') {\n accepted = true;\n this.patchSession(conversationId, current => ({\n ...current,\n conversation: applyNhAssistantQuestionAnswer(current.conversation, questionId, choice)\n }));\n }\n if (event.type === 'error') {\n failed = true;\n if (!accepted) {\n this.patchSession(conversationId, current => ({ ...current, error: event.data }));\n return;\n }\n }\n\n this.applyEvent(conversationId, event);\n },\n complete: () => {\n this.patchSession(conversationId, current => ({ ...current, deciding: false }));\n // An expired question released the conversation; reading it again shows that.\n this.afterTurn(conversationId, failed);\n }\n });\n }\n\n /**\n * Decides a proposal of an agent's run with `POST approvals/{id}/decisions`. An approved deferred\n * proposal executes later as a background operation; an inline one wakes the waiting run. The\n * reloaded snapshot shows the outcome and the proposals that remain open.\n */\n private async decideProposal(\n conversationId: string,\n approval: ApprovalPart,\n decision: AgentProposalDecision,\n reason?: string\n ): Promise<void> {\n const revision = this.accountRevision;\n this.patchSession(conversationId, session => ({ ...session, deciding: true, error: null, notice: null }));\n try {\n const proposal = await firstValueFrom(this.agentRuns.decide(approval, decision, reason));\n if (revision === this.accountRevision) {\n if (decision === 'reject' && proposal.status === 'rejected' && proposal.canGiveFeedback === true) {\n this.feedbackApprovalsState.update(approvals => new Set(approvals).add(approval.approvalId));\n }\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: applyProposalDecision(session.conversation, approval.approvalId, proposal.status)\n }));\n }\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(conversationId, error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.patchSession(conversationId, session => ({ ...session, deciding: false }));\n await this.reloadSession(conversationId);\n }\n }\n }\n\n /**\n * Resolves an uncertain hand-off in the open chat that the current user approved (`canResolve`):\n * `hand-to-application` hands it to the application again with a new report deadline,\n * `mark-resolved` confirms its outcome. The conversation the server returns replaces the shown one.\n * Ignores approvals the user may not resolve and calls while a decision or a turn is in flight.\n */\n async resolveApproval(approvalId: string, resolution: ApprovalResolution, reason?: string): Promise<void> {\n const session = this.activeSession();\n const conversation = session?.conversation;\n if (!session || !conversation || session.deciding || session.streaming\n || !resolvableApprovalParts(conversation).some(part => part.approvalId === approvalId)) {\n return;\n }\n\n const conversationId = conversation.id;\n const revision = this.accountRevision;\n this.patchSession(conversationId, current => ({ ...current, deciding: true, error: null, notice: null }));\n try {\n const resolved = await firstValueFrom(this.api.resolveApproval(conversationId, approvalId, {\n action: resolution,\n ...(reason ? { reason } : {})\n }));\n if (revision === this.accountRevision) {\n this.upsertSession(resolved);\n }\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(conversationId, error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.patchSession(conversationId, current => ({ ...current, deciding: false }));\n }\n }\n }\n\n /** Asks the server to stop the running turn or to abandon a waiting approval of the open conversation. */\n async cancel(): Promise<void> {\n const conversationId = this.activeIdState();\n if (conversationId) {\n this.pauseQueue();\n await this.cancelConversation(conversationId);\n }\n }\n\n private async cancelConversation(conversationId: string): Promise<void> {\n const session = this.sessionsState().get(conversationId);\n const conversation = session?.conversation;\n if (!session || !conversation || (conversation.status === 'idle' && !session.streaming)) {\n return;\n }\n\n const revision = this.accountRevision;\n try {\n await firstValueFrom(this.api.cancel(conversationId), { defaultValue: undefined });\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(conversationId, error);\n }\n return;\n }\n\n if (revision !== this.accountRevision) {\n return;\n }\n\n if (!this.sessionsState().get(conversationId)?.streaming) {\n await this.reloadSession(conversationId);\n return;\n }\n\n // The server ends the stream with turn.completed(cancelled); stop waiting if it does not.\n clearTimeout(this.cancelTimers.get(conversationId));\n this.cancelTimers.set(conversationId, setTimeout(() => {\n this.cancelTimers.delete(conversationId);\n if (this.sessionsState().get(conversationId)?.streaming) {\n this.streams.get(conversationId)?.unsubscribe();\n this.streams.delete(conversationId);\n this.patchSession(conversationId, current => ({ ...current, streaming: false, deciding: false, writingMessageId: null }));\n void this.reloadSession(conversationId);\n }\n }, cancelGracePeriodMs));\n }\n\n /** Joins a shared conversation with an invitation link and opens it. Resolves `false` on failure. */\n async joinConversation(conversationId: string, token: string): Promise<boolean> {\n await this.initialize();\n const revision = this.accountRevision;\n try {\n const conversation = await firstValueFrom(this.api.joinConversation(conversationId, token));\n if (revision !== this.accountRevision) {\n return false;\n }\n this.upsertSession(conversation);\n this.setActive(conversation.id, conversation.agentId);\n void this.refreshConversations();\n return true;\n } catch (error) {\n if (revision === this.accountRevision) {\n this.startNewConversation();\n this.setError(null, error);\n }\n return false;\n }\n }\n\n /** Owner only: creates a new invitation link for the open conversation and returns its token. */\n async createShareLink(): Promise<string | null> {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return null;\n }\n try {\n const link = await firstValueFrom(this.api.createShareLink(conversationId));\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: { ...session.conversation, shareToken: link.token }\n }));\n return link.token;\n } catch (error) {\n this.setError(conversationId, error);\n return null;\n }\n }\n\n /** Owner only: the invitation link of the open conversation stops working. */\n async revokeShareLink(): Promise<boolean> {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return false;\n }\n try {\n await firstValueFrom(this.api.revokeShareLink(conversationId), { defaultValue: undefined });\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: { ...session.conversation, shareToken: null }\n }));\n return true;\n } catch (error) {\n this.setError(conversationId, error);\n return false;\n }\n }\n\n /** Owner only: searches the application's directory for people to invite to the open conversation. */\n async searchParticipantCandidates(query: string): Promise<DirectoryEntry[]> {\n const conversationId = this.activeIdState();\n if (!conversationId || query.trim().length < 2) {\n return [];\n }\n try {\n return await firstValueFrom(this.api.searchParticipantCandidates(conversationId, query.trim()));\n } catch (error) {\n this.setError(conversationId, error);\n return [];\n }\n }\n\n /** Owner only: invites a person from the directory to the open conversation. */\n async inviteParticipant(actorId: string): Promise<boolean> {\n const conversationId = this.activeIdState();\n if (!conversationId) {\n return false;\n }\n try {\n await firstValueFrom(this.api.inviteParticipant(conversationId, actorId), { defaultValue: undefined });\n await this.reloadSession(conversationId);\n return true;\n } catch (error) {\n this.setError(conversationId, error);\n return false;\n }\n }\n\n /**\n * The owner removes a participant of the open conversation; with the current user's own id a\n * participant leaves it.\n */\n async removeParticipant(actorId: string): Promise<boolean> {\n const conversation = this.activeConversation();\n if (!conversation) {\n return false;\n }\n try {\n await firstValueFrom(this.api.removeParticipant(conversation.id, actorId), { defaultValue: undefined });\n if (actorId === conversation.currentActorId) {\n this.forget(conversation.id);\n } else {\n await this.reloadSession(conversation.id);\n }\n return true;\n } catch (error) {\n this.setError(conversation.id, error);\n return false;\n }\n }\n\n clearError(): void {\n const activeId = this.activeIdState();\n if (activeId === null) {\n this.draftErrorState.set(null);\n return;\n }\n this.patchSession(activeId, session => ({ ...session, error: null }));\n }\n\n clearNotice(): void {\n const activeId = this.activeIdState();\n if (activeId !== null) {\n this.patchSession(activeId, session => ({ ...session, notice: null }));\n }\n }\n\n /** Persists only drawer visibility, never the page context or a message draft. */\n setPanelOpen(open: boolean): void {\n this.restorePanelOpenState.set(open);\n this.uiState.update({ panelOpen: open });\n }\n\n /** Reads the host's page context again so the chip shows what the next message sends. */\n async refreshPageContext(): Promise<void> {\n const revision = this.accountRevision;\n const context = await this.readPageContext();\n if (revision === this.accountRevision) {\n this.pageContextState.set(context ?? null);\n }\n }\n\n /** Leaves the page context out of the next message only, or includes it again. */\n setPageContextExcluded(excluded: boolean): void {\n this.pageContextExcludedState.set(excluded);\n }\n\n /** Returns and clears the draft of a message that was not accepted. */\n consumeRestoredDraft(): string | null {\n const draft = this.restoredDraftState();\n this.restoredDraftState.set(null);\n return draft;\n }\n\n /**\n * Attaches files to the next message of the open conversation and uploads them at once. Each\n * file is checked first against `uploads()`: the most files of one message, the accepted media\n * types and the largest size; a file that fails stays as a failed attachment with its code and\n * is never uploaded. A new conversation is created first, because an upload belongs to one.\n */\n async attach(files: readonly File[]): Promise<void> {\n const uploads = this.uploads();\n if (!uploads || files.length === 0) {\n return;\n }\n\n const revision = this.accountRevision;\n const key = this.activeIdState() ?? newConversationKey;\n let attached = this.attachmentsOf(key).filter(attachment => attachment.state !== 'failed').length;\n const added: NhAssistantAttachment[] = [];\n const pending: { attachment: NhAssistantAttachment; content: Blob }[] = [];\n for (const file of files) {\n const mediaType = nhAssistantMediaTypeOf(file, uploads.acceptedMediaTypes, uploads.mappedExtensions);\n const problem = nhAssistantFileProblem(file, mediaType, uploads, attached);\n const attachment: NhAssistantAttachment = {\n id: createClientMessageId(),\n name: file.name,\n mediaType,\n size: file.size,\n state: problem ? 'failed' : 'uploading',\n progress: 0,\n file: null,\n error: problem ? clientError(problem) : null\n };\n added.push(attachment);\n if (!problem) {\n attached++;\n // The upload declares the media type the check accepted, also when the browser gave none.\n pending.push({ attachment, content: file.slice(0, file.size, mediaType) });\n }\n }\n this.patchAttachments(key, attachments => [...attachments, ...added]);\n if (pending.length === 0) {\n return;\n }\n\n let conversationId = this.activeIdState();\n if (conversationId === null) {\n this.attachmentConversation ??= this.createConversation().finally(() => {\n this.attachmentConversation = null;\n });\n const conversation = await this.attachmentConversation;\n if (revision !== this.accountRevision || this.destroyed) {\n return;\n }\n if (!conversation) {\n const error = this.draftErrorState() ?? clientError(NhAssistantClientErrorCodes.server);\n this.patchAttachments(key, attachments => attachments.map(attachment => pending.some(item => item.attachment.id === attachment.id)\n ? { ...attachment, state: 'failed', error }\n : attachment));\n return;\n }\n conversationId = conversation.id;\n this.moveAttachments(key, conversationId);\n }\n\n for (const { attachment, content } of pending) {\n this.startUpload(conversationId, attachment, content);\n }\n }\n\n /** Removes an attachment of the next message; an upload in progress stops. */\n removeAttachment(attachmentId: string): void {\n this.uploadSubscriptions.get(attachmentId)?.unsubscribe();\n this.uploadSubscriptions.delete(attachmentId);\n this.attachmentsState.update(all => {\n const next = new Map<string, readonly NhAssistantAttachment[]>();\n for (const [key, attachments] of all) {\n const kept = attachments.filter(attachment => attachment.id !== attachmentId);\n if (kept.length > 0) {\n next.set(key, kept);\n }\n }\n return next;\n });\n }\n\n private startUpload(conversationId: string, attachment: NhAssistantAttachment, content: Blob): void {\n const revision = this.accountRevision;\n const update = (change: Partial<NhAssistantAttachment>) => {\n if (revision === this.accountRevision) {\n this.patchAttachments(conversationId, attachments => attachments.map(item => item.id === attachment.id ? { ...item, ...change } : item));\n }\n };\n const subscription = this.api.uploadFile(conversationId, content, attachment.name).subscribe({\n next: event => {\n if (event.type === 'progress') {\n update({ progress: event.total > 0 ? Math.min(1, event.loaded / event.total) : 0 });\n return;\n }\n update({ state: 'uploaded', progress: 1, file: event.file });\n },\n error: error => {\n this.uploadSubscriptions.delete(attachment.id);\n update({ state: 'failed', error: error instanceof NhAssistantApiError\n ? { code: error.code, messageKey: error.messageKey }\n : clientError(NhAssistantClientErrorCodes.server) });\n },\n complete: () => this.uploadSubscriptions.delete(attachment.id)\n });\n if (!subscription.closed) {\n this.uploadSubscriptions.set(attachment.id, subscription);\n }\n }\n\n private attachmentsOf(key: string): readonly NhAssistantAttachment[] {\n return this.attachmentsState().get(key) ?? [];\n }\n\n private patchAttachments(\n key: string,\n update: (attachments: readonly NhAssistantAttachment[]) => readonly NhAssistantAttachment[]\n ): void {\n this.attachmentsState.update(all => {\n const next = new Map(all);\n const attachments = update(all.get(key) ?? []);\n if (attachments.length > 0) {\n next.set(key, attachments);\n } else {\n next.delete(key);\n }\n return next;\n });\n }\n\n /** Moves the attachments of a new conversation to the conversation that was created for them. */\n private moveAttachments(from: string, to: string): void {\n const moving = this.attachmentsOf(from);\n this.patchAttachments(from, () => []);\n this.patchAttachments(to, attachments => [...attachments, ...moving]);\n }\n\n /**\n * The attachments a message took leave the composer, and with them the failed ones; files that\n * still upload stay for the next message.\n */\n private releaseAttachments(conversationId: string, files: readonly FileReference[]): void {\n const sent = new Set(files.map(file => file.id));\n this.patchAttachments(conversationId, attachments => attachments.filter(attachment =>\n attachment.state === 'uploading' || (attachment.state === 'uploaded' && !sent.has(attachment.file?.id ?? ''))));\n }\n\n /** Stops the uploads of a conversation, or of every conversation, and forgets their attachments. */\n private dropAttachments(conversationId?: string): void {\n for (const [key, attachments] of this.attachmentsState()) {\n if (conversationId !== undefined && key !== conversationId) {\n continue;\n }\n for (const attachment of attachments) {\n this.uploadSubscriptions.get(attachment.id)?.unsubscribe();\n this.uploadSubscriptions.delete(attachment.id);\n }\n }\n if (conversationId === undefined) {\n this.attachmentsState.set(new Map());\n } else {\n this.patchAttachments(conversationId, () => []);\n }\n }\n\n private async loadConversation(conversationId: string, restoring: boolean): Promise<void> {\n if (this.sessionsState().has(conversationId)) {\n const session = this.sessionsState().get(conversationId)!;\n const offered = this.agents().some(agent => agent.id === session.conversation.agentId);\n this.setActive(conversationId, offered ? session.conversation.agentId : undefined);\n return;\n }\n if (this.activeIdState() === conversationId) {\n return;\n }\n\n const revision = this.accountRevision;\n this.conversationLoadingState.set(true);\n this.draftErrorState.set(null);\n try {\n const conversation = await firstValueFrom(this.api.getConversation(conversationId));\n if (revision !== this.accountRevision) {\n return;\n }\n // An agent's thread about a subject opens for whoever the server lets read it, also for an\n // agent kept out of the chat, such as one run by hand; it is never chosen for a new chat.\n const offered = this.agents().some(agent => agent.id === conversation.agentId);\n if (!offered && conversation.kind !== 'thread') {\n this.uiState.update({ conversationId: null });\n return;\n }\n this.upsertSession(conversation);\n this.setActive(conversationId, offered ? conversation.agentId : undefined);\n } catch (error) {\n if (revision !== this.accountRevision) {\n return;\n }\n if (error instanceof NhAssistantApiError && (error.status === 403 || error.status === 404)) {\n this.uiState.update({ conversationId: null });\n }\n if (!restoring) {\n this.setError(null, error);\n }\n } finally {\n if (revision === this.accountRevision) {\n this.conversationLoadingState.set(false);\n }\n }\n }\n\n private setActive(conversationId: string | null, agentId?: string): void {\n this.activeIdState.set(conversationId);\n if (agentId) {\n this.selectedAgentIdState.set(agentId);\n }\n this.uiState.update(agentId ? { conversationId, agentId } : { conversationId });\n }\n\n /**\n * Page context for one message: `undefined` omits the field (no getter, getter failed or\n * invalid shape), `null` sends an explicit \"none\" (no context or left out by the user).\n */\n private async contextForMessage(): Promise<ClientContext | null | undefined> {\n if (!this.config.getPageContext) {\n return undefined;\n }\n\n if (this.pageContextExcludedState()) {\n this.pageContextExcludedState.set(false);\n return null;\n }\n\n const revision = this.accountRevision;\n const context = await this.readPageContext();\n if (revision === this.accountRevision) {\n this.pageContextState.set(context ?? null);\n }\n return context;\n }\n\n private async readPageContext(): Promise<ClientContext | null | undefined> {\n const getter = this.config.getPageContext;\n if (!getter) {\n return undefined;\n }\n\n try {\n const value = await runInInjectionContext(this.injector, () => getter());\n if (value === null || value === undefined) {\n return null;\n }\n return normalizeNhAssistantClientContext(value) ?? undefined;\n } catch {\n // A failing host getter never blocks sending; the message goes without page context.\n return undefined;\n }\n }\n\n private async startInitialization(): Promise<void> {\n const decision = this.accessPolicy.canUse();\n if (!isObservable(decision)) {\n this.accessGrantedState.set(decision);\n await this.reloadStatus();\n return;\n }\n\n await new Promise<void>(resolve => {\n this.accessSubscription = (decision as Observable<boolean>).subscribe({\n next: granted => {\n this.accessGrantedState.set(granted);\n void this.reloadStatus().finally(() => resolve());\n },\n error: () => {\n this.accessGrantedState.set(false);\n resolve();\n },\n complete: () => resolve()\n });\n });\n }\n\n /** Connects live updates and notifications once per account and server configuration. */\n private startCollaboration(status: AssistantStatus): void {\n const collaboration = status.collaboration ?? null;\n const key = `${this.accountRevision}|${collaboration?.hubPath ?? ''}|${collaboration?.push === true}`;\n if (key === this.collaborationKey) {\n return;\n }\n const accountChanged = this.collaborationKey?.split('|')[0] !== String(this.accountRevision);\n this.collaborationKey = key;\n void this.live.connect(collaboration?.hubPath ?? null, accountChanged);\n void this.push.activate(collaboration?.push === true);\n }\n\n /** Forgets everything about the previous account: turns, conversations, live updates and push. */\n private resetAccount(): void {\n this.accountRevision++;\n this.collaborationKey = null;\n this.stopAllTurns();\n this.sessionsState.set(new Map());\n this.activeIdState.set(null);\n this.conversationsState.set([]);\n this.conversationsTotalState.set(0);\n this.conversationLoadingState.set(false);\n this.conversationsLoadingState.set(false);\n this.pageContextState.set(null);\n this.pageContextExcludedState.set(false);\n this.restoredDraftState.set(null);\n this.draftErrorState.set(null);\n this.sendingState.set(null);\n this.queuedState.set([]);\n this.pausedQueuesState.set(new Set());\n this.queueDispatchState.set(null);\n this.steeringState.set(null);\n this.submittingState.set(false);\n this.feedbackApprovalsState.set(new Set());\n this.dropAttachments();\n this.attachmentConversation = null;\n this.clearAgentWorkTimers();\n void this.live.stop();\n void this.push.deactivate().catch(() => undefined);\n }\n\n private async createConversation(): Promise<Conversation | null> {\n const agentId = this.selectedAgentIdState();\n if (!agentId) {\n return null;\n }\n\n const revision = this.accountRevision;\n try {\n const conversation = await firstValueFrom(this.api.createConversation({ agentId }));\n if (revision !== this.accountRevision) {\n return null;\n }\n this.upsertSession(conversation);\n this.setActive(conversation.id);\n this.conversationsState.update(items => [toSummary(conversation), ...items.filter(item => item.id !== conversation.id)]);\n this.conversationsTotalState.update(total => total + 1);\n return conversation;\n } catch (error) {\n if (revision === this.accountRevision) {\n this.setError(null, error);\n }\n return null;\n }\n }\n\n private runStream<TEvent extends NhAssistantMessageEvent>(\n conversationId: string,\n stream: Observable<TEvent>,\n handlers: { next: (event: TEvent) => void; complete: () => void }\n ): void {\n this.streams.get(conversationId)?.unsubscribe();\n this.patchSession(conversationId, session => ({ ...session, streaming: true, writingMessageId: null }));\n\n const finish = () => {\n clearTimeout(this.cancelTimers.get(conversationId));\n this.cancelTimers.delete(conversationId);\n this.streams.delete(conversationId);\n this.patchSession(conversationId, session => ({ ...session, streaming: false, writingMessageId: null }));\n handlers.complete();\n };\n\n const subscription = stream.subscribe({\n next: event => handlers.next(event),\n error: () => {\n this.patchSession(conversationId, session => ({ ...session, error: clientError(NhAssistantClientErrorCodes.network) }));\n finish();\n },\n complete: finish\n });\n if (!subscription.closed) {\n this.streams.set(conversationId, subscription);\n }\n }\n\n private stopAllTurns(): void {\n for (const subscription of this.streams.values()) {\n subscription.unsubscribe();\n }\n this.streams.clear();\n for (const resolve of this.pendingSendResolves.values()) {\n resolve(false);\n }\n this.pendingSendResolves.clear();\n for (const timer of this.cancelTimers.values()) {\n clearTimeout(timer);\n }\n this.cancelTimers.clear();\n }\n\n private applyEvent(conversationId: string, event: NhAssistantSseEvent, clientMessageId?: string): void {\n this.patchSession(conversationId, session => {\n const conversation = applyNhAssistantEvent(session.conversation, event, clientMessageId);\n let { error, notice, lastUsage } = session;\n if (event.type === 'error') {\n error = event.data;\n }\n if (event.type === 'turn.completed') {\n lastUsage = event.data.usage;\n if (event.data.status === 'failed') {\n error = clientError(event.data.errorCode ?? NhAssistantClientErrorCodes.server);\n } else if (event.data.status === 'completed') {\n notice = completionNotice(conversation, event.data.errorCode);\n }\n }\n return { ...session, conversation, error, notice, lastUsage, writingMessageId: writingAnswerAfter(session.writingMessageId, event) };\n });\n }\n\n private afterTurn(conversationId: string, reload: boolean): void {\n const session = this.sessionsState().get(conversationId);\n if (session) {\n const status = session.conversation.status;\n this.patchSummary(conversationId, summary => ({\n ...summary,\n status,\n updatedAt: new Date().toISOString(),\n activeActorId: status === 'waiting-for-approval' ? summary.activeActorId ?? session.conversation.currentActorId ?? null : null\n }));\n }\n\n if (reload) {\n void this.reloadSession(conversationId);\n }\n // The list carries the exact title, latest message and read position of the finished turn.\n void this.refreshConversations();\n }\n\n private async reloadSession(conversationId: string): Promise<void> {\n const revision = this.accountRevision;\n try {\n const conversation = await firstValueFrom(this.api.getConversation(conversationId));\n const session = this.sessionsState().get(conversationId);\n if (revision === this.accountRevision && session && !session.streaming) {\n this.upsertSession(conversation);\n }\n } catch (error) {\n if (error instanceof NhAssistantApiError && (error.status === 403 || error.status === 404)) {\n this.forget(conversationId);\n }\n // Otherwise keep the local state; the error of the turn is already shown.\n }\n }\n\n private markActiveReadWhenSeen(): void {\n const conversationId = this.activeIdState();\n if (!conversationId || !this.viewingState() || !this.pageVisibleState() || this.markingRead.has(conversationId)) {\n return;\n }\n const session = this.sessionsState().get(conversationId);\n const summary = this.conversationsState().find(item => item.id === conversationId);\n if (!session || session.streaming || !summary || !nhAssistantIsUnread(summary)) {\n return;\n }\n\n this.markingRead.add(conversationId);\n const revision = this.accountRevision;\n let request: Observable<void>;\n try {\n request = this.api.markRead(conversationId);\n } catch {\n this.markingRead.delete(conversationId);\n return;\n }\n firstValueFrom(request, { defaultValue: undefined })\n .then(() => {\n if (revision === this.accountRevision) {\n this.patchSummary(conversationId, item => ({ ...item, lastReadSequence: item.lastMessageSequence ?? item.lastReadSequence }));\n }\n })\n .catch(() => undefined)\n .finally(() => this.markingRead.delete(conversationId));\n }\n\n private onLiveChanged(change: LiveConversationChanged): void {\n const known = this.conversationsState().some(item => item.id === change.conversationId);\n if (!known) {\n this.scheduleRefresh();\n } else {\n this.patchSummary(change.conversationId, summary => ({\n ...summary,\n status: change.status,\n title: change.title,\n updatedAt: change.updatedAt,\n activeActorId: change.activeActorId,\n lastMessageSequence: Math.max(summary.lastMessageSequence ?? 0, change.lastMessageSequence),\n participantCount: change.participantCount\n }));\n }\n\n const session = this.sessionsState().get(change.conversationId);\n if (!session || session.streaming) {\n return;\n }\n const wasRunning = session.conversation.status === 'running';\n this.patchSession(change.conversationId, current => ({\n ...current,\n conversation: applyNhAssistantConversationChange(current.conversation, change),\n writingMessageId: change.status === 'running' ? current.writingMessageId : null\n }));\n if (wasRunning && change.status !== 'running') {\n // Another session ended its turn; the snapshot holds the exact answer and approvals.\n void this.reloadSession(change.conversationId);\n } else if (session.conversation.participantCount !== change.participantCount) {\n void this.reloadSession(change.conversationId);\n }\n }\n\n private onLiveRead(read: LiveConversationRead): void {\n this.patchSummary(read.conversationId, summary => ({\n ...summary,\n lastReadSequence: Math.max(summary.lastReadSequence ?? 0, read.lastReadSequence)\n }));\n }\n\n private onLiveRemoved(removed: LiveConversationRemoved): void {\n const wasActive = this.activeIdState() === removed.conversationId;\n this.forget(removed.conversationId);\n if (wasActive) {\n this.draftErrorState.set(clientError(NhAssistantClientErrorCodes.conversationRemoved));\n }\n }\n\n /**\n * Applies a live turn event or message to a conversation this tab shows. While the tab streams a\n * turn of the conversation, its stream brings the turn's events and its own message, so it applies\n * only messages that others stored meanwhile: the application's and other people's.\n */\n private onLiveEvent(event: LiveConversationEvent): void {\n const session = this.sessionsState().get(event.conversationId);\n if (event.type === 'turn.started') {\n this.patchSummary(event.conversationId, summary => ({ ...summary, status: 'running', activeActorId: event.actorId }));\n }\n if (!session) {\n return;\n }\n if (session.streaming && !isMessageOfOthers(session.conversation, event)) {\n return;\n }\n this.patchSession(event.conversationId, current => ({\n ...current,\n conversation: applyNhAssistantLiveEvent(current.conversation, event),\n // A turn this tab follows live names its answer; while the tab streams, its stream does.\n writingMessageId: current.streaming ? current.writingMessageId : writingAnswerAfter(current.writingMessageId, event)\n }));\n }\n\n /**\n * A run or proposal of an agent thread changed, for example a colleague decided a proposal in the\n * inbox: reload the thread when this tab has it open, so its approval cards show the decision.\n * A burst of updates reloads once. Feedback does not change the thread.\n */\n private onLiveAgentWork(change: LiveAgentWorkChanged): void {\n const conversationId = change.conversationId;\n const session = this.sessionsState().get(conversationId);\n if (change.reason === 'feedback' || !session || session.streaming) {\n return;\n }\n\n clearTimeout(this.agentWorkTimers.get(conversationId));\n this.agentWorkTimers.set(conversationId, setTimeout(() => {\n this.agentWorkTimers.delete(conversationId);\n const current = this.sessionsState().get(conversationId);\n // A decision of this tab reloads the thread itself when it ends.\n if (current && !current.streaming && !current.deciding) {\n void this.reloadSession(conversationId);\n }\n }, refreshDelayMs));\n }\n\n private clearAgentWorkTimers(): void {\n for (const timer of this.agentWorkTimers.values()) {\n clearTimeout(timer);\n }\n this.agentWorkTimers.clear();\n }\n\n /** After a reconnect: updates sent while disconnected are lost, so reload what is shown. */\n private resync(): void {\n if (!this.enabled()) {\n return;\n }\n void this.refreshConversations();\n for (const [conversationId, session] of this.sessionsState()) {\n if (!session.streaming) {\n void this.reloadSession(conversationId);\n }\n }\n }\n\n private scheduleRefresh(): void {\n clearTimeout(this.refreshTimer);\n this.refreshTimer = setTimeout(() => void this.refreshConversations(), refreshDelayMs);\n }\n\n /** Stores a snapshot, keeping at most `maxSessions` idle conversations in memory. */\n private upsertSession(conversation: Conversation): void {\n this.sessionsState.update(sessions => {\n const next = new Map(sessions);\n const existing = next.get(conversation.id);\n next.set(conversation.id, existing\n ? { ...existing, conversation, writingMessageId: conversation.status === 'running' ? existing.writingMessageId : null }\n : { conversation, streaming: false, deciding: false, error: null, notice: null, lastUsage: null, writingMessageId: null });\n if (next.size > maxSessions) {\n const activeId = this.activeIdState();\n for (const [id, session] of next) {\n if (next.size <= maxSessions) {\n break;\n }\n if (id !== activeId && id !== conversation.id && !session.streaming\n && !this.queuedState().some(item => item.conversationId === id)) {\n next.delete(id);\n }\n }\n }\n return next;\n });\n this.patchSummary(conversation.id, summary => ({\n ...summary,\n title: conversation.title,\n status: conversation.status,\n updatedAt: conversation.updatedAt,\n ...(conversation.lastMessageSequence === undefined ? {} : { lastMessageSequence: conversation.lastMessageSequence }),\n ...(conversation.lastReadSequence === undefined ? {} : { lastReadSequence: conversation.lastReadSequence }),\n ...(conversation.activeActorId === undefined ? {} : { activeActorId: conversation.activeActorId }),\n ...(conversation.members === undefined ? {} : { participantCount: Math.max(0, conversation.members.length - 1) })\n }));\n }\n\n private patchSession(conversationId: string, update: (session: NhAssistantSession) => NhAssistantSession): void {\n const session = this.sessionsState().get(conversationId);\n if (!session) {\n return;\n }\n this.sessionsState.update(sessions => new Map(sessions).set(conversationId, update(session)));\n }\n\n private patchSummary(\n conversationId: string,\n update: Partial<ConversationSummary> | ((summary: ConversationSummary) => ConversationSummary)\n ): void {\n this.conversationsState.update(items => items.map(item => {\n if (item.id !== conversationId) {\n return item;\n }\n return typeof update === 'function' ? update(item) : { ...item, ...update };\n }));\n }\n\n /**\n * Keeps local knowledge when the list is reloaded: the status of turns this tab streams, and a\n * read position the server already confirmed, which a list response sent earlier may not show.\n */\n private withLocalState(summary: ConversationSummary): ConversationSummary {\n const session = this.sessionsState().get(summary.id);\n const known = this.conversationsState().find(item => item.id === summary.id)?.lastReadSequence;\n const lastReadSequence = known !== undefined && summary.lastReadSequence !== undefined\n ? Math.max(known, summary.lastReadSequence)\n : summary.lastReadSequence;\n return {\n ...summary,\n lastReadSequence,\n status: session?.streaming ? session.conversation.status : summary.status\n };\n }\n\n /** Removes a deleted, left or inaccessible conversation everywhere. */\n private forget(conversationId: string): void {\n this.dropAttachments(conversationId);\n this.queuedState.update(items => items.filter(item => item.conversationId !== conversationId));\n this.pausedQueuesState.update(paused => new Set([...paused].filter(id => id !== conversationId)));\n this.streams.get(conversationId)?.unsubscribe();\n this.streams.delete(conversationId);\n this.sessionsState.update(sessions => {\n const next = new Map(sessions);\n next.delete(conversationId);\n return next;\n });\n const before = this.conversationsState().length;\n this.conversationsState.update(items => items.filter(item => item.id !== conversationId));\n if (this.conversationsState().length < before) {\n this.conversationsTotalState.update(total => Math.max(0, total - 1));\n }\n if (this.activeIdState() === conversationId) {\n this.activeIdState.set(null);\n this.uiState.update({ conversationId: null });\n }\n }\n\n private removeMessage(conversationId: string, messageId: string, status: Conversation['status']): void {\n this.patchSession(conversationId, session => ({\n ...session,\n conversation: {\n ...session.conversation,\n status,\n messages: session.conversation.messages.filter(message => message.id !== messageId)\n }\n }));\n this.patchSummary(conversationId, { status });\n }\n\n private selectInitialAgent(agents: AgentSummary[]): void {\n const current = this.selectedAgentIdState();\n if (current && agents.some(agent => agent.id === current)) {\n return;\n }\n\n const preferred = agents.find(agent => agent.id === this.config.defaultAgentId) ?? agents[0] ?? null;\n this.selectedAgentIdState.set(preferred?.id ?? null);\n this.uiState.update({ agentId: preferred?.id ?? null });\n }\n\n /** Shows an error on a conversation, or on the new-conversation view for `null`. */\n private setError(conversationId: string | null, error: unknown): void {\n const value = error instanceof NhAssistantApiError\n ? { code: error.code, messageKey: error.messageKey }\n : clientError(NhAssistantClientErrorCodes.server);\n if (conversationId === null || !this.sessionsState().has(conversationId)) {\n this.draftErrorState.set(value);\n return;\n }\n this.patchSession(conversationId, session => ({ ...session, error: value }));\n }\n}\n\nfunction clientError(code: string): NhAssistantError {\n return { code, messageKey: nhAssistantErrorMessageKey(code) };\n}\n\n/**\n * The notice of a message that waits for the next run of the agent working in the thread, with its\n * files when it carries any; the run adds the message to the thread when it takes it.\n */\nfunction messageQueuedNotice(fileCount: number): NhAssistantNotice {\n return {\n code: NH_ASSISTANT_MESSAGE_QUEUED_NOTICE_CODE,\n messageKey: fileCount > 0 ? 'nh-assistant.notices.message-queued-with-files' : 'nh-assistant.notices.message-queued'\n };\n}\n\n/**\n * The answer a turn writes after `event`: `turn.started` names it, `turn.completed` and `error` end\n * the turn, and every other event leaves it as it is.\n */\nfunction writingAnswerAfter(current: string | null, event: { type: string; data: unknown }): string | null {\n switch (event.type) {\n case 'turn.started':\n return (event.data as { assistantMessageId?: string } | null)?.assistantMessageId ?? null;\n case 'turn.completed':\n case 'error':\n return null;\n default:\n return current;\n }\n}\n\n/**\n * A completed turn with a server code, or without any answer text, explains itself with a notice.\n * Another person's message that arrived while the turn ran does not end this tab's turn.\n */\nfunction completionNotice(conversation: Conversation, errorCode: string | null): NhAssistantNotice | null {\n if (errorCode) {\n return clientError(errorCode);\n }\n const ownTurn = { ...conversation, messages: conversation.messages.filter(message => !isOtherPersonsMessage(conversation, message)) };\n if (!nhAssistantLatestTurnHasText(ownTurn)) {\n return { code: NH_ASSISTANT_NO_ANSWER_NOTICE_CODE, messageKey: 'nh-assistant.notices.no-answer' };\n }\n\n return null;\n}\n\n/**\n * True for a live `message.created` of a message that this tab did not write: the application's, or\n * a user message of another writer. A user message is this tab's own when the current user wrote it,\n * and when the tab does not know the current user, so a turn's own message never shows twice.\n */\nfunction isMessageOfOthers(conversation: Conversation, event: LiveConversationEvent): boolean {\n if (event.type !== 'message.created') {\n return false;\n }\n const message = event.data as Message | null;\n if (!message?.id) {\n return false;\n }\n if (message.role === 'application') {\n return true;\n }\n\n return message.role === 'user' && isOtherPersonsMessage(conversation, message, event.actorId);\n}\n\n/** True for a user message that a known writer other than the current user wrote. */\nfunction isOtherPersonsMessage(conversation: Conversation, message: Message, fallbackAuthor?: string): boolean {\n const author = message.authorActorId ?? fallbackAuthor;\n const currentActorId = conversation.currentActorId;\n return message.role === 'user' && !!author && !!currentActorId && author !== currentActorId;\n}\n\n/** The approvals of a conversation that still wait for a decision, each once. */\n/** Every approval of the conversation once, by approval id; later parts win. */\nfunction approvalParts(conversation: Conversation): ApprovalPart[] {\n const approvals = new Map<string, ApprovalPart>();\n for (const message of conversation.messages) {\n for (const part of message.parts) {\n if (part.type === 'approval') {\n approvals.set(part.approvalId, part);\n }\n }\n }\n return [...approvals.values()];\n}\n\n/** The uncertain hand-offs of a chat that the current user may resolve (`canResolve`). */\nfunction resolvableApprovalParts(conversation: Conversation): ApprovalPart[] {\n return conversation.messages\n .flatMap(message => message.parts)\n .filter((part): part is ApprovalPart => part.type === 'approval' && part.canResolve === true && part.status === 'execution-unknown');\n}\n\nfunction pendingApprovalParts(conversation: Conversation): ApprovalPart[] {\n const approvals = new Map<string, ApprovalPart>();\n for (const message of conversation.messages) {\n for (const part of message.parts) {\n if (part.type === 'approval' && part.status === 'pending') {\n approvals.set(part.approvalId, part);\n }\n }\n }\n if (conversation.pendingApproval?.status === 'pending') {\n approvals.set(conversation.pendingApproval.approvalId, conversation.pendingApproval);\n }\n return [...approvals.values()];\n}\n\n/**\n * Who decides an open proposal of an agent thread the caller may not decide, by the server's reason:\n * the person who consulted the agent, another approver for four-eyes, otherwise an approver.\n */\nfunction waitingForOf(reasonCode: string | null | undefined): NhAssistantApprovalWaitingFor {\n switch (reasonCode) {\n case askerDecidesCode:\n return 'asker';\n case fourEyesRequiredCode:\n return 'other-approver';\n default:\n return 'approver';\n }\n}\n\n/**\n * Shows the decision of an agent's proposal until the reloaded snapshot arrives: the approval's new\n * status, no open decision for it and, for the approval the conversation waited for, no pending one.\n */\nfunction applyProposalDecision(conversation: Conversation, approvalId: string, status: ApprovalStatus): Conversation {\n const messages = conversation.messages.map(message => ({\n ...message,\n parts: message.parts.map(part => part.type === 'approval' && part.approvalId === approvalId ? { ...part, status } : part)\n }));\n const thread = conversation.thread\n ? { ...conversation.thread, decisions: conversation.thread.decisions.filter(item => item.approvalId !== approvalId) }\n : conversation.thread;\n const pendingApproval = conversation.pendingApproval?.approvalId === approvalId ? null : conversation.pendingApproval;\n return { ...conversation, messages, thread, pendingApproval };\n}\n\nfunction toSummary(conversation: Conversation): ConversationSummary {\n return {\n id: conversation.id,\n agentId: conversation.agentId,\n title: conversation.title,\n status: conversation.status,\n createdAt: conversation.createdAt,\n updatedAt: conversation.updatedAt,\n role: conversation.role,\n participantCount: conversation.members ? Math.max(0, conversation.members.length - 1) : conversation.participantCount,\n lastMessageSequence: conversation.lastMessageSequence,\n lastReadSequence: conversation.lastReadSequence,\n activeActorId: conversation.activeActorId\n };\n}\n\nfunction createClientMessageId(): string {\n const cryptoApi = globalThis.crypto;\n if (cryptoApi?.randomUUID) {\n return cryptoApi.randomUUID();\n }\n\n const bytes = new Uint8Array(16);\n if (cryptoApi?.getRandomValues) {\n cryptoApi.getRandomValues(bytes);\n } else {\n for (let index = 0; index < bytes.length; index++) {\n bytes[index] = Math.floor(Math.random() * 256);\n }\n }\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Injectable, Injector, Signal, afterNextRender, effect, inject, signal, untracked } from '@angular/core';\nimport { Subscription, firstValueFrom } from 'rxjs';\nimport { AgentThreadLookup } from '../models/assistant-agent-run.models';\nimport { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\nimport { NhAssistantAgentRunApiService } from './nh-assistant-agent-run-api.service';\nimport { NhAssistantApiError, nhAssistantErrorMessageKey } from './nh-assistant-transport';\nimport { NhAssistantStore } from './nh-assistant.store';\n\n/** Drawer width on wider screens; below the mobile breakpoint the panel fills the screen. */\nexport const NH_ASSISTANT_PANEL_WIDTH = '420px';\nexport const NH_ASSISTANT_PANEL_MOBILE_QUERY = '(max-width: 599.98px)';\n\n/**\n * Opens and closes the assistant panel as a CDK overlay drawer on the right edge.\n * `nh-assistant-panel` registers its content once; any component can then open the panel,\n * optionally on a specific conversation. Escape closes the panel and focus returns to the\n * element that opened it.\n */\n@Injectable()\nexport class NhAssistantPanelService {\n private readonly overlay = inject(Overlay);\n private readonly store = inject(NhAssistantStore);\n private readonly agentRuns = inject(NhAssistantAgentRunApiService);\n private readonly injector = inject(Injector);\n private readonly document = inject(DOCUMENT);\n private readonly breakpoints = inject(BreakpointObserver);\n\n private readonly openState = signal(false);\n private overlayRef?: OverlayRef;\n private portal?: TemplatePortal;\n private subscriptions = new Subscription();\n private returnFocusTo: HTMLElement | null = null;\n\n readonly isOpen: Signal<boolean> = this.openState.asReadonly();\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.dispose());\n effect(() => {\n if (this.store.enabled() && this.store.restorePanelOpen() && this.portal && !this.openState()) {\n untracked(() => queueMicrotask(() => {\n if (this.portal && this.store.enabled() && this.store.restorePanelOpen() && !this.openState()) {\n this.showPanel();\n }\n }));\n }\n });\n }\n\n open(conversationId?: string): void {\n if (this.openState() && !conversationId) {\n return;\n }\n\n this.showPanel();\n void this.store.initialize().then(() => this.store.reloadStatus()).then(() => {\n if (this.openState()) {\n this.store.setPanelOpen(true);\n }\n if (conversationId) {\n void this.store.openConversation(conversationId);\n }\n });\n }\n\n /**\n * Opens the panel on the conversation with an agent about a subject, for example the intake\n * reviewer about one project. The server returns the agent's thread about the subject and creates\n * it without starting a run when it is missing; people then type in the conversation, which runs\n * a turn. Creating needs the participant role, readers may open an existing thread.\n *\n * Resolves with the lookup once the panel opens the conversation. A failure, such as\n * `assistant-subject-access-denied`, rejects with `NhAssistantApiError` and leaves the panel as\n * it is, so the caller shows the localized `messageKey` where the person asked.\n */\n async openSubject(agentId: string, subject: { type: string; id: string }): Promise<AgentThreadLookup> {\n const lookup = await firstValueFrom(this.agentRuns.openThread(agentId, subject.type, subject.id));\n const conversationId = lookup.thread?.conversationId;\n if (!conversationId) {\n const code = NhAssistantClientErrorCodes.invalidResponse;\n throw new NhAssistantApiError(200, code, nhAssistantErrorMessageKey(code));\n }\n\n this.open(conversationId);\n return lookup;\n }\n\n private showPanel(): void {\n if (this.openState()) {\n return;\n }\n\n const active = this.document.activeElement;\n this.returnFocusTo = active instanceof HTMLElement ? active : null;\n this.openState.set(true);\n this.attach();\n }\n\n close(): void {\n if (!this.openState()) {\n return;\n }\n\n this.openState.set(false);\n this.store.setPanelOpen(false);\n this.overlayRef?.detach();\n\n const target = this.returnFocusTo;\n this.returnFocusTo = null;\n if (target?.isConnected) {\n target.focus();\n }\n }\n\n toggle(): void {\n if (this.openState()) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Called by `nh-assistant-panel`; hosts should place that component once instead. */\n registerPanel(portal: TemplatePortal): void {\n this.portal = portal;\n if (this.openState()) {\n this.attach();\n } else {\n void this.store.initialize().then(() => {\n if (this.portal === portal && this.store.enabled() && this.store.restorePanelOpen()) {\n this.showPanel();\n }\n });\n }\n }\n\n unregisterPanel(portal: TemplatePortal): void {\n if (this.portal !== portal) {\n return;\n }\n\n this.overlayRef?.detach();\n this.portal = undefined;\n }\n\n private attach(): void {\n if (!this.portal || this.overlayRef?.hasAttached()) {\n return;\n }\n\n const overlayRef = this.ensureOverlay();\n overlayRef.attach(this.portal);\n this.updateSize(this.breakpoints.isMatched(NH_ASSISTANT_PANEL_MOBILE_QUERY));\n\n afterNextRender(() => {\n const target = overlayRef.overlayElement.querySelector<HTMLElement>('[data-nh-assistant-autofocus]');\n target?.focus();\n }, { injector: this.injector });\n }\n\n private ensureOverlay(): OverlayRef {\n if (this.overlayRef) {\n return this.overlayRef;\n }\n\n const overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().top('0').right('0'),\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n hasBackdrop: false,\n panelClass: 'nh-assistant-overlay-pane',\n height: '100%',\n width: NH_ASSISTANT_PANEL_WIDTH,\n maxWidth: '100vw'\n });\n\n this.subscriptions.add(overlayRef.keydownEvents().subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n }\n }));\n this.subscriptions.add(this.breakpoints.observe(NH_ASSISTANT_PANEL_MOBILE_QUERY).subscribe(state => {\n this.updateSize(state.matches);\n }));\n\n this.overlayRef = overlayRef;\n return overlayRef;\n }\n\n private updateSize(mobile: boolean): void {\n this.overlayRef?.updateSize({ width: mobile ? '100vw' : NH_ASSISTANT_PANEL_WIDTH, height: '100%' });\n }\n\n private dispose(): void {\n this.subscriptions.unsubscribe();\n this.overlayRef?.dispose();\n this.overlayRef = undefined;\n }\n}\n","import { DestroyRef, inject } from '@angular/core';\nimport { debounceTime, filter, merge } from 'rxjs';\nimport { LiveAgentWorkChanged } from '../models/assistant-live.models';\nimport { NhAssistantLiveService } from '../services/nh-assistant-live.service';\n\n/** How long a view waits for more agent-work updates before it reloads once. */\nexport const NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS = 300;\n\n/**\n * Watches the work of agents for the whole application while the calling component lives, so their\n * proposals and runs arrive as live agent-work updates although the whole application lists no\n * members (see `NhAssistantLiveService.watchAgentWork`). Call it in an injection context, for example\n * a component constructor, of a screen that shows that work, such as the approval inbox or a board.\n */\nexport function nhAssistantWatchAgentWork(): void {\n const live = inject(NhAssistantLiveService, { optional: true });\n if (!live || typeof live.watchAgentWork !== 'function') {\n return;\n }\n\n const release = live.watchAgentWork();\n inject(DestroyRef).onDestroy(() => release());\n}\n\n/**\n * Calls `reload` once a burst of live agent-work updates that `matches` has settled, and after\n * every (re)connect of the hub, because updates sent while it was disconnected are lost. Without a\n * live service or a connected hub nothing arrives and the view keeps its manual refresh. Call it in\n * an injection context, for example a component constructor; it stops when that context ends.\n */\nexport function nhAssistantReloadOnAgentWork(\n matches: (change: LiveAgentWorkChanged) => boolean,\n reload: () => void\n): void {\n const live = inject(NhAssistantLiveService, { optional: true });\n if (!live) {\n return;\n }\n\n const subscription = merge(live.agentWork$.pipe(filter(matches)), live.resync$)\n .pipe(debounceTime(NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS))\n .subscribe(() => reload());\n inject(DestroyRef).onDestroy(() => subscription.unsubscribe());\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Injectable, PLATFORM_ID, effect, inject, untracked } from '@angular/core';\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs';\nimport { AgentSubjectSummary, NH_ASSISTANT_MAX_SUBJECT_SUMMARY } from '../models/assistant-agent-run.models';\nimport { LiveAgentWorkChanged } from '../models/assistant-live.models';\nimport { NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS } from '../internal/nh-assistant-agent-work';\nimport { NhAssistantAgentRunApiService } from './nh-assistant-agent-run-api.service';\nimport { NhAssistantLiveService } from './nh-assistant-live.service';\nimport { NhAssistantStore } from './nh-assistant.store';\n\n/** Summaries kept for subjects that nobody shows any more, so a list that re-renders needs no request. */\nconst maxUnwatchedSummaries = 500;\n\ninterface SummaryEntry {\n readonly subjectType: string;\n readonly subjectId: string;\n readonly value: BehaviorSubject<AgentSubjectSummary | null>;\n watchers: number;\n queued: boolean;\n loaded: boolean;\n failed: boolean;\n /** The request whose answer the entry takes; older answers are ignored. */\n request: number;\n}\n\n/**\n * Counts of agent work per subject for badges in lists and on pages. Every summary asked for in the\n * same tick becomes one `POST subjects/{type}/summary` per subject type, in chunks of\n * `NH_ASSISTANT_MAX_SUBJECT_SUMMARY`. Results are cached per subject and shared by everyone who\n * shows it. Live agent-work updates refetch only the subjects they name, batched; a reconnect of\n * the hub refetches every subject shown. Nothing is requested on the server or while the assistant\n * is disabled or denied, and the cache clears when it becomes unavailable, for example on sign-out.\n */\n@Injectable()\nexport class NhAssistantSubjectSummaryService {\n private readonly api = inject(NhAssistantAgentRunApiService);\n private readonly store = inject(NhAssistantStore);\n private readonly live = inject(NhAssistantLiveService, { optional: true });\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly entries = new Map<string, SummaryEntry>();\n /** Subject ids per type that wait for the next request. */\n private readonly queue = new Map<string, Set<string>>();\n /** Subjects named by live updates that wait for the end of the burst. */\n private readonly changed = new Set<string>();\n private requests = new Subscription();\n private readonly liveSubscription = new Subscription();\n private flushScheduled = false;\n private changedTimer?: ReturnType<typeof setTimeout>;\n private requestRevision = 0;\n private destroyed = false;\n\n constructor() {\n effect(() => {\n const enabled = this.store.enabled();\n untracked(() => this.onAvailabilityChanged(enabled));\n });\n\n if (this.live) {\n this.liveSubscription.add(this.live.agentWork$.subscribe(change => this.onAgentWork(change)));\n this.liveSubscription.add(this.live.resync$.subscribe(() => this.refetchShown()));\n }\n\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.liveSubscription.unsubscribe();\n this.requests.unsubscribe();\n clearTimeout(this.changedTimer);\n for (const entry of this.entries.values()) {\n entry.value.complete();\n }\n this.entries.clear();\n this.queue.clear();\n });\n }\n\n /**\n * The agent work on one subject: `null` until it is known, then every update. Subscribing shows\n * the subject; summaries of subjects that are shown stay current with live updates. The request\n * starts in the next microtask, together with every other summary asked for until then.\n */\n summary(subjectType: string, subjectId: string): Observable<AgentSubjectSummary | null> {\n return new Observable<AgentSubjectSummary | null>(subscriber => {\n const entry = this.watch(subjectType, subjectId);\n const subscription = entry.value.subscribe(subscriber);\n\n return () => {\n subscription.unsubscribe();\n this.unwatch(entry);\n };\n });\n }\n\n /**\n * Fetches the summaries of these subjects again, or of every subject of the type that is shown,\n * for example after the application changed them without an agent.\n */\n refresh(subjectType: string, subjectIds?: readonly string[]): void {\n const ids = subjectIds ? new Set(subjectIds) : null;\n for (const entry of [...this.entries.values()]) {\n if (entry.subjectType !== subjectType || (ids && !ids.has(entry.subjectId))) {\n continue;\n }\n\n if (entry.watchers > 0) {\n this.enqueue(entry);\n } else {\n this.forget(entry);\n }\n }\n }\n\n private watch(subjectType: string, subjectId: string): SummaryEntry {\n const key = summaryKey(subjectType, subjectId);\n let entry = this.entries.get(key);\n if (entry) {\n // The most recently shown summaries stay longest.\n this.entries.delete(key);\n } else {\n entry = {\n subjectType,\n subjectId,\n value: new BehaviorSubject<AgentSubjectSummary | null>(null),\n watchers: 0,\n queued: false,\n loaded: false,\n failed: false,\n request: 0\n };\n }\n\n this.entries.set(key, entry);\n entry.watchers++;\n if (!entry.loaded || entry.failed) {\n this.enqueue(entry);\n }\n if (this.browser) {\n void this.store.initialize();\n }\n return entry;\n }\n\n private unwatch(entry: SummaryEntry): void {\n entry.watchers = Math.max(0, entry.watchers - 1);\n if (entry.watchers > 0) {\n return;\n }\n\n let unwatched = 0;\n for (const item of this.entries.values()) {\n if (item.watchers === 0) {\n unwatched++;\n }\n }\n for (const item of [...this.entries.values()]) {\n if (unwatched <= maxUnwatchedSummaries) {\n break;\n }\n if (item.watchers === 0) {\n this.forget(item);\n unwatched--;\n }\n }\n }\n\n private isCurrent(entry: SummaryEntry): boolean {\n return this.entries.get(summaryKey(entry.subjectType, entry.subjectId)) === entry;\n }\n\n /** Drops a summary nobody shows; the next subscriber fetches it again. */\n private forget(entry: SummaryEntry): void {\n if (this.isCurrent(entry)) {\n this.entries.delete(summaryKey(entry.subjectType, entry.subjectId));\n }\n this.queue.get(entry.subjectType)?.delete(entry.subjectId);\n entry.value.complete();\n }\n\n private enqueue(entry: SummaryEntry): void {\n if (entry.queued) {\n return;\n }\n\n entry.queued = true;\n let ids = this.queue.get(entry.subjectType);\n if (!ids) {\n ids = new Set<string>();\n this.queue.set(entry.subjectType, ids);\n }\n ids.add(entry.subjectId);\n this.scheduleFlush();\n }\n\n private scheduleFlush(): void {\n if (this.flushScheduled) {\n return;\n }\n\n this.flushScheduled = true;\n queueMicrotask(() => {\n this.flushScheduled = false;\n this.flush();\n });\n }\n\n /** Sends the queued subjects: one request per type and chunk. Waits while the assistant is unavailable. */\n private flush(): void {\n if (this.destroyed || !this.browser || !this.store.enabled()) {\n return;\n }\n\n for (const [subjectType, ids] of [...this.queue]) {\n this.queue.delete(subjectType);\n const subjectIds = [...ids];\n for (let start = 0; start < subjectIds.length; start += NH_ASSISTANT_MAX_SUBJECT_SUMMARY) {\n this.send(subjectType, subjectIds.slice(start, start + NH_ASSISTANT_MAX_SUBJECT_SUMMARY));\n }\n }\n }\n\n private send(subjectType: string, subjectIds: string[]): void {\n const revision = ++this.requestRevision;\n const entries: SummaryEntry[] = [];\n for (const subjectId of subjectIds) {\n const entry = this.entries.get(summaryKey(subjectType, subjectId));\n if (entry) {\n entry.queued = false;\n entry.request = revision;\n entries.push(entry);\n }\n }\n if (entries.length === 0) {\n return;\n }\n\n const subscription = this.api.summarizeSubjects(subjectType, entries.map(entry => entry.subjectId)).subscribe({\n next: list => {\n const items = new Map(list.items.map(item => [item.subjectId, item]));\n for (const entry of entries) {\n if (entry.request !== revision || !this.isCurrent(entry)) {\n continue;\n }\n\n entry.loaded = true;\n entry.failed = false;\n entry.value.next(items.get(entry.subjectId) ?? emptySummary(entry.subjectId));\n }\n },\n error: () => {\n // A badge without a count is better than an error in a list; the next live update,\n // reconnect or subscriber tries again.\n for (const entry of entries) {\n if (entry.request === revision) {\n entry.failed = true;\n }\n }\n }\n });\n this.requests.add(subscription);\n }\n\n private onAgentWork(change: LiveAgentWorkChanged): void {\n if (!change.subjectType || !change.subjectId) {\n return;\n }\n\n const key = summaryKey(change.subjectType, change.subjectId);\n const entry = this.entries.get(key);\n if (!entry) {\n return;\n }\n if (entry.watchers === 0) {\n this.forget(entry);\n return;\n }\n\n this.changed.add(key);\n if (this.changedTimer === undefined) {\n this.changedTimer = setTimeout(() => this.refetchChanged(), NH_ASSISTANT_AGENT_WORK_RELOAD_DELAY_MS);\n }\n }\n\n /** Refetches the shown subjects of a burst of live updates, together. */\n private refetchChanged(): void {\n this.changedTimer = undefined;\n const keys = [...this.changed];\n this.changed.clear();\n for (const key of keys) {\n const entry = this.entries.get(key);\n if (entry && entry.watchers > 0) {\n this.enqueue(entry);\n }\n }\n }\n\n /** After a reconnect updates may have been missed: refetch what is shown, forget the rest. */\n private refetchShown(): void {\n for (const entry of [...this.entries.values()]) {\n if (entry.watchers > 0) {\n this.enqueue(entry);\n } else {\n this.forget(entry);\n }\n }\n }\n\n private onAvailabilityChanged(enabled: boolean): void {\n if (enabled) {\n for (const entry of this.entries.values()) {\n if (entry.watchers > 0 && (!entry.loaded || entry.failed)) {\n this.enqueue(entry);\n }\n }\n this.scheduleFlush();\n return;\n }\n\n // Signed out, denied or disabled: no counts of a previous account may remain.\n this.requests.unsubscribe();\n this.requests = new Subscription();\n clearTimeout(this.changedTimer);\n this.changedTimer = undefined;\n this.changed.clear();\n this.queue.clear();\n for (const entry of [...this.entries.values()]) {\n if (entry.watchers === 0) {\n this.forget(entry);\n continue;\n }\n\n entry.queued = false;\n entry.loaded = false;\n entry.failed = false;\n entry.request = 0;\n if (entry.value.value !== null) {\n entry.value.next(null);\n }\n }\n }\n}\n\nfunction summaryKey(subjectType: string, subjectId: string): string {\n return `${subjectType}\\u0000${subjectId}`;\n}\n\nfunction emptySummary(subjectId: string): AgentSubjectSummary {\n return { subjectId, openProposals: 0, proposalsToDecide: 0, runActive: false };\n}\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';\nimport { NhAssistantTranslationMerger } from './i18n/nh-assistant-translations';\nimport {\n NH_ASSISTANT_ACCESS_POLICY,\n NH_ASSISTANT_CONFIG,\n NhAssistantAllowAllAccessPolicy,\n NhAssistantConfig\n} from './nh-assistant.config';\nimport { NhAssistantAdminApiService } from './services/nh-assistant-admin-api.service';\nimport { NhAssistantAgentRunApiService } from './services/nh-assistant-agent-run-api.service';\nimport { NhAssistantApiService } from './services/nh-assistant-api.service';\nimport { NhAssistantLiveService } from './services/nh-assistant-live.service';\nimport { NhAssistantMcpConnectService } from './services/nh-assistant-mcp-connect.service';\nimport { NhAssistantPushService } from './services/nh-assistant-push.service';\nimport { NhAssistantPanelService } from './services/nh-assistant-panel.service';\nimport { NhAssistantStore } from './services/nh-assistant.store';\nimport { NhAssistantSubjectSummaryService } from './services/nh-assistant-subject-summary.service';\nimport { NhAssistantUiState } from './services/nh-assistant-ui-state';\nimport { NhAssistantTransport } from './services/nh-assistant-transport';\n\n/**\n * Registers the assistant client, store and panel for one application or route scope.\n * Call it once in the root providers; a route may call it again to host an isolated\n * assistant with its own configuration.\n */\nexport function provideNhAssistant(config: NhAssistantConfig): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: NH_ASSISTANT_CONFIG, useValue: config },\n { provide: NH_ASSISTANT_ACCESS_POLICY, useClass: config.accessPolicy ?? NhAssistantAllowAllAccessPolicy },\n NhAssistantTransport,\n NhAssistantApiService,\n NhAssistantAdminApiService,\n NhAssistantAgentRunApiService,\n NhAssistantLiveService,\n NhAssistantPushService,\n NhAssistantStore,\n NhAssistantUiState,\n NhAssistantPanelService,\n NhAssistantSubjectSummaryService,\n NhAssistantMcpConnectService,\n // A redirect-mode MCP authorization returns to the page with its outcome in the fragment. Every\n // outcome, a failure to complete it included, arrives in `NhAssistantMcpConnectService.returned`,\n // where the connection screens show it.\n ...(config.mcpConnectMode === 'redirect'\n ? [provideEnvironmentInitializer(() => {\n inject(NhAssistantMcpConnectService).completeReturn().subscribe();\n })]\n : []),\n ...(config.translations === 'host'\n ? []\n : [provideEnvironmentInitializer(() => inject(NhAssistantTranslationMerger).start())])\n ]);\n}\n","import { NhAssistantClientErrorCodes } from '../models/assistant-sse.models';\n\n/**\n * Failure codes the assistant back-end sends in error bodies, SSE `error` events and tool\n * result codes (`NhAssistantErrorCodes`, `NhAssistantAdminErrorCodes` and the runtime codes\n * of `NewHeap.Platform.AI.Chat`). Every code needs a text under `nh-assistant.errors.<code>`\n * in each bundled language; the translation tests enforce that.\n */\nexport const NH_ASSISTANT_SERVER_ERROR_CODES: readonly string[] = [\n // Chat endpoints and turns\n 'assistant-disabled',\n 'assistant-conversation-not-found',\n 'assistant-conversation-busy',\n 'assistant-agent-not-found',\n 'assistant-agent-forbidden',\n 'assistant-message-invalid',\n 'assistant-message-too-long',\n 'assistant-message-duplicate',\n 'assistant-title-invalid',\n 'assistant-approval-not-found',\n 'assistant-approval-not-pending',\n 'assistant-approval-decision-invalid',\n 'assistant-proposal-hash-mismatch',\n 'assistant-approval-expired',\n 'assistant-approval-invalid',\n 'assistant-approval-rejected',\n 'assistant-budget-exhausted',\n 'assistant-tool-call-limit-reached',\n 'assistant-tools-disabled',\n 'assistant-turn-timeout',\n 'assistant-model-unavailable',\n 'assistant-classification-not-permitted',\n 'assistant-model-region-denied',\n 'assistant-files-unavailable',\n 'assistant-files-not-accepted',\n 'assistant-file-reference-invalid',\n 'assistant-file-not-found',\n 'assistant-file-forbidden',\n 'assistant-file-unavailable',\n 'assistant-file-reader-failed',\n 'assistant-file-too-large',\n 'assistant-file-too-many-pages',\n 'assistant-file-count-limit',\n 'assistant-file-token-limit',\n 'assistant-file-type-not-supported',\n 'assistant-file-upload-invalid',\n 'assistant-file-type-not-accepted',\n 'assistant-file-upload-refused',\n 'assistant-file-upload-failed',\n 'assistant-file-scan-refused',\n 'assistant-turn-failed',\n 'assistant-context-unavailable',\n 'assistant-actor-mismatch',\n // Sharing and notifications\n 'assistant-owner-required',\n 'assistant-approval-forbidden',\n 'assistant-turn-forbidden',\n 'assistant-share-link-invalid',\n 'assistant-participant-not-found',\n 'assistant-participant-limit-reached',\n 'assistant-directory-unavailable',\n 'assistant-push-unavailable',\n 'assistant-push-subscription-invalid',\n 'assistant-not-allowed-while-impersonating',\n // Agent runs\n 'assistant-subject-not-found',\n 'assistant-subject-invalid',\n 'assistant-subject-type-unknown',\n 'assistant-subject-search-unavailable',\n 'assistant-agent-does-not-work-on',\n 'assistant-subject-access-denied',\n 'assistant-no-accountable-owner',\n 'assistant-agent-disabled',\n 'assistant-agent-stopped',\n 'assistant-agent-paused',\n 'assistant-agent-configured-off',\n 'assistant-run-token-limit',\n 'assistant-skill-stopped',\n 'assistant-skill-paused',\n 'assistant-agent-off',\n 'assistant-skill-off',\n 'assistant-skill-not-found',\n 'assistant-skill-not-available',\n 'assistant-skill-switch-limit',\n 'assistant-moved-to-shadow',\n 'assistant-shadow-variant',\n 'assistant-not-shadow-variant',\n 'assistant-service-account-not-used',\n 'assistant-service-account-not-found',\n 'assistant-service-account-not-permitted',\n 'assistant-skill-in-code',\n 'assistant-trigger-in-code',\n 'assistant-trigger-filter-not-found',\n 'assistant-skill-in-use',\n 'assistant-configuration-limit',\n 'assistant-run-settings-in-code',\n 'assistant-run-settings-in-use',\n 'assistant-skill-candidate-not-found',\n 'assistant-trigger-candidate-not-found',\n 'assistant-skill-version-gone',\n 'assistant-account-search-unavailable',\n 'assistant-handoff-unavailable',\n 'assistant-handoff-not-accepted',\n 'assistant-handoff-subject-unavailable',\n 'assistant-handoff-shadow-to-live',\n 'assistant-handoff-chain-limit',\n 'assistant-handoff-limit-reached',\n 'assistant-replay-not-shadow',\n 'assistant-replay-active',\n 'assistant-evaluation-not-variant',\n 'assistant-agent-not-configured',\n 'assistant-run-not-found',\n 'assistant-run-not-retryable',\n 'assistant-run-filter-invalid',\n 'assistant-run-operation-cancelled',\n 'assistant-run-operation-stalled',\n 'assistant-run-operation-ended',\n 'assistant-board-not-found',\n 'assistant-board-scope-invalid',\n 'assistant-approval-policy-denied',\n 'assistant-four-eyes-required',\n 'assistant-execution-not-uncertain',\n 'assistant-proposal-stale',\n 'assistant-proposal-check-failed',\n 'assistant-proposal-already-open',\n 'assistant-proposal-recently-rejected',\n 'assistant-proposal-superseded',\n 'assistant-proposal-refused',\n 'assistant-proposal-placed',\n 'assistant-proposal-not-placed',\n 'assistant-proposal-not-needed',\n 'assistant-trigger-not-found',\n 'assistant-trigger-rate-limited',\n 'assistant-trigger-rolled-back',\n 'assistant-webhook-signature-invalid',\n 'assistant-webhook-payload-invalid',\n 'assistant-webhook-payload-too-large',\n 'assistant-memory-not-configured',\n 'assistant-memory-invalid',\n 'assistant-memory-conflict',\n 'assistant-artifact-invalid',\n 'assistant-artifact-outside-turn',\n 'assistant-artifact-not-found',\n // Feedback on proposals\n 'assistant-feedback-invalid',\n 'assistant-feedback-not-accepted',\n // Questions an agent asks with ask_question in a person's chat\n 'assistant-question-invalid',\n 'assistant-question-not-found',\n 'assistant-question-not-pending',\n 'assistant-question-forbidden',\n 'assistant-question-expired',\n 'assistant-question-cancelled',\n 'assistant-question-answer-invalid',\n // Consultations of other agents\n 'assistant-consult-subject-unavailable',\n 'assistant-consult-agent-unavailable',\n 'assistant-consult-depth-exceeded',\n 'assistant-consult-budget-exhausted',\n 'assistant-consult-limit-reached',\n 'assistant-consult-turn-limit',\n 'assistant-consult-timeout',\n 'assistant-consult-failed',\n 'assistant-consult-read-only',\n 'assistant-consult-tool-not-selected',\n 'assistant-consult-proposal-refused',\n 'assistant-consult-asker-decides',\n 'assistant-consult-route-not-allowed',\n 'assistant-consult-proposal-moved',\n // Consultations defined as data in the administration\n 'assistant-consultation-in-code',\n 'assistant-consultation-not-found',\n 'assistant-consultations-not-allowed',\n // Hand-offs defined as data and shadow variants created in the administration\n 'assistant-handoffs-not-allowed',\n 'assistant-handoff-in-code',\n 'assistant-handoff-not-found',\n 'assistant-shadow-variants-not-allowed',\n // Agent packages: their format and the parts they lock\n 'assistant-package-format-unsupported',\n 'assistant-package-too-large',\n 'assistant-package-refused',\n 'assistant-package-locked',\n 'assistant-package-not-linked',\n // Preferences and administration\n 'assistant-validation',\n 'assistant-instructions-too-long',\n 'assistant-forbidden',\n 'assistant-not-found',\n 'assistant-context-not-found',\n 'assistant-version-conflict',\n 'assistant-agent-exists',\n 'assistant-code-agent-not-deletable',\n 'assistant-agent-not-code',\n // Agent metadata registered by the application\n 'assistant-metadata-entry-not-found',\n 'assistant-metadata-read-only',\n // Instructions from the application's text assets\n 'assistant-instructions-asset-not-found',\n 'assistant-instructions-asset-unavailable',\n 'assistant-agent-instructions-unavailable',\n 'assistant-mcp-server-not-found',\n 'assistant-mcp-server-exists',\n 'assistant-mcp-tool-not-found',\n 'assistant-mcp-unreachable',\n 'assistant-mcp-unauthorized',\n 'assistant-mcp-host-blocked',\n 'assistant-mcp-schema-changed',\n 'assistant-mcp-tool-disabled',\n 'assistant-mcp-response-too-large',\n 'assistant-mcp-tool-list-too-large',\n 'assistant-mcp-tool-name-conflict',\n 'assistant-mcp-insufficient-scope',\n 'assistant-mcp-headless-not-allowed',\n 'assistant-mcp-credential-mismatch',\n 'assistant-mcp-consent-required',\n 'assistant-mcp-initiator-only',\n 'assistant-mcp-delegated-token-unavailable',\n 'assistant-mcp-secret-reference-invalid',\n 'assistant-mcp-certificate-reference-invalid',\n 'assistant-mcp-secret-unreadable',\n 'assistant-mcp-secret-unavailable',\n // MCP OAuth connections\n 'assistant-mcp-connection-required',\n 'assistant-mcp-reauthorization-required',\n 'assistant-mcp-scope-not-allowed',\n 'assistant-mcp-authorization-failed',\n 'assistant-mcp-authorization-expired',\n 'assistant-mcp-authorization-invalid',\n 'assistant-mcp-discovery-failed',\n 'assistant-mcp-pkce-unsupported',\n 'assistant-mcp-client-registration-required',\n 'assistant-mcp-token-request-failed',\n 'assistant-mcp-issuer-changed',\n 'assistant-mcp-authorization-not-confirmed',\n 'assistant-mcp-oauth-not-configured',\n 'assistant-mcp-too-many-authorizations',\n 'assistant-mcp-connection-not-supported'\n];\n\n/** Every code the assistant UI can show: server codes and client-side transport codes. */\nexport const NH_ASSISTANT_ERROR_CODES: readonly string[] = [\n ...new Set([...NH_ASSISTANT_SERVER_ERROR_CODES, ...Object.values(NhAssistantClientErrorCodes)])\n];\n","/** Fragment the panel reads to join a shared conversation: `#nh-assistant-join=<id>.<token>`. */\nexport const NH_ASSISTANT_JOIN_FRAGMENT = 'nh-assistant-join';\n\n/** Fragment a clicked notification opens: `#nh-assistant-conversation=<id>`. */\nexport const NH_ASSISTANT_CONVERSATION_FRAGMENT = 'nh-assistant-conversation';\n\n/**\n * Fragment a clicked notification about the proposals of a run opens:\n * `#nh-assistant-run=<runId>.<conversationId>`. The run goes to `NhAssistantPushService.openRun$`\n * while the application subscribes; otherwise the panel opens the conversation.\n */\nexport const NH_ASSISTANT_RUN_FRAGMENT = 'nh-assistant-run';\n\n/** Builds the default invitation link: the current page with the join fragment. */\nexport function nhAssistantShareLink(conversationId: string, token: string): string {\n const location = globalThis.location;\n const page = location ? `${location.origin}${location.pathname}${location.search}` : '';\n return `${page}#${NH_ASSISTANT_JOIN_FRAGMENT}=${encodeURIComponent(conversationId)}.${encodeURIComponent(token)}`;\n}\n","import { ChangeDetectionStrategy, Component, InjectionToken, computed, inject, input } from '@angular/core';\n\nexport type NhAssistantIconName =\n | 'assistant'\n | 'close'\n | 'send'\n | 'stop'\n | 'plus'\n | 'list'\n | 'trash'\n | 'tool'\n | 'check'\n | 'x'\n | 'warning'\n | 'chevron-down'\n | 'clock'\n | 'settings'\n | 'admin'\n | 'edit'\n | 'refresh'\n | 'link'\n | 'page'\n | 'users'\n | 'copy'\n | 'bell'\n | 'leave'\n | 'attach'\n | 'file'\n | 'lock';\n\n/**\n * Optional icon classes of the host's icon library, for example `{ close: 'ph ph-x' }`.\n * Icons without a class use the library's small built-in outline glyphs.\n */\nexport const NH_ASSISTANT_ICONS = new InjectionToken<Partial<Record<NhAssistantIconName, string>>>('NH_ASSISTANT_ICONS');\n\nconst builtInPaths: Record<NhAssistantIconName, string> = {\n assistant: 'M12 3l1.8 4.7 4.7 1.8-4.7 1.8L12 16l-1.8-4.7-4.7-1.8 4.7-1.8zM18.5 15l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z',\n close: 'M6 6l12 12M18 6L6 18',\n send: 'M4 12l16-8-6 16-2.5-6.5zM11.5 13.5L20 4',\n stop: 'M7 7h10v10H7z',\n plus: 'M12 5v14M5 12h14',\n list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',\n trash: 'M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3',\n tool: 'M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17l3 3 5.3-5.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.1-.4-.4-2.1z',\n check: 'M5 12.5l4.5 4.5L19 7.5',\n x: 'M7 7l10 10M17 7L7 17',\n warning: 'M12 4L2.5 20h19zM12 10v4M12 17h.01',\n 'chevron-down': 'M6 9l6 6 6-6',\n clock: 'M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18zM12 7v5l3 2',\n settings: 'M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4',\n admin: 'M12 3l7 3v5c0 4.5-3 8.2-7 10-4-1.8-7-5.5-7-10V6zM9.5 12l2 2 3.5-3.5',\n edit: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4',\n refresh: 'M20 11a8 8 0 0 0-14.3-4.9L4 8M4 4v4h4M4 13a8 8 0 0 0 14.3 4.9L20 16M20 20v-4h-4',\n link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',\n page: 'M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 16h6',\n users: 'M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 1 0 0 7zM3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14.5c1.8.9 3 2.8 3 5',\n copy: 'M9 9h11v11H9zM5 15H4V4h11v1',\n bell: 'M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0',\n leave: 'M10 4H5v16h5M14 8l4 4-4 4M18 12H9',\n attach: 'M19 11.5l-7.6 7.6a4.6 4.6 0 0 1-6.5-6.5l8.3-8.3a3 3 0 0 1 4.3 4.3l-8.2 8.2a1.5 1.5 0 0 1-2.1-2.1l7.4-7.4',\n file: 'M6 3h8l4 4v14H6zM14 3v4h4',\n lock: 'M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 0 1 7 0v3M12 15v2'\n};\n\n/** Decorative icon. The surrounding control provides the accessible name. */\n@Component({\n selector: 'nh-assistant-icon',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (iconClass(); as iconClass) {\n <i [class]=\"iconClass\" aria-hidden=\"true\"></i>\n } @else {\n <svg viewBox=\"0 0 24 24\" width=\"1em\" height=\"1em\" aria-hidden=\"true\" focusable=\"false\">\n <path [attr.d]=\"path()\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n }\n `,\n styles: [`\n :host { display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-size: 1.15em; }\n svg { display: block; }\n `]\n})\nexport class NhAssistantIconComponent {\n private readonly icons = inject(NH_ASSISTANT_ICONS, { optional: true });\n\n readonly name = input.required<NhAssistantIconName>();\n readonly iconClass = computed(() => this.icons?.[this.name()] ?? null);\n readonly path = computed(() => builtInPaths[this.name()]);\n}\n","import { ChangeDetectionStrategy, Component, afterNextRender, computed, effect, inject, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantPanelService } from '../../services/nh-assistant-panel.service';\nimport { NhAssistantStore } from '../../services/nh-assistant.store';\n\n/**\n * Header button that opens the assistant panel. It renders nothing while the assistant is\n * disabled on the server or the access policy denies the user. One small badge shows what needs\n * attention, in this order: an approval that waits, the number of unread conversations, or a\n * turn that runs. Projected content replaces the default icon.\n */\n@Component({\n selector: 'nh-assistant-launcher',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (store.enabled()) {\n <button\n class=\"launcher\"\n type=\"button\"\n [class.open]=\"panel.isOpen()\"\n [attr.aria-expanded]=\"panel.isOpen()\"\n [attr.aria-label]=\"label() | translate\"\n [attr.title]=\"label() | translate\"\n (click)=\"panel.toggle()\">\n <ng-content><nh-assistant-icon name=\"assistant\" /></ng-content>\n @switch (badge()) {\n @case ('waiting') {\n <span class=\"badge\" data-state=\"waiting\" aria-hidden=\"true\"></span>\n }\n @case ('unread') {\n <span class=\"badge count\" data-state=\"unread\" aria-hidden=\"true\">{{ unreadLabel() }}</span>\n }\n @case ('running') {\n <span class=\"badge\" data-state=\"running\" aria-hidden=\"true\"></span>\n }\n }\n @if (waitingForApproval()) {\n <span class=\"visually-hidden\">{{ 'nh-assistant.launcher.pending-approval' | translate }}</span>\n }\n @if (store.unreadCount() > 0) {\n <span class=\"visually-hidden\">{{ 'nh-assistant.launcher.unread' | translate: { count: store.unreadCount() } }}</span>\n }\n @if (store.runningCount() > 0) {\n <span class=\"visually-hidden\">{{ 'nh-assistant.launcher.running' | translate: { count: store.runningCount() } }}</span>\n }\n </button>\n }\n `,\n styleUrl: './nh-assistant-launcher.component.scss'\n})\nexport class NhAssistantLauncherComponent {\n readonly store = inject(NhAssistantStore);\n readonly panel = inject(NhAssistantPanelService);\n\n readonly waitingForApproval = computed(() =>\n this.store.pendingApproval() !== null ||\n this.store.conversations().some(conversation => conversation.status === 'waiting-for-approval')\n );\n readonly badge = computed<'waiting' | 'unread' | 'running' | null>(() => {\n if (this.waitingForApproval()) {\n return 'waiting';\n }\n if (this.store.unreadCount() > 0) {\n return 'unread';\n }\n return this.store.runningCount() > 0 || this.store.streaming() ? 'running' : null;\n });\n readonly unreadLabel = computed(() => this.store.unreadCount() > 9 ? '9+' : String(this.store.unreadCount()));\n readonly label = computed(() => this.panel.isOpen() ? 'nh-assistant.launcher.close' : 'nh-assistant.launcher.open');\n\n constructor() {\n // Browser only: the status request and access policy need the signed-in user.\n afterNextRender(() => {\n void this.store.initialize();\n });\n\n effect(() => {\n if (this.store.enabled()) {\n untracked(() => void this.store.refreshConversations());\n }\n });\n }\n}\n","import { ChangeDetectorRef, DestroyRef, Pipe, PipeTransform, inject } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { merge } from 'rxjs';\n\n/**\n * Translates the first key that has a translation and otherwise returns the fallback text.\n * Used for server-provided keys (agent names, error message keys, result codes) that the\n * host may or may not translate.\n */\n@Pipe({ name: 'nhAssistantTranslate', standalone: true, pure: false })\nexport class NhAssistantTranslatePipe implements PipeTransform {\n private readonly translate = inject(TranslateService);\n private lastKeys = '';\n private lastParams = '';\n private lastValue = '';\n private dirty = true;\n\n constructor() {\n const changeDetector = inject(ChangeDetectorRef);\n const subscription = merge(this.translate.onTranslationChange, this.translate.onLangChange).subscribe(() => {\n this.dirty = true;\n changeDetector.markForCheck();\n });\n inject(DestroyRef).onDestroy(() => subscription.unsubscribe());\n }\n\n transform(keys: string | readonly (string | null | undefined)[], fallback = '', params?: Record<string, unknown>): string {\n const candidates = (Array.isArray(keys) ? keys : [keys]).filter((key): key is string => !!key);\n const keySignature = candidates.join('|');\n const paramSignature = params ? JSON.stringify(params) : '';\n if (!this.dirty && keySignature === this.lastKeys && paramSignature === this.lastParams) {\n return this.lastValue;\n }\n\n this.lastKeys = keySignature;\n this.lastParams = paramSignature;\n this.dirty = false;\n this.lastValue = this.resolve(candidates, fallback, params);\n return this.lastValue;\n }\n\n private resolve(candidates: string[], fallback: string, params?: Record<string, unknown>): string {\n for (const key of candidates) {\n const value = this.translate.instant(key, params);\n if (typeof value === 'string' && value.length > 0 && value !== key) {\n return value;\n }\n }\n\n return fallback;\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantActivity } from '../../services/nh-assistant.store';\n\n/**\n * One slim row of the other conversations that need attention: a running turn, an approval that\n * waits, or an unread answer. It renders nothing when there are none, so it costs no space in the\n * usual case. Selecting a chip opens that conversation; its turn keeps running meanwhile.\n */\n@Component({\n selector: 'nh-assistant-activity',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (others().length > 0) {\n <nav class=\"strip\" [attr.aria-label]=\"'nh-assistant.activity.label' | translate\">\n @for (item of others(); track item.id) {\n <button\n class=\"chip\"\n type=\"button\"\n [attr.data-state]=\"state(item)\"\n [attr.title]=\"(item.title || ('nh-assistant.conversation-list.untitled' | translate)) + ' — ' + ('nh-assistant.activity.' + state(item) | translate)\"\n (click)=\"conversationSelect.emit(item.id)\">\n <span class=\"indicator\" aria-hidden=\"true\"></span>\n <span class=\"title\">{{ item.title || ('nh-assistant.conversation-list.untitled' | translate) }}</span>\n @if (item.shared) {\n <nh-assistant-icon class=\"shared\" name=\"users\" />\n }\n <span class=\"visually-hidden\">{{ 'nh-assistant.activity.' + state(item) | translate }}</span>\n </button>\n }\n </nav>\n }\n `,\n styleUrl: './nh-assistant-activity.component.scss'\n})\nexport class NhAssistantActivityComponent {\n readonly items = input.required<readonly NhAssistantActivity[]>();\n readonly conversationSelect = output<string>();\n\n /** The open conversation already shows its own state. */\n readonly others = computed(() => this.items().filter(item => !item.active));\n\n state(item: NhAssistantActivity): 'running' | 'waiting' | 'unread' {\n if (item.status === 'running') {\n return 'running';\n }\n return item.status === 'waiting-for-approval' ? 'waiting' : 'unread';\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { AgentSummary } from '../../models/assistant-api.models';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\n\nlet nextId = 0;\n\n/**\n * Chooses the agent for new conversations. Agent names come from the host's translation\n * keys; agents created by an administrator carry literal text, which is shown as is.\n */\n@Component({\n selector: 'nh-assistant-agent-picker',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { '[class.compact]': 'compact()' },\n template: `\n <label class=\"visually-hidden\" [for]=\"selectId\">{{ 'nh-assistant.agent-picker.label' | translate }}</label>\n <select\n [id]=\"selectId\"\n [disabled]=\"disabled() || agents().length < 2\"\n [attr.aria-describedby]=\"selected() ? selectId + '-capability' : null\"\n [attr.title]=\"selected() ? (([selected()!.descriptionKey] | nhAssistantTranslate: selected()!.descriptionKey) + (compact() ? ' · ' + ((selected()!.canMutate ? 'nh-assistant.agent-picker.can-mutate' : 'nh-assistant.agent-picker.read-only') | translate) : '')) : null\"\n (change)=\"onChange($event)\">\n @for (agent of agents(); track agent.id) {\n <option [value]=\"agent.id\" [selected]=\"agent.id === selectedAgentId()\">\n {{ [agent.displayNameKey] | nhAssistantTranslate: agent.displayNameKey }}\n </option>\n }\n </select>\n @if (selected(); as agent) {\n <span class=\"capability\" [id]=\"selectId + '-capability'\" [class.visually-hidden]=\"compact()\" [attr.data-can-mutate]=\"agent.canMutate\">\n {{ (agent.canMutate ? 'nh-assistant.agent-picker.can-mutate' : 'nh-assistant.agent-picker.read-only') | translate }}\n </span>\n }\n `,\n styleUrl: './nh-assistant-agent-picker.component.scss'\n})\nexport class NhAssistantAgentPickerComponent {\n readonly agents = input.required<readonly AgentSummary[]>();\n readonly selectedAgentId = input<string | null>(null);\n readonly disabled = input(false);\n /** Compact prompt-bar control; capability information remains in the tooltip and accessible description. */\n readonly compact = input(false);\n readonly agentChange = output<string>();\n\n readonly selectId = `nh-assistant-agent-picker-${nextId++}`;\n readonly selected = computed(() => this.agents().find(agent => agent.id === this.selectedAgentId()) ?? null);\n\n onChange(event: Event): void {\n this.agentChange.emit((event.target as HTMLSelectElement).value);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe, TranslateService } from '@ngx-translate/core';\nimport { AgentUploads } from '../../models/assistant-api.models';\nimport {\n nhAssistantAcceptAttribute,\n nhAssistantFileTypeLabel,\n nhAssistantFormatFileSize\n} from '../../internal/nh-assistant-files';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport type { NhAssistantAttachment } from '../../services/nh-assistant.store';\n\nlet nextId = 0;\n\n/**\n * Message input. Enter sends when sending is available; Shift+Enter inserts a new line.\n * Drafting remains available while the assistant runs or waits for approval. With `uploads`, an\n * attach button chooses files for the next message; the host uploads them and passes them back as\n * `attachments`, which show their progress, or why they cannot be attached, at the control. Sending\n * waits while a file uploads.\n */\n@Component({\n selector: 'nh-assistant-composer',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent, NhAssistantTranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-composer.component.html',\n styleUrl: './nh-assistant-composer.component.scss'\n})\nexport class NhAssistantComposerComponent {\n /** Disables the editor only when the conversation itself cannot accept a draft. */\n readonly disabled = input(false);\n /** Blocks sending without disabling the editor or clearing its draft. */\n readonly sendDisabled = input(false);\n /** Shows the stop button instead of the send button. */\n readonly busy = input(false);\n /** Keeps the send action available next to Stop so the host can queue messages. */\n readonly queueWhileBusy = input(false);\n /**\n * Announces why sending is temporarily unavailable: a running turn, a turn that waits for an\n * approval, or one that waits for the answer to a question the agent asked.\n */\n readonly status = input<'running' | 'waiting-for-approval' | 'waiting-for-answer' | null>(null);\n /** Name of the participant whose turn runs or waits, or who answers the question, when it is someone else. */\n readonly statusActor = input<string | null>(null);\n /** False when the user may not stop the running turn, such as another participant's turn. */\n readonly canStop = input(true);\n readonly maxLength = input<number | null>(null);\n /** Text to put back into the input, for example a message the server did not accept. */\n readonly restore = input<string | null>(null);\n /**\n * What the person may attach, for example `NhAssistantStore.uploads()`; `null` hides the attach\n * button.\n */\n readonly uploads = input<AgentUploads | null>(null);\n /** The attachments of the next message, for example `NhAssistantStore.attachments()`. */\n readonly attachments = input<readonly NhAssistantAttachment[]>([]);\n\n readonly send = output<string>();\n readonly cancel = output<void>();\n readonly restored = output<void>();\n /** Files the person chose to attach, for example for `NhAssistantStore.attach`. */\n readonly attach = output<File[]>();\n /** The id of an attachment the person removed, for example for `NhAssistantStore.removeAttachment`. */\n readonly removeAttachment = output<string>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly translate = inject(TranslateService, { optional: true });\n private readonly textarea = viewChild.required<ElementRef<HTMLTextAreaElement>>('textarea');\n private readonly attachButton = viewChild<ElementRef<HTMLButtonElement>>('attachButton');\n private ownedFocus = false;\n private previousBusy = false;\n\n readonly inputId = `nh-assistant-composer-${nextId++}`;\n readonly hintId = `${this.inputId}-hint`;\n readonly attachHintId = `${this.inputId}-attach-hint`;\n readonly attachmentsId = `${this.inputId}-attachments`;\n readonly text = signal('');\n readonly length = computed(() => this.text().trim().length);\n readonly tooLong = computed(() => {\n const max = this.maxLength();\n return max !== null && this.length() > max;\n });\n readonly showCounter = computed(() => {\n const max = this.maxLength();\n return max !== null && this.length() >= max * 0.8;\n });\n /** True while a file of the next message still uploads. */\n readonly uploading = computed(() => this.attachments().some(attachment => attachment.state === 'uploading'));\n readonly canSend = computed(() =>\n !this.disabled() && !this.sendDisabled() && this.length() > 0 && !this.tooLong() && !this.uploading());\n /** The `accept` attribute of the file input, with the extensions the application mapped. */\n readonly accept = computed(() => {\n const uploads = this.uploads();\n return nhAssistantAcceptAttribute(uploads?.acceptedMediaTypes ?? [], uploads?.mappedExtensions);\n });\n /** The values the attachment texts name: the accepted types, the largest size and the most files. */\n readonly uploadParams = computed(() => {\n const uploads = this.uploads();\n return {\n types: (uploads?.acceptedMediaTypes ?? []).map(nhAssistantFileTypeLabel).join(', '),\n max: uploads ? this.size(uploads.maxFileBytes) : '',\n count: uploads?.maxFiles ?? 0\n };\n });\n\n constructor() {\n effect(() => {\n const draft = this.restore();\n if (draft !== null) {\n untracked(() => {\n this.text.set(draft);\n this.restored.emit();\n });\n }\n });\n\n effect(() => {\n const busy = this.busy();\n if (this.previousBusy && !busy) {\n queueMicrotask(() => this.restoreOwnedFocus());\n }\n this.previousBusy = busy;\n });\n }\n\n @HostListener('focusin')\n onFocusIn(): void {\n this.ownedFocus = true;\n }\n\n @HostListener('focusout', ['$event'])\n onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n if (next instanceof Node && !this.host.nativeElement.contains(next)) {\n this.ownedFocus = false;\n }\n }\n\n onInput(event: Event): void {\n this.text.set((event.target as HTMLTextAreaElement).value);\n }\n\n onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Enter' || event.shiftKey || event.isComposing) {\n return;\n }\n\n event.preventDefault();\n this.submit();\n }\n\n onSubmit(event: SubmitEvent): void {\n event.preventDefault();\n this.submit();\n queueMicrotask(() => this.textarea().nativeElement.focus({ preventScroll: true }));\n }\n\n submit(): void {\n if (!this.canSend()) {\n return;\n }\n\n const text = this.text().trim();\n this.text.set('');\n this.send.emit(text);\n }\n\n /** Hands the chosen files to the host and empties the input, so the same file can be chosen again. */\n onFilesChosen(event: Event): void {\n const input = event.target as HTMLInputElement;\n const files = Array.from(input.files ?? []);\n input.value = '';\n if (files.length > 0) {\n this.attach.emit(files);\n }\n }\n\n /** Removes an attachment and keeps the keyboard in the composer, on the attach button. */\n remove(attachment: NhAssistantAttachment): void {\n this.removeAttachment.emit(attachment.id);\n queueMicrotask(() => (this.attachButton()?.nativeElement ?? this.textarea().nativeElement).focus({ preventScroll: true }));\n }\n\n /** The translation keys of why an attachment failed, from the composer's own text to the generic one. */\n errorKeys(attachment: NhAssistantAttachment): string[] {\n const error = attachment.error;\n if (!error) {\n return [];\n }\n\n return [\n `nh-assistant.composer.attachment-errors.${error.code}`,\n error.messageKey,\n `nh-assistant.errors.${error.code}`,\n 'nh-assistant.errors.generic'\n ];\n }\n\n percent(attachment: NhAssistantAttachment): number {\n return Math.round(attachment.progress * 100);\n }\n\n /** A size in bytes in the current language, such as `1.4 MB`. */\n size(bytes: number): string {\n return nhAssistantFormatFileSize(bytes, this.translate?.getCurrentLang());\n }\n\n private restoreOwnedFocus(): void {\n if (!this.ownedFocus || matchMedia('(pointer: coarse)').matches) {\n return;\n }\n\n const active = document.activeElement;\n if (active === document.body || active === null || !active.isConnected) {\n this.textarea().nativeElement.focus({ preventScroll: true });\n }\n }\n}\n","<form class=\"composer\" (submit)=\"onSubmit($event)\">\n <label class=\"visually-hidden\" [for]=\"inputId\">{{ 'nh-assistant.composer.label' | translate }}</label>\n <textarea\n #textarea\n data-nh-assistant-autofocus\n rows=\"2\"\n [id]=\"inputId\"\n [value]=\"text()\"\n [disabled]=\"disabled()\"\n [attr.placeholder]=\"'nh-assistant.composer.placeholder' | translate\"\n [attr.aria-describedby]=\"hintId\"\n [attr.aria-invalid]=\"tooLong() ? true : null\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"></textarea>\n\n @if (attachments().length > 0) {\n <ul class=\"attachments\" [id]=\"attachmentsId\" [attr.aria-label]=\"'nh-assistant.composer.attachments' | translate\">\n @for (attachment of attachments(); track attachment.id) {\n <li class=\"attachment\" [attr.data-state]=\"attachment.state\">\n <nh-assistant-icon class=\"attachment-icon\" [name]=\"attachment.state === 'failed' ? 'warning' : 'file'\" />\n <div class=\"attachment-body\">\n <span class=\"attachment-name\" [attr.title]=\"attachment.name\">{{ attachment.name }}</span>\n @switch (attachment.state) {\n @case ('uploading') {\n <progress\n class=\"attachment-progress\"\n max=\"100\"\n [value]=\"percent(attachment)\"\n [attr.aria-label]=\"'nh-assistant.composer.uploading' | translate: { name: attachment.name }\"></progress>\n }\n @case ('failed') {\n <span class=\"attachment-error\" role=\"alert\">\n {{ errorKeys(attachment) | nhAssistantTranslate: (attachment.error?.code ?? '') : uploadParams() }}\n </span>\n }\n @default {\n <span class=\"attachment-meta\">{{ size(attachment.size) }}</span>\n }\n }\n </div>\n <button\n class=\"attachment-remove\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.composer.remove-attachment' | translate: { name: attachment.name }\"\n [attr.title]=\"'nh-assistant.composer.remove-attachment' | translate: { name: attachment.name }\"\n (click)=\"remove(attachment)\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </li>\n }\n </ul>\n }\n\n <div class=\"prompt-bar\">\n @if (uploads()) {\n <button\n #attachButton\n class=\"attach\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.composer.attach' | translate\"\n [attr.title]=\"'nh-assistant.composer.attach-hint' | translate: uploadParams()\"\n [attr.aria-describedby]=\"attachHintId\"\n (click)=\"fileInput.click()\">\n <nh-assistant-icon name=\"attach\" />\n </button>\n <span class=\"visually-hidden\" [id]=\"attachHintId\">{{ 'nh-assistant.composer.attach-hint' | translate: uploadParams() }}</span>\n <input\n #fileInput\n class=\"visually-hidden\"\n type=\"file\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept()\"\n (change)=\"onFilesChosen($event)\" />\n }\n <div class=\"prompt-controls\">\n <ng-content select=\"[nhAssistantComposerControls]\" />\n </div>\n <div class=\"actions\">\n @if (busy() && canStop()) {\n <button\n class=\"stop\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.composer.stop' | translate\"\n [attr.title]=\"'nh-assistant.composer.stop' | translate\"\n (click)=\"cancel.emit()\">\n <nh-assistant-icon name=\"stop\" />\n </button>\n }\n @if (!busy() || !canStop() || queueWhileBusy()) {\n <button\n class=\"send\"\n type=\"submit\"\n [disabled]=\"!canSend()\"\n [attr.aria-label]=\"(busy() && queueWhileBusy() ? 'nh-assistant.queue.add' : 'nh-assistant.composer.send') | translate\"\n [attr.title]=\"(busy() && queueWhileBusy() ? 'nh-assistant.queue.add' : 'nh-assistant.composer.send') | translate\">\n <nh-assistant-icon name=\"send\" />\n </button>\n }\n </div>\n </div>\n</form>\n\n@if (status() === 'waiting-for-approval') {\n <p class=\"composer-status\" role=\"status\" aria-live=\"polite\">\n @if (statusActor(); as name) {\n {{ 'nh-assistant.composer.status.waiting-for-approval-by' | translate: { name } }}\n } @else {\n {{ 'nh-assistant.composer.status.waiting-for-approval' | translate }}\n }\n </p>\n} @else if (status() === 'waiting-for-answer') {\n <p class=\"composer-status\" role=\"status\" aria-live=\"polite\">\n @if (statusActor(); as name) {\n {{ 'nh-assistant.composer.status.waiting-for-answer-by' | translate: { name } }}\n } @else {\n {{ 'nh-assistant.composer.status.waiting-for-answer' | translate }}\n }\n </p>\n}\n\n<p class=\"hint\" [id]=\"hintId\">\n @if (tooLong()) {\n <span class=\"error\">{{ 'nh-assistant.composer.too-long' | translate }}</span>\n } @else if (uploading()) {\n <span>{{ 'nh-assistant.composer.uploading-hint' | translate }}</span>\n } @else {\n <span>{{ (busy() && queueWhileBusy() ? 'nh-assistant.queue.hint' : 'nh-assistant.composer.hint') | translate }}</span>\n }\n @if (showCounter()) {\n <span class=\"counter\" [class.error]=\"tooLong()\">\n {{ 'nh-assistant.composer.characters' | translate: { count: length(), max: maxLength() } }}\n </span>\n }\n</p>\n","import { DatePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ConversationSummary } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { nhAssistantIsUnread } from '../../services/nh-assistant.store';\n\n/**\n * The user's own and shared conversations with loading and empty states; selecting one opens it.\n * Each row marks a running turn, a waiting approval and unread messages. A participant leaves a\n * shared conversation instead of deleting it.\n */\n@Component({\n selector: 'nh-assistant-conversation-list',\n standalone: true,\n imports: [DatePipe, TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-conversation-list.component.html',\n styleUrl: './nh-assistant-conversation-list.component.scss'\n})\nexport class NhAssistantConversationListComponent {\n readonly conversations = input.required<readonly ConversationSummary[]>();\n readonly total = input(0);\n readonly activeConversationId = input<string | null>(null);\n readonly loading = input(false);\n readonly disabled = input(false);\n\n readonly conversationSelect = output<string>();\n /** The owner deletes the conversation; a participant leaves it. */\n readonly conversationDelete = output<string>();\n readonly conversationCreate = output<void>();\n\n unread(conversation: ConversationSummary): boolean {\n return nhAssistantIsUnread(conversation);\n }\n\n indicator(conversation: ConversationSummary): 'running' | 'waiting' | 'unread' | null {\n if (conversation.status === 'running') {\n return 'running';\n }\n if (conversation.status === 'waiting-for-approval') {\n return 'waiting';\n }\n return this.unread(conversation) ? 'unread' : null;\n }\n}\n","<nav class=\"list\" [attr.aria-label]=\"'nh-assistant.conversation-list.title' | translate\" [attr.aria-busy]=\"loading()\">\n <header class=\"header\">\n <h3>{{ 'nh-assistant.conversation-list.title' | translate }}</h3>\n @if (conversations().length > 0 && total() > conversations().length) {\n <span class=\"count\">{{ 'nh-assistant.conversation-list.count' | translate: { count: conversations().length, total: total() } }}</span>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.panel.new-conversation' | translate\"\n [attr.title]=\"'nh-assistant.panel.new-conversation' | translate\"\n (click)=\"conversationCreate.emit()\">\n <nh-assistant-icon name=\"plus\" />\n </button>\n </header>\n\n @if (loading() && conversations().length === 0) {\n <p class=\"state\" role=\"status\">{{ 'nh-assistant.conversation-list.loading' | translate }}</p>\n } @else if (conversations().length === 0) {\n <p class=\"state\">{{ 'nh-assistant.conversation-list.empty' | translate }}</p>\n } @else {\n <ul>\n @for (conversation of conversations(); track conversation.id) {\n <li [class.active]=\"conversation.id === activeConversationId()\" [class.unread]=\"unread(conversation)\">\n <button\n class=\"item\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-current]=\"conversation.id === activeConversationId() ? 'true' : null\"\n (click)=\"conversationSelect.emit(conversation.id)\">\n <span class=\"title-row\">\n <span class=\"indicator\" [attr.data-state]=\"indicator(conversation)\" aria-hidden=\"true\"></span>\n <span class=\"title\">{{ conversation.title || ('nh-assistant.conversation-list.untitled' | translate) }}</span>\n @if ((conversation.participantCount ?? 0) > 0) {\n <nh-assistant-icon\n class=\"shared\"\n name=\"users\"\n [attr.title]=\"'nh-assistant.conversation-list.shared' | translate: { count: conversation.participantCount }\" />\n }\n </span>\n <span class=\"meta\">\n <span class=\"status\" [attr.data-status]=\"conversation.status\">{{ 'nh-assistant.conversation-list.status.' + conversation.status | translate }}</span>\n @if (unread(conversation)) {\n <span class=\"unread-label\">{{ 'nh-assistant.conversation-list.unread' | translate }}</span>\n }\n @if (conversation.role === 'participant') {\n <span>{{ 'nh-assistant.conversation-list.shared-with-you' | translate }}</span>\n }\n <time [attr.datetime]=\"conversation.updatedAt\">{{ conversation.updatedAt | date: 'short' }}</time>\n </span>\n </button>\n <button\n class=\"icon-button delete\"\n type=\"button\"\n [disabled]=\"disabled() || conversation.status === 'running'\"\n [attr.aria-label]=\"((conversation.role === 'participant' ? 'nh-assistant.conversation-list.leave' : 'nh-assistant.conversation-list.delete') | translate) + ': ' + (conversation.title || ('nh-assistant.conversation-list.untitled' | translate))\"\n [attr.title]=\"(conversation.role === 'participant' ? 'nh-assistant.conversation-list.leave' : 'nh-assistant.conversation-list.delete') | translate\"\n (click)=\"conversationDelete.emit(conversation.id)\">\n <nh-assistant-icon [name]=\"conversation.role === 'participant' ? 'leave' : 'trash'\" />\n </button>\n </li>\n }\n </ul>\n }\n</nav>\n","import { DatePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, computed, effect, inject, signal, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Subscription } from 'rxjs';\nimport { McpConnection } from '../../models/assistant-admin.models';\nimport { nhAssistantErrorKeys, nhAssistantErrorOf, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantApiService } from '../../services/nh-assistant-api.service';\nimport { NhAssistantMcpConnectService } from '../../services/nh-assistant-mcp-connect.service';\nimport { NhAssistantError, NhAssistantStore } from '../../services/nh-assistant.store';\n\nlet nextId = 0;\n\n/**\n * The caller's own MCP accounts: servers each person connects to with OAuth, with Connect,\n * Connect again and Disconnect, and the consent to background use of servers that run with the\n * caller's own account. Each change applies at once. Renders nothing while no server asks for it,\n * so most applications never show it.\n */\n@Component({\n selector: 'nh-assistant-mcp-connections',\n standalone: true,\n imports: [DatePipe, TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-mcp-connections.component.html',\n styleUrl: './nh-assistant-mcp-connections.component.scss'\n})\nexport class NhAssistantMcpConnectionsComponent {\n private readonly api = inject(NhAssistantApiService);\n private readonly connector = inject(NhAssistantMcpConnectService);\n private readonly store = inject(NhAssistantStore, { optional: true });\n private loadSubscription?: Subscription;\n private updateSubscription?: Subscription;\n\n readonly id = `nh-assistant-mcp-connections-${nextId++}`;\n readonly connections = signal<McpConnection[]>([]);\n readonly loadFailed = signal(false);\n /** The server whose consent or connection is being changed. */\n readonly busy = signal<string | null>(null);\n readonly confirmingDisconnect = signal<string | null>(null);\n /** The latest change to announce, per server. */\n readonly notice = signal<{ serverId: string; key: string } | null>(null);\n readonly error = signal<NhAssistantError | null>(null);\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n /** Whether any listed server is one the caller connects with OAuth. */\n readonly connectsAccounts = computed(() => this.connections().some(connection => connection.connectionStatus !== null));\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.loadSubscription?.unsubscribe();\n this.updateSubscription?.unsubscribe();\n });\n this.load();\n // A redirect-mode authorization that returned to this page.\n effect(() => {\n const returned = this.connector.returned();\n if (returned) {\n untracked(() => {\n this.connector.returned.set(null);\n if (returned.completion) {\n this.notice.set({ serverId: returned.completion.serverId, key: 'nh-assistant.preferences.mcp.connect-done' });\n this.load();\n } else {\n this.error.set(nhAssistantErrorOf(returned.code));\n }\n });\n }\n });\n }\n\n load(): void {\n this.loadFailed.set(false);\n this.loadSubscription?.unsubscribe();\n this.loadSubscription = this.api.getMcpConnections().subscribe({\n next: connections => this.connections.set(connections),\n error: () => this.loadFailed.set(true)\n });\n }\n\n /** The agents' names as the chat shows them; an agent the chat does not list shows its id. */\n agentKeys(connection: McpConnection): string[] {\n const agents = this.store?.agents() ?? [];\n return connection.agentIds.map(agentId => agents.find(agent => agent.id === agentId)?.displayNameKey ?? agentId);\n }\n\n toggle(connection: McpConnection, event: Event): void {\n const allow = (event.target as HTMLInputElement).checked;\n this.busy.set(connection.serverId);\n this.error.set(null);\n this.notice.set(null);\n this.updateSubscription?.unsubscribe();\n this.updateSubscription = this.api.updateMcpConnection(connection.serverId, { allowBackgroundUse: allow }).subscribe({\n next: updated => {\n this.connections.update(items => items.map(item => item.serverId === updated.serverId ? updated : item));\n this.busy.set(null);\n },\n error: (error: unknown) => {\n // Show the stored decision again.\n this.connections.update(items => [...items]);\n (event.target as HTMLInputElement).checked = connection.allowBackgroundUse;\n this.busy.set(null);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n /** Connects the caller's own account; call from the click, so the popup is allowed. */\n connect(connection: McpConnection): void {\n this.busy.set(connection.serverId);\n this.error.set(null);\n this.notice.set(null);\n this.updateSubscription?.unsubscribe();\n this.updateSubscription = this.connector.connect(connection.serverId).subscribe({\n next: () => {\n this.busy.set(null);\n this.notice.set({ serverId: connection.serverId, key: 'nh-assistant.preferences.mcp.connect-done' });\n this.load();\n },\n error: (error: unknown) => {\n this.busy.set(null);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n disconnect(connection: McpConnection): void {\n this.confirmingDisconnect.set(null);\n this.busy.set(connection.serverId);\n this.error.set(null);\n this.notice.set(null);\n this.updateSubscription?.unsubscribe();\n this.updateSubscription = this.api.disconnectMcpConnection(connection.serverId).subscribe({\n complete: () => {\n this.busy.set(null);\n this.notice.set({ serverId: connection.serverId, key: 'nh-assistant.preferences.mcp.disconnect-done' });\n this.load();\n },\n error: (error: unknown) => {\n this.busy.set(null);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n}\n","@if (connections().length > 0) {\n <fieldset class=\"connections\" [attr.aria-busy]=\"busy() !== null\">\n <legend>{{ (connectsAccounts() ? 'nh-assistant.preferences.mcp.accounts-title' : 'nh-assistant.preferences.mcp.title') | translate }}</legend>\n <p class=\"hint\">{{ (connectsAccounts() ? 'nh-assistant.preferences.mcp.accounts-description' : 'nh-assistant.preferences.mcp.description') | translate }}</p>\n <ul class=\"list\">\n @for (connection of connections(); track connection.serverId) {\n <li class=\"item\" [attr.data-status]=\"connection.connectionStatus\">\n @if (connection.connectionStatus !== null) {\n <div class=\"account\">\n <strong class=\"name\">{{ connection.displayName }}</strong>\n <span\n class=\"badge\"\n [class.success]=\"connection.connectionStatus === 'active'\"\n [class.warning]=\"connection.connectionStatus === 'reauthorization-required' || connection.connectionStatus === 'issuer-changed'\">\n {{ 'nh-assistant.preferences.mcp.status.' + connection.connectionStatus | translate }}\n </span>\n </div>\n @if (connection.connectionStatus === 'active' && connection.connectedAt) {\n <p class=\"hint details\">{{ 'nh-assistant.preferences.mcp.connected-since' | translate: { date: (connection.connectedAt | date: 'medium') } }}</p>\n }\n @if (connection.requiredScopes; as scopes) {\n <p class=\"hint details\">{{ 'nh-assistant.preferences.mcp.more-permissions' | translate: { scopes: scopes } }}</p>\n }\n @if (connection.connectionStatus === 'issuer-changed') {\n <p class=\"hint details\">{{ 'nh-assistant.preferences.mcp.issuer-changed' | translate }}</p>\n }\n <div class=\"actions\">\n @if (connection.connectionStatus !== 'issuer-changed') {\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy() !== null\" (click)=\"connect(connection)\">\n {{ (connection.connectionStatus === 'not-connected' ? 'nh-assistant.preferences.mcp.connect' : 'nh-assistant.preferences.mcp.connect-again') | translate }}\n </button>\n }\n @if (connection.connectionStatus !== 'not-connected') {\n @if (confirmingDisconnect() === connection.serverId) {\n <button class=\"secondary danger\" type=\"button\" [disabled]=\"busy() !== null\" (click)=\"disconnect(connection)\">\n {{ 'nh-assistant.preferences.mcp.confirm-disconnect' | translate }}\n </button>\n <button class=\"secondary\" type=\"button\" (click)=\"confirmingDisconnect.set(null)\">{{ 'nh-assistant.preferences.mcp.cancel' | translate }}</button>\n } @else {\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy() !== null\" (click)=\"confirmingDisconnect.set(connection.serverId)\">\n {{ 'nh-assistant.preferences.mcp.disconnect' | translate }}\n </button>\n }\n }\n </div>\n }\n @if (connection.offersBackgroundUse) {\n <label class=\"switch\">\n <input\n type=\"checkbox\"\n [checked]=\"connection.allowBackgroundUse\"\n [disabled]=\"busy() !== null\"\n [attr.aria-describedby]=\"id + '-' + connection.serverId\"\n (change)=\"toggle(connection, $event)\" />\n <span>{{ 'nh-assistant.preferences.mcp.allow' | translate: { name: connection.displayName } }}</span>\n </label>\n }\n <p class=\"hint details\" [id]=\"id + '-' + connection.serverId\">\n <span class=\"host\">{{ connection.host }}</span>\n @if (connection.offersBackgroundUse) {\n <span>\n @if (connection.allowBackgroundUse && connection.consentedAt) {\n {{ 'nh-assistant.preferences.mcp.allowed-since' | translate: { date: (connection.consentedAt | date: 'medium') } }}\n } @else {\n {{ 'nh-assistant.preferences.mcp.not-allowed' | translate }}\n }\n </span>\n }\n <span>\n {{ 'nh-assistant.preferences.mcp.used-by' | translate }}\n @for (key of agentKeys(connection); track $index) {\n <span class=\"agent\">{{ [key] | nhAssistantTranslate: key }}</span>\n }\n </span>\n </p>\n @if (notice()?.serverId === connection.serverId) {\n <p class=\"message success\" role=\"status\"><nh-assistant-icon name=\"check\" />{{ notice()!.key | translate: { name: connection.displayName } }}</p>\n }\n </li>\n }\n </ul>\n @if (error(); as failure) {\n <p class=\"message error\" role=\"alert\">\n <nh-assistant-icon name=\"warning\" />\n {{ errorKeys() | nhAssistantTranslate: failure.code }}\n </p>\n }\n </fieldset>\n} @else if (loadFailed()) {\n <div class=\"load-failed\" role=\"alert\">\n <span>{{ 'nh-assistant.preferences.mcp.load-failed' | translate }}</span>\n <button class=\"secondary\" type=\"button\" (click)=\"load()\">{{ 'nh-assistant.preferences.retry' | translate }}</button>\n </div>\n}\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, inject, output, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Subscription } from 'rxjs';\nimport {\n AssistantAddressForm,\n AssistantPreferences,\n AssistantResponseLength,\n AssistantStyle\n} from '../../models/assistant-admin.models';\nimport { nhAssistantErrorKeys, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantMcpConnectionsComponent } from './nh-assistant-mcp-connections.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantApiService } from '../../services/nh-assistant-api.service';\nimport { NhAssistantPushService } from '../../services/nh-assistant-push.service';\nimport { NhAssistantError } from '../../services/nh-assistant.store';\n\n/** Maximum length of the user's own instructions. */\nexport const NH_ASSISTANT_MAX_CUSTOM_INSTRUCTIONS = 1_000;\n\nlet nextId = 0;\n\n/**\n * The user's own assistant preferences: desktop notifications, background use of MCP servers\n * with the user's own account, style, form of address, answer length and optional instructions.\n * Notifications and background use apply immediately; the other\n * preferences steer style only and are saved together, below the application context and\n * agent instructions.\n */\n@Component({\n selector: 'nh-assistant-preferences',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent, NhAssistantMcpConnectionsComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-preferences.component.html',\n styleUrl: './nh-assistant-preferences.component.scss'\n})\nexport class NhAssistantPreferencesComponent {\n private readonly api = inject(NhAssistantApiService);\n readonly push = inject(NhAssistantPushService);\n private subscription?: Subscription;\n\n /** Emitted when the user leaves the preferences. */\n readonly closed = output<void>();\n /** Emitted with the stored preferences after a successful save. */\n readonly saved = output<AssistantPreferences>();\n\n readonly id = `nh-assistant-preferences-${nextId++}`;\n readonly styles: readonly AssistantStyle[] = ['default', 'direct', 'personal', 'detailed'];\n readonly addressForms: readonly AssistantAddressForm[] = ['informal', 'formal'];\n readonly responseLengths: readonly AssistantResponseLength[] = ['short', 'normal', 'long'];\n readonly maxInstructions = NH_ASSISTANT_MAX_CUSTOM_INSTRUCTIONS;\n\n readonly loading = signal(true);\n readonly loadFailed = signal(false);\n readonly saving = signal(false);\n readonly savedMessage = signal(false);\n readonly error = signal<NhAssistantError | null>(null);\n\n readonly style = signal<AssistantStyle>('default');\n readonly addressForm = signal<AssistantAddressForm>('informal');\n readonly responseLength = signal<AssistantResponseLength>('normal');\n readonly customInstructions = signal('');\n private readonly stored = signal<AssistantPreferences | null>(null);\n\n readonly instructionsLength = computed(() => this.customInstructions().length);\n readonly tooLong = computed(() => this.instructionsLength() > this.maxInstructions);\n readonly dirty = computed(() => {\n const stored = this.stored();\n return !stored || stored.style !== this.style() || stored.addressForm !== this.addressForm() ||\n stored.responseLength !== this.responseLength() || (stored.customInstructions ?? '') !== this.customInstructions();\n });\n readonly canSave = computed(() => !this.loading() && !this.saving() && !this.tooLong() && this.dirty());\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());\n this.load();\n }\n\n load(): void {\n this.loading.set(true);\n this.loadFailed.set(false);\n this.subscription?.unsubscribe();\n this.subscription = this.api.getPreferences().subscribe({\n next: preferences => {\n this.apply(preferences);\n this.loading.set(false);\n },\n error: () => {\n this.loading.set(false);\n this.loadFailed.set(true);\n }\n });\n }\n\n /** Turns desktop notifications on or off; turning them on asks the browser for permission. */\n async toggleNotifications(event: Event): Promise<void> {\n const enabled = (event.target as HTMLInputElement).checked;\n this.error.set(null);\n try {\n await this.push.setEnabled(enabled);\n } catch (error) {\n this.error.set(toNhAssistantError(error));\n }\n }\n\n onInstructionsInput(event: Event): void {\n this.customInstructions.set((event.target as HTMLTextAreaElement).value);\n this.savedMessage.set(false);\n }\n\n choose<T>(target: { set(value: T): void }, value: T): void {\n target.set(value);\n this.savedMessage.set(false);\n }\n\n save(): void {\n if (!this.canSave()) {\n return;\n }\n\n const instructions = this.customInstructions().trim();\n const preferences: AssistantPreferences = {\n style: this.style(),\n addressForm: this.addressForm(),\n responseLength: this.responseLength(),\n customInstructions: instructions.length > 0 ? instructions : null\n };\n\n this.saving.set(true);\n this.error.set(null);\n this.savedMessage.set(false);\n this.subscription?.unsubscribe();\n this.subscription = this.api.updatePreferences(preferences).subscribe({\n next: stored => {\n this.apply(stored);\n this.saving.set(false);\n this.savedMessage.set(true);\n this.saved.emit(stored);\n },\n error: (error: unknown) => {\n this.saving.set(false);\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n private apply(preferences: AssistantPreferences): void {\n this.stored.set(preferences);\n this.style.set(preferences.style);\n this.addressForm.set(preferences.addressForm);\n this.responseLength.set(preferences.responseLength);\n this.customInstructions.set(preferences.customInstructions ?? '');\n }\n}\n","<section class=\"preferences\" [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"loading() || saving()\">\n <header class=\"header\">\n <h3 [id]=\"id + '-title'\">{{ 'nh-assistant.preferences.title' | translate }}</h3>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.preferences.back' | translate\"\n [attr.title]=\"'nh-assistant.preferences.back' | translate\"\n (click)=\"closed.emit()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </header>\n\n @if (loading()) {\n <p class=\"state\" role=\"status\">{{ 'nh-assistant.preferences.loading' | translate }}</p>\n } @else if (loadFailed()) {\n <div class=\"state\" role=\"alert\">\n <p>{{ 'nh-assistant.preferences.load-failed' | translate }}</p>\n <button class=\"secondary\" type=\"button\" (click)=\"load()\">{{ 'nh-assistant.preferences.retry' | translate }}</button>\n </div>\n } @else {\n <form class=\"form\" (submit)=\"$event.preventDefault(); save()\">\n @if (push.state() !== 'unavailable') {\n <fieldset class=\"notifications\">\n <legend>{{ 'nh-assistant.preferences.notifications-label' | translate }}</legend>\n <label class=\"switch\">\n <input\n type=\"checkbox\"\n [checked]=\"push.settings()?.pushEnabled === true\"\n [disabled]=\"push.busy()\"\n [attr.aria-describedby]=\"id + '-notifications-hint'\"\n (change)=\"toggleNotifications($event)\" />\n <span>{{ 'nh-assistant.preferences.notifications' | translate }}</span>\n </label>\n <p class=\"hint\" [id]=\"id + '-notifications-hint'\">\n <span>{{ 'nh-assistant.preferences.notifications-state.' + push.state() | translate }}</span>\n </p>\n </fieldset>\n }\n\n <nh-assistant-mcp-connections />\n\n <p class=\"description\">{{ 'nh-assistant.preferences.description' | translate }}</p>\n\n <fieldset>\n <legend>{{ 'nh-assistant.preferences.style-label' | translate }}</legend>\n <div class=\"options styles\">\n @for (option of styles; track option) {\n <label class=\"option\" [class.selected]=\"style() === option\">\n <input type=\"radio\" [name]=\"id + '-style'\" [value]=\"option\" [checked]=\"style() === option\" (change)=\"choose(style, option)\" />\n <span>\n <strong>{{ 'nh-assistant.preferences.style.' + option | translate }}</strong>\n <small>{{ 'nh-assistant.preferences.style.' + option + '-description' | translate }}</small>\n </span>\n </label>\n }\n </div>\n </fieldset>\n\n <fieldset>\n <legend>{{ 'nh-assistant.preferences.address-form-label' | translate }}</legend>\n <div class=\"options segmented\">\n @for (option of addressForms; track option) {\n <label class=\"option\" [class.selected]=\"addressForm() === option\">\n <input type=\"radio\" [name]=\"id + '-address'\" [value]=\"option\" [checked]=\"addressForm() === option\" (change)=\"choose(addressForm, option)\" />\n <span><strong>{{ 'nh-assistant.preferences.address-form.' + option | translate }}</strong></span>\n </label>\n }\n </div>\n </fieldset>\n\n <fieldset>\n <legend>{{ 'nh-assistant.preferences.response-length-label' | translate }}</legend>\n <div class=\"options segmented\">\n @for (option of responseLengths; track option) {\n <label class=\"option\" [class.selected]=\"responseLength() === option\">\n <input type=\"radio\" [name]=\"id + '-length'\" [value]=\"option\" [checked]=\"responseLength() === option\" (change)=\"choose(responseLength, option)\" />\n <span><strong>{{ 'nh-assistant.preferences.response-length.' + option | translate }}</strong></span>\n </label>\n }\n </div>\n </fieldset>\n\n <div class=\"field\">\n <label [for]=\"id + '-instructions'\">{{ 'nh-assistant.preferences.custom-instructions-label' | translate }}</label>\n <textarea\n rows=\"4\"\n [id]=\"id + '-instructions'\"\n [value]=\"customInstructions()\"\n [attr.aria-describedby]=\"id + '-instructions-hint'\"\n [attr.aria-invalid]=\"tooLong() ? true : null\"\n (input)=\"onInstructionsInput($event)\"></textarea>\n <p class=\"hint\" [id]=\"id + '-instructions-hint'\">\n @if (tooLong()) {\n <span class=\"error-text\">{{ 'nh-assistant.preferences.too-long' | translate }}</span>\n } @else {\n <span>{{ 'nh-assistant.preferences.custom-instructions-hint' | translate }}</span>\n }\n <span class=\"counter\" [class.error-text]=\"tooLong()\">\n {{ 'nh-assistant.preferences.characters' | translate: { count: instructionsLength(), max: maxInstructions } }}\n </span>\n </p>\n </div>\n\n @if (error(); as error) {\n <p class=\"message error\" role=\"alert\">\n <nh-assistant-icon name=\"warning\" />\n {{ errorKeys() | nhAssistantTranslate: error.code }}\n </p>\n }\n @if (savedMessage()) {\n <p class=\"message success\" role=\"status\">\n <nh-assistant-icon name=\"check\" />\n {{ 'nh-assistant.preferences.saved' | translate }}\n </p>\n }\n\n <div class=\"actions\">\n <button class=\"secondary\" type=\"button\" (click)=\"closed.emit()\">{{ 'nh-assistant.preferences.back' | translate }}</button>\n <button class=\"primary\" type=\"submit\" [disabled]=\"!canSave()\">\n {{ (saving() ? 'nh-assistant.preferences.saving' : 'nh-assistant.preferences.save') | translate }}\n </button>\n </div>\n </form>\n }\n</section>\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, inject, input, output, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ConversationMember, DirectoryEntry } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NH_ASSISTANT_CONFIG } from '../../nh-assistant.config';\nimport { NhAssistantStore } from '../../services/nh-assistant.store';\nimport { nhAssistantShareLink } from '../../services/nh-assistant-share-link';\n\nlet nextId = 0;\nconst searchDelayMs = 250;\n\n/**\n * Sharing of the open conversation. The owner creates, copies, renews or stops an invitation\n * link, invites colleagues through the application's directory when it offers one, and removes\n * participants. A participant sees who takes part and can leave.\n */\n@Component({\n selector: 'nh-assistant-share',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-share.component.html',\n styleUrl: './nh-assistant-share.component.scss'\n})\nexport class NhAssistantShareComponent {\n readonly store = inject(NhAssistantStore);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private searchTimer?: ReturnType<typeof setTimeout>;\n private searchRevision = 0;\n\n /** Emitted when the user leaves the view. */\n readonly closed = output<void>();\n /** Show the invitation link, participants, or both (the default for custom hosts). */\n readonly section = input<'all' | 'link' | 'members'>('all');\n\n readonly id = `nh-assistant-share-${nextId++}`;\n readonly conversation = this.store.activeConversation;\n readonly isOwner = this.store.isOwner;\n readonly busy = signal(false);\n readonly copied = signal(false);\n readonly query = signal('');\n readonly searching = signal(false);\n readonly candidates = signal<DirectoryEntry[]>([]);\n readonly invited = signal<string | null>(null);\n\n readonly directory = computed(() => this.store.collaboration()?.directory === true && this.isOwner());\n readonly maxParticipants = computed(() => this.store.collaboration()?.maxParticipants ?? null);\n readonly participants = computed(() => this.store.members().filter(member => member.role === 'participant'));\n readonly link = computed(() => {\n const conversation = this.conversation();\n if (!conversation?.shareToken) {\n return null;\n }\n return (this.config.buildShareLink ?? nhAssistantShareLink)(conversation.id, conversation.shareToken);\n });\n readonly full = computed(() => {\n const max = this.maxParticipants();\n return max !== null && this.participants().length >= max;\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => clearTimeout(this.searchTimer));\n }\n\n async createLink(): Promise<void> {\n await this.run(() => this.store.createShareLink());\n this.copied.set(false);\n }\n\n async revokeLink(): Promise<void> {\n await this.run(() => this.store.revokeShareLink());\n this.copied.set(false);\n }\n\n async copy(input: HTMLInputElement): Promise<void> {\n const link = this.link();\n if (!link) {\n return;\n }\n try {\n await navigator.clipboard.writeText(link);\n } catch {\n // Without clipboard access the selected text can be copied by hand.\n input.select();\n }\n this.copied.set(true);\n }\n\n onSearch(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.query.set(value);\n this.invited.set(null);\n clearTimeout(this.searchTimer);\n const revision = ++this.searchRevision;\n if (value.trim().length < 2) {\n this.candidates.set([]);\n this.searching.set(false);\n return;\n }\n this.searching.set(true);\n this.searchTimer = setTimeout(async () => {\n const results = await this.store.searchParticipantCandidates(value);\n if (revision === this.searchRevision) {\n this.candidates.set(results);\n this.searching.set(false);\n }\n }, searchDelayMs);\n }\n\n async invite(entry: DirectoryEntry): Promise<void> {\n const invited = await this.run(() => this.store.inviteParticipant(entry.actorId));\n if (invited) {\n this.invited.set(entry.displayName);\n this.candidates.update(items => items.filter(item => item.actorId !== entry.actorId));\n }\n }\n\n async remove(member: ConversationMember): Promise<void> {\n await this.run(() => this.store.removeParticipant(member.actorId));\n }\n\n async leave(): Promise<void> {\n const actorId = this.conversation()?.currentActorId;\n if (!actorId) {\n return;\n }\n if (await this.run(() => this.store.removeParticipant(actorId))) {\n this.closed.emit();\n }\n }\n\n isCurrentUser(member: ConversationMember): boolean {\n return member.actorId === this.conversation()?.currentActorId;\n }\n\n private async run<T>(action: () => Promise<T>): Promise<T | undefined> {\n if (this.busy()) {\n return undefined;\n }\n this.busy.set(true);\n try {\n return await action();\n } finally {\n this.busy.set(false);\n }\n }\n}\n","<section class=\"share\" [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"busy()\">\n <header class=\"header\">\n <h3 [id]=\"id + '-title'\">\n {{ (isOwner() && section() !== 'members' ? 'nh-assistant.share.title' : 'nh-assistant.share.members-title') | translate }}\n </h3>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.share.back' | translate\"\n [attr.title]=\"'nh-assistant.share.back' | translate\"\n (click)=\"closed.emit()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </header>\n\n @if (conversation(); as conversation) {\n <div class=\"content\">\n @if (isOwner()) {\n <p class=\"description\">{{ 'nh-assistant.share.description' | translate }}</p>\n\n @if (section() !== 'members' || !directory()) {\n <section class=\"block\" [attr.aria-labelledby]=\"id + '-link'\">\n <h4 [id]=\"id + '-link'\">{{ 'nh-assistant.share.link-title' | translate }}</h4>\n @if (link(); as link) {\n <div class=\"link-row\">\n <label class=\"visually-hidden\" [for]=\"id + '-link-input'\">{{ 'nh-assistant.share.link-label' | translate }}</label>\n <input #linkInput type=\"text\" readonly [id]=\"id + '-link-input'\" [value]=\"link\" (focus)=\"linkInput.select()\" />\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.share.copy' | translate\"\n [attr.title]=\"'nh-assistant.share.copy' | translate\"\n (click)=\"copy(linkInput)\">\n <nh-assistant-icon name=\"copy\" />\n </button>\n </div>\n @if (copied()) {\n <p class=\"message success\" role=\"status\">\n <nh-assistant-icon name=\"check\" />\n {{ 'nh-assistant.share.copied' | translate }}\n </p>\n }\n <div class=\"actions\">\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy()\" (click)=\"revokeLink()\">\n {{ 'nh-assistant.share.revoke' | translate }}\n </button>\n <button class=\"secondary\" type=\"button\" [disabled]=\"busy()\" (click)=\"createLink()\">\n {{ 'nh-assistant.share.renew' | translate }}\n </button>\n </div>\n <p class=\"hint\">{{ 'nh-assistant.share.link-hint' | translate }}</p>\n } @else {\n <button class=\"primary\" type=\"button\" [disabled]=\"busy() || full()\" (click)=\"createLink()\">\n <nh-assistant-icon name=\"link\" />\n {{ 'nh-assistant.share.create' | translate }}\n </button>\n }\n </section>\n }\n\n @if (directory() && section() !== 'link') {\n <section class=\"block\" [attr.aria-labelledby]=\"id + '-invite'\">\n <h4 [id]=\"id + '-invite'\">{{ 'nh-assistant.share.invite-title' | translate }}</h4>\n <label class=\"visually-hidden\" [for]=\"id + '-search'\">{{ 'nh-assistant.share.search-label' | translate }}</label>\n <input\n type=\"search\"\n autocomplete=\"off\"\n [id]=\"id + '-search'\"\n [value]=\"query()\"\n [disabled]=\"full()\"\n [attr.placeholder]=\"'nh-assistant.share.search-placeholder' | translate\"\n (input)=\"onSearch($event)\" />\n @if (searching()) {\n <p class=\"hint\" role=\"status\">{{ 'nh-assistant.share.searching' | translate }}</p>\n } @else if (query().trim().length >= 2 && candidates().length === 0 && !invited()) {\n <p class=\"hint\">{{ 'nh-assistant.share.no-results' | translate }}</p>\n }\n @if (candidates().length > 0) {\n <ul class=\"people\">\n @for (entry of candidates(); track entry.actorId) {\n <li>\n <span class=\"person\">\n <strong>{{ entry.displayName }}</strong>\n @if (entry.detail) {\n <small>{{ entry.detail }}</small>\n }\n </span>\n <button class=\"secondary small\" type=\"button\" [disabled]=\"busy() || full()\" (click)=\"invite(entry)\">\n {{ 'nh-assistant.share.invite' | translate }}\n </button>\n </li>\n }\n </ul>\n }\n @if (invited(); as name) {\n <p class=\"message success\" role=\"status\">\n <nh-assistant-icon name=\"check\" />\n {{ 'nh-assistant.share.invited' | translate: { name } }}\n </p>\n }\n </section>\n }\n }\n\n @if (section() !== 'link') {\n <section class=\"block\" [attr.aria-labelledby]=\"id + '-members'\">\n <h4 [id]=\"id + '-members'\">\n {{ 'nh-assistant.share.members' | translate }}\n @if (maxParticipants() !== null && isOwner()) {\n <span class=\"count\">{{ 'nh-assistant.share.count' | translate: { count: participants().length, max: maxParticipants() } }}</span>\n }\n </h4>\n @if (store.members().length === 0) {\n <p class=\"hint\">{{ 'nh-assistant.share.not-shared' | translate }}</p>\n } @else {\n <ul class=\"people\">\n @for (member of store.members(); track member.actorId) {\n <li>\n <span class=\"person\">\n <strong>\n {{ member.displayName || ('nh-assistant.share.unnamed' | translate) }}\n @if (isCurrentUser(member)) {\n <small class=\"you\">{{ 'nh-assistant.share.you' | translate }}</small>\n }\n </strong>\n <small>{{ 'nh-assistant.share.role.' + member.role | translate }}</small>\n </span>\n @if (isOwner() && member.role === 'participant') {\n <button\n class=\"icon-button\"\n type=\"button\"\n [disabled]=\"busy()\"\n [attr.aria-label]=\"'nh-assistant.share.remove' | translate: { name: member.displayName || ('nh-assistant.share.unnamed' | translate) }\"\n [attr.title]=\"'nh-assistant.share.remove' | translate: { name: member.displayName || ('nh-assistant.share.unnamed' | translate) }\"\n (click)=\"remove(member)\">\n <nh-assistant-icon name=\"trash\" />\n </button>\n }\n </li>\n }\n </ul>\n }\n </section>\n }\n\n @if (!isOwner()) {\n <div class=\"actions\">\n <button class=\"secondary danger\" type=\"button\" [disabled]=\"busy() || conversation.status === 'running'\" (click)=\"leave()\">\n <nh-assistant-icon name=\"leave\" />\n {{ 'nh-assistant.share.leave' | translate }}\n </button>\n </div>\n }\n </div>\n } @else {\n <p class=\"state\">{{ 'nh-assistant.share.no-conversation' | translate }}</p>\n }\n</section>\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\nimport createDOMPurify, { DOMPurify } from 'dompurify';\nimport { Marked, Tokens } from 'marked';\n\n/** The tags model text may render as; shared with `nh-assistant-document`. */\nexport const nhAssistantMarkdownTags: readonly string[] = [\n 'p', 'br', 'strong', 'em', 'del', 'code', 'pre', 'blockquote', 'ul', 'ol', 'li', 'a',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'table', 'thead', 'tbody', 'tr', 'th', 'td'\n];\nexport const nhAssistantMarkdownAttributes: readonly string[] = ['href', 'title', 'start', 'align'];\nconst allowedUris = /^(?:https?:|mailto:|\\/(?!\\/)|#)/i;\n\nexport function nhAssistantEscapeHtml(text: string): string {\n return text\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * Renders model text as Markdown into a strict HTML subset. Inline HTML in the model text\n * is shown as literal text, images render as their alt text, and the result is sanitized\n * with DOMPurify. Links open in a new tab with `rel=\"noopener noreferrer\"`.\n */\n@Injectable({ providedIn: 'root' })\nexport class NhAssistantMarkdownRenderer {\n private readonly document = inject(DOCUMENT);\n private readonly marked = new Marked({\n gfm: true,\n breaks: true,\n async: false,\n renderer: {\n html(token: Tokens.HTML | Tokens.Tag): string {\n return nhAssistantEscapeHtml(token.text);\n },\n image(token: Tokens.Image): string {\n return nhAssistantEscapeHtml(token.text);\n }\n }\n });\n private purifier: DOMPurify | null = null;\n\n render(text: string): string {\n const purifier = this.getPurifier();\n if (!purifier) {\n return `<p>${nhAssistantEscapeHtml(text)}</p>`;\n }\n\n const html = this.marked.parse(text, { async: false });\n return purifier.sanitize(html, {\n ALLOWED_TAGS: [...nhAssistantMarkdownTags],\n ALLOWED_ATTR: [...nhAssistantMarkdownAttributes],\n ALLOWED_URI_REGEXP: allowedUris,\n ALLOW_DATA_ATTR: false,\n ALLOW_ARIA_ATTR: false\n });\n }\n\n private getPurifier(): DOMPurify | null {\n if (this.purifier) {\n return this.purifier;\n }\n\n const view = this.document.defaultView;\n if (!view) {\n return null;\n }\n\n const purifier = createDOMPurify(view);\n if (!purifier.isSupported) {\n return null;\n }\n\n purifier.addHook('afterSanitizeAttributes', node => {\n if (node.tagName === 'A') {\n node.setAttribute('target', '_blank');\n node.setAttribute('rel', 'noopener noreferrer');\n }\n });\n\n this.purifier = purifier;\n return purifier;\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { NhAssistantMarkdownRenderer } from './nh-assistant-markdown';\n\n/** Renders model text into sanitized HTML. Pure, so unchanged text is not rendered again. */\n@Pipe({ name: 'nhAssistantMarkdown', standalone: true })\nexport class NhAssistantMarkdownPipe implements PipeTransform {\n private readonly renderer = inject(NhAssistantMarkdownRenderer);\n\n transform(text: string): string {\n return this.renderer.render(text);\n }\n}\n","import { LocationStrategy } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EnvironmentInjector,\n computed,\n inject,\n input,\n runInInjectionContext\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { NH_ASSISTANT_CONFIG } from '../nh-assistant.config';\n\n/** Where a subject link leads: a route of the host application or an `https` address elsewhere. */\nexport interface NhAssistantSubjectTarget {\n href: string;\n /** The URL the router navigates to; `null` for an address outside the application. */\n route: string | null;\n}\n\n/**\n * The name of a subject with the name of its type, linked to where the application shows the\n * subject (internal). The host's `subjectLinks` builder wins over the server's link; a link within\n * the application navigates through the router, an `https` link leaves it, and anything else shows\n * no link. Ctrl-, Cmd-, Shift- and middle-clicks keep the browser's behavior, such as a new tab.\n * A name that already says the type, as \"The whole application\" does for the application as a\n * whole, is shown once.\n */\n@Component({\n selector: 'nh-assistant-subject-link',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (shownTypeName(); as type) {\n <!-- The space keeps the type and the name apart for screen readers; the flex gap shows it. -->\n <span class=\"nh-assistant-subject-type\">{{ type }}</span>{{ ' ' }}\n }\n @if (target(); as link) {\n <a class=\"nh-assistant-subject-name\" [href]=\"link.href\" (click)=\"open($event, link)\">{{ label() }}</a>\n } @else {\n <span class=\"nh-assistant-subject-name\">{{ label() }}</span>\n }\n `,\n styleUrl: './nh-assistant-subject-link.component.scss'\n})\nexport class NhAssistantSubjectLinkComponent {\n private readonly config = inject(NH_ASSISTANT_CONFIG, { optional: true });\n private readonly router = inject(Router, { optional: true });\n private readonly locationStrategy = inject(LocationStrategy, { optional: true });\n private readonly injector = inject(EnvironmentInjector);\n\n readonly subjectType = input.required<string>();\n readonly subjectId = input.required<string>();\n /** The text people read, usually the subject's display name. */\n readonly label = input.required<string>();\n /** The name of the subject type, such as \"Project\"; nothing is shown without one. */\n readonly typeName = input<string | null | undefined>(null);\n /** The server's link to the subject. */\n readonly link = input<string | null | undefined>(null);\n\n /** The type's name, unless the subject's name is the type's name itself, as for the whole application. */\n readonly shownTypeName = computed(() => {\n const type = this.typeName()?.trim();\n if (!type) {\n return null;\n }\n\n return type.toLocaleLowerCase() === this.label().trim().toLocaleLowerCase() ? null : type;\n });\n\n readonly target = computed<NhAssistantSubjectTarget | null>(() => {\n const builder = this.config?.subjectLinks?.[this.subjectType()];\n const subject = { type: this.subjectType(), id: this.subjectId() };\n const custom = builder ? runInInjectionContext(this.injector, () => builder(subject)) : undefined;\n if (custom === null) {\n return null;\n }\n if (Array.isArray(custom)) {\n return this.routeTarget(this.router ? this.router.serializeUrl(this.router.createUrlTree([...custom])) : null);\n }\n\n return this.urlTarget(typeof custom === 'string' ? custom : this.link() ?? null);\n });\n\n open(event: MouseEvent, target: NhAssistantSubjectTarget): void {\n nhAssistantOpenLink(event, target, this.router);\n }\n\n private urlTarget(url: string | null): NhAssistantSubjectTarget | null {\n return nhAssistantLinkTarget(url, this.router, this.locationStrategy);\n }\n\n private routeTarget(url: string | null): NhAssistantSubjectTarget | null {\n return nhAssistantRouteTarget(url, this.router, this.locationStrategy);\n }\n}\n\n/**\n * Where a link the server sent leads (internal): a path within the application, which the router\n * opens, an `https` address elsewhere, or `null` for anything else, so no other scheme reaches an\n * anchor. Subject links and the links of application messages follow this rule.\n */\nexport function nhAssistantLinkTarget(\n url: string | null | undefined,\n router: Router | null,\n locationStrategy: LocationStrategy | null\n): NhAssistantSubjectTarget | null {\n if (!url) {\n return null;\n }\n if (url.startsWith('/') && !url.startsWith('//') && !url.startsWith('/\\\\')) {\n return nhAssistantRouteTarget(url, router, locationStrategy);\n }\n\n return /^https:\\/\\/[^/\\\\\\s]+/i.test(url) ? { href: url, route: null } : null;\n}\n\n/** A route of the application as the browser shows it and as the router opens it (internal). */\nexport function nhAssistantRouteTarget(\n url: string | null,\n router: Router | null,\n locationStrategy: LocationStrategy | null\n): NhAssistantSubjectTarget | null {\n if (!url) {\n return null;\n }\n\n return {\n href: locationStrategy ? locationStrategy.prepareExternalUrl(url) : url,\n route: router ? url : null\n };\n}\n\n/**\n * Opens a route of the application through the router on a plain click (internal). Ctrl-, Cmd-,\n * Shift-, Alt- and middle-clicks, and addresses outside the application, keep the browser's behavior.\n */\nexport function nhAssistantOpenLink(event: MouseEvent, target: NhAssistantSubjectTarget, router: Router | null): void {\n if (!target.route || !router || event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {\n return;\n }\n\n event.preventDefault();\n void router.navigateByUrl(target.route);\n}\n","import { LocationStrategy } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { NhAssistantIconComponent } from './nh-assistant-icon.component';\nimport { NhAssistantSubjectTarget, nhAssistantLinkTarget, nhAssistantOpenLink } from './nh-assistant-subject-link.component';\n\n/**\n * The link of a message the application posted (internal): a path within the application opens\n * through the router, an `https` address leaves it, and anything else shows nothing, by the same rule\n * as subject links.\n */\n@Component({\n selector: 'nh-assistant-message-link',\n standalone: true,\n imports: [NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (target(); as link) {\n <a class=\"nh-assistant-message-link\" [href]=\"link.href\" (click)=\"open($event, link)\">\n <nh-assistant-icon name=\"link\" />{{ label() }}\n </a>\n }\n `,\n styles: `\n :host {\n display: block;\n }\n\n .nh-assistant-message-link {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n color: var(--nha-accent);\n font-size: 13px;\n font-weight: 600;\n text-decoration: none;\n }\n\n .nh-assistant-message-link:hover {\n text-decoration: underline;\n }\n\n .nh-assistant-message-link:focus-visible {\n outline: 2px solid var(--nha-focus);\n outline-offset: 2px;\n border-radius: 4px;\n }\n `\n})\nexport class NhAssistantMessageLinkComponent {\n private readonly router = inject(Router, { optional: true });\n private readonly locationStrategy = inject(LocationStrategy, { optional: true });\n\n /** A path within the application or an `https` address. */\n readonly url = input.required<string>();\n /** The text people read. */\n readonly label = input.required<string>();\n\n readonly target = computed(() => nhAssistantLinkTarget(this.url(), this.router, this.locationStrategy));\n\n open(event: MouseEvent, target: NhAssistantSubjectTarget): void {\n nhAssistantOpenLink(event, target, this.router);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { ApprovalPart, ConnectionRequiredPart, FilePart, MessagePart, QuestionPart, TextPart, ToolCallPart } from '../models/assistant-api.models';\n\n/**\n * A message part as the thread renders it: consecutive tool calls form one group, and so do\n * consecutive attached files.\n */\nexport type NhAssistantPartGroup =\n | { kind: 'text'; key: string; part: TextPart }\n | { kind: 'approval'; key: string; part: ApprovalPart }\n | { kind: 'question'; key: string; part: QuestionPart }\n | { kind: 'connection'; key: string; part: ConnectionRequiredPart }\n | { kind: 'tools'; key: string; calls: ToolCallPart[] }\n | { kind: 'files'; key: string; files: FilePart[] };\n\n/**\n * Groups consecutive tool calls of a message, and consecutive files. Text and approvals break a\n * group, so an approval always stays visible. A tool group's key is its first invocation id, so it\n * keeps its identity while later calls of the same run are appended.\n */\nexport function groupNhAssistantParts(parts: readonly MessagePart[]): NhAssistantPartGroup[] {\n const groups: NhAssistantPartGroup[] = [];\n let tools: { kind: 'tools'; key: string; calls: ToolCallPart[] } | null = null;\n let files: { kind: 'files'; key: string; files: FilePart[] } | null = null;\n\n parts.forEach((part, index) => {\n if (part.type === 'tool-call') {\n files = null;\n if (!tools) {\n tools = { kind: 'tools', key: `tools:${part.invocationId}`, calls: [] };\n groups.push(tools);\n }\n tools.calls.push(part);\n return;\n }\n\n tools = null;\n if (part.type === 'file') {\n if (!files) {\n files = { kind: 'files', key: `files:${index}`, files: [] };\n groups.push(files);\n }\n files.files.push(part);\n return;\n }\n\n files = null;\n if (part.type === 'approval') {\n groups.push({ kind: 'approval', key: `approval:${part.approvalId}`, part });\n } else if (part.type === 'question') {\n groups.push({ kind: 'question', key: `question:${part.questionId}`, part });\n } else if (part.type === 'connection-required') {\n groups.push({ kind: 'connection', key: `connection:${part.serverId}:${index}`, part });\n } else {\n groups.push({ kind: 'text', key: `text:${index}`, part });\n }\n });\n\n return groups;\n}\n\n/** Pure, so the groups are only rebuilt when the reducer replaces a message's parts. */\n@Pipe({ name: 'nhAssistantPartGroups', standalone: true })\nexport class NhAssistantPartGroupsPipe implements PipeTransform {\n transform(parts: readonly MessagePart[]): NhAssistantPartGroup[] {\n return groupNhAssistantParts(parts);\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n inject,\n input,\n linkedSignal,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Observable, Subscription, forkJoin, map } from 'rxjs';\nimport {\n AgentFeedbackOutcome,\n AgentProposalFeedback,\n AgentProposalFeedbackCategory,\n NH_ASSISTANT_FEEDBACK_CATEGORIES,\n NH_ASSISTANT_MAX_BULK_FEEDBACK,\n NH_ASSISTANT_MAX_FEEDBACK_TEXT\n} from '../../models/assistant-agent-run.models';\nimport { nhAssistantErrorKeys, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantAgentRunApiService } from '../../services/nh-assistant-agent-run-api.service';\nimport { nhAssistantErrorMessageKey } from '../../services/nh-assistant-transport';\nimport type { NhAssistantError } from '../../services/nh-assistant.store';\n\n/** What `nh-assistant-proposal-feedback` stored. */\nexport interface NhAssistantProposalFeedbackSaved {\n /** The proposals whose feedback the server stored. */\n approvalIds: string[];\n category: AgentProposalFeedbackCategory;\n text: string | null;\n}\n\nconst notAcceptedCode = 'assistant-feedback-not-accepted';\n\nlet nextId = 0;\n\n/**\n * Asks, after a rejection, what was wrong with one or more agent proposals: a category from a fixed\n * set and an optional text. It is optional and never blocks the decision; people skip it with one\n * action. One proposal is sent with `PUT approvals/{id}/feedback`, several rejected together with\n * `POST approvals/feedback` as bulk feedback. With `initial` it changes the caller's own feedback.\n * After saving it thanks the person in place of the form; hosts remove it after `dismissed`.\n */\n@Component({\n selector: 'nh-assistant-proposal-feedback',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-proposal-feedback.component.html',\n styleUrl: './nh-assistant-proposal-feedback.component.scss'\n})\nexport class NhAssistantProposalFeedbackComponent {\n private readonly api = inject(NhAssistantAgentRunApiService);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n private readonly thanks = viewChild<ElementRef<HTMLElement>>('thanks');\n private subscription?: Subscription;\n\n /** The proposals the feedback is about; several when they were rejected together. */\n readonly approvalIds = input.required<readonly string[]>();\n /** The caller's current feedback, to change it; `null` for new feedback. */\n readonly initial = input<AgentProposalFeedback | null>(null);\n /** Emits after the server stored the feedback. */\n readonly saved = output<NhAssistantProposalFeedbackSaved>();\n /** Emits when the person skips the question. */\n readonly dismissed = output<void>();\n\n readonly id = `nh-assistant-proposal-feedback-${nextId++}`;\n readonly categories = NH_ASSISTANT_FEEDBACK_CATEGORIES;\n readonly maxText = NH_ASSISTANT_MAX_FEEDBACK_TEXT;\n\n /** A new question when the host passes other proposals or other initial feedback. */\n private readonly question = computed(() => ({ approvalIds: this.approvalIds(), initial: this.initial() }));\n\n readonly category = linkedSignal<AgentProposalFeedbackCategory | null>(() => this.question().initial?.category ?? null);\n readonly text = linkedSignal(() => this.question().initial?.text ?? '');\n readonly busy = signal(false);\n readonly done = linkedSignal({ source: this.question, computation: () => false });\n /** Set when a bulk request stored the feedback for only part of the proposals. */\n readonly partial = linkedSignal<unknown, { stored: number; total: number } | null>({\n source: this.question,\n computation: () => null\n });\n readonly error = linkedSignal<unknown, NhAssistantError | null>({ source: this.question, computation: () => null });\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n readonly count = computed(() => new Set(this.approvalIds()).size);\n readonly textLength = computed(() => this.text().length);\n readonly tooLong = computed(() => this.textLength() > this.maxText);\n readonly canSend = computed(() => this.category() !== null && this.count() > 0 && !this.busy() && !this.tooLong());\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());\n }\n\n choose(category: AgentProposalFeedbackCategory): void {\n this.category.set(category);\n this.error.set(null);\n }\n\n onText(event: Event): void {\n this.text.set((event.target as HTMLTextAreaElement).value);\n }\n\n dismiss(): void {\n this.subscription?.unsubscribe();\n this.busy.set(false);\n this.dismissed.emit();\n }\n\n send(): void {\n const category = this.category();\n if (!this.canSend() || category === null) {\n return;\n }\n\n const approvalIds = [...new Set(this.approvalIds())];\n const text = this.text().trim() || null;\n this.busy.set(true);\n this.error.set(null);\n this.subscription?.unsubscribe();\n this.subscription = this.request(approvalIds, category, text).subscribe({\n next: outcomes => {\n this.busy.set(false);\n const stored = outcomes.filter(outcome => outcome.succeeded).map(outcome => outcome.approvalId);\n if (stored.length === 0) {\n const code = outcomes.find(outcome => outcome.code)?.code ?? notAcceptedCode;\n this.error.set({ code, messageKey: nhAssistantErrorMessageKey(code) });\n return;\n }\n\n // The form disappears; keep keyboard focus on the confirmation instead of losing it.\n const focused = this.host.nativeElement.contains(this.document.activeElement);\n this.partial.set(stored.length < approvalIds.length ? { stored: stored.length, total: approvalIds.length } : null);\n this.done.set(true);\n if (focused) {\n afterNextRender(() => this.thanks()?.nativeElement.focus(), { injector: this.injector });\n }\n this.saved.emit({ approvalIds: stored, category, text });\n },\n error: failure => {\n this.busy.set(false);\n this.error.set(toNhAssistantError(failure));\n }\n });\n }\n\n /** One proposal through its own endpoint; several in requests of at most the bulk limit. */\n private request(\n approvalIds: string[],\n category: AgentProposalFeedbackCategory,\n text: string | null\n ): Observable<AgentFeedbackOutcome[]> {\n if (approvalIds.length === 1) {\n const [approvalId] = approvalIds;\n return this.api.giveFeedback(approvalId, category, text).pipe(\n map(() => [{ approvalId, succeeded: true, code: null }])\n );\n }\n\n const chunks: string[][] = [];\n for (let index = 0; index < approvalIds.length; index += NH_ASSISTANT_MAX_BULK_FEEDBACK) {\n chunks.push(approvalIds.slice(index, index + NH_ASSISTANT_MAX_BULK_FEEDBACK));\n }\n return forkJoin(chunks.map(chunk => this.api.giveFeedbackMany(chunk, category, text))).pipe(\n map(responses => responses.flatMap(response => response.results))\n );\n }\n}\n","@if (done()) {\n <div class=\"feedback done\" role=\"status\" tabindex=\"-1\" #thanks>\n <p class=\"thanks\"><nh-assistant-icon name=\"check\" />{{ 'nh-assistant.proposal-feedback.thanks' | translate }}</p>\n @if (partial(); as stored) {\n <p class=\"scope\">{{ 'nh-assistant.proposal-feedback.partial' | translate: { stored: stored.stored, total: stored.total } }}</p>\n }\n </div>\n} @else {\n <form class=\"feedback\" [attr.aria-busy]=\"busy()\" (submit)=\"$event.preventDefault(); send()\">\n <fieldset class=\"categories\" [disabled]=\"busy()\">\n <legend>{{ 'nh-assistant.proposal-feedback.legend' | translate }}</legend>\n @if (count() > 1) {\n <p class=\"scope\">{{ 'nh-assistant.proposal-feedback.bulk' | translate: { count: count() } }}</p>\n }\n <div class=\"chips\">\n @for (option of categories; track option) {\n <label class=\"chip\" [class.selected]=\"category() === option\">\n <input\n type=\"radio\"\n [name]=\"id + '-category'\"\n [value]=\"option\"\n [checked]=\"category() === option\"\n [attr.aria-describedby]=\"id + '-hint-' + option\"\n (change)=\"choose(option)\" />\n @if (category() === option) {\n <nh-assistant-icon name=\"check\" />\n }\n <span>{{ 'nh-assistant.proposal-feedback.categories.' + option | translate }}</span>\n </label>\n }\n </div>\n @for (option of categories; track option) {\n <span class=\"visually-hidden\" [id]=\"id + '-hint-' + option\">{{ 'nh-assistant.proposal-feedback.hints.' + option | translate }}</span>\n }\n @if (category(); as selected) {\n <p class=\"selected-hint\" aria-hidden=\"true\">{{ 'nh-assistant.proposal-feedback.hints.' + selected | translate }}</p>\n }\n\n <div class=\"field\">\n <label [for]=\"id + '-text'\">{{ 'nh-assistant.proposal-feedback.text-label' | translate }}</label>\n <textarea\n rows=\"2\"\n [id]=\"id + '-text'\"\n [attr.maxlength]=\"maxText\"\n [value]=\"text()\"\n [attr.aria-describedby]=\"id + '-text-hint'\"\n [attr.aria-invalid]=\"tooLong() ? true : null\"\n (input)=\"onText($event)\"></textarea>\n <p class=\"hint\" [id]=\"id + '-text-hint'\">\n <span>{{ 'nh-assistant.proposal-feedback.text-hint' | translate }}</span>\n <span class=\"counter\" [class.error-text]=\"tooLong()\">\n {{ 'nh-assistant.proposal-feedback.characters' | translate: { count: textLength(), max: maxText } }}\n </span>\n </p>\n </div>\n </fieldset>\n\n @if (error(); as failure) {\n <p class=\"message error\" role=\"alert\"><nh-assistant-icon name=\"warning\" />{{ errorKeys() | nhAssistantTranslate: failure.code }}</p>\n }\n\n <div class=\"actions\">\n <button class=\"text-button\" type=\"button\" (click)=\"dismiss()\">\n {{ (initial() ? 'nh-assistant.proposal-feedback.cancel' : 'nh-assistant.proposal-feedback.skip') | translate }}\n </button>\n <button class=\"primary\" type=\"submit\" [disabled]=\"!canSend()\">\n {{ (busy() ? 'nh-assistant.proposal-feedback.sending' : 'nh-assistant.proposal-feedback.send') | translate }}\n </button>\n </div>\n </form>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ApprovalDecision, ApprovalPart, ApprovalResolution } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantStore, type NhAssistantApprovalWaitingFor } from '../../services/nh-assistant.store';\nimport { NhAssistantProposalFeedbackComponent } from '../proposal-feedback/nh-assistant-proposal-feedback.component';\n\nlet nextId = 0;\n\n/** Formats remaining milliseconds as `m:ss`, or `h:mm:ss` above one hour. */\nexport function formatNhAssistantCountdown(milliseconds: number): string {\n const totalSeconds = Math.max(0, Math.ceil(milliseconds / 1000));\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const paddedSeconds = seconds.toString().padStart(2, '0');\n\n return hours > 0\n ? `${hours}:${minutes.toString().padStart(2, '0')}:${paddedSeconds}`\n : `${minutes}:${paddedSeconds}`;\n}\n\n/**\n * Asks the user to approve or reject a proposed mutation. Shows the summary, targets,\n * proposed arguments and a countdown to expiry. A decision is emitted at most once until\n * the host reports that it is no longer deciding. After the user rejected an agent's proposal\n * (`canGiveFeedback`), a low-key action asks what was wrong. A proposal that closed because it no\n * longer fits shows why, such as \"Already done\", with the application's explanation. A proposal of\n * another agent the assistant consulted (`consultation`) names that agent and the subject, offers the\n * agent's answer and says that approving runs it with the user's own rights; with a\n * `consultation.leaveRoute` a third action leaves it for the subject's approvers (`leave`), after which\n * the card says that it waits for them. A proposal the user approved in their chat whose hand-off to the\n * application has an unknown outcome (`canResolve`) offers to hand it to the application again or to mark\n * it resolved (`resolve`).\n */\n@Component({\n selector: 'nh-assistant-approval-card',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent, NhAssistantProposalFeedbackComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-approval-card.component.html',\n styleUrl: './nh-assistant-approval-card.component.scss',\n host: {\n '[attr.data-status]': 'shownStatus()'\n }\n})\nexport class NhAssistantApprovalCardComponent {\n /** Names the consulted agent as the status does; the card also works outside `provideNhAssistant`. */\n private readonly store = inject(NhAssistantStore, { optional: true });\n\n readonly approval = input.required<ApprovalPart>();\n /** True while the host submits a decision; disables both buttons. */\n readonly deciding = input(false);\n /**\n * False when the current user may not decide: in a chat the approval belongs to another\n * participant's turn, in an agent thread the user is no approver of the proposal.\n */\n readonly canDecide = input(true);\n /** Name of the participant who decides a `turn` approval, shown when the current user cannot. */\n readonly decisionOwner = input<string | null>(null);\n /**\n * Who decides when the current user cannot: the author of the turn (`turn`, the default), an\n * approver of the agent thread's subject (`approver`), or another approver because the current\n * user started the work (`other-approver`).\n */\n readonly waitingFor = input<NhAssistantApprovalWaitingFor>('turn');\n /**\n * True when the current user rejected this agent proposal and may say what was wrong, for example\n * from `NhAssistantStore.approvalRights`. Chat approvals never offer feedback.\n */\n readonly canGiveFeedback = input(false);\n readonly decide = output<ApprovalDecision>();\n /** How the user resolves an uncertain execution they approved in this chat (`canResolve`). */\n readonly resolve = output<ApprovalResolution>();\n\n private readonly now = signal(Date.now());\n private readonly submitted = signal(false);\n /** The decision this card sent last, so a proposal left for the approvers reads as such at once. */\n private readonly chosen = signal<ApprovalDecision | null>(null);\n /** The feedback question is expanded. */\n readonly feedbackOpen = signal(false);\n /** The feedback was stored; the question thanks the person and the action disappears. */\n readonly feedbackSaved = signal(false);\n private readonly feedbackToggle = viewChild<ElementRef<HTMLButtonElement>>('feedbackToggle');\n\n readonly remainingMs = computed(() => Date.parse(this.approval().expiresAt) - this.now());\n readonly expired = computed(() => this.approval().status === 'expired' ||\n (this.approval().status === 'pending' && this.remainingMs() <= 0));\n readonly effectiveStatus = computed(() => this.expired() ? 'expired' : this.approval().status);\n /** Where a consulted agent's proposal comes from; `null` for the conversation's own proposals. */\n readonly consultation = computed(() => this.approval().consultation ?? null);\n /**\n * The translation keys of the consulted agent's name: the name the assistant's status gives it,\n * then the convention `nh-assistant.agents.{id}.name`; the id when neither translates.\n */\n readonly consultedAgentKeys = computed(() => {\n const consultation = this.consultation();\n if (!consultation) {\n return [];\n }\n\n const convention = `nh-assistant.agents.${consultation.agentId}.name`;\n const known = this.store?.agents().find(agent => agent.id === consultation.agentId)?.displayNameKey;\n return known && known !== convention ? [known, convention] : [convention];\n });\n /** The subject the consulted agent was asked about, by name or else by id. */\n readonly consultedSubject = computed(() => {\n const consultation = this.consultation();\n return consultation ? consultation.subjectDisplayName ?? consultation.subjectId : null;\n });\n /**\n * The user left the consulted agent's proposal for the subject's approvers: the server names the\n * proposal that waits there, or this card just sent the decision and it was accepted.\n */\n readonly leftForApprovers = computed(() => {\n const consultation = this.consultation();\n return consultation !== null\n && (!!consultation.movedToApprovalId || (this.chosen() === 'leave' && this.approval().status !== 'pending'));\n });\n /** The status the card shows: `moved` for a proposal left for the subject's approvers. */\n readonly shownStatus = computed(() => this.leftForApprovers() ? 'moved' : this.effectiveStatus());\n /**\n * Translation key of the status: the kind of a stale proposal, \"replaced\" for a superseded one,\n * \"left for approvers\" for a consulted agent's proposal the user left, otherwise the status itself.\n */\n readonly statusKey = computed(() => {\n if (this.leftForApprovers()) {\n return 'nh-assistant.approval.consultation.moved-status';\n }\n\n const kind = this.approval().staleKind;\n if (this.effectiveStatus() === 'stale' && kind) {\n return `nh-assistant.approval.stale-kind.${kind}`;\n }\n\n return this.effectiveStatus() === 'withdrawn' && this.approval().supersededByApprovalId\n ? 'nh-assistant.approval.superseded'\n : `nh-assistant.approval.status.${this.effectiveStatus()}`;\n });\n /** Why the agent's rules proposed it; model proposals have none. */\n readonly rationale = computed(() => this.approval().rationale ?? null);\n /** The application's explanation of a stale proposal, such as who already did the work. */\n readonly staleExplanation = computed(() =>\n this.effectiveStatus() === 'stale' ? this.approval().staleExplanation ?? null : null);\n readonly actionable = computed(() => this.effectiveStatus() === 'pending');\n readonly succeeded = computed(() =>\n ['approved', 'executing', 'awaiting-application', 'executed', 'resolved'].includes(this.effectiveStatus()));\n readonly disabled = computed(() => !this.actionable() || !this.canDecide() || this.deciding() || this.submitted());\n /** The route at the subject the pending proposal may be left for; `null` when it can only be approved or rejected. */\n readonly leaveRoute = computed(() => this.actionable() ? this.consultation()?.leaveRoute ?? null : null);\n readonly leaveHintId = `nh-assistant-approval-leave-${nextId++}`;\n /** The user may resolve this uncertain hand-off: the server says so for the person who approved it. */\n readonly resolvable = computed(() => this.approval().canResolve === true && this.effectiveStatus() === 'execution-unknown');\n readonly resolveDisabled = computed(() => !this.resolvable() || this.deciding() || this.resolving());\n readonly resolveHintId = `nh-assistant-approval-resolve-${nextId++}`;\n private readonly resolving = signal(false);\n readonly countdown = computed(() => formatNhAssistantCountdown(this.remainingMs()));\n readonly presentedSummary = computed(() => this.approval().presentation?.summary ?? null);\n readonly feedbackAvailable = computed(() => this.canGiveFeedback() && this.effectiveStatus() === 'rejected');\n readonly feedbackIds = computed(() => [this.approval().approvalId]);\n readonly feedbackPanelId = `nh-assistant-approval-feedback-${nextId++}`;\n /** Translation key of the text shown instead of the buttons when the current user cannot decide. */\n readonly waitingKey = computed(() => {\n switch (this.waitingFor()) {\n case 'approver':\n return 'nh-assistant.approval.waiting-for-approver';\n case 'other-approver':\n return 'nh-assistant.approval.waiting-for-other-approver';\n case 'asker':\n return 'nh-assistant.approval.waiting-for-asker';\n default:\n return this.decisionOwner() ? 'nh-assistant.approval.waiting-for' : 'nh-assistant.approval.waiting-for-participant';\n }\n });\n\n constructor() {\n // Tick only while the approval is pending and not yet expired.\n effect(onCleanup => {\n if (this.approval().status !== 'pending') {\n return;\n }\n\n const expiresAt = Date.parse(this.approval().expiresAt);\n const timer = setInterval(() => {\n this.now.set(Date.now());\n if (Date.now() >= expiresAt) {\n clearInterval(timer);\n }\n }, 1000);\n onCleanup(() => clearInterval(timer));\n });\n\n // Allow a new attempt once the host finished deciding and the approval is still pending.\n effect(() => {\n if (!this.deciding() && this.approval().status === 'pending') {\n this.submitted.set(false);\n }\n });\n\n // Allow another resolution once the host finished and the outcome is still unknown.\n effect(() => {\n if (!this.deciding() && this.approval().status === 'execution-unknown') {\n this.resolving.set(false);\n }\n });\n }\n\n /** Emits a resolution of an uncertain hand-off, at most once until the host reports it is done. */\n chooseResolution(resolution: ApprovalResolution): void {\n if (this.resolveDisabled()) {\n return;\n }\n\n this.resolving.set(true);\n this.resolve.emit(resolution);\n }\n\n /** Emits a decision; `leave` only for a consulted agent's proposal with a route at the subject. */\n choose(decision: ApprovalDecision): void {\n if (this.disabled() || (decision === 'leave' && this.leaveRoute() === null)) {\n return;\n }\n\n this.submitted.set(true);\n this.chosen.set(decision);\n this.decide.emit(decision);\n }\n\n toggleFeedback(): void {\n this.feedbackOpen.update(open => !open);\n }\n\n onFeedbackSaved(): void {\n this.feedbackSaved.set(true);\n }\n\n /** Collapses the question and returns focus to the action that opened it. */\n onFeedbackDismissed(): void {\n this.feedbackOpen.set(false);\n this.feedbackToggle()?.nativeElement.focus();\n }\n}\n","<section class=\"card\" [attr.aria-label]=\"'nh-assistant.approval.title' | translate\">\n <header class=\"header\">\n <nh-assistant-icon [name]=\"leftForApprovers() ? 'users' : actionable() ? 'warning' : succeeded() ? 'check' : 'x'\" />\n <h3>{{ 'nh-assistant.approval.title' | translate }}</h3>\n <span class=\"status\">{{ statusKey() | translate }}</span>\n </header>\n\n @if (staleExplanation(); as explanation) {\n <p class=\"stale-explanation\">{{ explanation }}</p>\n }\n\n <!-- Another agent the assistant consulted proposes this; the person who asked decides it here. -->\n @if (consultation(); as origin) {\n <p class=\"consultation-origin\" data-consultation-origin>\n <nh-assistant-icon name=\"users\" />\n <span>{{ 'nh-assistant.approval.consultation.origin' | translate: { agent: (consultedAgentKeys() | nhAssistantTranslate: origin.agentId), subject: consultedSubject() } }}</span>\n </p>\n }\n\n @if (approval().presentation; as presentation) {\n <p class=\"tool-name\">{{ presentation.toolDisplayName }}</p>\n <p class=\"summary\">{{ presentation.summary }}</p>\n @if (presentation.fields.length > 0) {\n <dl class=\"presentation-fields\">\n @for (field of presentation.fields; track $index) {\n <div>\n <dt>{{ field.label }}</dt>\n <dd>{{ field.value }}</dd>\n </div>\n }\n </dl>\n }\n @if (presentation.notice) {\n <p class=\"notice\">{{ presentation.notice }}</p>\n }\n } @else {\n <p class=\"summary\">{{ 'nh-assistant.approval.fallback-summary' | translate }}</p>\n }\n\n @if (rationale(); as why) {\n <p class=\"rationale\">{{ 'nh-assistant.approval.rationale' | translate: { rationale: why } }}</p>\n }\n\n @if (consultation(); as origin) {\n @if (origin.answer) {\n <details class=\"consultation-answer\" data-consultation-answer>\n <summary>{{ 'nh-assistant.approval.consultation.answer' | translate: { agent: (consultedAgentKeys() | nhAssistantTranslate: origin.agentId) } }}</summary>\n <p>{{ origin.answer }}</p>\n </details>\n }\n @if (leftForApprovers()) {\n <p class=\"consultation-moved\" role=\"status\" data-consultation-moved>\n <nh-assistant-icon name=\"users\" />\n <span>{{ 'nh-assistant.approval.consultation.moved' | translate: { subject: consultedSubject() } }}</span>\n </p>\n }\n }\n\n <details class=\"technical-details\">\n <summary>{{ 'nh-assistant.approval.technical-details' | translate }}</summary>\n <p class=\"label\">{{ 'nh-assistant.approval.tool-id' | translate }}</p>\n <code>{{ approval().toolId }}</code>\n @if (approval().targets.length > 0) {\n <p class=\"label\">{{ 'nh-assistant.approval.targets' | translate }}</p>\n <ul class=\"targets\">\n @for (target of approval().targets; track $index) {\n <li>{{ target }}</li>\n }\n </ul>\n }\n @if (approval().argumentsPreview) {\n <p class=\"label\">{{ 'nh-assistant.approval.arguments' | translate }}</p>\n <pre>{{ approval().argumentsPreview }}</pre>\n }\n </details>\n\n @if (actionable() && !canDecide()) {\n <p class=\"waiting-for-other\" role=\"status\">\n <nh-assistant-icon name=\"users\" />\n {{ waitingKey() | translate: { name: decisionOwner() } }}\n </p>\n } @else if (actionable()) {\n @if (consultation()) {\n <p class=\"consultation-rights\" data-consultation-rights>{{ 'nh-assistant.approval.consultation.own-rights' | translate }}</p>\n }\n <p class=\"expiry\" aria-live=\"off\">\n <nh-assistant-icon name=\"clock\" />\n {{ 'nh-assistant.approval.expires-in' | translate: { time: countdown() } }}\n </p>\n <div class=\"actions\">\n <button\n class=\"reject\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.approval.reject-label' | translate: { summary: presentedSummary() ?? ('nh-assistant.approval.fallback-summary' | translate) }\"\n (click)=\"choose('reject')\">\n {{ 'nh-assistant.approval.reject' | translate }}\n </button>\n <button\n class=\"approve\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.approval.approve-label' | translate: { summary: presentedSummary() ?? ('nh-assistant.approval.fallback-summary' | translate) }\"\n (click)=\"choose('approve')\">\n {{ 'nh-assistant.approval.approve' | translate }}\n </button>\n </div>\n <!-- The person may leave a consulted agent's proposal for the subject's approvers instead. -->\n @if (leaveRoute(); as route) {\n <div class=\"leave-for-approvers\">\n <p class=\"leave-explanation\" [id]=\"leaveHintId\">{{ 'nh-assistant.approval.consultation.leave-explain.' + route | translate: { subject: consultedSubject() } }}</p>\n <button\n class=\"leave\"\n type=\"button\"\n data-leave\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.approval.consultation.leave-label' | translate: { summary: presentedSummary() ?? ('nh-assistant.approval.fallback-summary' | translate) }\"\n [attr.aria-describedby]=\"leaveHintId\"\n (click)=\"choose('leave')\">\n {{ 'nh-assistant.approval.consultation.leave' | translate }}\n </button>\n </div>\n }\n @if (deciding()) {\n <p class=\"deciding\" role=\"status\">{{ 'nh-assistant.approval.deciding' | translate }}</p>\n }\n } @else if (expired()) {\n <p class=\"expiry\">{{ 'nh-assistant.approval.expired' | translate }}</p>\n }\n\n <!-- The user approved it in this chat and whether the application took it is unknown. -->\n @if (resolvable()) {\n <div class=\"resolve\" data-resolve>\n <p class=\"resolve-explanation\" [id]=\"resolveHintId\">{{ 'nh-assistant.approval.resolve.explanation' | translate }}</p>\n <div class=\"actions\">\n <button\n class=\"mark-resolved\"\n type=\"button\"\n data-mark-resolved\n [disabled]=\"resolveDisabled()\"\n [attr.aria-describedby]=\"resolveHintId\"\n (click)=\"chooseResolution('mark-resolved')\">\n {{ 'nh-assistant.approval.resolve.mark-resolved' | translate }}\n </button>\n <button\n class=\"hand-again\"\n type=\"button\"\n data-hand-to-application\n [disabled]=\"resolveDisabled()\"\n [attr.aria-describedby]=\"resolveHintId\"\n (click)=\"chooseResolution('hand-to-application')\">\n {{ 'nh-assistant.approval.resolve.hand-to-application' | translate }}\n </button>\n </div>\n @if (deciding()) {\n <p class=\"deciding\" role=\"status\">{{ 'nh-assistant.approval.resolve.resolving' | translate }}</p>\n }\n </div>\n }\n\n @if (feedbackAvailable()) {\n @if (!feedbackSaved()) {\n <button\n #feedbackToggle\n class=\"feedback-toggle\"\n type=\"button\"\n [attr.aria-expanded]=\"feedbackOpen()\"\n [attr.aria-controls]=\"feedbackOpen() ? feedbackPanelId : null\"\n (click)=\"toggleFeedback()\">\n {{ 'nh-assistant.approval.give-feedback' | translate }}\n </button>\n }\n @if (feedbackOpen()) {\n <nh-assistant-proposal-feedback\n class=\"feedback\"\n [attr.id]=\"feedbackPanelId\"\n [approvalIds]=\"feedbackIds()\"\n (saved)=\"onFeedbackSaved()\"\n (dismissed)=\"onFeedbackDismissed()\" />\n }\n }\n</section>\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, effect, inject, input, output, signal, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Subscription } from 'rxjs';\nimport { ConnectionRequiredPart } from '../../models/assistant-api.models';\nimport { nhAssistantErrorKeys, nhAssistantErrorOf, toNhAssistantError } from '../../internal/nh-assistant-errors';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NhAssistantMcpConnectService, NhAssistantMcpReturnOutcome } from '../../services/nh-assistant-mcp-connect.service';\nimport { NhAssistantError } from '../../services/nh-assistant.store';\n\nlet nextId = 0;\n\n/**\n * The card of a turn that went on without an MCP server the person who asked has to connect. It\n * connects the viewer's own account, in a popup or by redirect as the host configured, and then\n * offers to ask again. After a redirect the page returns to, the card of that server shows how the\n * connection ended: connected, or the failure with its translated code.\n */\n@Component({\n selector: 'nh-assistant-connection-required',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-connection-required.component.html',\n styleUrl: './nh-assistant-connection-required.component.scss',\n host: { '[attr.data-state]': 'state()' }\n})\nexport class NhAssistantConnectionRequiredComponent {\n private readonly connections = inject(NhAssistantMcpConnectService);\n private subscription?: Subscription;\n\n readonly part = input.required<ConnectionRequiredPart>();\n /** Whether \"Ask again\" is offered once the account is connected. */\n readonly canRetry = input(true);\n /** Asks the question of the turn again after the account was connected. */\n readonly retry = output<void>();\n\n readonly id = `nh-assistant-connection-${nextId++}`;\n readonly state = signal<'idle' | 'connecting' | 'connected' | 'failed'>('idle');\n /** Why connecting failed, as a code and translation key. */\n readonly error = signal<NhAssistantError | null>(null);\n /** The code of `error`. */\n readonly errorCode = computed(() => this.error()?.code ?? null);\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.error()));\n /** The connect button names connecting again when the person had connected before. */\n readonly again = computed(() => this.part().reason !== 'not-connected');\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.subscription?.unsubscribe());\n // The page returned from connecting this card's server in redirect mode.\n effect(() => {\n const returned = this.connections.returned();\n const serverId = this.part().serverId;\n if (returned && serverOf(returned) === serverId) {\n untracked(() => this.showReturned(returned));\n }\n });\n }\n\n connect(): void {\n if (this.state() === 'connecting') {\n return;\n }\n this.state.set('connecting');\n this.error.set(null);\n this.subscription?.unsubscribe();\n this.subscription = this.connections.connect(this.part().serverId).subscribe({\n next: () => this.state.set('connected'),\n error: (error: unknown) => {\n this.state.set('failed');\n this.error.set(toNhAssistantError(error));\n }\n });\n }\n\n private showReturned(returned: NhAssistantMcpReturnOutcome): void {\n if (this.state() === 'connecting') {\n return;\n }\n if (returned.completion) {\n this.state.set('connected');\n this.error.set(null);\n return;\n }\n\n this.state.set('failed');\n this.error.set(nhAssistantErrorOf(returned.code));\n }\n}\n\n/** The server a returned outcome belongs to: the connected one, or the one the page left for. */\nfunction serverOf(returned: NhAssistantMcpReturnOutcome): string | null {\n return returned.completion?.serverId ?? returned.serverId ?? null;\n}\n","<section class=\"card\" role=\"group\" [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"state() === 'connecting'\">\n <div class=\"header\">\n <nh-assistant-icon [name]=\"state() === 'connected' ? 'check' : 'link'\" />\n <h3 [id]=\"id + '-title'\">{{ 'nh-assistant.connection.title' | translate: { name: part().displayName } }}</h3>\n </div>\n <p class=\"text\">{{ 'nh-assistant.connection.' + part().reason | translate: { name: part().displayName } }}</p>\n\n <div class=\"actions\" aria-live=\"polite\">\n @switch (state()) {\n @case ('connected') {\n <p class=\"done\" role=\"status\"><nh-assistant-icon name=\"check\" />{{ 'nh-assistant.connection.connected' | translate: { name: part().displayName } }}</p>\n @if (canRetry()) {\n <button class=\"primary\" type=\"button\" (click)=\"retry.emit()\">{{ 'nh-assistant.connection.retry' | translate }}</button>\n }\n }\n @case ('connecting') {\n <button class=\"primary\" type=\"button\" disabled>{{ 'nh-assistant.connection.connecting' | translate }}</button>\n }\n @default {\n <button class=\"primary\" type=\"button\" (click)=\"connect()\">\n {{ (again() ? 'nh-assistant.connection.connect-again' : 'nh-assistant.connection.connect') | translate }}\n </button>\n }\n }\n </div>\n\n @if (error(); as failure) {\n <p class=\"error\" role=\"alert\" data-connection-error><nh-assistant-icon name=\"warning\" />{{ errorKeys() | nhAssistantTranslate: failure.code }}</p>\n }\n</section>\n","import { ChangeDetectionStrategy, Component, computed, effect, input, output, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { QuestionPart, QuestionStatus } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent, NhAssistantIconName } from '../../internal/nh-assistant-icon.component';\nimport { formatNhAssistantCountdown } from '../approval-card/nh-assistant-approval-card.component';\n\nlet nextId = 0;\n\nconst statusIcons: Record<QuestionStatus, NhAssistantIconName> = {\n pending: 'clock',\n answered: 'check',\n expired: 'x',\n cancelled: 'stop'\n};\n\n/**\n * A question the agent asked with `ask_question`: the question with one button per choice for the\n * person it is addressed to (`canAnswer`), and read-only for everyone else, who sees whom it waits\n * for. It counts down to the end of its wait. Once answered it marks the chosen answer; an expired or\n * cancelled question says so. An answer is emitted at most once until the host reports that it is no\n * longer answering.\n */\n@Component({\n selector: 'nh-assistant-question-card',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-question-card.component.html',\n styleUrl: './nh-assistant-question-card.component.scss',\n host: {\n '[attr.data-status]': 'effectiveStatus()'\n }\n})\nexport class NhAssistantQuestionCardComponent {\n readonly question = input.required<QuestionPart>();\n /** True when the current user is the addressee and may answer, for example `NhAssistantStore.canAnswer`. */\n readonly canAnswer = input(false);\n /** Name of the person the question is addressed to, shown to everyone else; `null` when unknown. */\n readonly addresseeName = input<string | null>(null);\n /** True while the host submits an answer; disables the choices. */\n readonly answering = input(false);\n /** The zero-based index of the chosen answer. */\n readonly answer = output<number>();\n\n readonly questionId = `nh-assistant-question-${nextId++}`;\n private readonly now = signal(Date.now());\n private readonly submitted = signal(false);\n\n readonly remainingMs = computed(() => Date.parse(this.question().expiresAt) - this.now());\n /** A pending question whose wait ended reads as expired before the server says so. */\n readonly effectiveStatus = computed<QuestionStatus>(() =>\n this.question().status === 'pending' && this.remainingMs() <= 0 ? 'expired' : this.question().status);\n readonly actionable = computed(() => this.effectiveStatus() === 'pending');\n readonly statusIcon = computed(() => statusIcons[this.effectiveStatus()]);\n readonly disabled = computed(() => !this.actionable() || !this.canAnswer() || this.answering() || this.submitted());\n readonly chosen = computed(() => this.question().answerIndex ?? null);\n readonly chosenText = computed(() => {\n const index = this.chosen();\n return index === null ? null : this.question().choices[index] ?? null;\n });\n readonly countdown = computed(() => formatNhAssistantCountdown(this.remainingMs()));\n\n constructor() {\n // Tick only while the question waits.\n effect(onCleanup => {\n if (this.question().status !== 'pending') {\n return;\n }\n\n const expiresAt = Date.parse(this.question().expiresAt);\n const timer = setInterval(() => {\n this.now.set(Date.now());\n if (Date.now() >= expiresAt) {\n clearInterval(timer);\n }\n }, 1000);\n onCleanup(() => clearInterval(timer));\n });\n\n // Allow another attempt once the host finished and the question still waits.\n effect(() => {\n if (!this.answering() && this.question().status === 'pending') {\n this.submitted.set(false);\n }\n });\n }\n\n /** Emits the chosen answer once. */\n choose(index: number): void {\n if (this.disabled() || index < 0 || index >= this.question().choices.length) {\n return;\n }\n\n this.submitted.set(true);\n this.answer.emit(index);\n }\n}\n","<section class=\"card\" [attr.aria-labelledby]=\"questionId\">\n <header class=\"header\">\n <nh-assistant-icon [name]=\"statusIcon()\" />\n <h3>{{ 'nh-assistant.question.title' | translate }}</h3>\n <span class=\"status\">{{ 'nh-assistant.question.status.' + effectiveStatus() | translate }}</span>\n </header>\n\n <p class=\"question\" [id]=\"questionId\">{{ question().question }}</p>\n\n @if (actionable() && canAnswer()) {\n <div class=\"choices\" role=\"group\" [attr.aria-labelledby]=\"questionId\">\n @for (choice of question().choices; track $index) {\n <button\n class=\"choice\"\n type=\"button\"\n data-choice\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.question.choose-label' | translate: { choice }\"\n (click)=\"choose($index)\">\n {{ choice }}\n </button>\n }\n </div>\n <p class=\"expiry\" aria-live=\"off\">\n <nh-assistant-icon name=\"clock\" />\n {{ 'nh-assistant.question.expires-in' | translate: { time: countdown() } }}\n </p>\n @if (answering()) {\n <p class=\"answering\" role=\"status\">{{ 'nh-assistant.question.answering' | translate }}</p>\n }\n } @else {\n <ul class=\"choices read-only\" [attr.aria-label]=\"'nh-assistant.question.choices' | translate\">\n @for (choice of question().choices; track $index) {\n <li class=\"choice\" [attr.data-chosen]=\"$index === chosen() ? 'true' : null\">\n @if ($index === chosen()) {\n <nh-assistant-icon name=\"check\" />\n }\n <span>{{ choice }}</span>\n </li>\n }\n </ul>\n @switch (effectiveStatus()) {\n @case ('pending') {\n <p class=\"waiting-for-other\" role=\"status\" data-waiting-for>\n <nh-assistant-icon name=\"users\" />\n @if (addresseeName(); as name) {\n {{ 'nh-assistant.question.waiting-for' | translate: { name } }}\n } @else {\n {{ 'nh-assistant.question.waiting-for-participant' | translate }}\n }\n </p>\n }\n @case ('answered') {\n @if (chosenText(); as text) {\n <p class=\"outcome\" data-answer>{{ 'nh-assistant.question.answered' | translate: { choice: text } }}</p>\n }\n }\n @case ('expired') {\n <p class=\"outcome\">{{ 'nh-assistant.question.expired' | translate }}</p>\n }\n @case ('cancelled') {\n <p class=\"outcome\">{{ 'nh-assistant.question.cancelled' | translate }}</p>\n }\n }\n }\n</section>\n","import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ToolCallPart } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent, NhAssistantIconName } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\n\nlet nextId = 0;\n\nconst statusIcons: Record<ToolCallPart['status'], NhAssistantIconName> = {\n running: 'tool',\n succeeded: 'check',\n failed: 'warning',\n 'awaiting-approval': 'clock',\n // An ask_question call waits for the person it asked.\n 'awaiting-answer': 'clock',\n rejected: 'x',\n // Ended without running: its proposal expired, was withdrawn or became stale.\n 'not-executed': 'stop'\n};\n\n/** Shows one tool invocation with its status and expandable input and result previews. */\n@Component({\n selector: 'nh-assistant-tool-call-card',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-tool-call-card.component.html',\n styleUrl: './nh-assistant-tool-call-card.component.scss',\n host: {\n '[attr.data-status]': 'part().status'\n }\n})\nexport class NhAssistantToolCallCardComponent {\n readonly part = input.required<ToolCallPart>();\n\n readonly detailsId = `nh-assistant-tool-call-${nextId++}`;\n readonly expanded = signal(false);\n readonly statusIcon = computed(() => statusIcons[this.part().status]);\n readonly hasDetails = computed(() => !!this.part().toolId);\n\n toggle(): void {\n this.expanded.update(expanded => !expanded);\n }\n}\n","<article class=\"card\" [attr.aria-label]=\"'nh-assistant.tool-call.label' | translate: { name: part().displayName }\">\n <header class=\"header\">\n <span class=\"status-icon\" [class.spinning]=\"part().status === 'running'\">\n <nh-assistant-icon [name]=\"statusIcon()\" />\n </span>\n <span class=\"title\">{{ part().displayName }}</span>\n @if (part().grantSource; as grantSource) {\n <span class=\"grant\" [attr.title]=\"'nh-assistant.tool-call.grant-source.' + grantSource + '-hint' | translate\">\n {{ 'nh-assistant.tool-call.grant-source.' + grantSource | translate }}\n </span>\n }\n <span class=\"status\">{{ 'nh-assistant.tool-call.status.' + part().status | translate }}</span>\n @if (hasDetails()) {\n <button\n class=\"toggle\"\n type=\"button\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"detailsId\"\n [attr.aria-label]=\"(expanded() ? 'nh-assistant.tool-call.hide-details' : 'nh-assistant.tool-call.show-details') | translate\"\n [attr.title]=\"(expanded() ? 'nh-assistant.tool-call.hide-details' : 'nh-assistant.tool-call.show-details') | translate\"\n (click)=\"toggle()\">\n <nh-assistant-icon name=\"chevron-down\" [class.rotated]=\"expanded()\" />\n </button>\n }\n </header>\n\n @if (part().resultCode; as resultCode) {\n <p class=\"result-code\">\n {{ ['nh-assistant.result-codes.' + resultCode, 'nh-assistant.errors.' + resultCode] | nhAssistantTranslate: resultCode }}\n </p>\n }\n\n @if (hasDetails()) {\n <div class=\"details\" [id]=\"detailsId\" [hidden]=\"!expanded()\">\n <p class=\"label\">{{ 'nh-assistant.tool-call.tool-id' | translate }}</p>\n <code>{{ part().toolId }}</code>\n @if (part().argumentsPreview; as argumentsPreview) {\n <p class=\"label\">{{ 'nh-assistant.tool-call.arguments' | translate }}</p>\n <pre>{{ argumentsPreview }}</pre>\n }\n @if (part().resultPreview; as resultPreview) {\n <p class=\"label\">{{ 'nh-assistant.tool-call.result' | translate }}</p>\n <pre>{{ resultPreview }}</pre>\n } @else if (part().restricted) {\n <p class=\"label\">{{ 'nh-assistant.tool-call.result' | translate }}</p>\n <p class=\"restricted\">{{ 'nh-assistant.tool-call.restricted' | translate }}</p>\n }\n </div>\n }\n</article>\n","import { ChangeDetectionStrategy, Component, computed, input, signal } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ToolCallPart } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent, NhAssistantIconName } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantToolCallCardComponent } from '../tool-call-card/nh-assistant-tool-call-card.component';\n\nlet nextId = 0;\n\n/**\n * Overall state of a run of tool calls, from most to least urgent. `not-executed` means that every\n * call finished and at least one ended without running, because its proposal expired, was\n * withdrawn or became stale. `awaiting-answer` waits for the answer to a question the agent asked.\n */\nexport type NhAssistantToolCallGroupState = 'awaiting-approval' | 'awaiting-answer' | 'running' | 'failed' | 'not-executed' | 'succeeded';\n\nconst stateIcons: Record<NhAssistantToolCallGroupState, NhAssistantIconName> = {\n 'awaiting-approval': 'clock',\n 'awaiting-answer': 'clock',\n running: 'tool',\n failed: 'warning',\n 'not-executed': 'stop',\n succeeded: 'check'\n};\n\n/**\n * Summarizes consecutive tool calls in one collapsed line that counts along live: the\n * tool that runs now while the assistant works, and how many tools were used and failed\n * afterwards. Expanding it shows every call as a card.\n */\n@Component({\n selector: 'nh-assistant-tool-call-group',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent, NhAssistantToolCallCardComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-tool-call-group.component.html',\n styleUrl: './nh-assistant-tool-call-group.component.scss',\n host: {\n '[attr.data-status]': 'state()'\n }\n})\nexport class NhAssistantToolCallGroupComponent {\n readonly calls = input.required<readonly ToolCallPart[]>();\n\n readonly callsId = `nh-assistant-tool-call-group-${nextId++}`;\n readonly expanded = signal(false);\n\n /** The call that currently needs attention or runs; the latest one when several do. */\n readonly current = computed(() => {\n const calls = this.calls();\n return findLast(calls, call => call.status === 'awaiting-approval' || call.status === 'awaiting-answer')\n ?? findLast(calls, call => call.status === 'running')\n ?? null;\n });\n readonly total = computed(() => this.calls().length);\n readonly finished = computed(() => this.calls().filter(call => !isActive(call)).length);\n readonly failed = computed(() => this.calls().filter(call => call.status === 'failed').length);\n /** Calls that finished without running; they never wait. */\n readonly notExecuted = computed(() => this.calls().filter(call => call.status === 'not-executed').length);\n readonly state = computed<NhAssistantToolCallGroupState>(() => {\n const current = this.current();\n if (current) {\n return current.status === 'awaiting-approval' || current.status === 'awaiting-answer' ? current.status : 'running';\n }\n\n if (this.failed() > 0) {\n return 'failed';\n }\n\n return this.notExecuted() > 0 ? 'not-executed' : 'succeeded';\n });\n readonly stateIcon = computed(() => stateIcons[this.state()]);\n\n toggle(): void {\n this.expanded.update(expanded => !expanded);\n }\n}\n\nfunction isActive(call: ToolCallPart): boolean {\n return call.status === 'running' || call.status === 'awaiting-approval' || call.status === 'awaiting-answer';\n}\n\nfunction findLast(calls: readonly ToolCallPart[], predicate: (call: ToolCallPart) => boolean): ToolCallPart | undefined {\n for (let index = calls.length - 1; index >= 0; index--) {\n if (predicate(calls[index])) {\n return calls[index];\n }\n }\n\n return undefined;\n}\n","<section class=\"group\">\n <button\n class=\"summary\"\n type=\"button\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"callsId\"\n [attr.title]=\"(expanded() ? 'nh-assistant.tool-group.hide-calls' : 'nh-assistant.tool-group.show-calls') | translate\"\n (click)=\"toggle()\">\n <span class=\"status-icon\" [class.spinning]=\"state() === 'running'\">\n <nh-assistant-icon [name]=\"stateIcon()\" />\n </span>\n <span class=\"title\">\n @switch (state()) {\n @case ('running') {\n {{ 'nh-assistant.tool-group.running' | translate: { name: current()?.displayName } }}\n }\n @case ('awaiting-approval') {\n {{ 'nh-assistant.tool-group.awaiting-approval' | translate: { name: current()?.displayName } }}\n }\n @case ('awaiting-answer') {\n {{ 'nh-assistant.tool-group.awaiting-answer' | translate }}\n }\n @default {\n {{ (total() === 1 ? 'nh-assistant.tool-group.used-one' : 'nh-assistant.tool-group.used-many') | translate: { count: total() } }}\n }\n }\n </span>\n @if (state() === 'running' || state() === 'awaiting-approval' || state() === 'awaiting-answer') {\n <span class=\"count\">{{ 'nh-assistant.tool-group.progress' | translate: { finished: finished(), total: total() } }}</span>\n } @else {\n @if (failed() > 0) {\n <span class=\"count failed\">{{ 'nh-assistant.tool-group.failed' | translate: { count: failed() } }}</span>\n }\n @if (notExecuted() > 0) {\n <span class=\"count not-executed\">{{ 'nh-assistant.tool-group.not-executed' | translate: { count: notExecuted() } }}</span>\n }\n }\n <nh-assistant-icon class=\"chevron\" name=\"chevron-down\" [class.rotated]=\"expanded()\" />\n </button>\n\n <div class=\"calls\" [id]=\"callsId\" [hidden]=\"!expanded()\">\n @if (expanded()) {\n @for (call of calls(); track call.invocationId) {\n <nh-assistant-tool-call-card [part]=\"call\" />\n }\n }\n </div>\n</section>\n","import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe, TranslateService } from '@ngx-translate/core';\nimport { ApprovalDecision, ApprovalPart, ApprovalResolution, ConversationMember, FilePart, Message, QuestionPart } from '../../models/assistant-api.models';\nimport { nhAssistantFileTypeLabel, nhAssistantFormatFileSize } from '../../internal/nh-assistant-files';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantMarkdownPipe } from '../../internal/nh-assistant-markdown.pipe';\nimport { NhAssistantMessageLinkComponent } from '../../internal/nh-assistant-message-link.component';\nimport { NhAssistantPartGroupsPipe } from '../../internal/nh-assistant-part-groups';\nimport { NhAssistantApprovalCardComponent } from '../approval-card/nh-assistant-approval-card.component';\nimport { NhAssistantConnectionRequiredComponent } from '../connection-required/nh-assistant-connection-required.component';\nimport { NhAssistantQuestionCardComponent } from '../question-card/nh-assistant-question-card.component';\nimport { NhAssistantToolCallGroupComponent } from '../tool-call-group/nh-assistant-tool-call-group.component';\nimport type { NhAssistantApprovalRight } from '../../services/nh-assistant.store';\n\n/** A decision about one approval of the thread. */\nexport interface NhAssistantApprovalChoice {\n approvalId: string;\n decision: ApprovalDecision;\n}\n\n/** The answer the user chose for a question of the thread. */\nexport interface NhAssistantQuestionAnswer {\n questionId: string;\n /** The zero-based index of the chosen answer. */\n choice: number;\n}\n\n/** How the user resolves the uncertain hand-off of one approval they made in this chat. */\nexport interface NhAssistantApprovalResolutionChoice {\n approvalId: string;\n resolution: ApprovalResolution;\n}\n\n/** Above this number of messages the thread renders through CDK virtual scrolling. */\nexport const NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD = 200;\n\n/** Distance from the bottom, in pixels, within which new content keeps the thread pinned to the end. */\nconst stickToBottomDistance = 120;\n\n/**\n * The messages of a conversation as a live log. Assistant text renders as sanitized\n * Markdown, consecutive tool calls as one collapsible group that counts along, and\n * approvals as cards. The files a person attached show by name, type and size. Messages a\n * trigger wrote into an agent thread read as events, not as a person, and a message the application\n * posted reads as the application's, with its sender, title, Markdown text and link, and a label when\n * the assistant follows it as an instruction. While a turn runs without visible progress, a working\n * indicator shows the elapsed time: under the answer `writingMessageId` names, also when the\n * application's or another person's message arrived after it, and at the end without it. The thread\n * follows new content while the user is at the bottom.\n */\n@Component({\n selector: 'nh-assistant-thread',\n standalone: true,\n imports: [\n NgTemplateOutlet,\n ScrollingModule,\n TranslatePipe,\n NhAssistantIconComponent,\n NhAssistantMarkdownPipe,\n NhAssistantMessageLinkComponent,\n NhAssistantPartGroupsPipe,\n NhAssistantToolCallGroupComponent,\n NhAssistantApprovalCardComponent,\n NhAssistantConnectionRequiredComponent,\n NhAssistantQuestionCardComponent\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-thread.component.html',\n styleUrl: './nh-assistant-thread.component.scss'\n})\nexport class NhAssistantThreadComponent {\n private readonly injector = inject(Injector);\n private readonly translate = inject(TranslateService, { optional: true });\n\n /** The type and size of an attached file, in the current language. */\n fileMeta(file: FilePart): { type: string; size: string } {\n return {\n type: nhAssistantFileTypeLabel(file.mediaType),\n size: nhAssistantFormatFileSize(file.size, this.translate?.getCurrentLang())\n };\n }\n\n readonly messages = input.required<readonly Message[]>();\n readonly streaming = input(false);\n readonly deciding = input(false);\n readonly markdown = input(true);\n /** The owner and participants of a shared conversation; empty while it is not shared. */\n readonly members = input<readonly ConversationMember[]>([]);\n /** The current user, to tell their own messages from those of others. */\n readonly currentActorId = input<string | null>(null);\n /** False when the pending approval belongs to another participant's turn. */\n readonly canDecide = input(true);\n /** Name of the participant who decides the pending approval, when it is someone else. */\n readonly decisionOwner = input<string | null>(null);\n /**\n * Who may decide each pending approval, by approval id, for example `NhAssistantStore.approvalRights`.\n * An agent thread can hold several open proposals that the subject's approvers decide. Approvals\n * without an entry use `canDecide` and `decisionOwner`. An entry with `canGiveFeedback` lets the\n * card of a rejected proposal ask what was wrong.\n */\n readonly approvalRights = input<ReadonlyMap<string, NhAssistantApprovalRight> | null>(null);\n /**\n * The answer the running turn writes, for example `NhAssistantStore.writingMessageId`. The working\n * indicator stays under that answer, also when the application's or a colleague's message arrives\n * after it during the turn. Without it, or when it names no message of `messages`, the indicator\n * shows at the end of the thread.\n */\n readonly writingMessageId = input<string | null>(null);\n /** The decision about an approval card, without the approval it belongs to. */\n readonly approvalDecision = output<ApprovalDecision>();\n /** The decision about an approval card together with its approval id. */\n readonly approvalChoice = output<NhAssistantApprovalChoice>();\n /** How the user resolves an uncertain hand-off they approved in this chat, with its approval id. */\n readonly approvalResolution = output<NhAssistantApprovalResolutionChoice>();\n /**\n * The answer the user chose for a question addressed to them, for example for\n * `NhAssistantStore.answerQuestion`. Only the addressee of a pending question gets choice buttons.\n */\n readonly questionAnswer = output<NhAssistantQuestionAnswer>();\n /**\n * The question to ask again after the viewer connected an MCP server from a connection card: the\n * text of the user message the card answered. The panel sends it.\n */\n readonly retryMessage = output<string>();\n\n private readonly names = computed(() => new Map(this.members().map(member => [member.actorId, member.displayName])));\n\n /** Asks the question again that the assistant message with a connection card answered. */\n retryAfterConnect(message: Message): void {\n const messages = this.messages();\n const index = messages.findIndex(item => item.id === message.id);\n for (let position = index - 1; position >= 0; position--) {\n const candidate = messages[position];\n if (candidate.role !== 'user') {\n continue;\n }\n const text = candidate.parts.map(part => part.type === 'text' ? part.text : '').join('').trim();\n if (text.length > 0) {\n this.retryMessage.emit(text);\n }\n return;\n }\n }\n\n readonly virtualThreshold = NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD;\n readonly virtual = computed(() => this.messages().length > NH_ASSISTANT_VIRTUAL_SCROLL_THRESHOLD);\n /**\n * True while the turn runs and nothing else shows progress: before the first part and\n * between tool calls while the model decides what to do next. Streaming text and a\n * running tool group show their own progress; an approval waits for the user. With\n * `writingMessageId`, the answer it names decides, as if the messages after it were not there.\n */\n readonly working = computed(() => {\n if (!this.streaming()) {\n return false;\n }\n\n const messages = this.messages();\n const last = this.answerBeingWritten() ?? messages[messages.length - 1];\n if (!last || last.role === 'user' || last.role === 'application' || last.parts.length === 0) {\n return true;\n }\n\n const lastPart = last.parts[last.parts.length - 1];\n return lastPart.type === 'tool-call'\n && lastPart.status !== 'running'\n && lastPart.status !== 'awaiting-approval'\n && lastPart.status !== 'awaiting-answer';\n });\n /**\n * The message in whose row the working indicator shows: the answer `writingMessageId` names.\n * `null` puts the indicator at the end of the thread.\n */\n readonly workingAfterId = computed(() => this.answerBeingWritten()?.id ?? null);\n /** While a turn runs: the answer `writingMessageId` names, when `messages` holds it. */\n private readonly answerBeingWritten = computed<Message | null>(() => {\n const writingMessageId = this.writingMessageId();\n if (!this.streaming() || !writingMessageId) {\n return null;\n }\n\n return this.messages().find(message => message.id === writingMessageId) ?? null;\n });\n /** Whole seconds since the running turn started. */\n readonly elapsedSeconds = computed(() => {\n const startedAt = this.turnStartedAt();\n return startedAt === null ? 0 : Math.max(0, Math.floor((this.now() - startedAt) / 1000));\n });\n\n private readonly turnStartedAt = signal<number | null>(null);\n private readonly now = signal(Date.now());\n\n private readonly scroller = viewChild<ElementRef<HTMLElement>>('scroller');\n private readonly viewport = viewChild(CdkVirtualScrollViewport);\n\n constructor() {\n effect(onCleanup => {\n if (!this.streaming()) {\n this.turnStartedAt.set(null);\n return;\n }\n\n untracked(() => {\n const now = Date.now();\n this.now.set(now);\n if (this.turnStartedAt() === null) {\n this.turnStartedAt.set(now);\n }\n });\n const timer = setInterval(() => this.now.set(Date.now()), 1000);\n onCleanup(() => clearInterval(timer));\n });\n\n effect(() => {\n this.messages();\n this.working();\n const element = this.scrollElement();\n const pinned = !element || element.scrollHeight - element.scrollTop - element.clientHeight <= stickToBottomDistance;\n if (pinned) {\n afterNextRender(() => this.scrollToEnd(), { injector: this.injector });\n }\n });\n }\n\n trackMessage(_index: number, message: Message): string {\n return message.id;\n }\n\n /** True for a user message a trigger wrote into an agent thread. */\n isTrigger(message: Message): boolean {\n return message.role === 'user' && message.authorKind === 'trigger';\n }\n\n /** True for a message the application posted into the conversation. */\n isApplication(message: Message): boolean {\n return message.role === 'application';\n }\n\n /** True for an assistant message the agent's rules wrote without a model. */\n isRule(message: Message): boolean {\n return message.role === 'assistant' && message.authorKind === 'rule';\n }\n\n /** True for a user message written by another person in a shared conversation. */\n isOthers(message: Message): boolean {\n return message.role === 'user'\n && !this.isTrigger(message)\n && !!message.authorActorId\n && !!this.currentActorId()\n && message.authorActorId !== this.currentActorId();\n }\n\n /** Whether and why the current user may decide an approval card. */\n rightFor(approval: ApprovalPart): NhAssistantApprovalRight {\n return this.approvalRights()?.get(approval.approvalId) ?? {\n canDecide: this.canDecide(),\n waitingFor: 'turn',\n decisionOwner: this.decisionOwner()\n };\n }\n\n choose(approval: ApprovalPart, decision: ApprovalDecision): void {\n this.approvalDecision.emit(decision);\n this.approvalChoice.emit({ approvalId: approval.approvalId, decision });\n }\n\n resolveApproval(approval: ApprovalPart, resolution: ApprovalResolution): void {\n this.approvalResolution.emit({ approvalId: approval.approvalId, resolution });\n }\n\n /** Whether the current user may answer the question: it waits and is addressed to them. */\n canAnswer(question: QuestionPart): boolean {\n const currentActorId = this.currentActorId();\n return question.status === 'pending' && !!currentActorId && question.addresseeActorId === currentActorId;\n }\n\n /** The name of the person a question is addressed to, or `null` when the application provides none. */\n addresseeName(question: QuestionPart): string | null {\n return this.names().get(question.addresseeActorId) ?? null;\n }\n\n answerQuestion(question: QuestionPart, choice: number): void {\n this.questionAnswer.emit({ questionId: question.questionId, choice });\n }\n\n /** Display name of another person's message, or `null` when the application provides none. */\n authorName(message: Message): string | null {\n return message.authorActorId ? this.names().get(message.authorActorId) ?? null : null;\n }\n\n private scrollElement(): HTMLElement | null {\n return this.viewport()?.elementRef.nativeElement ?? this.scroller()?.nativeElement ?? null;\n }\n\n private scrollToEnd(): void {\n const viewport = this.viewport();\n if (viewport) {\n viewport.scrollToIndex(this.messages().length - 1);\n viewport.scrollTo({ bottom: 0 });\n return;\n }\n\n const element = this.scroller()?.nativeElement;\n if (element) {\n element.scrollTop = element.scrollHeight;\n }\n }\n}\n","<div class=\"log\" role=\"log\" aria-live=\"polite\" [attr.aria-label]=\"'nh-assistant.thread.label' | translate\" [attr.aria-busy]=\"streaming()\">\n @if (virtual()) {\n <cdk-virtual-scroll-viewport class=\"scroller\" itemSize=\"120\" minBufferPx=\"1200\" maxBufferPx=\"2400\">\n <div class=\"row\" *cdkVirtualFor=\"let message of messages(); trackBy: trackMessage\">\n <ng-container [ngTemplateOutlet]=\"messageTemplate\" [ngTemplateOutletContext]=\"{ $implicit: message }\" />\n @if (working() && message.id === workingAfterId()) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </div>\n @if (working() && workingAfterId() === null) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </cdk-virtual-scroll-viewport>\n } @else {\n <div class=\"scroller\" #scroller tabindex=\"0\">\n @for (message of messages(); track message.id) {\n <div class=\"row\">\n <ng-container [ngTemplateOutlet]=\"messageTemplate\" [ngTemplateOutletContext]=\"{ $implicit: message }\" />\n <!-- The answer a turn still writes (writingMessageId) keeps the indicator under it, also when messages arrived after it. -->\n @if (working() && message.id === workingAfterId()) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </div>\n }\n @if (working() && workingAfterId() === null) {\n <ng-container [ngTemplateOutlet]=\"workingTemplate\" />\n }\n </div>\n }\n</div>\n\n<ng-template #messageTemplate let-message>\n <article\n class=\"message\"\n [attr.data-role]=\"message.role\"\n [attr.data-others]=\"isOthers(message) ? 'true' : null\"\n [attr.data-author]=\"isTrigger(message) ? 'trigger' : isRule(message) ? 'rule' : isApplication(message) ? 'application' : null\"\n [attr.aria-label]=\"isApplication(message) ? ('nh-assistant.thread.application-label' | translate) : null\">\n @if (isTrigger(message)) {\n <p class=\"author\">{{ 'nh-assistant.thread.trigger' | translate }}</p>\n } @else if (isRule(message)) {\n <p class=\"author\">{{ 'nh-assistant.thread.rule' | translate }}</p>\n } @else if (isApplication(message)) {\n <!-- The application's message reads as the application's, also when it names who in the application posted it. -->\n <p class=\"author\">\n <nh-assistant-icon class=\"author-icon\" name=\"bell\" />\n @if (message.application?.senderName; as sender) {\n <!-- The space keeps the sender and the tag apart for screen readers; the flex gap shows it. -->\n <span>{{ sender }}</span>{{ ' ' }}<span class=\"tag\">{{ 'nh-assistant.thread.application' | translate }}</span>\n } @else {\n <span>{{ 'nh-assistant.thread.application' | translate }}</span>\n }\n @if (message.application?.trusted) {\n <!-- People see which of the application's messages the assistant follows as an instruction. -->\n {{ ' ' }}<span class=\"tag trusted\">{{ 'nh-assistant.thread.application-trusted' | translate }}</span>\n }\n </p>\n @if (message.application?.title; as title) {\n <p class=\"application-title\">{{ title }}</p>\n }\n } @else if (isOthers(message)) {\n <p class=\"author\">{{ authorName(message) ?? ('nh-assistant.thread.participant' | translate) }}</p>\n } @else {\n <p class=\"author\">{{ 'nh-assistant.thread.' + (message.role === 'user' ? 'you' : message.role) | translate }}</p>\n }\n @for (group of message.parts | nhAssistantPartGroups; track group.key) {\n @switch (group.kind) {\n @case ('text') {\n @if ((message.role === 'assistant' || isApplication(message)) && markdown()) {\n <div class=\"bubble markdown\" [innerHTML]=\"group.part.text | nhAssistantMarkdown\"></div>\n } @else {\n <div class=\"bubble plain\">{{ group.part.text }}</div>\n }\n }\n @case ('tools') {\n <nh-assistant-tool-call-group class=\"part\" [calls]=\"group.calls\" />\n }\n @case ('files') {\n <ul class=\"files\" [attr.aria-label]=\"'nh-assistant.thread.files' | translate\">\n @for (file of group.files; track $index) {\n <li class=\"file\">\n <nh-assistant-icon class=\"file-icon\" name=\"file\" />\n <span class=\"file-name\" [attr.title]=\"file.name\">{{ file.name }}</span>\n <span class=\"file-meta\">{{ 'nh-assistant.thread.file-meta' | translate: fileMeta(file) }}</span>\n </li>\n }\n </ul>\n }\n @case ('connection') {\n <nh-assistant-connection-required\n class=\"part\"\n [part]=\"group.part\"\n [canRetry]=\"!streaming()\"\n (retry)=\"retryAfterConnect(message)\" />\n }\n @case ('approval') {\n <nh-assistant-approval-card\n class=\"part\"\n [approval]=\"group.part\"\n [deciding]=\"deciding()\"\n [canDecide]=\"rightFor(group.part).canDecide\"\n [decisionOwner]=\"rightFor(group.part).decisionOwner\"\n [waitingFor]=\"rightFor(group.part).waitingFor\"\n [canGiveFeedback]=\"rightFor(group.part).canGiveFeedback === true\"\n (decide)=\"choose(group.part, $event)\"\n (resolve)=\"resolveApproval(group.part, $event)\" />\n }\n @case ('question') {\n <nh-assistant-question-card\n class=\"part\"\n [question]=\"group.part\"\n [canAnswer]=\"canAnswer(group.part)\"\n [addresseeName]=\"addresseeName(group.part)\"\n [answering]=\"deciding()\"\n (answer)=\"answerQuestion(group.part, $event)\" />\n }\n }\n }\n @if (isApplication(message) && message.application?.link; as link) {\n <nh-assistant-message-link\n class=\"application-link\"\n [url]=\"link.url\"\n [label]=\"link.label || ('nh-assistant.thread.application-link' | translate)\" />\n }\n </article>\n</ng-template>\n\n<ng-template #workingTemplate>\n <p class=\"working\" role=\"status\">\n <span class=\"dots\" aria-hidden=\"true\"><span></span><span></span><span></span></span>\n {{ 'nh-assistant.thread.working' | translate }}\n @if (elapsedSeconds() > 0) {\n <span class=\"elapsed\">{{ 'nh-assistant.thread.elapsed' | translate: { seconds: elapsedSeconds() } }}</span>\n }\n </p>\n</ng-template>\n","import { TemplatePortal } from '@angular/cdk/portal';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n OnDestroy,\n TemplateRef,\n ViewContainerRef,\n computed,\n effect,\n inject,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { NavigationEnd, Router, RouterLink } from '@angular/router';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ApprovalDecision, ClientContext, FileReference } from '../../models/assistant-api.models';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from '../../internal/nh-assistant-translate.pipe';\nimport { NH_ASSISTANT_CONFIG } from '../../nh-assistant.config';\nimport { NhAssistantPanelService } from '../../services/nh-assistant-panel.service';\nimport { NhAssistantError, NhAssistantStore } from '../../services/nh-assistant.store';\nimport { describeNhAssistantClientContext } from '../../services/nh-assistant-page-context';\nimport { NhAssistantPushService } from '../../services/nh-assistant-push.service';\nimport { NhAssistantActivityComponent } from '../activity/nh-assistant-activity.component';\nimport { NhAssistantAgentPickerComponent } from '../agent-picker/nh-assistant-agent-picker.component';\nimport { NhAssistantComposerComponent } from '../composer/nh-assistant-composer.component';\nimport { NhAssistantConversationListComponent } from '../conversation-list/nh-assistant-conversation-list.component';\nimport { NhAssistantPreferencesComponent } from '../preferences/nh-assistant-preferences.component';\nimport { NhAssistantShareComponent } from '../share/nh-assistant-share.component';\nimport {\n NH_ASSISTANT_CONVERSATION_FRAGMENT,\n NH_ASSISTANT_JOIN_FRAGMENT,\n NH_ASSISTANT_RUN_FRAGMENT\n} from '../../services/nh-assistant-share-link';\nimport {\n NhAssistantApprovalChoice,\n NhAssistantApprovalResolutionChoice,\n NhAssistantQuestionAnswer,\n NhAssistantThreadComponent\n} from '../thread/nh-assistant-thread.component';\nimport { nhAssistantErrorKeys, toNhAssistantError } from '../../internal/nh-assistant-errors';\n\nlet nextId = 0;\n\n/**\n * The assistant drawer. Place it once in the application layout; it renders nothing in\n * place and appears as an overlay when `NhAssistantPanelService.open()` is called. It opens\n * by itself for an invitation link (`#nh-assistant-join=...`) and for a clicked notification.\n */\n@Component({\n selector: 'nh-assistant-panel',\n standalone: true,\n imports: [\n RouterLink,\n TranslatePipe,\n NhAssistantTranslatePipe,\n NhAssistantIconComponent,\n NhAssistantActivityComponent,\n NhAssistantAgentPickerComponent,\n NhAssistantComposerComponent,\n NhAssistantConversationListComponent,\n NhAssistantPreferencesComponent,\n NhAssistantShareComponent,\n NhAssistantThreadComponent\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-panel.component.html',\n styleUrl: './nh-assistant-panel.component.scss'\n})\nexport class NhAssistantPanelComponent implements AfterViewInit, OnDestroy {\n readonly store = inject(NhAssistantStore);\n readonly panel = inject(NhAssistantPanelService);\n readonly push = inject(NhAssistantPushService);\n private readonly config = inject(NH_ASSISTANT_CONFIG);\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly router = inject(Router, { optional: true });\n private readonly drawer = viewChild.required<TemplateRef<unknown>>('drawer');\n private portal?: TemplatePortal;\n\n readonly titleId = `nh-assistant-panel-title-${nextId++}`;\n readonly markdown = this.config.markdown?.enabled ?? true;\n readonly showConversations = signal(false);\n readonly showPreferences = signal(false);\n readonly showShare = signal(false);\n readonly shareSection = signal<'all' | 'link' | 'members'>('all');\n readonly notificationError = signal<NhAssistantError | null>(null);\n readonly notificationsLabel = computed(() => this.push.settings()?.pushEnabled\n ? 'nh-assistant.panel.notifications-off' : 'nh-assistant.panel.notifications-on');\n readonly adminRoute = this.config.adminRoute ?? null;\n readonly conversation = this.store.activeConversation;\n private readonly conversationId = computed(() => this.conversation()?.id ?? null);\n readonly messages = computed(() => this.conversation()?.messages ?? []);\n /** An archived conversation takes no new messages. A failed one does: the person asks again. */\n readonly closed = computed(() => this.conversation()?.status === 'archived');\n readonly busy = computed(() => this.store.streaming() || this.conversation()?.status === 'running');\n /**\n * The last turn failed and no error bar explains it, for example after the conversation was\n * reopened. The panel then says so, while the composer stays available.\n */\n readonly lastTurnFailed = computed(() => this.conversation()?.status === 'failed'\n && !this.busy() && this.store.error() === null);\n readonly composerDisabled = computed(() => !this.store.canSubmit());\n readonly editingQueuedId = signal<string | null>(null);\n readonly queuedDraft = signal('');\n private resumeAfterEditing = false;\n readonly validQueuedDraft = computed(() => this.queuedDraft().trim().length > 0\n && this.queuedDraft().trim().length <= (this.store.limits()?.maxMessageChars ?? Infinity));\n readonly composerStatus = computed<'running' | 'waiting-for-approval' | 'waiting-for-answer' | null>(() => {\n if (this.store.streaming() || this.conversation()?.status === 'running') {\n return 'running';\n }\n if (this.conversation()?.status !== 'waiting-for-approval' || this.store.waitExpired()) {\n // A wait whose lifetime passed holds nothing back: the next message is sent and closes it.\n return null;\n }\n // A turn that asked a question waits for its answer, not for an approval.\n return this.conversation()?.pendingQuestion ? 'waiting-for-answer' : 'waiting-for-approval';\n });\n /**\n * Who the composer says the conversation waits for, when it is someone else: the addressee of a\n * pending question, otherwise the person whose turn waits.\n */\n readonly composerStatusActor = computed(() => {\n if (this.composerStatus() === 'waiting-for-answer') {\n const addressee = this.store.questionAddressee();\n return addressee ? addressee.displayName ?? '' : null;\n }\n return this.activeMemberName();\n });\n /** Name of another participant whose turn runs or waits, or `null`. */\n readonly activeMemberName = computed(() => {\n const member = this.store.activeMember();\n return member ? member.displayName ?? '' : null;\n });\n /** The owner and the person who started the turn may stop it. */\n readonly canStop = computed(() => this.store.isOwner() || this.store.activeMember() === null);\n readonly shared = computed(() => this.store.members().some(member => member.role === 'participant'));\n readonly canShare = computed(() => this.conversation() !== null && !!this.store.collaboration());\n readonly errorKeys = computed(() => nhAssistantErrorKeys(this.notificationError() ?? this.store.error()));\n readonly noticeKeys = computed(() => nhAssistantErrorKeys(this.store.notice()));\n\n constructor() {\n // Opening, creating or leaving a conversation returns from the list to the thread.\n effect(() => {\n if (this.conversationId() !== undefined) {\n untracked(() => {\n this.showConversations.set(false);\n this.showPreferences.set(false);\n this.showShare.set(false);\n });\n }\n });\n\n // The open thread counts as seen only while the drawer shows it.\n effect(() => {\n const viewing = this.panel.isOpen() && !this.showConversations() && !this.showPreferences() && !this.showShare();\n untracked(() => this.store.setViewing(viewing));\n });\n\n // A clicked notification opens its conversation in this window.\n const notifications = this.push.openConversation$.subscribe(conversationId => this.panel.open(conversationId));\n inject(DestroyRef).onDestroy(() => notifications.unsubscribe());\n\n effect(() => {\n if (this.panel.isOpen()) {\n untracked(() => {\n void this.store.initialize().then(() => this.store.refreshConversations());\n this.refreshPageContext();\n });\n }\n });\n\n // The drawer stays open while the user navigates; keep the page-context control current.\n const navigation = this.router?.events.subscribe(event => {\n if (event instanceof NavigationEnd && this.panel.isOpen()) {\n this.refreshPageContext();\n }\n });\n inject(DestroyRef).onDestroy(() => navigation?.unsubscribe());\n }\n\n ngAfterViewInit(): void {\n this.portal = new TemplatePortal(this.drawer(), this.viewContainerRef);\n this.panel.registerPanel(this.portal);\n this.openFromLocation();\n }\n\n ngOnDestroy(): void {\n if (this.portal) {\n this.panel.unregisterPanel(this.portal);\n }\n }\n\n refreshPageContext(): void {\n void this.store.refreshPageContext();\n }\n\n describeContext(context: ClientContext): string {\n return describeNhAssistantClientContext(context);\n }\n\n toggleConversations(): void {\n this.showPreferences.set(false);\n this.showShare.set(false);\n this.showConversations.update(show => !show);\n }\n\n togglePreferences(): void {\n this.showConversations.set(false);\n this.showShare.set(false);\n this.showPreferences.update(show => !show);\n }\n\n toggleShare(section: 'all' | 'link' | 'members' = 'all'): void {\n this.showConversations.set(false);\n this.showPreferences.set(false);\n const close = this.showShare() && this.shareSection() === section;\n this.shareSection.set(section);\n this.showShare.set(!close);\n }\n\n /** Applies the notification choice immediately, including browser permission handling. */\n async toggleNotifications(): Promise<void> {\n if (this.push.busy() || this.push.state() === 'unavailable') {\n return;\n }\n this.notificationError.set(null);\n try {\n await this.push.setEnabled(!this.push.settings()?.pushEnabled);\n } catch (error) {\n this.notificationError.set(toNhAssistantError(error));\n }\n }\n\n newConversation(): void {\n this.store.startNewConversation();\n this.showConversations.set(false);\n }\n\n openConversation(conversationId: string): void {\n void this.store.openConversation(conversationId);\n this.showConversations.set(false);\n }\n\n deleteConversation(conversationId: string): void {\n void this.store.deleteConversation(conversationId);\n }\n\n send(text: string): void {\n this.showConversations.set(false);\n this.showPreferences.set(false);\n this.showShare.set(false);\n void this.store.submit(text, this.store.attachedFiles());\n }\n\n /** Uploads the files the person attached to the next message. */\n attach(files: File[]): void {\n void this.store.attach(files);\n }\n\n /** The names of the files a queued message carries, as the queue lists them. */\n fileNames(files: readonly FileReference[]): string {\n return files.map(file => file.name).join(', ');\n }\n\n editQueuedMessage(id: string, text: string): void {\n this.resumeAfterEditing = !this.store.queuePaused();\n this.store.pauseQueue();\n this.editingQueuedId.set(id);\n this.queuedDraft.set(text);\n }\n\n changeQueuedDraft(event: Event): void {\n this.queuedDraft.set((event.target as HTMLTextAreaElement).value);\n }\n\n saveQueuedMessage(id: string): void {\n if (this.store.updateQueuedMessage(id, this.queuedDraft())) {\n this.cancelQueueEdit();\n }\n }\n\n cancelQueueEdit(): void {\n this.editingQueuedId.set(null);\n if (this.resumeAfterEditing && !this.store.error()) {\n this.store.resumeQueue();\n }\n }\n\n /**\n * Opens the panel for an invitation link or a clicked notification in the URL fragment and\n * removes the fragment, so a reload or a shared screenshot does not reuse the token. A clicked\n * notification about the proposals of a run goes to `NhAssistantPushService.openRun$` while the\n * application subscribes, and otherwise opens its conversation.\n */\n private openFromLocation(): void {\n const location = globalThis.location;\n const hash = location?.hash?.replace(/^#/, '') ?? '';\n const separatorIndex = hash.indexOf('=');\n const name = separatorIndex < 0 ? hash : hash.slice(0, separatorIndex);\n const value = separatorIndex < 0 ? '' : hash.slice(separatorIndex + 1);\n if (!value || (name !== NH_ASSISTANT_JOIN_FRAGMENT && name !== NH_ASSISTANT_CONVERSATION_FRAGMENT && name !== NH_ASSISTANT_RUN_FRAGMENT)) {\n return;\n }\n\n globalThis.history?.replaceState(globalThis.history.state, '', location.pathname + location.search);\n if (name === NH_ASSISTANT_CONVERSATION_FRAGMENT) {\n this.panel.open(decodeURIComponent(value));\n return;\n }\n\n const tokenIndex = value.indexOf('.');\n if (tokenIndex <= 0) {\n return;\n }\n if (name === NH_ASSISTANT_RUN_FRAGMENT) {\n this.push.openNotification(decodeURIComponent(value.slice(tokenIndex + 1)), decodeURIComponent(value.slice(0, tokenIndex)));\n return;\n }\n const conversationId = decodeURIComponent(value.slice(0, tokenIndex));\n const token = decodeURIComponent(value.slice(tokenIndex + 1));\n this.panel.open();\n void this.store.initialize().then(() => this.store.joinConversation(conversationId, token));\n }\n\n decide(decision: ApprovalDecision): void {\n this.store.decide(decision);\n }\n\n /** Decides the approval of a card; in an agent thread several proposals can be open. */\n decideApproval(choice: NhAssistantApprovalChoice): void {\n this.store.decide(choice.decision, undefined, choice.approvalId);\n }\n\n resolveApproval(choice: NhAssistantApprovalResolutionChoice): void {\n void this.store.resolveApproval(choice.approvalId, choice.resolution);\n }\n\n /** Answers the question the conversation waits for; only its addressee gets the choices. */\n answerQuestion(answer: NhAssistantQuestionAnswer): void {\n this.store.answerQuestion(answer.questionId, answer.choice);\n }\n\n cancel(): void {\n void this.store.cancel();\n }\n}\n","<ng-template #drawer>\n <section class=\"drawer\" role=\"dialog\" aria-modal=\"false\" [attr.aria-labelledby]=\"titleId\">\n <header class=\"header\">\n <div class=\"heading\">\n <h2 [id]=\"titleId\">{{ 'nh-assistant.panel.title' | translate }}</h2>\n </div>\n <div class=\"header-actions\">\n @if (store.enabled()) {\n @if (push.state() !== 'unavailable') {\n <button\n class=\"icon-button notification-button\"\n type=\"button\"\n [class.active]=\"push.state() === 'on'\"\n [class.off]=\"!push.settings()?.pushEnabled\"\n [class.blocked]=\"push.state() === 'blocked'\"\n [disabled]=\"push.busy()\"\n [attr.aria-pressed]=\"push.settings()?.pushEnabled === true\"\n [attr.aria-label]=\"notificationsLabel() | translate\"\n [attr.title]=\"('nh-assistant.preferences.notifications-state.' + push.state() | translate) + ' · ' + (notificationsLabel() | translate)\"\n (click)=\"toggleNotifications()\">\n <nh-assistant-icon name=\"bell\" />\n </button>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [class.active]=\"showConversations()\"\n [attr.aria-expanded]=\"showConversations()\"\n [attr.aria-label]=\"(showConversations() ? 'nh-assistant.panel.hide-conversations' : 'nh-assistant.panel.show-conversations') | translate\"\n [attr.title]=\"(showConversations() ? 'nh-assistant.panel.hide-conversations' : 'nh-assistant.panel.show-conversations') | translate\"\n (click)=\"toggleConversations()\">\n <nh-assistant-icon name=\"list\" />\n </button>\n <button\n class=\"icon-button\"\n type=\"button\"\n [class.active]=\"showPreferences()\"\n [attr.aria-expanded]=\"showPreferences()\"\n [attr.aria-label]=\"'nh-assistant.panel.open-preferences' | translate\"\n [attr.title]=\"'nh-assistant.panel.open-preferences' | translate\"\n (click)=\"togglePreferences()\">\n <nh-assistant-icon name=\"settings\" />\n </button>\n @if (adminRoute && store.canAdminister()) {\n <a\n class=\"icon-button\"\n [routerLink]=\"adminRoute\"\n [attr.aria-label]=\"'nh-assistant.panel.open-admin' | translate\"\n [attr.title]=\"'nh-assistant.panel.open-admin' | translate\"\n (click)=\"panel.close()\">\n <nh-assistant-icon name=\"admin\" />\n </a>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.new-conversation' | translate\"\n [attr.title]=\"'nh-assistant.panel.new-conversation' | translate\"\n (click)=\"newConversation()\">\n <nh-assistant-icon name=\"plus\" />\n </button>\n }\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.close' | translate\"\n [attr.title]=\"'nh-assistant.panel.close' | translate\"\n (click)=\"panel.close()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </div>\n </header>\n\n @if (store.enabled()) {\n <nh-assistant-activity [items]=\"store.activity()\" (conversationSelect)=\"openConversation($event)\" />\n }\n\n <div class=\"body\">\n @if (store.statusLoading() && !store.enabled()) {\n <div class=\"state\" role=\"status\">\n <p class=\"state-title\">{{ 'nh-assistant.panel.loading' | translate }}</p>\n </div>\n } @else if (!store.enabled()) {\n <div class=\"state\">\n <nh-assistant-icon class=\"state-icon\" name=\"warning\" />\n <p class=\"state-title\">{{ 'nh-assistant.panel.unavailable-title' | translate }}</p>\n <p>{{ 'nh-assistant.panel.unavailable-description' | translate }}</p>\n </div>\n } @else {\n @if (showPreferences()) {\n <nh-assistant-preferences class=\"overlay-view\" (closed)=\"showPreferences.set(false)\" />\n }\n\n @if (showShare()) {\n <nh-assistant-share class=\"overlay-view\" [section]=\"shareSection()\" (closed)=\"showShare.set(false)\" />\n }\n\n @if (showConversations()) {\n <nh-assistant-conversation-list\n class=\"overlay-view\"\n [conversations]=\"store.conversations()\"\n [total]=\"store.conversationsTotal()\"\n [activeConversationId]=\"conversation()?.id ?? null\"\n [loading]=\"store.conversationsLoading()\"\n (conversationSelect)=\"openConversation($event)\"\n (conversationDelete)=\"deleteConversation($event)\"\n (conversationCreate)=\"newConversation()\" />\n }\n\n @if (store.conversationLoading()) {\n <div class=\"state\" role=\"status\">\n <p class=\"state-title\">{{ 'nh-assistant.thread.loading' | translate }}</p>\n </div>\n } @else if (messages().length === 0 && !store.streaming()) {\n <div class=\"state\">\n <nh-assistant-icon class=\"state-icon\" name=\"assistant\" />\n <p class=\"state-title\">{{ 'nh-assistant.panel.empty-title' | translate }}</p>\n <p>{{ 'nh-assistant.panel.empty-description' | translate }}</p>\n </div>\n } @else {\n <nh-assistant-thread\n class=\"thread\"\n [attr.inert]=\"showPreferences() || showShare() || showConversations() ? '' : null\"\n [messages]=\"messages()\"\n [streaming]=\"busy()\"\n [deciding]=\"store.deciding()\"\n [markdown]=\"markdown\"\n [members]=\"store.members()\"\n [currentActorId]=\"conversation()?.currentActorId ?? null\"\n [canDecide]=\"store.canDecide()\"\n [decisionOwner]=\"activeMemberName()\"\n [approvalRights]=\"store.approvalRights()\"\n [writingMessageId]=\"store.writingMessageId()\"\n (approvalChoice)=\"decideApproval($event)\"\n (approvalResolution)=\"resolveApproval($event)\"\n (questionAnswer)=\"answerQuestion($event)\"\n (retryMessage)=\"store.send($event)\" />\n }\n }\n </div>\n\n @if (notificationError() ?? store.error(); as error) {\n <div class=\"error\" role=\"alert\">\n <nh-assistant-icon name=\"warning\" />\n <p>{{ errorKeys() | nhAssistantTranslate: error.code }}</p>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.dismiss-error' | translate\"\n [attr.title]=\"'nh-assistant.panel.dismiss-error' | translate\"\n (click)=\"store.clearError(); notificationError.set(null)\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </div>\n } @else if (store.notice(); as notice) {\n <div class=\"turn-notice\" role=\"status\">\n <nh-assistant-icon name=\"warning\" />\n <p>{{ noticeKeys() | nhAssistantTranslate: notice.code }}</p>\n <button\n class=\"icon-button\"\n type=\"button\"\n [attr.aria-label]=\"'nh-assistant.panel.dismiss-error' | translate\"\n [attr.title]=\"'nh-assistant.panel.dismiss-error' | translate\"\n (click)=\"store.clearNotice()\">\n <nh-assistant-icon name=\"close\" />\n </button>\n </div>\n }\n\n @if (store.enabled() && !showPreferences() && !showShare()) {\n <footer class=\"footer\" (focusin)=\"refreshPageContext()\">\n @if (closed()) {\n <p class=\"notice\">{{ 'nh-assistant.panel.conversation-closed' | translate }}</p>\n } @else if (lastTurnFailed()) {\n <p class=\"notice\">{{ 'nh-assistant.panel.last-turn-failed' | translate }}</p>\n }\n @if (store.collaboration() || store.pageContext()) {\n <div class=\"conversation-actions\">\n @if (store.collaboration()) {\n @if (!conversation() || store.isOwner()) {\n <button class=\"icon-button\" type=\"button\" [disabled]=\"!canShare()\"\n [attr.aria-label]=\"'nh-assistant.panel.share' | translate\"\n [attr.title]=\"'nh-assistant.panel.share' | translate\"\n [attr.aria-expanded]=\"showShare() && shareSection() === 'link'\"\n (click)=\"toggleShare('link')\">\n <nh-assistant-icon name=\"link\" />\n </button>\n }\n <button class=\"icon-button\" type=\"button\" [disabled]=\"!canShare()\"\n [class.active]=\"shared()\"\n [attr.aria-label]=\"(store.isOwner() || !conversation() ? 'nh-assistant.panel.add-members' : 'nh-assistant.panel.members') | translate\"\n [attr.title]=\"(store.isOwner() || !conversation() ? 'nh-assistant.panel.add-members' : 'nh-assistant.panel.members') | translate\"\n [attr.aria-expanded]=\"showShare() && shareSection() === 'members'\"\n (click)=\"toggleShare('members')\">\n <nh-assistant-icon name=\"users\" />\n </button>\n }\n @if (store.pageContext(); as context) {\n <button\n class=\"icon-button page-context-button\"\n [class.active]=\"!store.pageContextExcluded()\"\n type=\"button\"\n [attr.aria-pressed]=\"!store.pageContextExcluded()\"\n [attr.aria-label]=\"(store.pageContextExcluded() ? 'nh-assistant.page-context.include' : 'nh-assistant.page-context.exclude') | translate: { page: describeContext(context) }\"\n [attr.title]=\"(store.pageContextExcluded() ? 'nh-assistant.page-context.include' : 'nh-assistant.page-context.exclude') | translate: { page: describeContext(context) }\"\n (click)=\"store.setPageContextExcluded(!store.pageContextExcluded())\">\n <nh-assistant-icon name=\"page\" />\n </button>\n }\n </div>\n }\n @if (store.queuedMessages().length > 0) {\n <section class=\"message-queue\" [attr.aria-label]=\"'nh-assistant.queue.title' | translate: { count: store.queuedMessages().length }\">\n <div class=\"queue-heading\">\n <span aria-live=\"polite\">{{ 'nh-assistant.queue.title' | translate: { count: store.queuedMessages().length } }}</span>\n @if (store.queuePaused()) {\n <button type=\"button\" class=\"queue-resume\" [disabled]=\"editingQueuedId() !== null\" (click)=\"store.resumeQueue()\">\n {{ 'nh-assistant.queue.resume' | translate }}\n </button>\n }\n </div>\n <ol class=\"queue-items\">\n @for (item of store.queuedMessages(); track item.id) {\n <li class=\"queue-item\" [class.failed]=\"item.state === 'failed'\">\n @if (editingQueuedId() === item.id && item.state !== 'sending') {\n <div class=\"queue-edit\">\n <textarea rows=\"2\" [value]=\"queuedDraft()\" (input)=\"changeQueuedDraft($event)\"\n [attr.aria-label]=\"'nh-assistant.queue.edit' | translate\"></textarea>\n <div class=\"queue-buttons\">\n <button type=\"button\" class=\"icon-button\" [disabled]=\"!validQueuedDraft()\"\n [attr.aria-label]=\"'nh-assistant.queue.save' | translate\" [attr.title]=\"'nh-assistant.queue.save' | translate\"\n (click)=\"saveQueuedMessage(item.id)\"><nh-assistant-icon name=\"check\" /></button>\n <button type=\"button\" class=\"icon-button\" [attr.aria-label]=\"'nh-assistant.queue.cancel-edit' | translate\"\n [attr.title]=\"'nh-assistant.queue.cancel-edit' | translate\"\n (click)=\"cancelQueueEdit()\"><nh-assistant-icon name=\"close\" /></button>\n </div>\n </div>\n } @else {\n <div class=\"queue-message\">\n <p [title]=\"item.text\">{{ item.text }}</p>\n @if (item.files?.length) {\n <span class=\"queue-state queue-files\" data-queue-files>{{ 'nh-assistant.queue.files' | translate: { count: item.files!.length, names: fileNames(item.files!) } }}</span>\n }\n @if (item.state !== 'queued') {\n <span class=\"queue-state\">{{ 'nh-assistant.queue.state.' + item.state | translate }}</span>\n }\n </div>\n <div class=\"queue-buttons\">\n @if (store.canSteer() && item.state === 'queued') {\n <button type=\"button\" class=\"queue-steer\" [disabled]=\"editingQueuedId() !== null\"\n [attr.title]=\"'nh-assistant.queue.steer-hint' | translate\"\n (click)=\"store.steerQueuedMessage(item.id)\">{{ 'nh-assistant.queue.steer' | translate }}</button>\n }\n <button type=\"button\" class=\"icon-button\" [disabled]=\"item.state === 'sending'\"\n [attr.aria-label]=\"'nh-assistant.queue.edit' | translate\" [attr.title]=\"'nh-assistant.queue.edit' | translate\"\n (click)=\"editQueuedMessage(item.id, item.text)\"><nh-assistant-icon name=\"edit\" /></button>\n <button type=\"button\" class=\"icon-button\" [disabled]=\"item.state === 'sending'\"\n [attr.aria-label]=\"'nh-assistant.queue.remove' | translate\" [attr.title]=\"'nh-assistant.queue.remove' | translate\"\n (click)=\"store.removeQueuedMessage(item.id)\"><nh-assistant-icon name=\"close\" /></button>\n </div>\n }\n </li>\n }\n </ol>\n </section>\n }\n <nh-assistant-composer\n [disabled]=\"closed()\"\n [sendDisabled]=\"composerDisabled()\"\n [busy]=\"busy()\"\n [queueWhileBusy]=\"true\"\n [status]=\"composerStatus()\"\n [statusActor]=\"composerStatusActor()\"\n [canStop]=\"canStop()\"\n [maxLength]=\"store.limits()?.maxMessageChars ?? null\"\n [restore]=\"store.restoredDraft()\"\n [uploads]=\"store.uploads()\"\n [attachments]=\"store.attachments()\"\n (restored)=\"store.consumeRestoredDraft()\"\n (send)=\"send($event)\"\n (attach)=\"attach($event)\"\n (removeAttachment)=\"store.removeAttachment($event)\"\n (cancel)=\"cancel()\">\n @if (store.agents().length > 1) {\n <nh-assistant-agent-picker\n nhAssistantComposerControls\n [compact]=\"true\"\n [agents]=\"store.agents()\"\n [selectedAgentId]=\"store.selectedAgentId()\"\n (agentChange)=\"store.selectAgent($event)\" />\n }\n </nh-assistant-composer>\n </footer>\n }\n </section>\n</ng-template>\n","import { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, untracked } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantIconComponent } from '../../internal/nh-assistant-icon.component';\nimport { AgentSubjectSummary } from '../../models/assistant-agent-run.models';\nimport { NhAssistantSubjectSummaryService } from '../../services/nh-assistant-subject-summary.service';\n\n/**\n * A compact count of the agent work on one subject, for example on each row of a project list.\n * It shows nothing while the subject has no work. Otherwise it shows the number of proposals the\n * viewer may decide in the accent color, or, when they may decide none, a neutral count of the\n * open proposals, and a small working indicator while an agent works on the subject. Its tooltip\n * and accessible name say both counts. Badges on one page share one summary request per tick and\n * refresh on live agent-work updates of their subject; see `NhAssistantSubjectSummaryService`.\n */\n@Component({\n selector: 'nh-assistant-subject-badge',\n standalone: true,\n imports: [TranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (work(); as summary) {\n @let proposals = proposalsKey() ? (proposalsKey()! | translate: { toDecide: summary.proposalsToDecide, open: summary.openProposals }) : '';\n @let working = summary.runActive ? ('nh-assistant.subject-badge.working' | translate) : '';\n @let label = proposals && working ? proposals + ' ' + working : proposals || working;\n <span\n class=\"subject-badge\"\n [attr.data-state]=\"summary.proposalsToDecide > 0 ? 'decide' : summary.openProposals > 0 ? 'open' : 'working'\"\n [attr.title]=\"label\">\n <nh-assistant-icon name=\"assistant\" />\n @if (count() > 0) {\n <span class=\"count\" aria-hidden=\"true\">{{ countLabel() }}</span>\n }\n @if (summary.runActive) {\n <span class=\"working\" aria-hidden=\"true\"></span>\n }\n <span class=\"visually-hidden\">{{ label }}</span>\n </span>\n }\n `,\n styleUrl: './nh-assistant-subject-badge.component.scss'\n})\nexport class NhAssistantSubjectBadgeComponent {\n private readonly summaries = inject(NhAssistantSubjectSummaryService);\n private readonly summary = signal<AgentSubjectSummary | null>(null);\n\n /** The application's kind of subject, for example `project`. */\n readonly subjectType = input.required<string>();\n readonly subjectId = input.required<string>();\n\n /** The summary while the subject has work to show; `null` otherwise. */\n readonly work = computed(() => {\n const summary = this.summary();\n return summary && (summary.openProposals > 0 || summary.runActive) ? summary : null;\n });\n readonly count = computed(() => {\n const summary = this.work();\n if (!summary) {\n return 0;\n }\n return summary.proposalsToDecide > 0 ? summary.proposalsToDecide : summary.openProposals;\n });\n readonly countLabel = computed(() => this.count() > 99 ? '99+' : String(this.count()));\n readonly proposalsKey = computed(() => {\n const summary = this.work();\n if (!summary || summary.openProposals === 0) {\n return null;\n }\n return summary.proposalsToDecide > 0 ? 'nh-assistant.subject-badge.to-decide' : 'nh-assistant.subject-badge.open';\n });\n\n constructor() {\n effect(onCleanup => {\n const subjectType = this.subjectType();\n const subjectId = this.subjectId();\n const subscription = untracked(() =>\n this.summaries.summary(subjectType, subjectId).subscribe(summary => this.summary.set(summary)));\n onCleanup(() => subscription.unsubscribe());\n });\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\nimport createDOMPurify, { DOMPurify } from 'dompurify';\nimport { Marked, Renderer, Token, Tokens, TokensList } from 'marked';\nimport { NhAssistantDocumentHeading } from '../models/assistant-document.models';\nimport { nhAssistantEscapeHtml, nhAssistantMarkdownAttributes, nhAssistantMarkdownTags } from './nh-assistant-markdown';\n\n/** Links that leave the bundle: only these schemes, and they open in a new tab. */\nexport const nhAssistantExternalLinkPattern = /^(?:https?:|mailto:)/i;\nconst externalProtocols = new Set(['http:', 'https:', 'mailto:']);\nconst schemePattern = /^[a-z][a-z0-9+.-]*:/i;\nconst controlCharacters = /[\\u0000-\\u001f\\u007f]/;\nconst maxDiagramReason = 300;\n\n/** The options of one rendering of a document. */\nexport interface NhAssistantDocumentRenderOptions {\n /** The document's own path in its bundle; relative links resolve from its folder. */\n readonly path: string | null;\n /** The other documents of the bundle that links may lead to. */\n readonly siblingPaths: readonly string[];\n /** The fenced code languages that are diagrams, in lower case. */\n readonly diagramLanguages: readonly string[];\n /** Prefixes every heading id, so two documents on one page never share an id. */\n readonly idPrefix: string;\n}\n\nexport type NhAssistantDocumentSegment =\n | { readonly kind: 'html'; readonly html: string }\n | { readonly kind: 'diagram'; readonly language: string; readonly source: string };\n\nexport interface NhAssistantRenderedDocument {\n readonly segments: readonly NhAssistantDocumentSegment[];\n readonly headings: readonly NhAssistantDocumentHeading[];\n}\n\nfunction decodeOrNull(value: string, decode: (text: string) => string): string | null {\n try {\n return decode(value);\n } catch {\n return null;\n }\n}\n\n/**\n * The normalized form of a bundle path: forward slashes only, without `.` and `..` segments and\n * without a leading slash. `null` for a path that names a scheme, escapes the bundle's root or\n * holds a backslash or control character.\n */\nexport function nhAssistantBundlePath(path: string): string | null {\n const trimmed = path.trim();\n if (!trimmed || trimmed.includes('\\\\') || controlCharacters.test(trimmed) || schemePattern.test(trimmed) || trimmed.startsWith('//')) {\n return null;\n }\n\n const segments: string[] = [];\n for (const segment of trimmed.split('/')) {\n if (segment === '' || segment === '.') {\n continue;\n }\n\n if (segment === '..') {\n if (segments.length === 0) {\n return null;\n }\n segments.pop();\n continue;\n }\n\n segments.push(segment);\n }\n\n return segments.length > 0 ? segments.join('/') : null;\n}\n\n/**\n * Resolves a relative link of the document at `base` within its bundle: from the document's\n * folder, or from the bundle's root when it starts with `/`. The query is ignored.\n */\nexport function nhAssistantResolveBundleLink(base: string | null, href: string): { path: string; fragment: string | null } | null {\n const hashIndex = href.indexOf('#');\n const target = hashIndex >= 0 ? href.slice(0, hashIndex) : href;\n const fragment = hashIndex >= 0 ? decodeOrNull(href.slice(hashIndex + 1), decodeURIComponent) : null;\n const pathPart = decodeOrNull(target.split('?')[0], decodeURI);\n if (pathPart === null || pathPart.trim() === '' || (hashIndex >= 0 && fragment === null)) {\n return null;\n }\n\n const folder = base ? base.split('/').slice(0, -1).join('/') : '';\n const joined = pathPart.startsWith('/') || !folder ? pathPart : `${folder}/${pathPart}`;\n const path = schemePattern.test(pathPart) || pathPart.startsWith('//') ? null : nhAssistantBundlePath(joined);\n return path ? { path, fragment: fragment || null } : null;\n}\n\n/** The fragment of a heading: lower case, punctuation removed, spaces as dashes. */\nfunction slugOf(text: string): string {\n const slug = text\n .toLowerCase()\n .trim()\n .replace(/[^\\p{L}\\p{N}\\s_-]/gu, '')\n .replace(/\\s+/g, '-');\n return slug || 'section';\n}\n\n/** The state of one rendering, which the Markdown renderer and the sanitizer hooks share. */\nclass DocumentRendering {\n readonly headings: NhAssistantDocumentHeading[] = [];\n /** The bundle hrefs this rendering wrote, the only relative hrefs the sanitizer keeps. */\n readonly bundleHrefs = new Set<string>();\n private readonly siblings: Set<string>;\n private readonly ownPath: string | null;\n private readonly slugs = new Map<string, number>();\n\n constructor(readonly options: NhAssistantDocumentRenderOptions) {\n this.ownPath = options.path ? nhAssistantBundlePath(options.path) : null;\n this.siblings = new Set(options.siblingPaths\n .map(path => nhAssistantBundlePath(path))\n .filter((path): path is string => !!path));\n }\n\n addHeading(text: string, level: number): NhAssistantDocumentHeading {\n const base = slugOf(text);\n const seen = this.slugs.get(base) ?? 0;\n this.slugs.set(base, seen + 1);\n const fragment = seen === 0 ? base : `${base}-${seen}`;\n const heading = { id: `${this.options.idPrefix}${fragment}`, fragment, level, text };\n this.headings.push(heading);\n return heading;\n }\n\n /**\n * The href to write for a link, or `null` to show only its text: a fragment of this\n * document, an `https:`, `http:` or `mailto:` address, or a sibling of the bundle. Every\n * other scheme, such as `javascript:`, `data:` or `file:`, and every path outside the bundle\n * is refused.\n */\n hrefOf(raw: string): string | null {\n const href = raw.trim();\n if (!href || controlCharacters.test(href)) {\n return null;\n }\n\n if (href.startsWith('#')) {\n return href.length > 1 ? href : null;\n }\n\n if (nhAssistantExternalLinkPattern.test(href)) {\n return this.externalHref(href);\n }\n\n const resolved = schemePattern.test(href) || href.startsWith('//') ? null : nhAssistantResolveBundleLink(this.ownPath, href);\n if (!resolved) {\n return null;\n }\n\n const fragment = resolved.fragment ? `#${encodeURIComponent(resolved.fragment)}` : '';\n if (resolved.path === this.ownPath) {\n return fragment || null;\n }\n\n if (!this.siblings.has(resolved.path)) {\n return null;\n }\n\n const bundleHref = `${encodeURI(resolved.path)}${fragment}`;\n this.bundleHrefs.add(bundleHref);\n return bundleHref;\n }\n\n private externalHref(href: string): string | null {\n try {\n const url = new URL(href);\n return externalProtocols.has(url.protocol) ? url.href : null;\n } catch {\n return null;\n }\n }\n}\n\n/** CSS that could run code or load something, which a diagram's styles may not contain. */\nfunction isUnsafeCss(css: string): boolean {\n if (/\\\\|@import|@font-face|expression\\s*\\(|-moz-binding|behavior\\s*:|image-set\\s*\\(|\\bimage\\s*\\(|cross-fade\\s*\\(|\\bsrc\\s*\\(/i.test(css)) {\n return true;\n }\n\n return hasExternalReference(css);\n}\n\n/** `url(...)` that names anything but a fragment of the diagram itself, such as `url(#arrow)`. */\nfunction hasExternalReference(value: string): boolean {\n for (const match of value.matchAll(/url\\s*\\(\\s*(['\"]?)\\s*([^)'\"]*)/gi)) {\n if (!match[2].trim().startsWith('#')) {\n return true;\n }\n }\n\n return false;\n}\n\n/** The reason a renderer gave, as one short line; empty when it gave none. */\nexport function nhAssistantDiagramReason(error: unknown): string {\n const text = error instanceof Error ? error.message : typeof error === 'string' ? error : '';\n const line = text.replace(/\\s+/g, ' ').trim();\n return line.length > maxDiagramReason ? `${line.slice(0, maxDiagramReason - 1)}…` : line;\n}\n\n/**\n * Renders untrusted Markdown documents of a bundle with the assistant's safety defaults: inline\n * HTML shows as text, images as their alt text, links only to fragments, `https:`, `http:`,\n * `mailto:` and sibling documents, and DOMPurify sanitizes the result. Top-level fenced code\n * blocks of a diagram language become diagram segments. Internal to `nh-assistant-document`.\n */\n@Injectable({ providedIn: 'root' })\nexport class NhAssistantDocumentMarkdownRenderer {\n private readonly document = inject(DOCUMENT);\n private documentPurifier: DOMPurify | null = null;\n private diagramPurifier: DOMPurify | null = null;\n /** The rendering being sanitized; the purifier's hooks read it. */\n private current: DocumentRendering | null = null;\n\n render(markdown: string, options: NhAssistantDocumentRenderOptions): NhAssistantRenderedDocument {\n const rendering = new DocumentRendering(options);\n const purifier = this.getDocumentPurifier();\n if (!purifier) {\n return { segments: [{ kind: 'html', html: `<p>${nhAssistantEscapeHtml(markdown)}</p>` }], headings: [] };\n }\n\n const marked = this.createMarked(rendering);\n const tokens = marked.lexer(markdown);\n const diagramLanguages = new Set(options.diagramLanguages.map(language => language.toLowerCase()));\n const segments: NhAssistantDocumentSegment[] = [];\n let pending: Token[] = [];\n\n const flush = () => {\n if (pending.length === 0) {\n return;\n }\n\n const html = marked.parser(Object.assign(pending, { links: tokens.links }) as TokensList);\n segments.push({ kind: 'html', html: this.sanitize(purifier, rendering, html) });\n pending = [];\n };\n\n for (const token of tokens) {\n const language = token.type === 'code' ? (token as Tokens.Code).lang?.trim().split(/\\s+/)[0]?.toLowerCase() : undefined;\n if (language && diagramLanguages.has(language)) {\n flush();\n segments.push({ kind: 'diagram', language, source: (token as Tokens.Code).text });\n continue;\n }\n\n pending.push(token);\n }\n flush();\n\n return { segments, headings: rendering.headings };\n }\n\n /**\n * Sanitizes a renderer's SVG: SVG and its filters only, without scripts, event handlers,\n * links, images, `use`, foreign content, external references or CSS that could load or run\n * anything. `null` when the result is not one SVG element.\n */\n sanitizeDiagram(svg: string): SVGSVGElement | null {\n const purifier = this.getDiagramPurifier();\n if (!purifier) {\n return null;\n }\n\n const fragment = purifier.sanitize(svg, {\n USE_PROFILES: { svg: true, svgFilters: true },\n FORBID_TAGS: ['a', 'image', 'use', 'feImage', 'foreignObject', 'script', 'iframe'],\n FORBID_ATTR: ['href', 'xlink:href'],\n ALLOW_DATA_ATTR: false,\n RETURN_DOM_FRAGMENT: true\n });\n const elements = Array.from(fragment.children);\n const root = elements[0];\n if (elements.length !== 1 || root.namespaceURI !== 'http://www.w3.org/2000/svg' || root.localName !== 'svg') {\n return null;\n }\n\n return root as SVGSVGElement;\n }\n\n private createMarked(rendering: DocumentRendering): Marked {\n return new Marked({\n gfm: true,\n breaks: false,\n async: false,\n renderer: {\n html(token: Tokens.HTML | Tokens.Tag): string {\n return nhAssistantEscapeHtml(token.text);\n },\n image(token: Tokens.Image): string {\n return nhAssistantEscapeHtml(token.text);\n },\n heading(this: Renderer, token: Tokens.Heading): string {\n const text = this.parser.parseInline(token.tokens, this.parser.textRenderer);\n const heading = rendering.addHeading(text, token.depth);\n return `<h${token.depth} id=\"${nhAssistantEscapeHtml(heading.id)}\">${this.parser.parseInline(token.tokens)}</h${token.depth}>\\n`;\n },\n link(this: Renderer, token: Tokens.Link): string {\n const label = this.parser.parseInline(token.tokens);\n const href = rendering.hrefOf(token.href);\n if (!href) {\n return label;\n }\n\n const title = token.title ? ` title=\"${nhAssistantEscapeHtml(token.title)}\"` : '';\n return `<a href=\"${nhAssistantEscapeHtml(href)}\"${title}>${label}</a>`;\n }\n }\n });\n }\n\n private sanitize(purifier: DOMPurify, rendering: DocumentRendering, html: string): string {\n this.current = rendering;\n try {\n return purifier.sanitize(html, {\n ALLOWED_TAGS: [...nhAssistantMarkdownTags],\n ALLOWED_ATTR: [...nhAssistantMarkdownAttributes, 'id'],\n ALLOWED_URI_REGEXP: /^(?:https?:|mailto:|#)/i,\n ALLOW_DATA_ATTR: false,\n ALLOW_ARIA_ATTR: false\n });\n } finally {\n this.current = null;\n }\n }\n\n private createPurifier(): DOMPurify | null {\n const view = this.document.defaultView;\n if (!view) {\n return null;\n }\n\n const purifier = createDOMPurify(view);\n return purifier.isSupported ? purifier : null;\n }\n\n private getDocumentPurifier(): DOMPurify | null {\n if (this.documentPurifier) {\n return this.documentPurifier;\n }\n\n const purifier = this.createPurifier();\n if (!purifier) {\n return null;\n }\n\n purifier.addHook('uponSanitizeAttribute', (_node, event) => {\n const rendering = this.current;\n if (event.attrName === 'href' && rendering?.bundleHrefs.has(event.attrValue)) {\n // A sibling document this rendering resolved itself; the URI pattern knows no paths.\n event.forceKeepAttr = true;\n } else if (event.attrName === 'id' && !(rendering && event.attrValue.startsWith(rendering.options.idPrefix))) {\n event.keepAttr = false;\n }\n });\n purifier.addHook('afterSanitizeAttributes', node => {\n const href = node.tagName === 'A' ? node.getAttribute('href') : null;\n if (href && nhAssistantExternalLinkPattern.test(href)) {\n node.setAttribute('target', '_blank');\n node.setAttribute('rel', 'noopener noreferrer');\n }\n });\n\n this.documentPurifier = purifier;\n return purifier;\n }\n\n private getDiagramPurifier(): DOMPurify | null {\n if (this.diagramPurifier) {\n return this.diagramPurifier;\n }\n\n const purifier = this.createPurifier();\n if (!purifier) {\n return null;\n }\n\n purifier.addHook('uponSanitizeElement', (node, event) => {\n if (event.tagName === 'style' && isUnsafeCss(node.textContent ?? '')) {\n node.textContent = '';\n }\n });\n purifier.addHook('uponSanitizeAttribute', (_node, event) => {\n const unsafe = event.attrName === 'style' ? isUnsafeCss(event.attrValue) : hasExternalReference(event.attrValue);\n if (unsafe) {\n event.keepAttr = false;\n }\n });\n\n this.diagramPurifier = purifier;\n return purifier;\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n PLATFORM_ID,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { NhAssistantDocumentMarkdownRenderer, nhAssistantDiagramReason } from '../../internal/nh-assistant-document-markdown';\nimport { NhAssistantDiagramRenderer } from '../../models/assistant-document.models';\n\ntype DiagramState =\n | { readonly kind: 'source' }\n | { readonly kind: 'drawing' }\n | { readonly kind: 'drawn' }\n | { readonly kind: 'failed'; readonly reason: string; readonly reasonKey: string | null };\n\n/** Sizes the drawing inside its own shadow root, where the diagram's styles stay contained. */\nconst canvasStyles = ':host { display: block; } svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }';\n\n/**\n * One diagram of a document: the source while it is drawn or when no renderer draws it, the\n * sanitized SVG once drawn, and the source with the reason when it cannot be drawn. The SVG\n * goes into a shadow root, so its styles never reach the page. Internal to\n * `nh-assistant-document`.\n */\n@Component({\n selector: 'nh-assistant-document-diagram',\n standalone: true,\n imports: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <figure class=\"diagram\" [attr.data-diagram-state]=\"state().kind\" [attr.aria-busy]=\"state().kind === 'drawing'\">\n <div #canvas class=\"canvas\" [hidden]=\"state().kind !== 'drawn'\"></div>\n @if (state().kind !== 'drawn') {\n <pre class=\"source\"><code>{{ source() }}</code></pre>\n }\n @if (failure(); as failed) {\n <figcaption class=\"failure\" role=\"note\">\n {{ 'nh-assistant.document.diagram-failed' | translate: { reason: failed.reasonKey ? (failed.reasonKey | translate) : failed.reason } }}\n </figcaption>\n }\n </figure>\n `,\n styles: `\n :host { display: block; margin: 0 0 12px; }\n .diagram { margin: 0; }\n .canvas { overflow-x: auto; }\n .source {\n margin: 0;\n overflow-x: auto;\n border-radius: 8px;\n padding: 8px;\n background: var(--nha-surface-strong);\n font-family: var(--nha-mono);\n font-size: 12.5px;\n }\n .failure { margin-top: 6px; color: var(--nha-danger); font-size: 13px; }\n `\n})\nexport class NhAssistantDocumentDiagramComponent {\n private readonly markdown = inject(NhAssistantDocumentMarkdownRenderer);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly canvas = viewChild.required<ElementRef<HTMLElement>>('canvas');\n private generation = 0;\n\n /** The block's text. */\n readonly source = input.required<string>();\n /** The block's language in lower case. */\n readonly language = input.required<string>();\n readonly renderer = input<NhAssistantDiagramRenderer | null>(null);\n\n readonly state = signal<DiagramState>({ kind: 'source' });\n\n failure(): Extract<DiagramState, { kind: 'failed' }> | null {\n const state = this.state();\n return state.kind === 'failed' ? state : null;\n }\n\n constructor() {\n effect(() => {\n const source = this.source();\n const language = this.language();\n const renderer = this.renderer();\n untracked(() => {\n void this.draw(source, language, renderer);\n });\n });\n }\n\n private async draw(source: string, language: string, renderer: NhAssistantDiagramRenderer | null): Promise<void> {\n const generation = ++this.generation;\n if (!this.browser || !renderer) {\n this.state.set({ kind: 'source' });\n return;\n }\n\n this.state.set({ kind: 'drawing' });\n let svg: unknown;\n try {\n svg = await renderer.render(source, language);\n } catch (error) {\n if (generation === this.generation) {\n const reason = nhAssistantDiagramReason(error);\n this.state.set({ kind: 'failed', reason, reasonKey: reason ? null : 'nh-assistant.document.diagram-no-reason' });\n }\n return;\n }\n\n if (generation !== this.generation) {\n return;\n }\n\n const drawing = typeof svg === 'string' ? this.markdown.sanitizeDiagram(svg) : null;\n if (!drawing) {\n this.state.set({ kind: 'failed', reason: '', reasonKey: 'nh-assistant.document.diagram-not-svg' });\n return;\n }\n\n this.paint(drawing);\n this.state.set({ kind: 'drawn' });\n }\n\n private paint(drawing: SVGSVGElement): void {\n const canvas = this.canvas().nativeElement;\n const shadow = canvas.shadowRoot ?? canvas.attachShadow({ mode: 'open' });\n const style = canvas.ownerDocument.createElement('style');\n style.textContent = canvasStyles;\n shadow.replaceChildren(style, drawing);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n afterRenderEffect,\n computed,\n inject,\n input,\n output\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport {\n NhAssistantDocumentMarkdownRenderer,\n nhAssistantExternalLinkPattern\n} from '../../internal/nh-assistant-document-markdown';\nimport {\n NhAssistantDiagramRenderer,\n NhAssistantDocumentHeading,\n NhAssistantDocumentLinkEvent\n} from '../../models/assistant-document.models';\nimport { NhAssistantDocumentDiagramComponent } from './nh-assistant-document-diagram.component';\n\nlet nextDocumentId = 0;\n\ntype DocumentPart =\n | { readonly kind: 'html'; readonly html: SafeHtml }\n | { readonly kind: 'diagram'; readonly language: string; readonly source: string };\n\nfunction decoded(value: string, decode: (text: string) => string): string {\n try {\n return decode(value);\n } catch {\n return value;\n }\n}\n\n/**\n * Renders an untrusted Markdown document, for example one file of a skill or knowledge bundle,\n * with the assistant's safety defaults: inline HTML shows as text, images as their alt text, and\n * a link keeps its address only for a heading of the document, a sibling of the bundle or an\n * `https:`, `http:` or `mailto:` address; `javascript:`, `data:` and every other scheme show as\n * text. Relative links resolve from the document's `path` against `siblingPaths`.\n *\n * Fenced code blocks of the languages of `diagramRenderer` become diagrams: the application's\n * renderer draws them, the document sanitizes its SVG and shows it in a shadow root, and a block\n * it cannot draw shows its source with the reason. Without a renderer they stay code.\n *\n * `linkClick` reports every link the reader activates; `headingsChange` the headings once they\n * are in the page. The texts are `nh-assistant.document.*`, which `provideNhAssistant` merges;\n * an application without it starts `NhAssistantTranslationMerger` or translates the keys itself.\n */\n@Component({\n selector: 'nh-assistant-document',\n standalone: true,\n imports: [NhAssistantDocumentDiagramComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-document.component.html',\n styleUrl: './nh-assistant-document.component.scss',\n host: {\n class: 'nh-assistant-document',\n '(click)': 'onClick($event)'\n }\n})\nexport class NhAssistantDocumentComponent {\n private readonly markdownRenderer = inject(NhAssistantDocumentMarkdownRenderer);\n private readonly sanitizer = inject(DomSanitizer);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly idPrefix = `nh-document-${++nextDocumentId}-`;\n\n /** The document's Markdown. Treated as untrusted. */\n readonly markdown = input.required<string>();\n /** The document's own path in its bundle, for example `guides/setup.md`. */\n readonly path = input<string | null>(null);\n /** The paths of the other documents in the bundle that its links may open. */\n readonly siblingPaths = input<readonly string[]>([]);\n /** Draws the bundle's diagrams; the application loads its drawing library lazily. */\n readonly diagramRenderer = input<NhAssistantDiagramRenderer | null>(null);\n\n /** A link the reader activated; see `NhAssistantDocumentLinkEvent`. */\n readonly linkClick = output<NhAssistantDocumentLinkEvent>();\n /** The headings, in document order, each time they changed and are in the page. */\n readonly headingsChange = output<readonly NhAssistantDocumentHeading[]>();\n\n private readonly rendered = computed(() => this.markdownRenderer.render(this.markdown() ?? '', {\n path: this.path(),\n siblingPaths: this.siblingPaths() ?? [],\n diagramLanguages: this.diagramRenderer()?.languages ?? [],\n idPrefix: this.idPrefix\n }));\n\n /** The headings of the rendered document. */\n readonly headings = computed(() => this.rendered().headings);\n\n readonly parts = computed<readonly DocumentPart[]>(() => this.rendered().segments.map(segment => {\n if (segment.kind === 'diagram') {\n return segment;\n }\n\n // DOMPurify sanitized the HTML; Angular's own sanitizer would drop the heading ids.\n return { kind: 'html', html: this.sanitizer.bypassSecurityTrustHtml(segment.html) };\n }));\n\n constructor() {\n afterRenderEffect(() => {\n this.headingsChange.emit(this.headings());\n });\n }\n\n /**\n * Scrolls to a heading of the document by its fragment and focuses it; false when the\n * document has no such heading.\n */\n scrollToHeading(fragment: string): boolean {\n const heading = this.headings().find(item => item.fragment === fragment);\n const element = heading ? this.host.nativeElement.querySelector<HTMLElement>(`[id=\"${CSS.escape(heading.id)}\"]`) : null;\n if (!element) {\n return false;\n }\n\n if (!element.hasAttribute('tabindex')) {\n element.setAttribute('tabindex', '-1');\n }\n element.scrollIntoView({ block: 'start' });\n element.focus({ preventScroll: true });\n return true;\n }\n\n onClick(event: MouseEvent): void {\n const target = event.target instanceof Element ? event.target : null;\n const anchor = target?.closest('a[href]');\n if (!anchor || !this.host.nativeElement.contains(anchor)) {\n return;\n }\n\n const href = anchor.getAttribute('href') ?? '';\n if (href.startsWith('#')) {\n const fragment = decoded(href.slice(1), decodeURIComponent);\n event.preventDefault();\n this.scrollToHeading(fragment);\n this.linkClick.emit({ kind: 'anchor', href, path: null, fragment, event });\n return;\n }\n\n if (nhAssistantExternalLinkPattern.test(href)) {\n this.linkClick.emit({ kind: 'external', href, path: null, fragment: null, event });\n return;\n }\n\n // A sibling of the bundle: the application opens it, the browser does not navigate.\n event.preventDefault();\n const hashIndex = href.indexOf('#');\n const path = decoded(hashIndex >= 0 ? href.slice(0, hashIndex) : href, decodeURI);\n const fragment = hashIndex >= 0 ? decoded(href.slice(hashIndex + 1), decodeURIComponent) : null;\n this.linkClick.emit({ kind: 'document', href, path, fragment, event });\n }\n}\n","@for (part of parts(); track $index) {\n @if (part.kind === 'html') {\n <div class=\"document-part markdown\" [innerHTML]=\"part.html\"></div>\n } @else {\n <nh-assistant-document-diagram [source]=\"part.source\" [language]=\"part.language\" [renderer]=\"diagramRenderer()\" />\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n computed,\n inject,\n input,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { Observable, Subscription } from 'rxjs';\nimport { NhAssistantError } from '../services/nh-assistant.store';\nimport { nhAssistantErrorKeys, toNhAssistantError } from './nh-assistant-errors';\nimport { NhAssistantIconComponent } from './nh-assistant-icon.component';\nimport { NhAssistantTranslatePipe } from './nh-assistant-translate.pipe';\n\n/** One choice of a picker: the stored value, its name and what it means. */\nexport interface NhAssistantPickerOption {\n value: string;\n label: string;\n description?: string | null;\n}\n\nlet nextId = 0;\nconst searchDelayMs = 250;\n\n/**\n * A searchable choice for the administration (internal): a combobox with a listbox popup in the ARIA\n * 1.2 pattern. Typing filters the options on name and description, the arrow keys move, Enter\n * chooses and Escape closes. With `search` it asks the server instead, after `minQueryLength`\n * characters; a failed search says why below the field, with its translated code, and offers to\n * search again instead of claiming that nothing was found. `noneLabel` adds an explicit empty\n * choice, emitted as `''`.\n */\n@Component({\n selector: 'nh-assistant-picker',\n standalone: true,\n imports: [TranslatePipe, NhAssistantTranslatePipe, NhAssistantIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './nh-assistant-picker.component.html',\n styleUrl: './nh-assistant-picker.component.scss'\n})\nexport class NhAssistantPickerComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private searchTimer?: ReturnType<typeof setTimeout>;\n private searchSubscription?: Subscription;\n /** The text of the latest search, for searching again after a failure. */\n private lastQuery = '';\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('field');\n\n /** The id of the text field, for the label's `for`. */\n readonly inputId = input.required<string>();\n readonly options = input<readonly NhAssistantPickerOption[]>([]);\n readonly value = input<string | null>(null);\n /** The name to show for a value that is not among the options, such as a found account. */\n readonly selectedLabel = input<string | null>(null);\n /** The label of the empty choice; without it there is none. */\n readonly noneLabel = input<string | null>(null);\n readonly placeholder = input<string | null>(null);\n /** Searches the server; the options are ignored while it is set. */\n readonly search = input<((query: string) => Observable<NhAssistantPickerOption[]>) | null>(null);\n readonly minQueryLength = input(2);\n readonly invalid = input(false);\n readonly describedBy = input<string | null>(null);\n readonly disabled = input(false);\n\n readonly valueChange = output<string>();\n /** The chosen option, also for a search result the options do not contain. */\n readonly optionChange = output<NhAssistantPickerOption | null>();\n\n readonly listId = `nh-assistant-picker-${nextId++}`;\n readonly open = signal(false);\n /** The text typed since the list opened; `null` shows the chosen option's name. */\n readonly query = signal<string | null>(null);\n readonly active = signal(-1);\n readonly searching = signal(false);\n readonly results = signal<NhAssistantPickerOption[]>([]);\n /** Why the latest search failed; `null` after a search that answered. */\n readonly searchError = signal<NhAssistantError | null>(null);\n readonly searchErrorKeys = computed(() => nhAssistantErrorKeys(this.searchError()));\n readonly searchErrorId = `${this.listId}-search-error`;\n /** The field describes itself with the host's ids and, after a failed search, with its reason. */\n readonly fieldDescribedBy = computed(() =>\n [this.describedBy(), this.searchError() ? this.searchErrorId : null].filter(Boolean).join(' ') || null);\n private readonly chosen = signal<NhAssistantPickerOption | null>(null);\n\n readonly selected = computed<NhAssistantPickerOption | null>(() => {\n const value = this.value();\n if (value === null || value === '') {\n return null;\n }\n const known = this.options().find(option => option.value === value)\n ?? this.results().find(option => option.value === value)\n ?? (this.chosen()?.value === value ? this.chosen() : null);\n return known ?? { value, label: this.selectedLabel() ?? value };\n });\n\n readonly inputText = computed(() => this.query() ?? this.selected()?.label ?? (this.value() === '' ? this.noneLabel() ?? '' : ''));\n\n readonly visible = computed<NhAssistantPickerOption[]>(() => {\n if (this.search()) {\n return this.results();\n }\n const none = this.noneLabel();\n const all = none === null ? [...this.options()] : [{ value: '', label: none }, ...this.options()];\n const text = this.query()?.trim().toLocaleLowerCase() ?? '';\n return text.length === 0\n ? all\n : all.filter(option =>\n option.label.toLocaleLowerCase().includes(text)\n || option.value.toLocaleLowerCase().includes(text)\n || (option.description ?? '').toLocaleLowerCase().includes(text));\n });\n\n /** Why the list is empty: still typing, searching, the search failed, or nothing found. */\n readonly emptyKey = computed(() => {\n if (this.searching()) {\n return 'nh-assistant.picker.searching';\n }\n if (this.searchError()) {\n return 'nh-assistant.picker.search-failed';\n }\n if (this.search() && (this.query()?.trim().length ?? 0) < this.minQueryLength()) {\n return 'nh-assistant.picker.type-more';\n }\n return 'nh-assistant.picker.no-results';\n });\n\n readonly activeId = computed(() => this.open() && this.active() >= 0 && this.active() < this.visible().length\n ? this.optionId(this.active())\n : null);\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.searchTimer);\n this.searchSubscription?.unsubscribe();\n });\n }\n\n optionId(index: number): string {\n return `${this.listId}-option-${index}`;\n }\n\n /** Moves the focus to the text field, for example after a refused save. */\n focus(): void {\n this.field().nativeElement.focus();\n }\n\n toggle(): void {\n if (this.open()) {\n this.close();\n } else {\n this.openList();\n this.focus();\n }\n }\n\n openList(): void {\n if (this.disabled() || this.open()) {\n return;\n }\n this.open.set(true);\n const index = this.visible().findIndex(option => option.value === (this.value() ?? ''));\n this.active.set(index);\n }\n\n onInput(event: Event): void {\n const text = (event.target as HTMLInputElement).value;\n this.query.set(text);\n this.open.set(true);\n this.active.set(this.search() ? -1 : 0);\n if (this.search()) {\n this.startSearch(text);\n }\n }\n\n onKeydown(event: KeyboardEvent): void {\n const count = this.visible().length;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.open()) {\n this.openList();\n }\n this.active.set(Math.min(this.active() + 1, count - 1));\n this.scrollActiveIntoView();\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.active.set(Math.max(this.active() - 1, 0));\n this.scrollActiveIntoView();\n break;\n case 'Enter':\n if (this.open()) {\n event.preventDefault();\n const option = this.visible()[this.active()];\n if (option) {\n this.choose(option);\n } else {\n this.close();\n }\n }\n break;\n case 'Escape':\n if (this.open()) {\n event.preventDefault();\n event.stopPropagation();\n this.close();\n }\n break;\n case 'Tab':\n this.close();\n break;\n }\n }\n\n onBlur(): void {\n this.close();\n }\n\n /** Searches the latest text again after a failed search and shows the list. */\n retrySearch(): void {\n if (!this.search() || this.disabled()) {\n return;\n }\n this.query.set(this.lastQuery);\n this.open.set(true);\n this.active.set(-1);\n this.startSearch(this.lastQuery);\n this.focus();\n }\n\n choose(option: NhAssistantPickerOption): void {\n this.searchError.set(null);\n this.chosen.set(option.value === '' ? null : option);\n this.valueChange.emit(option.value);\n this.optionChange.emit(option.value === '' ? null : option);\n this.close();\n }\n\n private close(): void {\n this.open.set(false);\n this.query.set(null);\n this.active.set(-1);\n }\n\n private startSearch(text: string): void {\n clearTimeout(this.searchTimer);\n this.searchSubscription?.unsubscribe();\n this.lastQuery = text;\n this.searchError.set(null);\n const search = this.search();\n const query = text.trim();\n if (!search || query.length < this.minQueryLength()) {\n this.results.set([]);\n this.searching.set(false);\n return;\n }\n this.searching.set(true);\n this.searchTimer = setTimeout(() => {\n this.searchSubscription = search(query).subscribe({\n next: results => {\n this.results.set(results);\n this.searching.set(false);\n this.active.set(results.length > 0 ? 0 : -1);\n },\n error: (error: unknown) => {\n this.results.set([]);\n this.searching.set(false);\n this.searchError.set(toNhAssistantError(error));\n }\n });\n }, searchDelayMs);\n }\n\n private scrollActiveIntoView(): void {\n const id = this.activeId();\n if (id) {\n queueMicrotask(() => this.host.nativeElement.querySelector(`#${id}`)?.scrollIntoView?.({ block: 'nearest' }));\n }\n }\n}\n","<div class=\"picker\" [class.open]=\"open()\">\n <div class=\"control\">\n <input\n #field\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n [id]=\"inputId()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-invalid]=\"invalid() ? true : null\"\n [attr.aria-describedby]=\"fieldDescribedBy()\"\n [attr.placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [value]=\"inputText()\"\n (input)=\"onInput($event)\"\n (click)=\"openList()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\" />\n <button\n type=\"button\"\n class=\"toggle\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"'nh-assistant.picker.toggle' | translate\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"toggle()\">\n <nh-assistant-icon name=\"chevron-down\" />\n </button>\n </div>\n @if (searchError(); as failure) {\n <!-- A failed search says why and offers to search again; the list never claims nothing was found. -->\n <p class=\"field-error search-error\" role=\"alert\" data-search-error [id]=\"searchErrorId\">\n <nh-assistant-icon name=\"warning\" />\n <span>{{ searchErrorKeys() | nhAssistantTranslate: failure.code }}</span>\n <button\n type=\"button\"\n class=\"link\"\n data-search-retry\n [disabled]=\"disabled()\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"retrySearch()\">{{ 'nh-assistant.picker.search-again' | translate }}</button>\n </p>\n }\n @if (open()) {\n <ul class=\"listbox\" role=\"listbox\" [id]=\"listId\">\n @for (option of visible(); track option.value; let index = $index) {\n <li\n role=\"option\"\n [id]=\"optionId(index)\"\n [class.active]=\"index === active()\"\n [attr.aria-selected]=\"option.value === (value() ?? '')\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"active.set(index)\"\n (click)=\"choose(option)\">\n <span class=\"label\">{{ option.label }}</span>\n @if (option.description) {\n <span class=\"description\">{{ option.description }}</span>\n }\n </li>\n } @empty {\n <li class=\"state\" role=\"presentation\">{{ emptyKey() | translate }}</li>\n }\n </ul>\n } @else if (selected()?.description; as description) {\n <p class=\"chosen\">{{ description }}</p>\n }\n</div>\n","/*\n * Public API surface of @newheap/platform-ai-chat.\n */\nexport * from './lib/models/assistant-api.models';\nexport * from './lib/models/assistant-sse.models';\nexport * from './lib/models/assistant-live.models';\nexport * from './lib/models/assistant-admin.models';\nexport * from './lib/models/assistant-agent-run.models';\nexport * from './lib/models/assistant-hand-off.models';\nexport * from './lib/models/assistant-agent-package.models';\nexport * from './lib/models/assistant-document.models';\nexport * from './lib/nh-assistant.config';\nexport * from './lib/provide-nh-assistant';\nexport { NH_ASSISTANT_TRANSLATIONS, NhAssistantTranslationMerger } from './lib/i18n/nh-assistant-translations';\nexport * from './lib/i18n/nh-assistant-error-codes';\nexport * from './lib/services/nh-assistant-sse-parser';\nexport { NhAssistantStatusCodes } from './lib/services/nh-assistant-transport';\nexport * from './lib/services/nh-assistant-api.service';\nexport * from './lib/services/nh-assistant-admin-api.service';\nexport * from './lib/services/nh-assistant-agent-run-api.service';\nexport * from './lib/services/nh-assistant-reducer';\nexport * from './lib/services/nh-assistant-page-context';\nexport * from './lib/services/nh-assistant.store';\nexport { NhAssistantLiveService, NhAssistantLiveState } from './lib/services/nh-assistant-live.service';\nexport { NhAssistantPushService, NhAssistantPushState } from './lib/services/nh-assistant-push.service';\nexport * from './lib/services/nh-assistant-panel.service';\nexport * from './lib/services/nh-assistant-subject-summary.service';\nexport * from './lib/services/nh-assistant-share-link';\nexport * from './lib/services/nh-assistant-mcp-authorization';\nexport * from './lib/services/nh-assistant-mcp-connect.service';\nexport { toNhAssistantError } from './lib/internal/nh-assistant-errors';\nexport { NH_ASSISTANT_ICONS, NhAssistantIconName } from './lib/internal/nh-assistant-icon.component';\nexport * from './lib/components/launcher/nh-assistant-launcher.component';\nexport * from './lib/components/panel/nh-assistant-panel.component';\nexport * from './lib/components/conversation-list/nh-assistant-conversation-list.component';\nexport * from './lib/components/thread/nh-assistant-thread.component';\nexport * from './lib/components/composer/nh-assistant-composer.component';\nexport * from './lib/components/tool-call-card/nh-assistant-tool-call-card.component';\nexport * from './lib/components/tool-call-group/nh-assistant-tool-call-group.component';\nexport * from './lib/components/approval-card/nh-assistant-approval-card.component';\nexport * from './lib/components/question-card/nh-assistant-question-card.component';\nexport * from './lib/components/proposal-feedback/nh-assistant-proposal-feedback.component';\nexport * from './lib/components/agent-picker/nh-assistant-agent-picker.component';\nexport * from './lib/components/preferences/nh-assistant-preferences.component';\nexport * from './lib/components/preferences/nh-assistant-mcp-connections.component';\nexport * from './lib/components/connection-required/nh-assistant-connection-required.component';\nexport * from './lib/components/share/nh-assistant-share.component';\nexport * from './lib/components/activity/nh-assistant-activity.component';\nexport * from './lib/components/subject-badge/nh-assistant-subject-badge.component';\nexport * from './lib/components/document/nh-assistant-document.component';\n\n/*\n * Internal building blocks shared with the secondary entry points. Not part of the public\n * API; they may change without notice.\n */\nexport { NhAssistantIconComponent as ɵNhAssistantIconComponent } from './lib/internal/nh-assistant-icon.component';\nexport { NhAssistantTranslatePipe as ɵNhAssistantTranslatePipe } from './lib/internal/nh-assistant-translate.pipe';\nexport {\n nhAssistantReloadOnAgentWork as ɵnhAssistantReloadOnAgentWork,\n nhAssistantWatchAgentWork as ɵnhAssistantWatchAgentWork\n} from './lib/internal/nh-assistant-agent-work';\nexport {\n NhAssistantPickerComponent as ɵNhAssistantPickerComponent,\n type NhAssistantPickerOption as ɵNhAssistantPickerOption\n} from './lib/internal/nh-assistant-picker.component';\nexport { NhAssistantSubjectLinkComponent as ɵNhAssistantSubjectLinkComponent } from './lib/internal/nh-assistant-subject-link.component';\nexport { NhAssistantMarkdownPipe as ɵNhAssistantMarkdownPipe } from './lib/internal/nh-assistant-markdown.pipe';\n// The merge of bundled texts, shared with the administration, which brings its own texts.\nexport { nhAssistantMergeTranslations as ɵnhAssistantMergeTranslations } from './lib/i18n/nh-assistant-translations';\n// The upload media type rule, shared with the mock API of the testing entry point.\nexport { nhAssistantMediaTypeOf as ɵnhAssistantMediaTypeOf } from './lib/internal/nh-assistant-files';\nexport {\n NH_ASSISTANT_DASH_CASE as ɵNH_ASSISTANT_DASH_CASE,\n nhAssistantCodeKeys as ɵnhAssistantCodeKeys,\n nhAssistantErrorKeys as ɵnhAssistantErrorKeys,\n nhAssistantErrorOf as ɵnhAssistantErrorOf,\n // Kept for the secondary entry points and earlier callers; `toNhAssistantError` is public.\n toNhAssistantError as ɵtoNhAssistantError\n} from './lib/internal/nh-assistant-errors';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["withQuery","nextId","searchDelayMs","statusIcons"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;AAMG;;ACmGI,MAAM,4BAA4B,GAAuC;IAC9E,cAAc;IACd,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,qBAAqB;IACrB,gBAAgB;IAChB;;AAGF;;;AAGG;AACI,MAAM,2BAA2B,GAAG;AACzC,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,eAAe,EAAE,2BAA2B;AAC5C,IAAA,SAAS,EAAE,qBAAqB;AAChC,IAAA,QAAQ,EAAE,qBAA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