@xpert-ai/contracts 3.36.0 → 3.37.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/index.cjs.js +818 -450
- package/index.esm.js +806 -451
- package/package.json +2 -2
- package/src/ai/agent-runtime.model.d.ts +2 -2
- package/src/ai/assistant-template-manifest.model.d.ts +328 -328
- package/src/ai/assistant-template-setup.model.d.ts +8 -8
- package/src/ai/chat-activity.model.d.ts +5 -0
- package/src/ai/chat.model.d.ts +2 -0
- package/src/ai/conversation-trail.model.d.ts +66 -66
- package/src/ai/execution-activity.model.d.ts +10 -10
- package/src/ai/execution-control-evidence.schema.d.ts +30 -30
- package/src/ai/execution-observability.model.d.ts +96 -96
- package/src/ai/mcp-execution-control.schema.d.ts +2 -2
- package/src/ai/model-replacement.model.d.ts +6 -6
- package/src/ai/project-pipeline/analytics.d.ts +154 -154
- package/src/ai/project-pipeline/budget.schema.d.ts +4 -4
- package/src/ai/project-pipeline/commands.schema.d.ts +68 -68
- package/src/ai/project-pipeline/configuration-declaration.schema.d.ts +3815 -0
- package/src/ai/project-pipeline/configuration-form.d.ts +215 -215
- package/src/ai/project-pipeline/configuration.schema.d.ts +50 -50
- package/src/ai/project-pipeline/contribution.schema.d.ts +173 -70
- package/src/ai/project-pipeline/definition.schema.d.ts +50 -50
- package/src/ai/project-pipeline/execution-statistics.d.ts +18 -18
- package/src/ai/project-pipeline/graph.model.d.ts +2 -2
- package/src/ai/project-pipeline/index.d.ts +1 -0
- package/src/ai/project-pipeline/model-usage-statistics.d.ts +2 -2
- package/src/ai/project-pipeline/node.schema.d.ts +2 -2
- package/src/ai/project-pipeline/operation.schema.d.ts +344 -344
- package/src/ai/project-pipeline/portfolio.schema.d.ts +348 -348
- package/src/ai/project-pipeline/primitives.schema.d.ts +4 -4
- package/src/ai/project-pipeline/projection.schema.d.ts +260 -260
- package/src/ai/project-pipeline/provider-actions.schema.d.ts +28 -28
- package/src/ai/project-pipeline/queue-statistics.d.ts +24 -24
- package/src/ai/project-pipeline/runtime.schema.d.ts +50 -50
- package/src/ai/project-pipeline/statistics.d.ts +74 -74
- package/src/ai/project-task-runtime.model.d.ts +23 -23
- package/src/ai/sandbox-execution-control.schema.d.ts +6 -6
- package/src/ai/template-installation.model.d.ts +16 -16
- package/src/ai/template-lifecycle.model.d.ts +2 -2
- package/src/ai/thread-control-view.schema.d.ts +4 -4
- package/src/ai/xpert-agent-execution.model.d.ts +29 -0
- package/src/ai/xpert-tool.model.d.ts +12 -0
- package/src/{agent-event.model.d.ts → always-on/agent-event.model.d.ts} +37 -4
- package/src/{agent-event.schema.d.ts → always-on/agent-event.schema.d.ts} +19 -0
- package/src/always-on/agent-output-reference.schema.d.ts +27 -0
- package/src/always-on/agent-output.model.d.ts +411 -0
- package/src/always-on/human-decision.model.d.ts +204 -0
- package/src/always-on/index.d.ts +3 -0
- package/src/always-on/output-workbench.schema.d.ts +154 -0
- package/src/analytics/analytics-diagnostic.d.ts +4 -4
- package/src/app-platform.d.ts +18 -18
- package/src/artifacts/artifact.model.d.ts +2 -0
- package/src/content/content-resource.model.d.ts +2 -1
- package/src/icon-definition.schema.d.ts +6 -10
- package/src/index.d.ts +1 -1
- package/src/secret-token.model.d.ts +4 -4
- package/src/user-notification.schema.d.ts +1290 -479
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v3';
|
|
2
|
+
/** Validates the source-defined object identity carried in a subject or a handling result. */
|
|
2
3
|
export declare const agentEventRefSchema: z.ZodObject<{
|
|
3
4
|
kind: z.ZodEffects<z.ZodString, string, string>;
|
|
4
5
|
key: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -9,6 +10,7 @@ export declare const agentEventRefSchema: z.ZodObject<{
|
|
|
9
10
|
kind: string;
|
|
10
11
|
key: string;
|
|
11
12
|
}>;
|
|
13
|
+
/** Validates the event envelope at inbox admission. The source retains the referenced business data. */
|
|
12
14
|
export declare const pluginAgentEventSchema: z.ZodObject<{
|
|
13
15
|
sourceEventId: z.ZodEffects<z.ZodString, string, string>;
|
|
14
16
|
bindingRevision: z.ZodNumber;
|
|
@@ -69,8 +71,18 @@ export declare const pluginAgentEventSchema: z.ZodObject<{
|
|
|
69
71
|
sha256: string;
|
|
70
72
|
};
|
|
71
73
|
}>;
|
|
74
|
+
/**
|
|
75
|
+
* An object in the source domain. The subject's kind and key determine which events are
|
|
76
|
+
* ordered together. A result reference uses the same shape to identify an outcome.
|
|
77
|
+
*/
|
|
72
78
|
export type AgentEventRef = z.infer<typeof agentEventRefSchema>;
|
|
79
|
+
/**
|
|
80
|
+
* One occurrence reported under a source binding. Retrying it reuses the entire envelope.
|
|
81
|
+
* bindingRevision identifies the source configuration, schemaVersion identifies the event format,
|
|
82
|
+
* and fact identifies the immutable business snapshot by key, revision and content digest.
|
|
83
|
+
*/
|
|
73
84
|
export type PluginAgentEvent = z.infer<typeof pluginAgentEventSchema>;
|
|
85
|
+
/** Accepts a completed source handler outcome for storage on the inbox receipt. */
|
|
74
86
|
export declare const agentEventDecisionSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
75
87
|
status: z.ZodLiteral<"handled">;
|
|
76
88
|
operationKey: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -117,4 +129,11 @@ export declare const agentEventDecisionSchema: z.ZodDiscriminatedUnion<"status",
|
|
|
117
129
|
status: "blocked";
|
|
118
130
|
reasonCode: string;
|
|
119
131
|
}>]>;
|
|
132
|
+
/**
|
|
133
|
+
* The source handler's disposition of one receipt.
|
|
134
|
+
*
|
|
135
|
+
* - `handled` — Identifies the business operation and its result. Several receipts can resolve to the same operation.
|
|
136
|
+
* - `ignored` — No action applies to this event. The handler supplies a stable reason code.
|
|
137
|
+
* - `blocked` — The handler could not proceed. The reason code identifies what prevented it.
|
|
138
|
+
*/
|
|
120
139
|
export type EventDecision = z.infer<typeof agentEventDecisionSchema>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
/**
|
|
3
|
+
* Validates the immutable reference a source hands to the outbox. The key and revision use
|
|
4
|
+
* the source's vocabulary, such as a review run ID and its Git commit SHA.
|
|
5
|
+
*/
|
|
6
|
+
export declare const agentOutputReferenceSchema: z.ZodObject<{
|
|
7
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
8
|
+
kind: z.ZodString;
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
revision: z.ZodString;
|
|
11
|
+
publishedAt: z.ZodString;
|
|
12
|
+
recipientId: z.ZodString;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
kind: string;
|
|
15
|
+
key: string;
|
|
16
|
+
schemaVersion: 1;
|
|
17
|
+
revision: string;
|
|
18
|
+
publishedAt: string;
|
|
19
|
+
recipientId: string;
|
|
20
|
+
}, {
|
|
21
|
+
kind: string;
|
|
22
|
+
key: string;
|
|
23
|
+
schemaVersion: 1;
|
|
24
|
+
revision: string;
|
|
25
|
+
publishedAt: string;
|
|
26
|
+
recipientId: string;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { type OutputWorkbench, type OutputWorkbenchTarget } from './output-workbench.schema';
|
|
2
|
+
export type { OutputWorkbench, OutputWorkbenchTarget } from './output-workbench.schema';
|
|
3
|
+
import { agentOutputReferenceSchema } from './agent-output-reference.schema';
|
|
4
|
+
import { type HumanDecision } from './human-decision.model';
|
|
5
|
+
import { z } from 'zod/v3';
|
|
6
|
+
import { type OpenConversationAction } from '../user-notification.schema';
|
|
7
|
+
/** HTTP Accept profile for notification clients that can display agent outputs in list and sync responses. */
|
|
8
|
+
export declare const AGENT_OUTPUT_ACCEPT = "application/json; profile=\"xpert-agent-output-v1\"";
|
|
9
|
+
/**
|
|
10
|
+
* A labeled value the source has cleared for this recipient. Notification details and private
|
|
11
|
+
* decision cards share these display fields, for example a supplier's proposed delivery date.
|
|
12
|
+
*/
|
|
13
|
+
export type AgentOutputField = {
|
|
14
|
+
label: {
|
|
15
|
+
en_US: string;
|
|
16
|
+
zh_Hans: string;
|
|
17
|
+
};
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* One readable result in an in-app notification, which may group several results. The id
|
|
22
|
+
* identifies the delivery member. The host adds a conversation action when navigation is authorized.
|
|
23
|
+
*/
|
|
24
|
+
export interface AgentOutputItem {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
action: OpenConversationAction | null;
|
|
28
|
+
fields?: AgentOutputField[];
|
|
29
|
+
workbench?: OutputWorkbenchTarget;
|
|
30
|
+
}
|
|
31
|
+
/** Validates the local delivery window against its time zone, including windows that span midnight. */
|
|
32
|
+
export declare const outputQuietHoursSchema: z.ZodEffects<z.ZodObject<{
|
|
33
|
+
zone: z.ZodEffects<z.ZodString, string, string>;
|
|
34
|
+
start: z.ZodString;
|
|
35
|
+
end: z.ZodString;
|
|
36
|
+
}, "strict", z.ZodTypeAny, {
|
|
37
|
+
start: string;
|
|
38
|
+
zone: string;
|
|
39
|
+
end: string;
|
|
40
|
+
}, {
|
|
41
|
+
start: string;
|
|
42
|
+
zone: string;
|
|
43
|
+
end: string;
|
|
44
|
+
}>, {
|
|
45
|
+
start: string;
|
|
46
|
+
zone: string;
|
|
47
|
+
end: string;
|
|
48
|
+
}, {
|
|
49
|
+
start: string;
|
|
50
|
+
zone: string;
|
|
51
|
+
end: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* A recipient's daily quiet period in local time. Outputs arriving during the period can
|
|
55
|
+
* be grouped for delivery when it ends. An end before the start falls on the following day.
|
|
56
|
+
*/
|
|
57
|
+
export type OutputQuietHours = {
|
|
58
|
+
zone: string;
|
|
59
|
+
start: string;
|
|
60
|
+
end: string;
|
|
61
|
+
};
|
|
62
|
+
/** Validates per-channel settings. Enabling private Lark delivery requires a selected integration. */
|
|
63
|
+
export declare const outputPreferenceSchema: z.ZodEffects<z.ZodObject<{
|
|
64
|
+
kind: z.ZodString;
|
|
65
|
+
channel: z.ZodEnum<["in_app", "lark"]>;
|
|
66
|
+
enabled: z.ZodBoolean;
|
|
67
|
+
integrationId: z.ZodNullable<z.ZodString>;
|
|
68
|
+
quiet: z.ZodNullable<z.ZodEffects<z.ZodObject<{
|
|
69
|
+
zone: z.ZodEffects<z.ZodString, string, string>;
|
|
70
|
+
start: z.ZodString;
|
|
71
|
+
end: z.ZodString;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
start: string;
|
|
74
|
+
zone: string;
|
|
75
|
+
end: string;
|
|
76
|
+
}, {
|
|
77
|
+
start: string;
|
|
78
|
+
zone: string;
|
|
79
|
+
end: string;
|
|
80
|
+
}>, {
|
|
81
|
+
start: string;
|
|
82
|
+
zone: string;
|
|
83
|
+
end: string;
|
|
84
|
+
}, {
|
|
85
|
+
start: string;
|
|
86
|
+
zone: string;
|
|
87
|
+
end: string;
|
|
88
|
+
}>>;
|
|
89
|
+
}, "strict", z.ZodTypeAny, {
|
|
90
|
+
kind: string;
|
|
91
|
+
channel: "in_app" | "lark";
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
integrationId: string | null;
|
|
94
|
+
quiet: {
|
|
95
|
+
start: string;
|
|
96
|
+
zone: string;
|
|
97
|
+
end: string;
|
|
98
|
+
} | null;
|
|
99
|
+
}, {
|
|
100
|
+
kind: string;
|
|
101
|
+
channel: "in_app" | "lark";
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
integrationId: string | null;
|
|
104
|
+
quiet: {
|
|
105
|
+
start: string;
|
|
106
|
+
zone: string;
|
|
107
|
+
end: string;
|
|
108
|
+
} | null;
|
|
109
|
+
}>, {
|
|
110
|
+
kind: string;
|
|
111
|
+
channel: "in_app" | "lark";
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
integrationId: string | null;
|
|
114
|
+
quiet: {
|
|
115
|
+
start: string;
|
|
116
|
+
zone: string;
|
|
117
|
+
end: string;
|
|
118
|
+
} | null;
|
|
119
|
+
}, {
|
|
120
|
+
kind: string;
|
|
121
|
+
channel: "in_app" | "lark";
|
|
122
|
+
enabled: boolean;
|
|
123
|
+
integrationId: string | null;
|
|
124
|
+
quiet: {
|
|
125
|
+
start: string;
|
|
126
|
+
zone: string;
|
|
127
|
+
end: string;
|
|
128
|
+
} | null;
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* A recipient's delivery policy for one output kind and channel in the current organization.
|
|
132
|
+
* The recipient chooses the channel and quiet period. The source still authorizes each result.
|
|
133
|
+
*/
|
|
134
|
+
export type OutputPreference = {
|
|
135
|
+
kind: string;
|
|
136
|
+
channel: 'in_app' | 'lark';
|
|
137
|
+
enabled: boolean;
|
|
138
|
+
integrationId: string | null;
|
|
139
|
+
quiet: OutputQuietHours | null;
|
|
140
|
+
};
|
|
141
|
+
export { agentOutputReferenceSchema };
|
|
142
|
+
/**
|
|
143
|
+
* Identifies a committed result for one recipient, for example a published delivery reminder.
|
|
144
|
+
* The source reuses this reference across handoff retries with the same business revision and
|
|
145
|
+
* publication time. The host assigns a message ID when it accepts the result.
|
|
146
|
+
*/
|
|
147
|
+
export type AgentOutputReference = Required<z.output<typeof agentOutputReferenceSchema>>;
|
|
148
|
+
/** Validates the source's current visibility outcome and the content it permits the recipient to see. */
|
|
149
|
+
export declare const agentOutputPresentationSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
150
|
+
status: z.ZodLiteral<"visible">;
|
|
151
|
+
title: z.ZodString;
|
|
152
|
+
decision: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
type: z.ZodLiteral<"human_decision">;
|
|
154
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
155
|
+
requestVersion: z.ZodNumber;
|
|
156
|
+
choices: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
157
|
+
key: z.ZodString;
|
|
158
|
+
label: z.ZodObject<{
|
|
159
|
+
en_US: z.ZodString;
|
|
160
|
+
zh_Hans: z.ZodString;
|
|
161
|
+
}, "strict", z.ZodTypeAny, {
|
|
162
|
+
en_US: string;
|
|
163
|
+
zh_Hans: string;
|
|
164
|
+
}, {
|
|
165
|
+
en_US: string;
|
|
166
|
+
zh_Hans: string;
|
|
167
|
+
}>;
|
|
168
|
+
replyCommand: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, "strict", z.ZodTypeAny, {
|
|
170
|
+
key: string;
|
|
171
|
+
label: {
|
|
172
|
+
en_US: string;
|
|
173
|
+
zh_Hans: string;
|
|
174
|
+
};
|
|
175
|
+
replyCommand?: string | undefined;
|
|
176
|
+
}, {
|
|
177
|
+
key: string;
|
|
178
|
+
label: {
|
|
179
|
+
en_US: string;
|
|
180
|
+
zh_Hans: string;
|
|
181
|
+
};
|
|
182
|
+
replyCommand?: string | undefined;
|
|
183
|
+
}>, "many">, {
|
|
184
|
+
key: string;
|
|
185
|
+
label: {
|
|
186
|
+
en_US: string;
|
|
187
|
+
zh_Hans: string;
|
|
188
|
+
};
|
|
189
|
+
replyCommand?: string | undefined;
|
|
190
|
+
}[], {
|
|
191
|
+
key: string;
|
|
192
|
+
label: {
|
|
193
|
+
en_US: string;
|
|
194
|
+
zh_Hans: string;
|
|
195
|
+
};
|
|
196
|
+
replyCommand?: string | undefined;
|
|
197
|
+
}[]>;
|
|
198
|
+
}, "strict", z.ZodTypeAny, {
|
|
199
|
+
type: "human_decision";
|
|
200
|
+
schemaVersion: 1;
|
|
201
|
+
requestVersion: number;
|
|
202
|
+
choices: {
|
|
203
|
+
key: string;
|
|
204
|
+
label: {
|
|
205
|
+
en_US: string;
|
|
206
|
+
zh_Hans: string;
|
|
207
|
+
};
|
|
208
|
+
replyCommand?: string | undefined;
|
|
209
|
+
}[];
|
|
210
|
+
}, {
|
|
211
|
+
type: "human_decision";
|
|
212
|
+
schemaVersion: 1;
|
|
213
|
+
requestVersion: number;
|
|
214
|
+
choices: {
|
|
215
|
+
key: string;
|
|
216
|
+
label: {
|
|
217
|
+
en_US: string;
|
|
218
|
+
zh_Hans: string;
|
|
219
|
+
};
|
|
220
|
+
replyCommand?: string | undefined;
|
|
221
|
+
}[];
|
|
222
|
+
}>>;
|
|
223
|
+
workbench: z.ZodOptional<z.ZodObject<{
|
|
224
|
+
state: z.ZodEnum<["pending", "handled"]>;
|
|
225
|
+
title: z.ZodObject<{
|
|
226
|
+
en_US: z.ZodString;
|
|
227
|
+
zh_Hans: z.ZodString;
|
|
228
|
+
}, "strict", z.ZodTypeAny, {
|
|
229
|
+
en_US: string;
|
|
230
|
+
zh_Hans: string;
|
|
231
|
+
}, {
|
|
232
|
+
en_US: string;
|
|
233
|
+
zh_Hans: string;
|
|
234
|
+
}>;
|
|
235
|
+
openLabel: z.ZodObject<{
|
|
236
|
+
en_US: z.ZodString;
|
|
237
|
+
zh_Hans: z.ZodString;
|
|
238
|
+
}, "strict", z.ZodTypeAny, {
|
|
239
|
+
en_US: string;
|
|
240
|
+
zh_Hans: string;
|
|
241
|
+
}, {
|
|
242
|
+
en_US: string;
|
|
243
|
+
zh_Hans: string;
|
|
244
|
+
}>;
|
|
245
|
+
viewKey: z.ZodString;
|
|
246
|
+
selectionId: z.ZodString;
|
|
247
|
+
}, "strict", z.ZodTypeAny, {
|
|
248
|
+
state: "handled" | "pending";
|
|
249
|
+
title: {
|
|
250
|
+
en_US: string;
|
|
251
|
+
zh_Hans: string;
|
|
252
|
+
};
|
|
253
|
+
openLabel: {
|
|
254
|
+
en_US: string;
|
|
255
|
+
zh_Hans: string;
|
|
256
|
+
};
|
|
257
|
+
viewKey: string;
|
|
258
|
+
selectionId: string;
|
|
259
|
+
}, {
|
|
260
|
+
state: "handled" | "pending";
|
|
261
|
+
title: {
|
|
262
|
+
en_US: string;
|
|
263
|
+
zh_Hans: string;
|
|
264
|
+
};
|
|
265
|
+
openLabel: {
|
|
266
|
+
en_US: string;
|
|
267
|
+
zh_Hans: string;
|
|
268
|
+
};
|
|
269
|
+
viewKey: string;
|
|
270
|
+
selectionId: string;
|
|
271
|
+
}>>;
|
|
272
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
273
|
+
label: z.ZodObject<{
|
|
274
|
+
en_US: z.ZodString;
|
|
275
|
+
zh_Hans: z.ZodString;
|
|
276
|
+
}, "strict", z.ZodTypeAny, {
|
|
277
|
+
en_US: string;
|
|
278
|
+
zh_Hans: string;
|
|
279
|
+
}, {
|
|
280
|
+
en_US: string;
|
|
281
|
+
zh_Hans: string;
|
|
282
|
+
}>;
|
|
283
|
+
value: z.ZodString;
|
|
284
|
+
}, "strict", z.ZodTypeAny, {
|
|
285
|
+
value: string;
|
|
286
|
+
label: {
|
|
287
|
+
en_US: string;
|
|
288
|
+
zh_Hans: string;
|
|
289
|
+
};
|
|
290
|
+
}, {
|
|
291
|
+
value: string;
|
|
292
|
+
label: {
|
|
293
|
+
en_US: string;
|
|
294
|
+
zh_Hans: string;
|
|
295
|
+
};
|
|
296
|
+
}>, "many">>;
|
|
297
|
+
conversation: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
298
|
+
conversationId: z.ZodString;
|
|
299
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
300
|
+
}, "strict", z.ZodTypeAny, {
|
|
301
|
+
conversationId: string;
|
|
302
|
+
threadId?: string | undefined;
|
|
303
|
+
}, {
|
|
304
|
+
conversationId: string;
|
|
305
|
+
threadId?: string | undefined;
|
|
306
|
+
}>>>;
|
|
307
|
+
}, "strict", z.ZodTypeAny, {
|
|
308
|
+
status: "visible";
|
|
309
|
+
title: string;
|
|
310
|
+
fields?: {
|
|
311
|
+
value: string;
|
|
312
|
+
label: {
|
|
313
|
+
en_US: string;
|
|
314
|
+
zh_Hans: string;
|
|
315
|
+
};
|
|
316
|
+
}[] | undefined;
|
|
317
|
+
workbench?: {
|
|
318
|
+
state: "handled" | "pending";
|
|
319
|
+
title: {
|
|
320
|
+
en_US: string;
|
|
321
|
+
zh_Hans: string;
|
|
322
|
+
};
|
|
323
|
+
openLabel: {
|
|
324
|
+
en_US: string;
|
|
325
|
+
zh_Hans: string;
|
|
326
|
+
};
|
|
327
|
+
viewKey: string;
|
|
328
|
+
selectionId: string;
|
|
329
|
+
} | undefined;
|
|
330
|
+
decision?: {
|
|
331
|
+
type: "human_decision";
|
|
332
|
+
schemaVersion: 1;
|
|
333
|
+
requestVersion: number;
|
|
334
|
+
choices: {
|
|
335
|
+
key: string;
|
|
336
|
+
label: {
|
|
337
|
+
en_US: string;
|
|
338
|
+
zh_Hans: string;
|
|
339
|
+
};
|
|
340
|
+
replyCommand?: string | undefined;
|
|
341
|
+
}[];
|
|
342
|
+
} | undefined;
|
|
343
|
+
conversation?: {
|
|
344
|
+
conversationId: string;
|
|
345
|
+
threadId?: string | undefined;
|
|
346
|
+
} | undefined;
|
|
347
|
+
}, {
|
|
348
|
+
status: "visible";
|
|
349
|
+
title: string;
|
|
350
|
+
fields?: {
|
|
351
|
+
value: string;
|
|
352
|
+
label: {
|
|
353
|
+
en_US: string;
|
|
354
|
+
zh_Hans: string;
|
|
355
|
+
};
|
|
356
|
+
}[] | undefined;
|
|
357
|
+
workbench?: {
|
|
358
|
+
state: "handled" | "pending";
|
|
359
|
+
title: {
|
|
360
|
+
en_US: string;
|
|
361
|
+
zh_Hans: string;
|
|
362
|
+
};
|
|
363
|
+
openLabel: {
|
|
364
|
+
en_US: string;
|
|
365
|
+
zh_Hans: string;
|
|
366
|
+
};
|
|
367
|
+
viewKey: string;
|
|
368
|
+
selectionId: string;
|
|
369
|
+
} | undefined;
|
|
370
|
+
decision?: {
|
|
371
|
+
type: "human_decision";
|
|
372
|
+
schemaVersion: 1;
|
|
373
|
+
requestVersion: number;
|
|
374
|
+
choices: {
|
|
375
|
+
key: string;
|
|
376
|
+
label: {
|
|
377
|
+
en_US: string;
|
|
378
|
+
zh_Hans: string;
|
|
379
|
+
};
|
|
380
|
+
replyCommand?: string | undefined;
|
|
381
|
+
}[];
|
|
382
|
+
} | undefined;
|
|
383
|
+
conversation?: unknown;
|
|
384
|
+
}>, z.ZodObject<{
|
|
385
|
+
status: z.ZodEnum<["superseded", "forbidden", "unavailable"]>;
|
|
386
|
+
}, "strict", z.ZodTypeAny, {
|
|
387
|
+
status: "superseded" | "forbidden" | "unavailable";
|
|
388
|
+
}, {
|
|
389
|
+
status: "superseded" | "forbidden" | "unavailable";
|
|
390
|
+
}>]>;
|
|
391
|
+
/**
|
|
392
|
+
* The source resolves the result for its recipient at dispatch and again on read.
|
|
393
|
+
*
|
|
394
|
+
* - `visible` — The source provides content for the recipient and may offer a human decision.
|
|
395
|
+
* - `superseded` — The result is no longer current and is omitted.
|
|
396
|
+
* - `forbidden` — The recipient lacks access to the result and it is omitted.
|
|
397
|
+
* - `unavailable` — The source cannot resolve the result yet. Dispatch may retry, and the current read omits it.
|
|
398
|
+
*/
|
|
399
|
+
export type AgentOutputPresentation = {
|
|
400
|
+
status: 'visible';
|
|
401
|
+
title: string;
|
|
402
|
+
workbench?: OutputWorkbench;
|
|
403
|
+
decision?: HumanDecision;
|
|
404
|
+
fields?: AgentOutputField[];
|
|
405
|
+
conversation?: {
|
|
406
|
+
conversationId: string;
|
|
407
|
+
threadId?: string;
|
|
408
|
+
};
|
|
409
|
+
} | {
|
|
410
|
+
status: 'superseded' | 'forbidden' | 'unavailable';
|
|
411
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { AgentOutputField } from './agent-output.model';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
|
+
/** Validates the choices a source offers. Choice keys and direct-reply commands must each be unambiguous. */
|
|
4
|
+
export declare const humanDecisionSchema: z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"human_decision">;
|
|
6
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
+
requestVersion: z.ZodNumber;
|
|
8
|
+
choices: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
label: z.ZodObject<{
|
|
11
|
+
en_US: z.ZodString;
|
|
12
|
+
zh_Hans: z.ZodString;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
en_US: string;
|
|
15
|
+
zh_Hans: string;
|
|
16
|
+
}, {
|
|
17
|
+
en_US: string;
|
|
18
|
+
zh_Hans: string;
|
|
19
|
+
}>;
|
|
20
|
+
replyCommand: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strict", z.ZodTypeAny, {
|
|
22
|
+
key: string;
|
|
23
|
+
label: {
|
|
24
|
+
en_US: string;
|
|
25
|
+
zh_Hans: string;
|
|
26
|
+
};
|
|
27
|
+
replyCommand?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
key: string;
|
|
30
|
+
label: {
|
|
31
|
+
en_US: string;
|
|
32
|
+
zh_Hans: string;
|
|
33
|
+
};
|
|
34
|
+
replyCommand?: string | undefined;
|
|
35
|
+
}>, "many">, {
|
|
36
|
+
key: string;
|
|
37
|
+
label: {
|
|
38
|
+
en_US: string;
|
|
39
|
+
zh_Hans: string;
|
|
40
|
+
};
|
|
41
|
+
replyCommand?: string | undefined;
|
|
42
|
+
}[], {
|
|
43
|
+
key: string;
|
|
44
|
+
label: {
|
|
45
|
+
en_US: string;
|
|
46
|
+
zh_Hans: string;
|
|
47
|
+
};
|
|
48
|
+
replyCommand?: string | undefined;
|
|
49
|
+
}[]>;
|
|
50
|
+
}, "strict", z.ZodTypeAny, {
|
|
51
|
+
type: "human_decision";
|
|
52
|
+
schemaVersion: 1;
|
|
53
|
+
requestVersion: number;
|
|
54
|
+
choices: {
|
|
55
|
+
key: string;
|
|
56
|
+
label: {
|
|
57
|
+
en_US: string;
|
|
58
|
+
zh_Hans: string;
|
|
59
|
+
};
|
|
60
|
+
replyCommand?: string | undefined;
|
|
61
|
+
}[];
|
|
62
|
+
}, {
|
|
63
|
+
type: "human_decision";
|
|
64
|
+
schemaVersion: 1;
|
|
65
|
+
requestVersion: number;
|
|
66
|
+
choices: {
|
|
67
|
+
key: string;
|
|
68
|
+
label: {
|
|
69
|
+
en_US: string;
|
|
70
|
+
zh_Hans: string;
|
|
71
|
+
};
|
|
72
|
+
replyCommand?: string | undefined;
|
|
73
|
+
}[];
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* A request for an authorized person to choose a business outcome. The source defines the choices
|
|
77
|
+
* and their effects. Buttons submit a stable choice key. A quoted reply must match a declared
|
|
78
|
+
* replyCommand. The enclosing output reference identifies the request and business revision.
|
|
79
|
+
*/
|
|
80
|
+
export type HumanDecision = z.output<typeof humanDecisionSchema>;
|
|
81
|
+
/** Validates the submission shared by workbench actions and verified private-channel replies. */
|
|
82
|
+
export declare const humanDecisionInputSchema: z.ZodObject<{
|
|
83
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
84
|
+
requestId: z.ZodString;
|
|
85
|
+
sourceRevision: z.ZodString;
|
|
86
|
+
requestVersion: z.ZodNumber;
|
|
87
|
+
choice: z.ZodString;
|
|
88
|
+
commandId: z.ZodString;
|
|
89
|
+
}, "strict", z.ZodTypeAny, {
|
|
90
|
+
schemaVersion: 1;
|
|
91
|
+
requestVersion: number;
|
|
92
|
+
requestId: string;
|
|
93
|
+
sourceRevision: string;
|
|
94
|
+
choice: string;
|
|
95
|
+
commandId: string;
|
|
96
|
+
}, {
|
|
97
|
+
schemaVersion: 1;
|
|
98
|
+
requestVersion: number;
|
|
99
|
+
requestId: string;
|
|
100
|
+
sourceRevision: string;
|
|
101
|
+
choice: string;
|
|
102
|
+
commandId: string;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* One choice for the request and business revision the person saw. requestVersion identifies
|
|
106
|
+
* the state of the decision request. sourceRevision identifies the underlying business terms.
|
|
107
|
+
* Retries reuse commandId. The source arbitrates competing submissions under the authenticated actor.
|
|
108
|
+
*/
|
|
109
|
+
export type HumanDecisionInput = z.output<typeof humanDecisionInputSchema>;
|
|
110
|
+
/** Outcomes the workbench and channels can report after a submission is evaluated. */
|
|
111
|
+
export declare const humanDecisionStatusSchema: z.ZodEnum<["recorded", "already_recorded", "conflicting_choice", "stale", "closed", "forbidden"]>;
|
|
112
|
+
/**
|
|
113
|
+
* Outcome of submitting a choice for a decision request.
|
|
114
|
+
*
|
|
115
|
+
* - `recorded` — The source committed the choice.
|
|
116
|
+
* - `already_recorded` — The source previously committed the same choice for this request.
|
|
117
|
+
* - `conflicting_choice` — The choice conflicts with a recorded decision, or the command ID was reused with different input.
|
|
118
|
+
* - `stale` — The submitted version is out of date. Review the current request before choosing again.
|
|
119
|
+
* - `closed` — The request no longer accepts choices.
|
|
120
|
+
* - `forbidden` — The submission could not be authorized.
|
|
121
|
+
*/
|
|
122
|
+
export type HumanDecisionStatus = z.infer<typeof humanDecisionStatusSchema>;
|
|
123
|
+
/** Submission outcomes that can replace the actionable controls on the original private card. */
|
|
124
|
+
export declare const privateDecisionFeedbackStatusSchema: z.ZodEnum<["recorded", "already_recorded", "stale", "closed"]>;
|
|
125
|
+
/** A visible outcome for the original recipient. Conflicts and unauthorized attempts leave the card untouched. */
|
|
126
|
+
export type PrivateDecisionFeedbackStatus = z.infer<typeof privateDecisionFeedbackStatusSchema>;
|
|
127
|
+
/**
|
|
128
|
+
* Result returned to the caller after submitting a choice. When present, decisionId identifies the source's durable
|
|
129
|
+
* business decision. Concurrent submissions from different channels can return the same ID.
|
|
130
|
+
*/
|
|
131
|
+
export type HumanDecisionResult = {
|
|
132
|
+
status: HumanDecisionStatus;
|
|
133
|
+
decisionId?: string;
|
|
134
|
+
};
|
|
135
|
+
/** Accepts a button callback or a reply quoting a specific message, together with its sender and chat. */
|
|
136
|
+
export declare const privateDecisionReplySchema: z.ZodObject<{
|
|
137
|
+
parentId: z.ZodString;
|
|
138
|
+
chatId: z.ZodString;
|
|
139
|
+
openId: z.ZodString;
|
|
140
|
+
unionId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
input: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"button">;
|
|
143
|
+
interactionId: z.ZodString;
|
|
144
|
+
choice: z.ZodString;
|
|
145
|
+
}, "strict", z.ZodTypeAny, {
|
|
146
|
+
type: "button";
|
|
147
|
+
choice: string;
|
|
148
|
+
interactionId: string;
|
|
149
|
+
}, {
|
|
150
|
+
type: "button";
|
|
151
|
+
choice: string;
|
|
152
|
+
interactionId: string;
|
|
153
|
+
}>, z.ZodObject<{
|
|
154
|
+
type: z.ZodLiteral<"quoted_text">;
|
|
155
|
+
text: z.ZodString;
|
|
156
|
+
}, "strict", z.ZodTypeAny, {
|
|
157
|
+
type: "quoted_text";
|
|
158
|
+
text: string;
|
|
159
|
+
}, {
|
|
160
|
+
type: "quoted_text";
|
|
161
|
+
text: string;
|
|
162
|
+
}>]>;
|
|
163
|
+
}, "strict", z.ZodTypeAny, {
|
|
164
|
+
parentId: string;
|
|
165
|
+
chatId: string;
|
|
166
|
+
openId: string;
|
|
167
|
+
input: {
|
|
168
|
+
type: "button";
|
|
169
|
+
choice: string;
|
|
170
|
+
interactionId: string;
|
|
171
|
+
} | {
|
|
172
|
+
type: "quoted_text";
|
|
173
|
+
text: string;
|
|
174
|
+
};
|
|
175
|
+
unionId?: string | undefined;
|
|
176
|
+
}, {
|
|
177
|
+
parentId: string;
|
|
178
|
+
chatId: string;
|
|
179
|
+
openId: string;
|
|
180
|
+
input: {
|
|
181
|
+
type: "button";
|
|
182
|
+
choice: string;
|
|
183
|
+
interactionId: string;
|
|
184
|
+
} | {
|
|
185
|
+
type: "quoted_text";
|
|
186
|
+
text: string;
|
|
187
|
+
};
|
|
188
|
+
unionId?: string | undefined;
|
|
189
|
+
}>;
|
|
190
|
+
/**
|
|
191
|
+
* Channel evidence for a button click or a direct reply quoting the original card.
|
|
192
|
+
* The host matches `parentId` and `chatId` to the delivery and checks the sender's current identity
|
|
193
|
+
* binding before translating the button key or declared reply command into a decision input.
|
|
194
|
+
*/
|
|
195
|
+
export type PrivateDecisionReply = z.output<typeof privateDecisionReplySchema>;
|
|
196
|
+
/**
|
|
197
|
+
* A single recipient's decision as delivered to a private chat. The channel renders the
|
|
198
|
+
* authorized fields and choices, using the host's delivery attempt ID to correlate button replies.
|
|
199
|
+
*/
|
|
200
|
+
export interface PrivateDecisionCard {
|
|
201
|
+
title: string;
|
|
202
|
+
fields: AgentOutputField[];
|
|
203
|
+
decision: HumanDecision;
|
|
204
|
+
}
|