@noodleseed/one 0.177.0 → 0.179.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/dist/commands/solutions-activity.d.ts.map +1 -1
- package/dist/commands/solutions-activity.js +9 -35
- package/dist/commands/solutions-activity.js.map +1 -1
- package/dist/commands/solutions-conversations.d.ts.map +1 -1
- package/dist/commands/solutions-conversations.js +65 -6
- package/dist/commands/solutions-conversations.js.map +1 -1
- package/dist/commands/solutions-history.d.ts +9 -0
- package/dist/commands/solutions-history.d.ts.map +1 -0
- package/dist/commands/solutions-history.js +166 -0
- package/dist/commands/solutions-history.js.map +1 -0
- package/dist/commands/solutions-ops.d.ts.map +1 -1
- package/dist/commands/solutions-ops.js +3 -0
- package/dist/commands/solutions-ops.js.map +1 -1
- package/dist/commands/whatsapp-ops.d.ts.map +1 -1
- package/dist/commands/whatsapp-ops.js +0 -7
- package/dist/commands/whatsapp-ops.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +14 -0
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/public-surface.d.ts +6 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/public-surface.js +5 -2
- package/node_modules/@noodle-borg/assistant-gateway/package.json +1 -1
- package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts +18 -0
- package/node_modules/@noodle-borg/authoring/dist/assistant.js +14 -1
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-channels.js +0 -3
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solution-conversations.js +50 -5
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solution-history.js +82 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solutions.js +3 -42
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +8 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +7 -0
- package/node_modules/@noodle-borg/service/dist/application-activity.js +76 -21
- package/node_modules/@noodle-borg/service/dist/application-history-settings.js +108 -0
- package/node_modules/@noodle-borg/service/dist/assistant-composition.js +11 -2
- package/node_modules/@noodle-borg/service/dist/business-information/contracts.d.ts +3 -1
- package/node_modules/@noodle-borg/service/dist/business-information/workspace-permissions.js +1 -0
- package/node_modules/@noodle-borg/service/dist/channels/composition.js +10 -1
- package/node_modules/@noodle-borg/service/dist/channels/provider.js +13 -13
- package/node_modules/@noodle-borg/service/dist/channels/runtime.js +31 -5
- package/node_modules/@noodle-borg/service/dist/conversation-history/capture.js +63 -7
- package/node_modules/@noodle-borg/service/dist/conversation-history/contracts.js +13 -0
- package/node_modules/@noodle-borg/service/dist/conversation-history/customer.js +118 -0
- package/node_modules/@noodle-borg/service/dist/conversation-history/operator.js +147 -24
- package/node_modules/@noodle-borg/service/dist/conversation-history/preview.js +43 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-conversations.js +52 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.js +6 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-elevation.js +3 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js +2 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +6 -11
- package/node_modules/@noodle-borg/service/dist/routes/assistant-public-session.js +6 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-route-http.js +16 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant.js +5 -17
- package/node_modules/@noodle-borg/service/dist/routes/business-information-activity.js +6 -5
- package/node_modules/@noodle-borg/service/dist/routes/business-information-conversations.js +67 -13
- package/node_modules/@noodle-borg/service/dist/routes/business-information-dispatch.js +4 -2
- package/node_modules/@noodle-borg/service/dist/routes/business-information-paths.js +4 -2
- package/node_modules/@noodle-borg/service/dist/routes/business-information.js +4 -0
- package/node_modules/@noodle-borg/service/dist/routes/whatsapp.js +0 -10
- package/node_modules/@noodle-borg/service/dist/service-history-projections.js +35 -4
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +32 -0
- package/node_modules/@noodle-borg/service/dist/service.js +4 -3
- package/node_modules/@noodle-borg/service/package.json +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/application-activity.d.ts +0 -28
- package/node_modules/@noodle-borg/wire-contracts/dist/application-activity.js +0 -18
- package/node_modules/@noodle-borg/wire-contracts/dist/application-history-settings.d.ts +190 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-history-settings.js +92 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +3 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +6 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/conversation-history.d.ts +182 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/conversation-history.js +78 -2
- package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/index.js +1 -0
- package/node_modules/@noodleseed/assistant/README.md +19 -0
- package/node_modules/@noodleseed/assistant/package.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* One installation history setting (ADR 0241 decision 6): an Activity duration and a conversation
|
|
4
|
+
* duration (which may be Off) under the plan cap, plus per-channel recording switches, sharing one
|
|
5
|
+
* revision. Server output is strict; the `*ClientResponseSchema` variants tolerate additive fields.
|
|
6
|
+
*/
|
|
7
|
+
const DaysSchema = z.number().int().min(1).max(365);
|
|
8
|
+
const RevisionSchema = z.string().regex(/^[a-f0-9]{64}$/);
|
|
9
|
+
const CountSchema = z.number().int().nonnegative();
|
|
10
|
+
export const HistorySourcesSchema = z.strictObject({
|
|
11
|
+
websiteVisitors: z.boolean(),
|
|
12
|
+
signedInCustomers: z.boolean(),
|
|
13
|
+
whatsapp: z.boolean(),
|
|
14
|
+
});
|
|
15
|
+
/** A surface the application declared `history: false` on, named by its authoring constructor. */
|
|
16
|
+
export const ApplicationHistoryDisabledSurfaceSchema = z.enum([
|
|
17
|
+
'publicWebsite',
|
|
18
|
+
'authenticatedWebsite',
|
|
19
|
+
'publicMessaging',
|
|
20
|
+
]);
|
|
21
|
+
export const ApplicationHistorySettingsSchema = z.strictObject({
|
|
22
|
+
revision: RevisionSchema,
|
|
23
|
+
canEdit: z.boolean(),
|
|
24
|
+
activity: z.strictObject({
|
|
25
|
+
retentionDays: DaysSchema,
|
|
26
|
+
maximumDays: DaysSchema,
|
|
27
|
+
defaultDays: DaysSchema,
|
|
28
|
+
}),
|
|
29
|
+
/** `not_enabled`: never opted in, so nothing is recorded; `off`: an Owner/Admin turned it off. */
|
|
30
|
+
conversations: z.strictObject({
|
|
31
|
+
state: z.enum(['not_enabled', 'off', 'on']),
|
|
32
|
+
retentionDays: DaysSchema.optional(),
|
|
33
|
+
sources: HistorySourcesSchema,
|
|
34
|
+
/**
|
|
35
|
+
* Surfaces whose chats are never kept, whatever this setting says, because the application
|
|
36
|
+
* declared `history: false` in server.ts (ADR 0241 decision 11). Absent when none do.
|
|
37
|
+
*/
|
|
38
|
+
disabledByApplication: z.array(ApplicationHistoryDisabledSurfaceSchema).min(1).optional(),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
export const ApplicationHistorySettingsResponseSchema = z.strictObject({
|
|
42
|
+
ok: z.literal(true),
|
|
43
|
+
data: ApplicationHistorySettingsSchema,
|
|
44
|
+
});
|
|
45
|
+
/** Omitted fields keep their value; `dryRun` reports the effect without saving. */
|
|
46
|
+
export const ApplicationHistorySettingsSaveRequestSchema = z
|
|
47
|
+
.strictObject({
|
|
48
|
+
expectedRevision: RevisionSchema,
|
|
49
|
+
activityDays: DaysSchema.optional(),
|
|
50
|
+
conversations: z
|
|
51
|
+
.union([z.strictObject({ retentionDays: DaysSchema }), z.literal('off')])
|
|
52
|
+
.optional(),
|
|
53
|
+
sources: HistorySourcesSchema.partial().optional(),
|
|
54
|
+
dryRun: z.boolean().optional(),
|
|
55
|
+
})
|
|
56
|
+
.refine((value) => value.activityDays !== undefined ||
|
|
57
|
+
value.conversations !== undefined ||
|
|
58
|
+
value.sources !== undefined, { message: 'Change at least one history setting.' });
|
|
59
|
+
/** Existing conversation history older than the proposed conversation window. */
|
|
60
|
+
const HistoryImpactSchema = z.strictObject({ conversations: CountSchema, items: CountSchema });
|
|
61
|
+
export const ApplicationHistorySettingsSaveResponseSchema = z.strictObject({
|
|
62
|
+
ok: z.literal(true),
|
|
63
|
+
data: z.strictObject({
|
|
64
|
+
dryRun: z.boolean(),
|
|
65
|
+
/** Whether the change shortens or turns off conversation history, which needs confirmation. */
|
|
66
|
+
shortensConversations: z.boolean(),
|
|
67
|
+
impact: HistoryImpactSchema,
|
|
68
|
+
/** The saved setting, or the unchanged current one for a dry run. */
|
|
69
|
+
settings: ApplicationHistorySettingsSchema,
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
const ClientSettingsSchema = z.object({
|
|
73
|
+
...ApplicationHistorySettingsSchema.shape,
|
|
74
|
+
activity: z.object(ApplicationHistorySettingsSchema.shape.activity.shape),
|
|
75
|
+
conversations: z.object({
|
|
76
|
+
...ApplicationHistorySettingsSchema.shape.conversations.shape,
|
|
77
|
+
sources: z.object(HistorySourcesSchema.shape),
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
80
|
+
export const ApplicationHistorySettingsClientResponseSchema = z.object({
|
|
81
|
+
ok: z.literal(true),
|
|
82
|
+
data: ClientSettingsSchema,
|
|
83
|
+
});
|
|
84
|
+
export const ApplicationHistorySettingsSaveClientResponseSchema = z.object({
|
|
85
|
+
ok: z.literal(true),
|
|
86
|
+
data: z.object({
|
|
87
|
+
...ApplicationHistorySettingsSaveResponseSchema.shape.data.shape,
|
|
88
|
+
impact: z.object(HistoryImpactSchema.shape),
|
|
89
|
+
settings: ClientSettingsSchema,
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=application-history-settings.js.map
|
|
@@ -31,6 +31,9 @@ export declare const assistantSessionResponseSchema: z.ZodObject<{
|
|
|
31
31
|
tool: z.ZodString;
|
|
32
32
|
}, z.core.$strip>>;
|
|
33
33
|
continuedAfterAuthentication: z.ZodOptional<z.ZodLiteral<true>>;
|
|
34
|
+
history: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
retentionDays: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>>;
|
|
34
37
|
}, z.core.$strip>;
|
|
35
38
|
export type AssistantSessionResponse = z.infer<typeof assistantSessionResponseSchema>;
|
|
36
39
|
/** MCP-Apps-shaped, author-selected renderer summary included on one assistant turn. */
|
|
@@ -61,6 +61,12 @@ export const assistantSessionResponseSchema = z.object({
|
|
|
61
61
|
resume: z.object({ tool: z.string().min(1) }).optional(),
|
|
62
62
|
/** Additive elevation marker; the client renders one bounded continuation status. */
|
|
63
63
|
continuedAfterAuthentication: z.literal(true).optional(),
|
|
64
|
+
/**
|
|
65
|
+
* Additive retention notice (ADR 0241 decision 17): present only when this caller's conversation
|
|
66
|
+
* is recorded. Top level, never inside `configuration`, whose strict browser schema would make an
|
|
67
|
+
* older widget drop its whole appearance; older widgets ignore unknown top-level keys.
|
|
68
|
+
*/
|
|
69
|
+
history: z.object({ retentionDays: z.number().int().min(1).max(365) }).optional(),
|
|
64
70
|
});
|
|
65
71
|
const recoverableViewSchema = z
|
|
66
72
|
.object({
|
|
@@ -8,6 +8,13 @@ export declare const ConversationChannelSchema: z.ZodEnum<{
|
|
|
8
8
|
whatsapp: "whatsapp";
|
|
9
9
|
website: "website";
|
|
10
10
|
}>;
|
|
11
|
+
/** Staff review state; a failed tool outcome sets `needs_attention` automatically. */
|
|
12
|
+
export declare const ConversationReviewStatusSchema: z.ZodEnum<{
|
|
13
|
+
new: "new";
|
|
14
|
+
needs_attention: "needs_attention";
|
|
15
|
+
reviewed: "reviewed";
|
|
16
|
+
}>;
|
|
17
|
+
export type ConversationReviewStatus = z.infer<typeof ConversationReviewStatusSchema>;
|
|
11
18
|
export declare const ConversationSummarySchema: z.ZodObject<{
|
|
12
19
|
id: z.ZodString;
|
|
13
20
|
channel: z.ZodEnum<{
|
|
@@ -26,6 +33,11 @@ export declare const ConversationSummarySchema: z.ZodObject<{
|
|
|
26
33
|
startedAt: z.ZodISODateTime;
|
|
27
34
|
lastMessageAt: z.ZodISODateTime;
|
|
28
35
|
itemCount: z.ZodNumber;
|
|
36
|
+
reviewStatus: z.ZodEnum<{
|
|
37
|
+
new: "new";
|
|
38
|
+
needs_attention: "needs_attention";
|
|
39
|
+
reviewed: "reviewed";
|
|
40
|
+
}>;
|
|
29
41
|
}, z.core.$strict>;
|
|
30
42
|
export declare const ConversationItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
43
|
kind: z.ZodLiteral<"message">;
|
|
@@ -48,6 +60,64 @@ export declare const ConversationItemSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
48
60
|
at: z.ZodISODateTime;
|
|
49
61
|
}, z.core.$strict>], "kind">;
|
|
50
62
|
export declare const ConversationDetailSchema: z.ZodObject<{
|
|
63
|
+
expiresAt: z.ZodISODateTime;
|
|
64
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
65
|
+
kind: z.ZodLiteral<"message">;
|
|
66
|
+
role: z.ZodEnum<{
|
|
67
|
+
assistant: "assistant";
|
|
68
|
+
user: "user";
|
|
69
|
+
}>;
|
|
70
|
+
text: z.ZodString;
|
|
71
|
+
at: z.ZodISODateTime;
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"outcome">;
|
|
74
|
+
interactionId: z.ZodString;
|
|
75
|
+
tool: z.ZodString;
|
|
76
|
+
status: z.ZodEnum<{
|
|
77
|
+
failed: "failed";
|
|
78
|
+
succeeded: "succeeded";
|
|
79
|
+
declined: "declined";
|
|
80
|
+
cancelled: "cancelled";
|
|
81
|
+
}>;
|
|
82
|
+
at: z.ZodISODateTime;
|
|
83
|
+
}, z.core.$strict>], "kind">>;
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
channel: z.ZodEnum<{
|
|
86
|
+
whatsapp: "whatsapp";
|
|
87
|
+
website: "website";
|
|
88
|
+
}>;
|
|
89
|
+
subject: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
90
|
+
kind: z.ZodLiteral<"anonymous">;
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
92
|
+
kind: z.ZodLiteral<"customer">;
|
|
93
|
+
ref: z.ZodString;
|
|
94
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
95
|
+
kind: z.ZodLiteral<"participant">;
|
|
96
|
+
ref: z.ZodString;
|
|
97
|
+
}, z.core.$strict>], "kind">;
|
|
98
|
+
startedAt: z.ZodISODateTime;
|
|
99
|
+
lastMessageAt: z.ZodISODateTime;
|
|
100
|
+
itemCount: z.ZodNumber;
|
|
101
|
+
reviewStatus: z.ZodEnum<{
|
|
102
|
+
new: "new";
|
|
103
|
+
needs_attention: "needs_attention";
|
|
104
|
+
reviewed: "reviewed";
|
|
105
|
+
}>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
/** A private staff note: never sent to the customer, never exported, removed with its conversation. */
|
|
108
|
+
export declare const ConversationNoteSchema: z.ZodObject<{
|
|
109
|
+
author: z.ZodString;
|
|
110
|
+
text: z.ZodString;
|
|
111
|
+
at: z.ZodISODateTime;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
/** Show adds the private notes that export leaves out. */
|
|
114
|
+
export declare const ConversationShowSchema: z.ZodObject<{
|
|
115
|
+
notes: z.ZodArray<z.ZodObject<{
|
|
116
|
+
author: z.ZodString;
|
|
117
|
+
text: z.ZodString;
|
|
118
|
+
at: z.ZodISODateTime;
|
|
119
|
+
}, z.core.$strict>>;
|
|
120
|
+
expiresAt: z.ZodISODateTime;
|
|
51
121
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
52
122
|
kind: z.ZodLiteral<"message">;
|
|
53
123
|
role: z.ZodEnum<{
|
|
@@ -85,6 +155,11 @@ export declare const ConversationDetailSchema: z.ZodObject<{
|
|
|
85
155
|
startedAt: z.ZodISODateTime;
|
|
86
156
|
lastMessageAt: z.ZodISODateTime;
|
|
87
157
|
itemCount: z.ZodNumber;
|
|
158
|
+
reviewStatus: z.ZodEnum<{
|
|
159
|
+
new: "new";
|
|
160
|
+
needs_attention: "needs_attention";
|
|
161
|
+
reviewed: "reviewed";
|
|
162
|
+
}>;
|
|
88
163
|
}, z.core.$strict>;
|
|
89
164
|
export declare const ConversationListResponseSchema: z.ZodObject<{
|
|
90
165
|
ok: z.ZodLiteral<true>;
|
|
@@ -107,14 +182,29 @@ export declare const ConversationListResponseSchema: z.ZodObject<{
|
|
|
107
182
|
startedAt: z.ZodISODateTime;
|
|
108
183
|
lastMessageAt: z.ZodISODateTime;
|
|
109
184
|
itemCount: z.ZodNumber;
|
|
185
|
+
reviewStatus: z.ZodEnum<{
|
|
186
|
+
new: "new";
|
|
187
|
+
needs_attention: "needs_attention";
|
|
188
|
+
reviewed: "reviewed";
|
|
189
|
+
}>;
|
|
110
190
|
}, z.core.$strict>>;
|
|
111
191
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
192
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
193
|
+
retentionDays: z.ZodNumber;
|
|
194
|
+
}, z.core.$strict>>;
|
|
112
195
|
}, z.core.$strict>;
|
|
113
196
|
}, z.core.$strict>;
|
|
197
|
+
/** Show and review both answer with the conversation as staff now see it. */
|
|
114
198
|
export declare const ConversationShowResponseSchema: z.ZodObject<{
|
|
115
199
|
ok: z.ZodLiteral<true>;
|
|
116
200
|
data: z.ZodObject<{
|
|
117
201
|
conversation: z.ZodObject<{
|
|
202
|
+
notes: z.ZodArray<z.ZodObject<{
|
|
203
|
+
author: z.ZodString;
|
|
204
|
+
text: z.ZodString;
|
|
205
|
+
at: z.ZodISODateTime;
|
|
206
|
+
}, z.core.$strict>>;
|
|
207
|
+
expiresAt: z.ZodISODateTime;
|
|
118
208
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
119
209
|
kind: z.ZodLiteral<"message">;
|
|
120
210
|
role: z.ZodEnum<{
|
|
@@ -152,13 +242,29 @@ export declare const ConversationShowResponseSchema: z.ZodObject<{
|
|
|
152
242
|
startedAt: z.ZodISODateTime;
|
|
153
243
|
lastMessageAt: z.ZodISODateTime;
|
|
154
244
|
itemCount: z.ZodNumber;
|
|
245
|
+
reviewStatus: z.ZodEnum<{
|
|
246
|
+
new: "new";
|
|
247
|
+
needs_attention: "needs_attention";
|
|
248
|
+
reviewed: "reviewed";
|
|
249
|
+
}>;
|
|
155
250
|
}, z.core.$strict>;
|
|
156
251
|
}, z.core.$strict>;
|
|
157
252
|
}, z.core.$strict>;
|
|
253
|
+
/** Review status needs `records:status`, a note `records:note`; at least one is required. */
|
|
254
|
+
export declare const ConversationReviewRequestSchema: z.ZodObject<{
|
|
255
|
+
reviewStatus: z.ZodOptional<z.ZodEnum<{
|
|
256
|
+
new: "new";
|
|
257
|
+
needs_attention: "needs_attention";
|
|
258
|
+
reviewed: "reviewed";
|
|
259
|
+
}>>;
|
|
260
|
+
note: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
export type ConversationReviewRequest = z.infer<typeof ConversationReviewRequestSchema>;
|
|
158
263
|
export declare const ConversationExportResponseSchema: z.ZodObject<{
|
|
159
264
|
ok: z.ZodLiteral<true>;
|
|
160
265
|
data: z.ZodObject<{
|
|
161
266
|
conversations: z.ZodArray<z.ZodObject<{
|
|
267
|
+
expiresAt: z.ZodISODateTime;
|
|
162
268
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
163
269
|
kind: z.ZodLiteral<"message">;
|
|
164
270
|
role: z.ZodEnum<{
|
|
@@ -196,6 +302,11 @@ export declare const ConversationExportResponseSchema: z.ZodObject<{
|
|
|
196
302
|
startedAt: z.ZodISODateTime;
|
|
197
303
|
lastMessageAt: z.ZodISODateTime;
|
|
198
304
|
itemCount: z.ZodNumber;
|
|
305
|
+
reviewStatus: z.ZodEnum<{
|
|
306
|
+
new: "new";
|
|
307
|
+
needs_attention: "needs_attention";
|
|
308
|
+
reviewed: "reviewed";
|
|
309
|
+
}>;
|
|
199
310
|
}, z.core.$strict>>;
|
|
200
311
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
201
312
|
}, z.core.$strict>;
|
|
@@ -242,14 +353,28 @@ export declare const ConversationListClientResponseSchema: z.ZodObject<{
|
|
|
242
353
|
startedAt: z.ZodISODateTime;
|
|
243
354
|
lastMessageAt: z.ZodISODateTime;
|
|
244
355
|
itemCount: z.ZodNumber;
|
|
356
|
+
reviewStatus: z.ZodEnum<{
|
|
357
|
+
new: "new";
|
|
358
|
+
needs_attention: "needs_attention";
|
|
359
|
+
reviewed: "reviewed";
|
|
360
|
+
}>;
|
|
245
361
|
}, z.core.$strip>>;
|
|
246
362
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
363
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
364
|
+
retentionDays: z.ZodNumber;
|
|
365
|
+
}, z.core.$strip>>;
|
|
247
366
|
}, z.core.$strip>;
|
|
248
367
|
}, z.core.$strip>;
|
|
249
368
|
export declare const ConversationShowClientResponseSchema: z.ZodObject<{
|
|
250
369
|
ok: z.ZodLiteral<true>;
|
|
251
370
|
data: z.ZodObject<{
|
|
252
371
|
conversation: z.ZodObject<{
|
|
372
|
+
notes: z.ZodArray<z.ZodObject<{
|
|
373
|
+
author: z.ZodString;
|
|
374
|
+
text: z.ZodString;
|
|
375
|
+
at: z.ZodISODateTime;
|
|
376
|
+
}, z.core.$strip>>;
|
|
377
|
+
expiresAt: z.ZodISODateTime;
|
|
253
378
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
254
379
|
kind: z.ZodLiteral<"message">;
|
|
255
380
|
role: z.ZodEnum<{
|
|
@@ -287,6 +412,11 @@ export declare const ConversationShowClientResponseSchema: z.ZodObject<{
|
|
|
287
412
|
startedAt: z.ZodISODateTime;
|
|
288
413
|
lastMessageAt: z.ZodISODateTime;
|
|
289
414
|
itemCount: z.ZodNumber;
|
|
415
|
+
reviewStatus: z.ZodEnum<{
|
|
416
|
+
new: "new";
|
|
417
|
+
needs_attention: "needs_attention";
|
|
418
|
+
reviewed: "reviewed";
|
|
419
|
+
}>;
|
|
290
420
|
}, z.core.$strip>;
|
|
291
421
|
}, z.core.$strip>;
|
|
292
422
|
}, z.core.$strip>;
|
|
@@ -294,6 +424,7 @@ export declare const ConversationExportClientResponseSchema: z.ZodObject<{
|
|
|
294
424
|
ok: z.ZodLiteral<true>;
|
|
295
425
|
data: z.ZodObject<{
|
|
296
426
|
conversations: z.ZodArray<z.ZodObject<{
|
|
427
|
+
expiresAt: z.ZodISODateTime;
|
|
297
428
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
298
429
|
kind: z.ZodLiteral<"message">;
|
|
299
430
|
role: z.ZodEnum<{
|
|
@@ -331,6 +462,11 @@ export declare const ConversationExportClientResponseSchema: z.ZodObject<{
|
|
|
331
462
|
startedAt: z.ZodISODateTime;
|
|
332
463
|
lastMessageAt: z.ZodISODateTime;
|
|
333
464
|
itemCount: z.ZodNumber;
|
|
465
|
+
reviewStatus: z.ZodEnum<{
|
|
466
|
+
new: "new";
|
|
467
|
+
needs_attention: "needs_attention";
|
|
468
|
+
reviewed: "reviewed";
|
|
469
|
+
}>;
|
|
334
470
|
}, z.core.$strip>>;
|
|
335
471
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
336
472
|
}, z.core.$strip>;
|
|
@@ -344,4 +480,50 @@ export declare const ConversationForgetClientResponseSchema: z.ZodObject<{
|
|
|
344
480
|
}, z.core.$strip>;
|
|
345
481
|
}, z.core.$strip>;
|
|
346
482
|
}, z.core.$strip>;
|
|
483
|
+
export declare const ASSISTANT_CONVERSATION_PAGE_MAXIMUM = 50;
|
|
484
|
+
export declare const ASSISTANT_CONVERSATION_PREVIEW_MAXIMUM = 120;
|
|
485
|
+
export declare const AssistantConversationListRequestSchema: z.ZodObject<{
|
|
486
|
+
user: z.ZodObject<{
|
|
487
|
+
id: z.ZodString;
|
|
488
|
+
}, z.core.$strict>;
|
|
489
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
490
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
491
|
+
}, z.core.$strict>;
|
|
492
|
+
export declare const AssistantConversationForgetUserRequestSchema: z.ZodObject<{
|
|
493
|
+
user: z.ZodObject<{
|
|
494
|
+
id: z.ZodString;
|
|
495
|
+
}, z.core.$strict>;
|
|
496
|
+
}, z.core.$strict>;
|
|
497
|
+
export declare const AssistantConversationListResponseSchema: z.ZodObject<{
|
|
498
|
+
ok: z.ZodLiteral<true>;
|
|
499
|
+
data: z.ZodObject<{
|
|
500
|
+
conversations: z.ZodArray<z.ZodObject<{
|
|
501
|
+
id: z.ZodString;
|
|
502
|
+
channel: z.ZodEnum<{
|
|
503
|
+
whatsapp: "whatsapp";
|
|
504
|
+
website: "website";
|
|
505
|
+
}>;
|
|
506
|
+
startedAt: z.ZodISODateTime;
|
|
507
|
+
lastMessageAt: z.ZodISODateTime;
|
|
508
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
509
|
+
}, z.core.$strict>>;
|
|
510
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
511
|
+
}, z.core.$strict>;
|
|
512
|
+
}, z.core.$strict>;
|
|
513
|
+
export declare const AssistantConversationListClientResponseSchema: z.ZodObject<{
|
|
514
|
+
ok: z.ZodLiteral<true>;
|
|
515
|
+
data: z.ZodObject<{
|
|
516
|
+
conversations: z.ZodArray<z.ZodObject<{
|
|
517
|
+
id: z.ZodString;
|
|
518
|
+
channel: z.ZodEnum<{
|
|
519
|
+
whatsapp: "whatsapp";
|
|
520
|
+
website: "website";
|
|
521
|
+
}>;
|
|
522
|
+
startedAt: z.ZodISODateTime;
|
|
523
|
+
lastMessageAt: z.ZodISODateTime;
|
|
524
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
525
|
+
}, z.core.$strip>>;
|
|
526
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
527
|
+
}, z.core.$strip>;
|
|
528
|
+
}, z.core.$strip>;
|
|
347
529
|
//# sourceMappingURL=conversation-history.d.ts.map
|
|
@@ -5,6 +5,8 @@ import { z } from 'zod';
|
|
|
5
5
|
*/
|
|
6
6
|
export const ConversationIdSchema = z.string().regex(/^cv_[A-Za-z0-9_-]{8,64}$/);
|
|
7
7
|
export const ConversationChannelSchema = z.enum(['website', 'whatsapp']);
|
|
8
|
+
/** Staff review state; a failed tool outcome sets `needs_attention` automatically. */
|
|
9
|
+
export const ConversationReviewStatusSchema = z.enum(['new', 'needs_attention', 'reviewed']);
|
|
8
10
|
const SubjectRefSchema = z.string().min(1).max(256);
|
|
9
11
|
/** Anonymous handles never leave the service; verified subjects carry the reference forget uses. */
|
|
10
12
|
const ConversationSubjectSchema = z.discriminatedUnion('kind', [
|
|
@@ -19,6 +21,7 @@ export const ConversationSummarySchema = z.strictObject({
|
|
|
19
21
|
startedAt: z.iso.datetime(),
|
|
20
22
|
lastMessageAt: z.iso.datetime(),
|
|
21
23
|
itemCount: z.number().int().min(1),
|
|
24
|
+
reviewStatus: ConversationReviewStatusSchema,
|
|
22
25
|
});
|
|
23
26
|
export const ConversationItemSchema = z.discriminatedUnion('kind', [
|
|
24
27
|
z.strictObject({
|
|
@@ -37,19 +40,46 @@ export const ConversationItemSchema = z.discriminatedUnion('kind', [
|
|
|
37
40
|
]);
|
|
38
41
|
export const ConversationDetailSchema = z.strictObject({
|
|
39
42
|
...ConversationSummarySchema.shape,
|
|
43
|
+
/** When the last visible item is removed automatically under the live retention window. */
|
|
44
|
+
expiresAt: z.iso.datetime(),
|
|
40
45
|
items: z.array(ConversationItemSchema).max(10_000),
|
|
41
46
|
});
|
|
47
|
+
const NoteTextSchema = z.string().trim().min(1).max(2000);
|
|
48
|
+
/** A private staff note: never sent to the customer, never exported, removed with its conversation. */
|
|
49
|
+
export const ConversationNoteSchema = z.strictObject({
|
|
50
|
+
author: z.string().min(1).max(500),
|
|
51
|
+
text: NoteTextSchema,
|
|
52
|
+
at: z.iso.datetime(),
|
|
53
|
+
});
|
|
54
|
+
/** Show adds the private notes that export leaves out. */
|
|
55
|
+
export const ConversationShowSchema = z.strictObject({
|
|
56
|
+
...ConversationDetailSchema.shape,
|
|
57
|
+
notes: z.array(ConversationNoteSchema).max(100),
|
|
58
|
+
});
|
|
42
59
|
const NextCursorSchema = z.string().min(1).max(2048);
|
|
60
|
+
/** Present only for a Preview environment, whose conversations keep a short fixed window. */
|
|
61
|
+
const PreviewWindowSchema = z.strictObject({ retentionDays: z.number().int().min(0).max(365) });
|
|
43
62
|
export const ConversationListResponseSchema = z.strictObject({
|
|
44
63
|
ok: z.literal(true),
|
|
45
64
|
data: z.strictObject({
|
|
46
65
|
conversations: z.array(ConversationSummarySchema).max(100),
|
|
47
66
|
nextCursor: NextCursorSchema.optional(),
|
|
67
|
+
preview: PreviewWindowSchema.optional(),
|
|
48
68
|
}),
|
|
49
69
|
});
|
|
70
|
+
/** Show and review both answer with the conversation as staff now see it. */
|
|
50
71
|
export const ConversationShowResponseSchema = z.strictObject({
|
|
51
72
|
ok: z.literal(true),
|
|
52
|
-
data: z.strictObject({ conversation:
|
|
73
|
+
data: z.strictObject({ conversation: ConversationShowSchema }),
|
|
74
|
+
});
|
|
75
|
+
/** Review status needs `records:status`, a note `records:note`; at least one is required. */
|
|
76
|
+
export const ConversationReviewRequestSchema = z
|
|
77
|
+
.strictObject({
|
|
78
|
+
reviewStatus: ConversationReviewStatusSchema.optional(),
|
|
79
|
+
note: NoteTextSchema.optional(),
|
|
80
|
+
})
|
|
81
|
+
.refine((value) => value.reviewStatus !== undefined || value.note !== undefined, {
|
|
82
|
+
message: 'Set a review status or add a note.',
|
|
53
83
|
});
|
|
54
84
|
export const ConversationExportResponseSchema = z.strictObject({
|
|
55
85
|
ok: z.literal(true),
|
|
@@ -91,6 +121,7 @@ const ClientItemSchema = z.discriminatedUnion('kind', [
|
|
|
91
121
|
]);
|
|
92
122
|
const ClientDetailSchema = z.object({
|
|
93
123
|
...ClientSummarySchema.shape,
|
|
124
|
+
expiresAt: ConversationDetailSchema.shape.expiresAt,
|
|
94
125
|
items: z.array(ClientItemSchema).max(10_000),
|
|
95
126
|
});
|
|
96
127
|
export const ConversationListClientResponseSchema = z.object({
|
|
@@ -98,11 +129,17 @@ export const ConversationListClientResponseSchema = z.object({
|
|
|
98
129
|
data: z.object({
|
|
99
130
|
conversations: z.array(ClientSummarySchema).max(100),
|
|
100
131
|
nextCursor: NextCursorSchema.optional(),
|
|
132
|
+
preview: z.object(PreviewWindowSchema.shape).optional(),
|
|
101
133
|
}),
|
|
102
134
|
});
|
|
103
135
|
export const ConversationShowClientResponseSchema = z.object({
|
|
104
136
|
ok: z.literal(true),
|
|
105
|
-
data: z.object({
|
|
137
|
+
data: z.object({
|
|
138
|
+
conversation: z.object({
|
|
139
|
+
...ClientDetailSchema.shape,
|
|
140
|
+
notes: z.array(z.object(ConversationNoteSchema.shape)).max(100),
|
|
141
|
+
}),
|
|
142
|
+
}),
|
|
106
143
|
});
|
|
107
144
|
export const ConversationExportClientResponseSchema = z.object({
|
|
108
145
|
ok: z.literal(true),
|
|
@@ -117,4 +154,43 @@ export const ConversationForgetClientResponseSchema = z.object({
|
|
|
117
154
|
forgotten: z.object(ConversationForgetResponseSchema.shape.data.shape.forgotten.shape),
|
|
118
155
|
}),
|
|
119
156
|
});
|
|
157
|
+
/**
|
|
158
|
+
* The customer-backend projection (ADR 0241 decision 12): an embed client lists or forgets one of its
|
|
159
|
+
* own verified users, by the same `user.id` its session exchange sent. The tenant comes from the client
|
|
160
|
+
* credential, never the body; rows carry no subject and at most a short preview of the first question.
|
|
161
|
+
*/
|
|
162
|
+
const CustomerUserSchema = z.strictObject({ id: z.string().min(1).max(240) });
|
|
163
|
+
export const ASSISTANT_CONVERSATION_PAGE_MAXIMUM = 50;
|
|
164
|
+
export const ASSISTANT_CONVERSATION_PREVIEW_MAXIMUM = 120;
|
|
165
|
+
export const AssistantConversationListRequestSchema = z.strictObject({
|
|
166
|
+
user: CustomerUserSchema,
|
|
167
|
+
limit: z.number().int().min(1).max(ASSISTANT_CONVERSATION_PAGE_MAXIMUM).optional(),
|
|
168
|
+
cursor: NextCursorSchema.optional(),
|
|
169
|
+
});
|
|
170
|
+
export const AssistantConversationForgetUserRequestSchema = z.strictObject({
|
|
171
|
+
user: CustomerUserSchema,
|
|
172
|
+
});
|
|
173
|
+
const AssistantConversationRowSchema = z.strictObject({
|
|
174
|
+
id: ConversationIdSchema,
|
|
175
|
+
channel: ConversationChannelSchema,
|
|
176
|
+
startedAt: z.iso.datetime(),
|
|
177
|
+
lastMessageAt: z.iso.datetime(),
|
|
178
|
+
preview: z.string().min(1).max(ASSISTANT_CONVERSATION_PREVIEW_MAXIMUM).optional(),
|
|
179
|
+
});
|
|
180
|
+
export const AssistantConversationListResponseSchema = z.strictObject({
|
|
181
|
+
ok: z.literal(true),
|
|
182
|
+
data: z.strictObject({
|
|
183
|
+
conversations: z.array(AssistantConversationRowSchema).max(ASSISTANT_CONVERSATION_PAGE_MAXIMUM),
|
|
184
|
+
nextCursor: NextCursorSchema.optional(),
|
|
185
|
+
}),
|
|
186
|
+
});
|
|
187
|
+
export const AssistantConversationListClientResponseSchema = z.object({
|
|
188
|
+
ok: z.literal(true),
|
|
189
|
+
data: z.object({
|
|
190
|
+
conversations: z
|
|
191
|
+
.array(z.object(AssistantConversationRowSchema.shape))
|
|
192
|
+
.max(ASSISTANT_CONVERSATION_PAGE_MAXIMUM),
|
|
193
|
+
nextCursor: NextCursorSchema.optional(),
|
|
194
|
+
}),
|
|
195
|
+
});
|
|
120
196
|
//# sourceMappingURL=conversation-history.js.map
|
|
@@ -391,6 +391,7 @@ export * from './application-activity.js';
|
|
|
391
391
|
export * from './application-connections.js';
|
|
392
392
|
export * from './application-draft-validation.js';
|
|
393
393
|
export * from './application-drafts.js';
|
|
394
|
+
export * from './application-history-settings.js';
|
|
394
395
|
export * from './application-onboarding.js';
|
|
395
396
|
export * from './billing-catalog.js';
|
|
396
397
|
export * from './business-workspaces.js';
|
|
@@ -230,6 +230,7 @@ export * from './application-activity.js';
|
|
|
230
230
|
export * from './application-connections.js';
|
|
231
231
|
export * from './application-draft-validation.js';
|
|
232
232
|
export * from './application-drafts.js';
|
|
233
|
+
export * from './application-history-settings.js';
|
|
233
234
|
export * from './application-onboarding.js';
|
|
234
235
|
export * from './billing-catalog.js';
|
|
235
236
|
export * from './business-workspaces.js';
|
|
@@ -626,6 +626,25 @@ replay across sessions. React applications may observe recovery and structured f
|
|
|
626
626
|
`createAssistantSession` returns the opaque token, expiry, resolved non-secret configuration, and explicit
|
|
627
627
|
turn/interaction endpoint URLs. Forward that response unchanged to the component or headless client.
|
|
628
628
|
|
|
629
|
+
#### Your users' conversation history
|
|
630
|
+
|
|
631
|
+
When the business records conversations, the same backend credential lists or erases one signed-in user's
|
|
632
|
+
chats. Pass the exact `user.id` your session exchange sends; the client's application environment is the
|
|
633
|
+
only scope, so one customer's backend never reaches another's history.
|
|
634
|
+
|
|
635
|
+
```ts
|
|
636
|
+
import { forgetUser, listConversations } from "@noodleseed/assistant/server";
|
|
637
|
+
|
|
638
|
+
const credentials = { serviceUrl, clientId, clientSecret };
|
|
639
|
+
// A "your chats" view: newest first, each with a short preview of the first question.
|
|
640
|
+
const page = await listConversations({ ...credentials, user: { id: account.id }, limit: 20 });
|
|
641
|
+
// In your own account deletion. Idempotent, so a retry after a 5xx is safe.
|
|
642
|
+
await forgetUser({ ...credentials, user: { id: account.id } });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
`forgetUser` erases stored conversation history only; a live session's short-lived working memory is not
|
|
646
|
+
touched and expires within two hours. Failures throw `AssistantConversationsError` with a typed `detail` (`status`, `retryable`, `serviceCode`).
|
|
647
|
+
|
|
629
648
|
The MCP server's top-level `branding` block is the portable deployment source for identity and colors shared
|
|
630
649
|
by widgets and the assistant. The embedding application may use the typed `appearance` object when it needs
|
|
631
650
|
exact control over assistant-specific roles:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noodleseed/assistant",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
4
4
|
"description": "Embed the Noodle Seed customer-branded assistant in your web app with managed or framework-owned UI, a framework-neutral MCP App host, a DOM-free client, and a backend session helper. Authoring and deploying the server is @noodleseed/one.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noodleseed/one",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.179.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Noodle CLI by Noodle Seed — author, run, and deploy declarative MCP servers. Embedding the assistant in your own web app is @noodleseed/assistant.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
"@modelcontextprotocol/client": "2.0.0",
|
|
237
237
|
"@modelcontextprotocol/server": "2.0.0",
|
|
238
238
|
"@noodle-borg/admission-limits": "0.0.0",
|
|
239
|
-
"@noodle-borg/agent-kit": "0.
|
|
239
|
+
"@noodle-borg/agent-kit": "0.108.0",
|
|
240
240
|
"@noodle-borg/app-audit": "0.0.0",
|
|
241
241
|
"@noodle-borg/app-package": "0.0.0",
|
|
242
242
|
"@noodle-borg/assistant-gateway": "0.0.0",
|