@company-semantics/contracts 86.1.0 → 87.0.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/package.json +8 -8
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +50 -262
- package/src/chat/README.md +8 -20
- package/src/chat/__tests__/compaction-boundary.test.ts +1 -0
- package/src/chat/__tests__/continuity.test.ts +1 -0
- package/src/chat/__tests__/discussion-scope.test.ts +0 -7
- package/src/chat/__tests__/message-mentions.test.ts +1 -12
- package/src/chat/__tests__/multi-party.test.ts +15 -6
- package/src/chat/__tests__/page-context.test.ts +3 -3
- package/src/chat/enums.ts +24 -11
- package/src/chat/index.ts +4 -16
- package/src/chat/schemas.ts +9 -71
- package/src/chat/types.ts +25 -77
- package/src/generated/openapi-routes.ts +1 -4
- package/src/guards/config.ts +1 -1
- package/src/index.ts +4 -6
- package/src/notifications/__tests__/__snapshots__/monospace-budget.test.ts.snap +4 -4
- package/src/notifications/__tests__/__snapshots__/render-snapshot.test.ts.snap +50 -49
- package/src/notifications/__tests__/fixtures.ts +7 -7
- package/src/notifications/__tests__/render-snapshot.test.ts +7 -7
- package/src/notifications/kinds/chat-shared.ts +11 -5
- package/src/notifications/payloads.ts +5 -5
- package/src/org/__tests__/view-scopes.test.ts +0 -2
- package/src/org/view-scopes.ts +0 -1
|
@@ -150,39 +150,39 @@ add("security.alert", "Unusual login location", {
|
|
|
150
150
|
|
|
151
151
|
const CHAT_BASE = {
|
|
152
152
|
sharedByName: "Alex Rivera",
|
|
153
|
-
|
|
153
|
+
access: "read",
|
|
154
154
|
} as const;
|
|
155
155
|
add("chat.shared", "Default", {
|
|
156
156
|
...CHAT_BASE,
|
|
157
157
|
chatTitle: "API design discussion",
|
|
158
|
-
|
|
158
|
+
chatUrl: `${APP}/chat/abc123`,
|
|
159
159
|
previewText:
|
|
160
160
|
"Here are my thoughts on the REST API design for the new authentication endpoints.",
|
|
161
161
|
});
|
|
162
162
|
add("chat.shared", "No preview", {
|
|
163
163
|
...CHAT_BASE,
|
|
164
164
|
chatTitle: "Quick sync notes",
|
|
165
|
-
|
|
165
|
+
chatUrl: `${APP}/chat/xyz789`,
|
|
166
166
|
});
|
|
167
167
|
add("chat.shared", "Long title", {
|
|
168
168
|
...CHAT_BASE,
|
|
169
|
-
|
|
169
|
+
access: "collaborate",
|
|
170
170
|
chatTitle:
|
|
171
171
|
"This is a very long chat title that should be truncated to fit the layout properly",
|
|
172
|
-
|
|
172
|
+
chatUrl: `${APP}/chat/long456`,
|
|
173
173
|
previewText: "The assistant response preview text.",
|
|
174
174
|
});
|
|
175
175
|
add("chat.shared", "Long preview", {
|
|
176
176
|
...CHAT_BASE,
|
|
177
177
|
chatTitle: "Code review feedback",
|
|
178
|
-
|
|
178
|
+
chatUrl: `${APP}/chat/preview789`,
|
|
179
179
|
previewText:
|
|
180
180
|
"I reviewed the pull request and found several areas that need improvement. The authentication logic needs better error handling, and the database queries could be optimized.",
|
|
181
181
|
});
|
|
182
182
|
add("chat.shared", "Short", {
|
|
183
183
|
...CHAT_BASE,
|
|
184
184
|
chatTitle: "Hi",
|
|
185
|
-
|
|
185
|
+
chatUrl: `${APP}/chat/short123`,
|
|
186
186
|
previewText: "Hello!",
|
|
187
187
|
});
|
|
188
188
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The only kind that reproduces a real conversation: the chat's title is shown
|
|
5
5
|
* as the user's turn and the preview as the assistant's reply, elided into the
|
|
6
|
-
* call to action. `
|
|
7
|
-
*
|
|
6
|
+
* call to action. `access` says whether the recipient can take part or only
|
|
7
|
+
* read (ADR-CONTRACTS-206); the link is the chat itself, never a token.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ChatUnitItem } from "../content";
|
|
@@ -15,7 +15,7 @@ import { NOTICE } from "../text";
|
|
|
15
15
|
export const chatSharedDefinition: NotificationDefinition<"chat.shared"> = {
|
|
16
16
|
kind: "chat.shared",
|
|
17
17
|
compose: (payload, context) => {
|
|
18
|
-
const { chatTitle,
|
|
18
|
+
const { chatTitle, chatUrl, access, previewText, sharedByName } = payload;
|
|
19
19
|
|
|
20
20
|
const items: ChatUnitItem[] = [
|
|
21
21
|
{ type: "message", role: "user", text: chatTitle, from: sharedByName },
|
|
@@ -29,7 +29,7 @@ export const chatSharedDefinition: NotificationDefinition<"chat.shared"> = {
|
|
|
29
29
|
]
|
|
30
30
|
: []),
|
|
31
31
|
{ type: "continuation" },
|
|
32
|
-
{ type: "callToAction", label: "
|
|
32
|
+
{ type: "callToAction", label: "OPEN CHAT", href: chatUrl },
|
|
33
33
|
];
|
|
34
34
|
|
|
35
35
|
return {
|
|
@@ -41,7 +41,13 @@ export const chatSharedDefinition: NotificationDefinition<"chat.shared"> = {
|
|
|
41
41
|
{
|
|
42
42
|
elements: [
|
|
43
43
|
{ type: "greeting" },
|
|
44
|
-
{
|
|
44
|
+
{
|
|
45
|
+
type: "body",
|
|
46
|
+
text:
|
|
47
|
+
access === "collaborate"
|
|
48
|
+
? "A chat was shared with you. You can take part in it."
|
|
49
|
+
: "A chat was shared with you to read.",
|
|
50
|
+
},
|
|
45
51
|
{ type: "chatUnit", items },
|
|
46
52
|
{
|
|
47
53
|
type: "notice",
|
|
@@ -108,11 +108,11 @@ export interface NotificationPayloads {
|
|
|
108
108
|
sharedByName: string;
|
|
109
109
|
/** Title of the chat being shared */
|
|
110
110
|
chatTitle: string;
|
|
111
|
-
/** Full URL
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
/** First ~200 chars of chat content for preview. Generated server-side
|
|
111
|
+
/** Full URL of the chat itself — the link that opens it in the recipient's app */
|
|
112
|
+
chatUrl: string;
|
|
113
|
+
/** What the share granted: Read only or Collaborate */
|
|
114
|
+
access: "read" | "collaborate";
|
|
115
|
+
/** First ~200 chars of chat content for preview. Generated server-side. */
|
|
116
116
|
previewText?: string;
|
|
117
117
|
};
|
|
118
118
|
"share.granted": {
|
|
@@ -12,7 +12,6 @@ describe("VIEW_SCOPE_MAP golden snapshot", () => {
|
|
|
12
12
|
"internal-admin": "internal.view_admin",
|
|
13
13
|
"execution-detail": "org.view_timeline",
|
|
14
14
|
teams: null,
|
|
15
|
-
chat: null,
|
|
16
15
|
settings: null,
|
|
17
16
|
"my-work": null,
|
|
18
17
|
"user-md": null,
|
|
@@ -34,7 +33,6 @@ describe("getViewScope", () => {
|
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
it("returns null for public views", () => {
|
|
37
|
-
expect(getViewScope("chat")).toBeNull();
|
|
38
36
|
expect(getViewScope("settings")).toBeNull();
|
|
39
37
|
expect(getViewScope("upgrade")).toBeNull();
|
|
40
38
|
// teams is membership-derived, not scope-gated (ADR-CONTRACTS-062).
|
package/src/org/view-scopes.ts
CHANGED
|
@@ -33,7 +33,6 @@ export const VIEW_SCOPE_MAP = {
|
|
|
33
33
|
// not a scope. Repointed from the never-enforced `org.view_teams` to null when
|
|
34
34
|
// that scope was retired from the backend catalog (ADR-CONTRACTS-062 / ADR-BE-256).
|
|
35
35
|
teams: null,
|
|
36
|
-
chat: null,
|
|
37
36
|
settings: null,
|
|
38
37
|
"my-work": null,
|
|
39
38
|
"user-md": null,
|