@threadplane/chat 0.0.46

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # `@threadplane/chat` changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Changed
6
+
7
+ - **License:** `@threadplane/chat` is dual-licensed under PolyForm Noncommercial 1.0.0 (free noncommercial use) or a Threadplane Commercial license (production use inside a for-profit context).
8
+
9
+ ### Migration
10
+
11
+ Commercial users need a Threadplane Commercial license before production deployment. See [COMMERCIAL-USE.md](./COMMERCIAL-USE.md) for the definition of commercial use and the 30-day evaluation window, and <https://threadplane.ai/pricing> for plans.
@@ -0,0 +1,26 @@
1
+ # `@threadplane/chat` — Commercial Use Definition
2
+
3
+ ## What counts as commercial use
4
+
5
+ Commercial use means using `@threadplane/chat` in any application, product, service, internal tool, client deliverable, hosted experience, or workflow that is operated by or for a for-profit entity, generates revenue, supports paid services, supports business operations, or is delivered to a paying client.
6
+
7
+ ## Permitted free use under PolyForm Noncommercial 1.0.0
8
+
9
+ Free under the PolyForm Noncommercial 1.0.0 license:
10
+
11
+ - Personal projects
12
+ - Hobby projects
13
+ - Student projects
14
+ - Academic research
15
+ - Nonprofit use
16
+ - Public demos
17
+ - Evaluation and prototyping
18
+ - Open-source applications released under an OSI-approved license, provided `@threadplane/chat` is not redistributed as a competing component library
19
+
20
+ ## Evaluation
21
+
22
+ You may use `@threadplane/chat` commercially for 30 calendar days from your first commercial use as a good-faith evaluation. There is no telemetry or tracking — we trust you to count the days. After 30 days you must either purchase a Threadplane Commercial license or stop the commercial use. Continued commercial deployment beyond the evaluation window requires a paid Threadplane Commercial license.
23
+
24
+ ## Learn more
25
+
26
+ For the commercial license summary, see [LICENSE-COMMERCIAL.md](./LICENSE-COMMERCIAL.md). For the full PolyForm Noncommercial text, see [LICENSE.md](./LICENSE.md). For plans and pricing, see <https://threadplane.ai/pricing>.
@@ -0,0 +1,25 @@
1
+ # `@threadplane/chat` Commercial License — Summary
2
+
3
+ Commercial production use of `@threadplane/chat` requires a paid Threadplane commercial license. This document summarizes the expected terms; the signed commercial agreement is authoritative.
4
+
5
+ ## You may
6
+
7
+ - Use `@threadplane/chat` in commercial production applications.
8
+ - Bundle `@threadplane/chat` into hosted SaaS apps, internal tools, and shipped software.
9
+ - Modify `@threadplane/chat` for use inside your own application.
10
+ - Deploy licensed applications to unlimited end users unless otherwise agreed.
11
+ - Use the package in development, staging, CI/CD, and production environments.
12
+
13
+ ## You may not
14
+
15
+ - Redistribute `@threadplane/chat` as a standalone package.
16
+ - Sell, publish, or package it as a competing chat UI library, design system, app builder, template kit, SDK, or component library.
17
+ - Remove copyright, attribution, or license notices.
18
+ - Bypass license-key or entitlement checks.
19
+ - Sublicense the package except as embedded in a larger end-user application.
20
+
21
+ ## How to acquire
22
+
23
+ See plans and pricing at <https://threadplane.ai/pricing>. For enterprise, procurement, or custom terms, contact us at <https://threadplane.ai/contact>.
24
+
25
+ See [COMMERCIAL-USE.md](./COMMERCIAL-USE.md) for the definition of commercial use and which free uses are permitted.
package/LICENSE.md ADDED
@@ -0,0 +1,84 @@
1
+ # @threadplane/chat License
2
+
3
+ `@threadplane/chat` is licensed under the PolyForm Noncommercial License 1.0.0. Commercial use requires a separate commercial license from Threadplane.
4
+
5
+ For the definition of commercial use and which free uses are permitted, see [COMMERCIAL-USE.md](./COMMERCIAL-USE.md).
6
+ For an overview of the commercial license terms, see [LICENSE-COMMERCIAL.md](./LICENSE-COMMERCIAL.md).
7
+
8
+ Versions of `@threadplane/chat` published before this license change remain available under their original MIT terms.
9
+
10
+ ---
11
+
12
+ ## PolyForm Noncommercial License 1.0.0
13
+
14
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
15
+
16
+ ## Acceptance
17
+
18
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
19
+
20
+ ## Copyright License
21
+
22
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
23
+
24
+ ## Distribution License
25
+
26
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
27
+
28
+ ## Notices
29
+
30
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
31
+
32
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
33
+
34
+ ## Changes and New Works License
35
+
36
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
37
+
38
+ ## Patent License
39
+
40
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
41
+
42
+ ## Noncommercial Purposes
43
+
44
+ Any noncommercial purpose is a permitted purpose.
45
+
46
+ ## Personal Uses
47
+
48
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
49
+
50
+ ## Noncommercial Organizations
51
+
52
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
53
+
54
+ ## Fair Use
55
+
56
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
57
+
58
+ ## No Other Rights
59
+
60
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
61
+
62
+ ## Patent Defense
63
+
64
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
65
+
66
+ ## Violations
67
+
68
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
69
+
70
+ ## No Liability
71
+
72
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
73
+
74
+ ## Definitions
75
+
76
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
77
+
78
+ **You** refers to the individual or entity agreeing to these terms.
79
+
80
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
81
+
82
+ **Your licenses** are all the licenses granted to you for the software under these terms.
83
+
84
+ **Use** means anything you do with the software requiring one of your licenses.
package/NOTICE.md ADDED
@@ -0,0 +1,7 @@
1
+ # `@threadplane/chat` Notice
2
+
3
+ Copyright © 2026 Threadplane. All rights reserved.
4
+
5
+ `@threadplane/chat` is dual-licensed: PolyForm Noncommercial 1.0.0 for free noncommercial use, or a paid Threadplane Commercial license. See [LICENSE.md](./LICENSE.md), [LICENSE-COMMERCIAL.md](./LICENSE-COMMERCIAL.md), and [COMMERCIAL-USE.md](./COMMERCIAL-USE.md).
6
+
7
+ Built on top of the wider Threadplane ecosystem. The other published libraries (`@threadplane/render`, `@threadplane/langgraph`, `@threadplane/ag-ui`, `@threadplane/a2ui`, `@threadplane/licensing`, `@threadplane/telemetry`) remain MIT-licensed.
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # @threadplane/chat
2
+
3
+ Drop-in agent chat UI for Angular 20+. Headless primitives that read from a runtime-neutral `Agent` contract, plus opinionated compositions (`<chat>`, `<chat-debug>`, GenUI surfaces) you can ship in days.
4
+
5
+ Part of [Threadplane](https://github.com/cacheplane/angular-agent-framework).
6
+
7
+ `@threadplane/chat` is source-available and free for noncommercial use under PolyForm Noncommercial License 1.0.0. Commercial production use requires a Threadplane Commercial license.
8
+
9
+ This package is not licensed as OSI open source because commercial use requires a license. Threadplane uses a source-available model for `@threadplane/chat` while keeping protocol and ecosystem packages permissively licensed where appropriate.
10
+
11
+ ## Commercial use
12
+
13
+ Building a commercial product, SaaS application, internal business tool, agency deliverable, or paid client project with `@threadplane/chat` requires a Threadplane Commercial license.
14
+
15
+ Free under PolyForm Noncommercial:
16
+
17
+ - Personal, hobby, student, academic, nonprofit, public-demo use
18
+ - Open-source applications released under an OSI-approved license
19
+ - 30 calendar days of commercial evaluation from your first commercial use (good-faith — no tracking, no email required)
20
+
21
+ See [COMMERCIAL-USE.md](./COMMERCIAL-USE.md) for the definition of commercial use, [LICENSE-COMMERCIAL.md](./LICENSE-COMMERCIAL.md) for the commercial license summary, and the [Threadplane pricing page](https://threadplane.ai/pricing) for plans.
22
+
23
+ ## Using a commercial license
24
+
25
+ After purchase, Threadplane emails a signed license token to the address on your receipt. The license is valid for 12 months and the same email contains the token to paste into your app's `provideChat()` configuration:
26
+
27
+ ```typescript
28
+ // app.config.ts
29
+ import { ApplicationConfig } from '@angular/core';
30
+ import { provideChat } from '@threadplane/chat';
31
+
32
+ export const appConfig: ApplicationConfig = {
33
+ providers: [
34
+ provideChat({
35
+ license: 'eyJ…', // The token from your purchase email.
36
+ }),
37
+ ],
38
+ };
39
+ ```
40
+
41
+ The library verifies the token's signature on boot. A missing, expired, or tampered token logs a `console.warn` advisory but does not block rendering — chat continues to work either way. Tokens are validated offline; no calls to Threadplane are made at runtime.
42
+
43
+ The license string is safe to commit to source control if your repository is private, or to read from a build-time env var for public repositories:
44
+
45
+ ```typescript
46
+ declare const THREADPLANE_LICENSE: string | undefined;
47
+
48
+ providers: [
49
+ provideChat({
50
+ license: typeof THREADPLANE_LICENSE === 'string' ? THREADPLANE_LICENSE : undefined,
51
+ }),
52
+ ],
53
+ ```
54
+
55
+ (See `examples/chat/angular/` in the framework repo for a working example.)
56
+
57
+ ## Runtime adapters
58
+
59
+ Chat primitives consume a runtime-neutral `Agent` contract. Two adapters ship today:
60
+
61
+ - **`@threadplane/langgraph`** — for LangGraph / LangGraph Platform backends.
62
+ - **`@threadplane/ag-ui`** — for any AG-UI-compatible backend (LangGraph, CrewAI, Mastra, Microsoft Agent Framework, AG2, Pydantic AI, AWS Strands, CopilotKit runtime).
63
+
64
+ Custom backends can implement `Agent` directly with no library dependency.
65
+
66
+ See the capability matrix in the docs site for which primitives require which runtime capabilities.
67
+
68
+ ## Citations
69
+
70
+ Chat messages can include citations to sources. The `Citation` interface provides structured metadata for each source:
71
+
72
+ ```ts
73
+ interface Citation {
74
+ id: string; // Unique identifier for the citation
75
+ index?: number; // Display index (1-based) for inline markers
76
+ title?: string; // Source title
77
+ url?: string; // Source URL
78
+ snippet?: string; // Quoted excerpt
79
+ extra?: unknown; // Custom fields per adapter
80
+ }
81
+ ```
82
+
83
+ ### Message citations
84
+
85
+ Adapters populate `Message.citations?: Citation[]` from their respective backends. Messages are rendered with the `<chat-citations [message]="message" />` primitive, which displays a collapsible sources panel under assistant messages.
86
+
87
+ ### Rendering sources
88
+
89
+ Use the `<chat-citations>` component to render a sources panel. Customize the card layout with the optional `chatCitationCard` ng-template:
90
+
91
+ ```html
92
+ <chat [agent]="agent" />
93
+ <!-- or explicit: -->
94
+ <chat-citations [message]="message">
95
+ <ng-template chatCitationCard let-citation>
96
+ <div class="custom-card">
97
+ <a [href]="citation.url">{{ citation.title }}</a>
98
+ <p class="text-sm text-gray-600">{{ citation.snippet }}</p>
99
+ </div>
100
+ </ng-template>
101
+ </chat-citations>
102
+ ```
103
+
104
+ ### Inline markers
105
+
106
+ Markdown rendering registers `chat-md-citation-reference` in the markdown view registry. Citation indices are rendered as superscript markers inline with the message text. The markers link to the corresponding citation in the sources panel.
107
+
108
+ ### Adapter integration
109
+
110
+ Each runtime adapter extracts citations into the `Message.citations` array:
111
+
112
+ - **LangGraph** — reads from `message.additional_kwargs.citations` (preferred) or `message.additional_kwargs.sources` (fallback)
113
+ - **AG-UI** — reads from STATE_DELTA at JSON Pointer `/citations/{messageId}`
114
+
115
+ The `CitationsResolverService` is provided to query citations in message-first or markdown-fallback order.
116
+
117
+ ## A2UI surface theming
118
+
119
+ `<a2ui-surface>` declares ~50 internal `--a2ui-*` tokens at `:host` with dark-theme defaults (spacing, typography, shape radius, focus ring, motion, elevation, color). Catalog components consume them via `var(--a2ui-*)`. Override at `:root` to retheme.
120
+
121
+ ### Agent-driven theming (v1 wire format)
122
+
123
+ Agents control exactly two knobs per the canonical A2UI v1-compatible spec, set via `beginRendering.styles`:
124
+
125
+ - `font` — primary font family
126
+ - `primaryColor` — hex `#RRGGBB`
127
+
128
+ Both flow through to the rendered surface as inline styles on `<a2ui-surface>` (highest specificity), overriding any consumer `:root` defaults for the lifetime of that surface.
129
+
130
+ ### Built-in theme presets
131
+
132
+ Four CSS files ship in the package, each declaring `:root` overrides for the relevant tokens:
133
+
134
+ ```css
135
+ /* In your global stylesheet */
136
+ @import '@threadplane/chat/themes/default-dark.css'; /* lib defaults, explicit */
137
+ @import '@threadplane/chat/themes/default-light.css'; /* neutral light, blue accent */
138
+ @import '@threadplane/chat/themes/material-dark.css'; /* Material Design 3 dark */
139
+ @import '@threadplane/chat/themes/material-light.css'; /* Material Design 3 light */
140
+ ```
141
+
142
+ Material presets map [Material Design 3 color tokens](https://m3.material.io/styles/color/the-color-system/tokens) to the `--a2ui-*` vocabulary — no `@angular/material` runtime dep, just CSS custom-property declarations.
143
+
144
+ ### Custom themes
145
+
146
+ Override any subset of the ~50 tokens at `:root`:
147
+
148
+ ```css
149
+ :root {
150
+ --a2ui-primary: #FF6B35; /* brand orange */
151
+ --a2ui-shape-medium: 4px; /* sharper corners */
152
+ --a2ui-spacing-3: 16px; /* roomier layouts */
153
+ }
154
+ ```
155
+
156
+ The token surface:
157
+ - **Color** — `--a2ui-primary`, `--a2ui-on-primary`, `--a2ui-secondary`, `--a2ui-surface`, `--a2ui-on-surface`, `--a2ui-surface-variant`, `--a2ui-on-surface-variant`, `--a2ui-outline`, `--a2ui-outline-variant`, `--a2ui-error`, `--a2ui-on-error`, `--a2ui-scrim`
158
+ - **Spacing** — `--a2ui-spacing-1` (4px) through `--a2ui-spacing-7` (40px)
159
+ - **Typography** — `--a2ui-typography-{h1..h5,body,caption,label}-{size,weight,line-height}`
160
+ - **Shape** — `--a2ui-shape-{extra-small,small,medium,large,extra-large}`
161
+ - **Focus ring** — `--a2ui-focus-ring-color`, `--a2ui-focus-ring-width`
162
+ - **Motion** — `--a2ui-motion-duration-{short,medium,long}`, `--a2ui-motion-easing-{standard,emphasized}`
163
+ - **Elevation** — `--a2ui-elevation-{0,1,2,3,4,5}` (box-shadow tokens)