@company-semantics/contracts 9.0.0 → 9.2.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 +6 -3
- package/src/__tests__/resource-keys.test.ts +30 -23
- package/src/admin/authz-simulate.ts +4 -4
- package/src/admin/direct-grants.ts +2 -2
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +97 -0
- package/src/api/http/routes/ai-chat.ts +3 -3
- package/src/api/http/utils/resource-response.ts +5 -2
- package/src/api/index.ts +4 -4
- package/src/api/primitives.ts +6 -2
- package/src/auth/README.md +1 -0
- package/src/auth/index.ts +12 -5
- package/src/autotune.ts +5 -1
- package/src/billing/index.ts +1 -1
- package/src/billing/types.ts +1 -1
- package/src/chat/README.md +3 -0
- package/src/chat/__tests__/runtime-profile.test.ts +68 -48
- package/src/chat/index.ts +10 -4
- package/src/chat/runtime-profile.ts +25 -10
- package/src/chat/schemas.ts +49 -41
- package/src/chat/types.ts +48 -42
- package/src/ci-envelope/README.md +2 -0
- package/src/ci-envelope/__tests__/transitions.test.ts +56 -56
- package/src/ci-envelope/index.ts +2 -2
- package/src/ci-envelope/types.ts +20 -20
- package/src/ci-results/index.ts +2 -2
- package/src/ci-results/repo-ci-result.ts +15 -12
- package/src/compatibility.ts +6 -6
- package/src/content/index.ts +10 -4
- package/src/content/schemas.ts +42 -24
- package/src/dispatch/index.ts +18 -15
- package/src/email/__tests__/registry.test.ts +81 -77
- package/src/email/index.ts +3 -3
- package/src/email/registry.ts +25 -25
- package/src/email/types.ts +43 -43
- package/src/errors/index.ts +8 -8
- package/src/execution/__tests__/events.test.ts +42 -42
- package/src/execution/__tests__/lifecycle.test.ts +192 -190
- package/src/execution/__tests__/registry.test.ts +114 -114
- package/src/execution/audit-export.ts +4 -4
- package/src/execution/errors.ts +7 -7
- package/src/execution/event-metadata.ts +4 -4
- package/src/execution/events.ts +23 -21
- package/src/execution/expiry.ts +5 -5
- package/src/execution/hash-chain.ts +2 -2
- package/src/execution/index.ts +19 -28
- package/src/execution/kinds.ts +7 -7
- package/src/execution/lifecycle.ts +33 -33
- package/src/execution/registry.ts +63 -63
- package/src/execution/schemas.ts +31 -23
- package/src/execution/status.ts +45 -26
- package/src/execution/summary.ts +16 -17
- package/src/execution/timeline-ui.ts +9 -9
- package/src/execution/types.ts +31 -25
- package/src/generated/openapi-routes.ts +2 -0
- package/src/guards/config.ts +22 -18
- package/src/guards/index.ts +4 -4
- package/src/guards/types.ts +32 -24
- package/src/identity/__tests__/avatar.test.ts +68 -59
- package/src/identity/avatar.ts +8 -8
- package/src/identity/display-name.ts +3 -3
- package/src/identity/index.ts +8 -8
- package/src/identity/people-org-chart.ts +8 -4
- package/src/identity/schemas.ts +28 -18
- package/src/identity/types.ts +5 -5
- package/src/impersonation/index.ts +5 -5
- package/src/impersonation/schemas.ts +15 -9
- package/src/impersonation-events.ts +21 -21
- package/src/impersonation.ts +25 -24
- package/src/index.ts +118 -90
- package/src/interfaces/mcp/tools/help.ts +19 -19
- package/src/internal-admin.ts +6 -6
- package/src/mcp/README.md +2 -0
- package/src/mcp/__tests__/capability-graph.test.ts +290 -290
- package/src/mcp/capability-graph.ts +42 -40
- package/src/mcp/failure-context.ts +1 -3
- package/src/mcp/index.ts +69 -56
- package/src/mcp/resources.ts +9 -9
- package/src/meetings/index.ts +2 -2
- package/src/meetings/schemas.ts +51 -34
- package/src/message-parts/README.md +2 -0
- package/src/message-parts/__tests__/builder.test.ts +142 -142
- package/src/message-parts/__tests__/confirmation.test.ts +100 -86
- package/src/message-parts/__tests__/preview.test.ts +63 -63
- package/src/message-parts/__tests__/wire.test.ts +130 -124
- package/src/message-parts/builder.ts +23 -23
- package/src/message-parts/confirmation.ts +17 -14
- package/src/message-parts/execution.ts +7 -7
- package/src/message-parts/index.ts +10 -10
- package/src/message-parts/lifecycle.ts +25 -25
- package/src/message-parts/preview.ts +30 -30
- package/src/message-parts/types.ts +27 -27
- package/src/message-parts/wire.ts +24 -24
- package/src/mutations.ts +2 -2
- package/src/observability.ts +23 -11
- package/src/org/__tests__/org-units.test.ts +131 -96
- package/src/org/__tests__/tree-ordering.test.ts +57 -37
- package/src/org/__tests__/view-scopes.test.ts +40 -40
- package/src/org/domain.ts +9 -9
- package/src/org/index.ts +31 -21
- package/src/org/org-units.ts +34 -20
- package/src/org/schemas.ts +261 -124
- package/src/org/sharing.ts +17 -13
- package/src/org/tree-ordering.ts +3 -1
- package/src/org/types.ts +54 -47
- package/src/org/view-scopes.ts +9 -9
- package/src/permissions/access-levels.ts +7 -2
- package/src/permissions/access-source.ts +6 -6
- package/src/permissions/index.ts +5 -5
- package/src/permissions/orgchart-roles.ts +7 -7
- package/src/permissions/permission-introspection.ts +7 -5
- package/src/permissions/share-api.ts +19 -9
- package/src/pressure.ts +4 -4
- package/src/queryIntent.ts +21 -21
- package/src/ralph/__tests__/prd-groups.test.ts +159 -159
- package/src/ralph/__tests__/prd.test.ts +30 -30
- package/src/ralph/index.ts +3 -8
- package/src/ralph/prd.ts +33 -33
- package/src/ralph/progress.ts +1 -1
- package/src/rate-limit/README.md +4 -4
- package/src/rate-limit/index.ts +3 -3
- package/src/requests.ts +36 -8
- package/src/resource-keys.ts +207 -124
- package/src/resource-registry.ts +5 -5
- package/src/route-builder.ts +3 -3
- package/src/safe-mode.ts +2 -2
- package/src/security/index.ts +4 -4
- package/src/security/org-secrets.ts +13 -9
- package/src/security/secret.ts +3 -3
- package/src/sse.ts +3 -1
- package/src/system/README.md +3 -0
- package/src/system/capabilities.ts +22 -23
- package/src/system/diagram.ts +45 -45
- package/src/system/index.ts +14 -14
- package/src/tiers.ts +1 -1
- package/src/timeouts.ts +1 -1
- package/src/tracing.ts +30 -30
- package/src/types/analytics.ts +2 -2
- package/src/usage/README.md +3 -0
- package/src/usage/execution-types.ts +69 -69
- package/src/usage/types.ts +7 -3
|
@@ -8,29 +8,44 @@
|
|
|
8
8
|
* - balanced: Default. AiSdkOrchestrator + gpt-4o with tool support.
|
|
9
9
|
* - agentic: Multi-turn agent loop. ClaudeAgentOrchestrator.
|
|
10
10
|
*/
|
|
11
|
-
export type ChatRuntimeProfile =
|
|
11
|
+
export type ChatRuntimeProfile = "fast" | "balanced" | "agentic";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Runtime profile metadata for UI rendering.
|
|
15
15
|
* Labels and descriptions are user-facing — no vendor names.
|
|
16
16
|
*/
|
|
17
17
|
export interface ChatRuntimeProfileInfo {
|
|
18
|
-
id: ChatRuntimeProfile
|
|
19
|
-
label: string
|
|
20
|
-
description: string
|
|
21
|
-
model: string
|
|
18
|
+
id: ChatRuntimeProfile;
|
|
19
|
+
label: string;
|
|
20
|
+
description: string;
|
|
21
|
+
model: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Ordered list of available profiles for UI rendering.
|
|
26
26
|
*/
|
|
27
27
|
export const CHAT_RUNTIME_PROFILES: readonly ChatRuntimeProfileInfo[] = [
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
{
|
|
29
|
+
id: "fast",
|
|
30
|
+
label: "Fast",
|
|
31
|
+
description: "Single-step, no tools",
|
|
32
|
+
model: "gpt-3.5-turbo",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "balanced",
|
|
36
|
+
label: "Balanced",
|
|
37
|
+
description: "Multi-step with tools",
|
|
38
|
+
model: "gpt-4o",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "agentic",
|
|
42
|
+
label: "Agentic",
|
|
43
|
+
description: "Agent loop, full reasoning",
|
|
44
|
+
model: "claude-sonnet-4-20250514",
|
|
45
|
+
},
|
|
46
|
+
] as const;
|
|
32
47
|
|
|
33
48
|
/**
|
|
34
49
|
* Default profile when none is specified in the request.
|
|
35
50
|
*/
|
|
36
|
-
export const DEFAULT_CHAT_RUNTIME_PROFILE: ChatRuntimeProfile =
|
|
51
|
+
export const DEFAULT_CHAT_RUNTIME_PROFILE: ChatRuntimeProfile = "agentic";
|
package/src/chat/schemas.ts
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Reusable Primitives
|
|
5
5
|
// =============================================================================
|
|
6
6
|
|
|
7
7
|
/** ISO 8601 datetime string — the runtime safety net for date serialization. */
|
|
8
|
-
export const IsoDateString = z.string().datetime()
|
|
8
|
+
export const IsoDateString = z.string().datetime();
|
|
9
9
|
|
|
10
10
|
// =============================================================================
|
|
11
11
|
// Enums
|
|
12
12
|
// =============================================================================
|
|
13
13
|
|
|
14
|
-
export const ChatVisibilitySchema = z.enum([
|
|
15
|
-
export const TitleSourceSchema = z.enum([
|
|
16
|
-
export const InvalidationReasonSchema = z.enum([
|
|
17
|
-
|
|
14
|
+
export const ChatVisibilitySchema = z.enum(["private", "public"]);
|
|
15
|
+
export const TitleSourceSchema = z.enum(["auto", "manual"]);
|
|
16
|
+
export const InvalidationReasonSchema = z.enum([
|
|
17
|
+
"external-mutation",
|
|
18
|
+
"bulk-operation",
|
|
19
|
+
"sync-required",
|
|
20
|
+
]);
|
|
21
|
+
export const ChatChangedFieldSchema = z.enum([
|
|
22
|
+
"title",
|
|
23
|
+
"titleSource",
|
|
24
|
+
"pinnedAt",
|
|
25
|
+
]);
|
|
18
26
|
|
|
19
27
|
// =============================================================================
|
|
20
28
|
// Core Entities
|
|
@@ -27,28 +35,28 @@ export const ChatSummarySchema = z.object({
|
|
|
27
35
|
createdAt: IsoDateString,
|
|
28
36
|
updatedAt: IsoDateString,
|
|
29
37
|
isShared: z.boolean(),
|
|
30
|
-
})
|
|
38
|
+
});
|
|
31
39
|
|
|
32
40
|
export const ChatSummaryExtendedSchema = ChatSummarySchema.extend({
|
|
33
41
|
pinnedAt: IsoDateString.nullable(),
|
|
34
42
|
titleSource: TitleSourceSchema.nullable(),
|
|
35
43
|
titleGeneratedAt: IsoDateString.nullable(),
|
|
36
|
-
})
|
|
44
|
+
});
|
|
37
45
|
|
|
38
46
|
export const TitleGenerationResponseSchema = z.object({
|
|
39
47
|
title: z.string(),
|
|
40
48
|
isAutoGenerated: z.boolean(),
|
|
41
|
-
})
|
|
49
|
+
});
|
|
42
50
|
|
|
43
51
|
// =============================================================================
|
|
44
52
|
// Share Types
|
|
45
53
|
// =============================================================================
|
|
46
54
|
|
|
47
55
|
export const SharedChatMessageSchema = z.object({
|
|
48
|
-
role: z.enum([
|
|
56
|
+
role: z.enum(["user", "assistant"]),
|
|
49
57
|
content: z.string(),
|
|
50
58
|
parts: z.array(z.unknown()).optional(),
|
|
51
|
-
})
|
|
59
|
+
});
|
|
52
60
|
|
|
53
61
|
export const ChatShareInfoSchema = z.object({
|
|
54
62
|
id: z.string(),
|
|
@@ -61,7 +69,7 @@ export const ChatShareInfoSchema = z.object({
|
|
|
61
69
|
createdAt: IsoDateString,
|
|
62
70
|
createdByName: z.string(),
|
|
63
71
|
isRevoked: z.boolean(),
|
|
64
|
-
})
|
|
72
|
+
});
|
|
65
73
|
|
|
66
74
|
export const SharedChatViewSchema = z.object({
|
|
67
75
|
title: z.string(),
|
|
@@ -69,7 +77,7 @@ export const SharedChatViewSchema = z.object({
|
|
|
69
77
|
sharedAt: IsoDateString,
|
|
70
78
|
sharedByName: z.string(),
|
|
71
79
|
visibility: ChatVisibilitySchema,
|
|
72
|
-
})
|
|
80
|
+
});
|
|
73
81
|
|
|
74
82
|
// =============================================================================
|
|
75
83
|
// SSE Event Schemas
|
|
@@ -79,10 +87,10 @@ export const BaseEventSchema = z.object({
|
|
|
79
87
|
v: z.literal(1),
|
|
80
88
|
timestamp: IsoDateString,
|
|
81
89
|
eventId: z.string().optional(),
|
|
82
|
-
})
|
|
90
|
+
});
|
|
83
91
|
|
|
84
92
|
export const ChatCreatedEventSchema = BaseEventSchema.extend({
|
|
85
|
-
type: z.literal(
|
|
93
|
+
type: z.literal("chat.created"),
|
|
86
94
|
data: z.object({
|
|
87
95
|
chatId: z.string(),
|
|
88
96
|
interactionId: z.string().optional(),
|
|
@@ -94,10 +102,10 @@ export const ChatCreatedEventSchema = BaseEventSchema.extend({
|
|
|
94
102
|
updatedAt: IsoDateString,
|
|
95
103
|
isShared: z.boolean(),
|
|
96
104
|
}),
|
|
97
|
-
})
|
|
105
|
+
});
|
|
98
106
|
|
|
99
107
|
export const ChatUpdatedEventSchema = BaseEventSchema.extend({
|
|
100
|
-
type: z.literal(
|
|
108
|
+
type: z.literal("chat.updated"),
|
|
101
109
|
data: z.object({
|
|
102
110
|
chatId: z.string(),
|
|
103
111
|
title: z.string(),
|
|
@@ -110,48 +118,48 @@ export const ChatUpdatedEventSchema = BaseEventSchema.extend({
|
|
|
110
118
|
isShared: z.boolean(),
|
|
111
119
|
}),
|
|
112
120
|
changed: z.array(ChatChangedFieldSchema),
|
|
113
|
-
})
|
|
121
|
+
});
|
|
114
122
|
|
|
115
123
|
export const ChatDeletedEventSchema = BaseEventSchema.extend({
|
|
116
|
-
type: z.literal(
|
|
124
|
+
type: z.literal("chat.deleted"),
|
|
117
125
|
data: z.object({
|
|
118
126
|
chatId: z.string(),
|
|
119
127
|
}),
|
|
120
|
-
})
|
|
128
|
+
});
|
|
121
129
|
|
|
122
130
|
export const InvalidateChatEventSchema = BaseEventSchema.extend({
|
|
123
|
-
type: z.literal(
|
|
131
|
+
type: z.literal("invalidate.chat"),
|
|
124
132
|
chatId: z.string(),
|
|
125
133
|
reason: InvalidationReasonSchema,
|
|
126
|
-
})
|
|
134
|
+
});
|
|
127
135
|
|
|
128
136
|
export const InvalidateChatListEventSchema = BaseEventSchema.extend({
|
|
129
|
-
type: z.literal(
|
|
137
|
+
type: z.literal("invalidate.chat-list"),
|
|
130
138
|
reason: InvalidationReasonSchema,
|
|
131
|
-
})
|
|
139
|
+
});
|
|
132
140
|
|
|
133
141
|
// =============================================================================
|
|
134
142
|
// SSE Event Unions
|
|
135
143
|
// =============================================================================
|
|
136
144
|
|
|
137
|
-
export const ChatDomainEventSchema = z.discriminatedUnion(
|
|
145
|
+
export const ChatDomainEventSchema = z.discriminatedUnion("type", [
|
|
138
146
|
ChatCreatedEventSchema,
|
|
139
147
|
ChatUpdatedEventSchema,
|
|
140
148
|
ChatDeletedEventSchema,
|
|
141
|
-
])
|
|
149
|
+
]);
|
|
142
150
|
|
|
143
|
-
export const ChatInvalidationEventSchema = z.discriminatedUnion(
|
|
151
|
+
export const ChatInvalidationEventSchema = z.discriminatedUnion("type", [
|
|
144
152
|
InvalidateChatEventSchema,
|
|
145
153
|
InvalidateChatListEventSchema,
|
|
146
|
-
])
|
|
154
|
+
]);
|
|
147
155
|
|
|
148
|
-
export const ChatSseEventSchema = z.discriminatedUnion(
|
|
156
|
+
export const ChatSseEventSchema = z.discriminatedUnion("type", [
|
|
149
157
|
ChatCreatedEventSchema,
|
|
150
158
|
ChatUpdatedEventSchema,
|
|
151
159
|
ChatDeletedEventSchema,
|
|
152
160
|
InvalidateChatEventSchema,
|
|
153
161
|
InvalidateChatListEventSchema,
|
|
154
|
-
])
|
|
162
|
+
]);
|
|
155
163
|
|
|
156
164
|
// =============================================================================
|
|
157
165
|
// Message Types
|
|
@@ -160,12 +168,12 @@ export const ChatSseEventSchema = z.discriminatedUnion('type', [
|
|
|
160
168
|
/** Individual message in a chat, as returned by GET /api/chats/:id. */
|
|
161
169
|
export const ChatMessageSchema = z.object({
|
|
162
170
|
id: z.string(),
|
|
163
|
-
role: z.enum([
|
|
171
|
+
role: z.enum(["user", "assistant"]),
|
|
164
172
|
content: z.string(),
|
|
165
173
|
parts: z.array(z.unknown()).optional(),
|
|
166
174
|
sequenceNumber: z.number().int(),
|
|
167
175
|
createdAt: IsoDateString,
|
|
168
|
-
})
|
|
176
|
+
});
|
|
169
177
|
|
|
170
178
|
// =============================================================================
|
|
171
179
|
// HTTP Response Schemas
|
|
@@ -174,38 +182,38 @@ export const ChatMessageSchema = z.object({
|
|
|
174
182
|
/** Generic success confirmation for mutations that return no entity data. */
|
|
175
183
|
export const ChatSuccessResponseSchema = z.object({
|
|
176
184
|
success: z.literal(true),
|
|
177
|
-
})
|
|
185
|
+
});
|
|
178
186
|
|
|
179
187
|
/** Response for GET /api/chats/by-interaction/:interactionId */
|
|
180
188
|
export const ChatByInteractionResponseSchema = z.object({
|
|
181
189
|
chatId: z.string(),
|
|
182
|
-
})
|
|
190
|
+
});
|
|
183
191
|
|
|
184
192
|
/** Response for GET /api/chats */
|
|
185
193
|
export const ChatListResponseSchema = z.object({
|
|
186
194
|
chats: z.array(ChatSummaryExtendedSchema),
|
|
187
|
-
})
|
|
195
|
+
});
|
|
188
196
|
|
|
189
197
|
/** Response for POST /api/chats */
|
|
190
198
|
export const CreateChatResponseSchema = z.object({
|
|
191
199
|
chat: ChatSummaryExtendedSchema,
|
|
192
|
-
})
|
|
200
|
+
});
|
|
193
201
|
|
|
194
202
|
/** Response for POST /api/chats/:chatId/shares */
|
|
195
203
|
export const CreateShareResponseSchema = z.object({
|
|
196
204
|
share: ChatShareInfoSchema,
|
|
197
205
|
shareUrl: z.string(),
|
|
198
|
-
})
|
|
206
|
+
});
|
|
199
207
|
|
|
200
208
|
/** Response for GET /api/chats/:chatId/shares */
|
|
201
209
|
export const ListSharesResponseSchema = z.object({
|
|
202
210
|
shares: z.array(ChatShareInfoSchema),
|
|
203
|
-
})
|
|
211
|
+
});
|
|
204
212
|
|
|
205
213
|
/** Response for PATCH /api/shares/:shareId */
|
|
206
214
|
export const UpdateShareResponseSchema = z.object({
|
|
207
215
|
share: ChatShareInfoSchema,
|
|
208
|
-
})
|
|
216
|
+
});
|
|
209
217
|
|
|
210
218
|
/**
|
|
211
219
|
* Chat detail object in GET /api/chats/:id response.
|
|
@@ -220,10 +228,10 @@ export const ChatDetailSchema = z.object({
|
|
|
220
228
|
titleGeneratedAt: IsoDateString.nullable().optional(),
|
|
221
229
|
createdAt: IsoDateString,
|
|
222
230
|
updatedAt: IsoDateString,
|
|
223
|
-
})
|
|
231
|
+
});
|
|
224
232
|
|
|
225
233
|
/** Response for GET /api/chats/:id */
|
|
226
234
|
export const GetChatResponseSchema = z.object({
|
|
227
235
|
chat: ChatDetailSchema,
|
|
228
236
|
messages: z.array(ChatMessageSchema),
|
|
229
|
-
})
|
|
237
|
+
});
|
package/src/chat/types.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Request-only types remain as interfaces (no runtime validation needed).
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { z } from
|
|
9
|
+
import { z } from "zod";
|
|
10
10
|
import {
|
|
11
11
|
ChatVisibilitySchema,
|
|
12
12
|
TitleSourceSchema,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
ChatMessageSchema,
|
|
38
38
|
ChatDetailSchema,
|
|
39
39
|
GetChatResponseSchema,
|
|
40
|
-
} from
|
|
40
|
+
} from "./schemas";
|
|
41
41
|
|
|
42
42
|
// =============================================================================
|
|
43
43
|
// Visibility
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
* - private: Token exists but access requires authentication as chat owner
|
|
49
49
|
* - public: Token grants anonymous access to anyone with the link
|
|
50
50
|
*/
|
|
51
|
-
export type ChatVisibility = z.infer<typeof ChatVisibilitySchema
|
|
51
|
+
export type ChatVisibility = z.infer<typeof ChatVisibilitySchema>;
|
|
52
52
|
|
|
53
53
|
// =============================================================================
|
|
54
54
|
// Chat Summary
|
|
@@ -57,7 +57,7 @@ export type ChatVisibility = z.infer<typeof ChatVisibilitySchema>
|
|
|
57
57
|
/**
|
|
58
58
|
* Lightweight chat summary for list views.
|
|
59
59
|
*/
|
|
60
|
-
export type ChatSummary = z.infer<typeof ChatSummarySchema
|
|
60
|
+
export type ChatSummary = z.infer<typeof ChatSummarySchema>;
|
|
61
61
|
|
|
62
62
|
// =============================================================================
|
|
63
63
|
// Share Types
|
|
@@ -70,18 +70,18 @@ export type ChatSummary = z.infer<typeof ChatSummarySchema>
|
|
|
70
70
|
* A chat share must never expose messages with sequenceNumber > messageCountAtShare.
|
|
71
71
|
* Enforced in ChatShareService.viewSharedChat() only.
|
|
72
72
|
*/
|
|
73
|
-
export type ChatShareInfo = z.infer<typeof ChatShareInfoSchema
|
|
73
|
+
export type ChatShareInfo = z.infer<typeof ChatShareInfoSchema>;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Shared chat view returned to viewers.
|
|
77
77
|
* Messages are limited by the snapshot boundary.
|
|
78
78
|
*/
|
|
79
|
-
export type SharedChatView = z.infer<typeof SharedChatViewSchema
|
|
79
|
+
export type SharedChatView = z.infer<typeof SharedChatViewSchema>;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Individual message in a shared chat view.
|
|
83
83
|
*/
|
|
84
|
-
export type SharedChatMessage = z.infer<typeof SharedChatMessageSchema
|
|
84
|
+
export type SharedChatMessage = z.infer<typeof SharedChatMessageSchema>;
|
|
85
85
|
|
|
86
86
|
// =============================================================================
|
|
87
87
|
// API Request/Response Types
|
|
@@ -91,19 +91,19 @@ export type SharedChatMessage = z.infer<typeof SharedChatMessageSchema>
|
|
|
91
91
|
* Request to create a new share for a chat.
|
|
92
92
|
*/
|
|
93
93
|
export interface CreateShareRequest {
|
|
94
|
-
chatId: string
|
|
95
|
-
visibility: ChatVisibility
|
|
94
|
+
chatId: string;
|
|
95
|
+
visibility: ChatVisibility;
|
|
96
96
|
/** Optional: send email notification to this address */
|
|
97
|
-
recipientEmail?: string
|
|
97
|
+
recipientEmail?: string;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Request to update an existing share.
|
|
102
102
|
*/
|
|
103
103
|
export interface UpdateShareRequest {
|
|
104
|
-
visibility?: ChatVisibility
|
|
104
|
+
visibility?: ChatVisibility;
|
|
105
105
|
/** If true, update snapshot to include new messages added since share creation */
|
|
106
|
-
updateSnapshot?: boolean
|
|
106
|
+
updateSnapshot?: boolean;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// =============================================================================
|
|
@@ -115,40 +115,42 @@ export interface UpdateShareRequest {
|
|
|
115
115
|
* - auto: Generated automatically by LLM
|
|
116
116
|
* - manual: Set by user (disables future auto-generation)
|
|
117
117
|
*/
|
|
118
|
-
export type TitleSource = z.infer<typeof TitleSourceSchema
|
|
118
|
+
export type TitleSource = z.infer<typeof TitleSourceSchema>;
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Filters for listing chats.
|
|
122
122
|
*/
|
|
123
123
|
export interface ChatListFilters {
|
|
124
124
|
/** Search query - matches against title */
|
|
125
|
-
search?: string
|
|
125
|
+
search?: string;
|
|
126
126
|
/** Include pinned chats at top */
|
|
127
|
-
includePinned?: boolean
|
|
127
|
+
includePinned?: boolean;
|
|
128
128
|
/** Pagination limit */
|
|
129
|
-
limit?: number
|
|
129
|
+
limit?: number;
|
|
130
130
|
/** Pagination offset */
|
|
131
|
-
offset?: number
|
|
131
|
+
offset?: number;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* Extended chat summary with pin/title status.
|
|
136
136
|
*/
|
|
137
|
-
export type ChatSummaryExtended = z.infer<typeof ChatSummaryExtendedSchema
|
|
137
|
+
export type ChatSummaryExtended = z.infer<typeof ChatSummaryExtendedSchema>;
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Request to generate a title for a chat.
|
|
141
141
|
*/
|
|
142
142
|
export interface TitleGenerationRequest {
|
|
143
|
-
chatId: string
|
|
143
|
+
chatId: string;
|
|
144
144
|
/** First few messages for context */
|
|
145
|
-
messages: Array<{ role:
|
|
145
|
+
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
* Response from title generation.
|
|
150
150
|
*/
|
|
151
|
-
export type TitleGenerationResponse = z.infer<
|
|
151
|
+
export type TitleGenerationResponse = z.infer<
|
|
152
|
+
typeof TitleGenerationResponseSchema
|
|
153
|
+
>;
|
|
152
154
|
|
|
153
155
|
// =============================================================================
|
|
154
156
|
// Event System Types
|
|
@@ -164,19 +166,19 @@ export type TitleGenerationResponse = z.infer<typeof TitleGenerationResponseSche
|
|
|
164
166
|
* INV-EVENT-CONVERGENCE: Clients must assume events may be missed during SSE
|
|
165
167
|
* disconnects. Invalidation events ensure convergence.
|
|
166
168
|
*/
|
|
167
|
-
export type BaseEvent = z.infer<typeof BaseEventSchema
|
|
169
|
+
export type BaseEvent = z.infer<typeof BaseEventSchema>;
|
|
168
170
|
|
|
169
171
|
/**
|
|
170
172
|
* Reason for cache invalidation.
|
|
171
173
|
* INV-REASON-TELEMETRY: This is for telemetry only. UI behavior must be
|
|
172
174
|
* identical regardless of reason. Do not branch on this.
|
|
173
175
|
*/
|
|
174
|
-
export type InvalidationReason = z.infer<typeof InvalidationReasonSchema
|
|
176
|
+
export type InvalidationReason = z.infer<typeof InvalidationReasonSchema>;
|
|
175
177
|
|
|
176
178
|
/**
|
|
177
179
|
* Fields that can change on a chat, used in changed[] array.
|
|
178
180
|
*/
|
|
179
|
-
export type ChatChangedField = z.infer<typeof ChatChangedFieldSchema
|
|
181
|
+
export type ChatChangedField = z.infer<typeof ChatChangedFieldSchema>;
|
|
180
182
|
|
|
181
183
|
// =============================================================================
|
|
182
184
|
// Domain Events (past-tense facts, carry full state)
|
|
@@ -189,18 +191,18 @@ export type ChatChangedField = z.infer<typeof ChatChangedFieldSchema>
|
|
|
189
191
|
* INV-EVENT-1: This event is emitted exactly once per successful stream.
|
|
190
192
|
* INV-PERSIST-1: Chat record + messages are committed atomically before this event.
|
|
191
193
|
*/
|
|
192
|
-
export type ChatCreatedEvent = z.infer<typeof ChatCreatedEventSchema
|
|
194
|
+
export type ChatCreatedEvent = z.infer<typeof ChatCreatedEventSchema>;
|
|
193
195
|
|
|
194
196
|
/**
|
|
195
197
|
* Emitted when chat metadata changes (title, pin, etc.)
|
|
196
198
|
* Carries full current state - clients should replace local state entirely.
|
|
197
199
|
*/
|
|
198
|
-
export type ChatUpdatedEvent = z.infer<typeof ChatUpdatedEventSchema
|
|
200
|
+
export type ChatUpdatedEvent = z.infer<typeof ChatUpdatedEventSchema>;
|
|
199
201
|
|
|
200
202
|
/**
|
|
201
203
|
* Emitted when a chat is deleted.
|
|
202
204
|
*/
|
|
203
|
-
export type ChatDeletedEvent = z.infer<typeof ChatDeletedEventSchema
|
|
205
|
+
export type ChatDeletedEvent = z.infer<typeof ChatDeletedEventSchema>;
|
|
204
206
|
|
|
205
207
|
// =============================================================================
|
|
206
208
|
// Invalidation Events (staleness signals)
|
|
@@ -210,13 +212,15 @@ export type ChatDeletedEvent = z.infer<typeof ChatDeletedEventSchema>
|
|
|
210
212
|
* Single-entity staleness signal.
|
|
211
213
|
* Emitted when a specific chat may be out of sync (e.g., external mutation).
|
|
212
214
|
*/
|
|
213
|
-
export type InvalidateChatEvent = z.infer<typeof InvalidateChatEventSchema
|
|
215
|
+
export type InvalidateChatEvent = z.infer<typeof InvalidateChatEventSchema>;
|
|
214
216
|
|
|
215
217
|
/**
|
|
216
218
|
* Collection staleness signal.
|
|
217
219
|
* Emitted when chat list ordering/filtering may be stale.
|
|
218
220
|
*/
|
|
219
|
-
export type InvalidateChatListEvent = z.infer<
|
|
221
|
+
export type InvalidateChatListEvent = z.infer<
|
|
222
|
+
typeof InvalidateChatListEventSchema
|
|
223
|
+
>;
|
|
220
224
|
|
|
221
225
|
// =============================================================================
|
|
222
226
|
// SSE Event Union
|
|
@@ -225,49 +229,51 @@ export type InvalidateChatListEvent = z.infer<typeof InvalidateChatListEventSche
|
|
|
225
229
|
/**
|
|
226
230
|
* All domain events that carry full state.
|
|
227
231
|
*/
|
|
228
|
-
export type ChatDomainEvent = z.infer<typeof ChatDomainEventSchema
|
|
232
|
+
export type ChatDomainEvent = z.infer<typeof ChatDomainEventSchema>;
|
|
229
233
|
|
|
230
234
|
/**
|
|
231
235
|
* All invalidation events that signal staleness.
|
|
232
236
|
*/
|
|
233
|
-
export type ChatInvalidationEvent = z.infer<typeof ChatInvalidationEventSchema
|
|
237
|
+
export type ChatInvalidationEvent = z.infer<typeof ChatInvalidationEventSchema>;
|
|
234
238
|
|
|
235
239
|
/**
|
|
236
240
|
* SSE event types for chat updates.
|
|
237
241
|
* Client receives these via SSE and handles accordingly.
|
|
238
242
|
*/
|
|
239
|
-
export type ChatSseEvent = z.infer<typeof ChatSseEventSchema
|
|
243
|
+
export type ChatSseEvent = z.infer<typeof ChatSseEventSchema>;
|
|
240
244
|
|
|
241
245
|
// =============================================================================
|
|
242
246
|
// HTTP Response Types (derived from response schemas)
|
|
243
247
|
// =============================================================================
|
|
244
248
|
|
|
245
249
|
/** Generic mutation success confirmation. */
|
|
246
|
-
export type ChatSuccessResponse = z.infer<typeof ChatSuccessResponseSchema
|
|
250
|
+
export type ChatSuccessResponse = z.infer<typeof ChatSuccessResponseSchema>;
|
|
247
251
|
|
|
248
252
|
/** Response for GET /api/chats/by-interaction/:interactionId */
|
|
249
|
-
export type ChatByInteractionResponse = z.infer<
|
|
253
|
+
export type ChatByInteractionResponse = z.infer<
|
|
254
|
+
typeof ChatByInteractionResponseSchema
|
|
255
|
+
>;
|
|
250
256
|
|
|
251
257
|
/** Response for GET /api/chats */
|
|
252
|
-
export type ChatListResponse = z.infer<typeof ChatListResponseSchema
|
|
258
|
+
export type ChatListResponse = z.infer<typeof ChatListResponseSchema>;
|
|
253
259
|
|
|
254
260
|
/** Response for POST /api/chats */
|
|
255
|
-
export type CreateChatResponse = z.infer<typeof CreateChatResponseSchema
|
|
261
|
+
export type CreateChatResponse = z.infer<typeof CreateChatResponseSchema>;
|
|
256
262
|
|
|
257
263
|
/** Response for POST /api/chats/:chatId/shares */
|
|
258
|
-
export type CreateShareResponse = z.infer<typeof CreateShareResponseSchema
|
|
264
|
+
export type CreateShareResponse = z.infer<typeof CreateShareResponseSchema>;
|
|
259
265
|
|
|
260
266
|
/** Response for GET /api/chats/:chatId/shares */
|
|
261
|
-
export type ListSharesResponse = z.infer<typeof ListSharesResponseSchema
|
|
267
|
+
export type ListSharesResponse = z.infer<typeof ListSharesResponseSchema>;
|
|
262
268
|
|
|
263
269
|
/** Response for PATCH /api/shares/:shareId */
|
|
264
|
-
export type UpdateShareResponse = z.infer<typeof UpdateShareResponseSchema
|
|
270
|
+
export type UpdateShareResponse = z.infer<typeof UpdateShareResponseSchema>;
|
|
265
271
|
|
|
266
272
|
/** Individual message in a chat response (GET /api/chats/:id). */
|
|
267
|
-
export type ChatMessage = z.infer<typeof ChatMessageSchema
|
|
273
|
+
export type ChatMessage = z.infer<typeof ChatMessageSchema>;
|
|
268
274
|
|
|
269
275
|
/** Chat detail object in GET /api/chats/:id — includes interactionId for append-on-edit flows. */
|
|
270
|
-
export type ChatDetail = z.infer<typeof ChatDetailSchema
|
|
276
|
+
export type ChatDetail = z.infer<typeof ChatDetailSchema>;
|
|
271
277
|
|
|
272
278
|
/** Response for GET /api/chats/:id */
|
|
273
|
-
export type GetChatResponse = z.infer<typeof GetChatResponseSchema
|
|
279
|
+
export type GetChatResponse = z.infer<typeof GetChatResponseSchema>;
|
|
@@ -16,6 +16,7 @@ Defines the shared type vocabulary for CI execution envelopes. An envelope is an
|
|
|
16
16
|
## Public API
|
|
17
17
|
|
|
18
18
|
**Types:**
|
|
19
|
+
|
|
19
20
|
- `CIExecutionEnvelope` — Core envelope record (version, id, actor, session, intent, scope, authority, guardPlan, status, outcome)
|
|
20
21
|
- `CIEnvelopeStatus` — Lifecycle states: `proposed` → `validated` → `executing` → `finalized` (or `blocked`)
|
|
21
22
|
- `ExecutionIntent` — Semantic categories: `feature_extension`, `bug_fix`, `refactor_structural`, `guard_update`, `policy_update`, `schema_change`, `doc_update`, `cleanup`, `experimental`
|
|
@@ -27,6 +28,7 @@ Defines the shared type vocabulary for CI execution envelopes. An envelope is an
|
|
|
27
28
|
- `CIGuardViolation`, `CIExecutionOutcome` — Post-execution audit data
|
|
28
29
|
|
|
29
30
|
**Constants:**
|
|
31
|
+
|
|
30
32
|
- `ENVELOPE_TRANSITIONS` — Valid status transition graph (documentation only)
|
|
31
33
|
|
|
32
34
|
## Dependencies
|