@xpert-ai/contracts 3.19.0 → 3.21.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 +425 -20
- package/index.esm.js +372 -22
- package/package.json +5 -2
- package/src/agent/ai-model.d.ts +1 -0
- package/src/agent/token.d.ts +4 -0
- package/src/ai/agent-output-delivery.model.d.ts +31 -0
- package/src/ai/agent-runtime.model.d.ts +53 -0
- package/src/ai/ai-model.model.d.ts +3 -0
- package/src/ai/assistant-binding.model.d.ts +3 -0
- package/src/ai/assistant-configuration.model.d.ts +31 -0
- package/src/ai/bosi.model.d.ts +73 -0
- package/src/ai/chat-group-entity.model.d.ts +93 -0
- package/src/ai/chat-group.model.d.ts +298 -0
- package/src/ai/chat-message-envelope.model.d.ts +55 -0
- package/src/ai/chat-message.model.d.ts +10 -0
- package/src/ai/chat.model.d.ts +26 -0
- package/src/ai/conversation-entry.model.d.ts +18 -0
- package/src/ai/execution-activity.model.d.ts +547 -0
- package/src/ai/index.d.ts +11 -0
- package/src/ai/mcp-capability.model.d.ts +5 -1
- package/src/ai/membership.model.d.ts +5 -0
- package/src/ai/model-execution.model.d.ts +265 -0
- package/src/ai/model-gateway.model.d.ts +15 -3
- package/src/ai/model-usage.model.d.ts +19 -0
- package/src/ai/project-task-graph.model.d.ts +12 -0
- package/src/ai/project-task-runtime.model.d.ts +1106 -0
- package/src/ai/project-task-type.model.d.ts +13 -0
- package/src/ai/prompt-workflow.model.d.ts +4 -0
- package/src/ai/realtime-voice.model.d.ts +90 -0
- package/src/ai/realtime-voice.transport.d.ts +54 -0
- package/src/ai/resource-card.d.ts +2 -0
- package/src/ai/sandbox-terminal.model.d.ts +1 -0
- package/src/ai/thread-activity.model.d.ts +14 -0
- package/src/ai/xpert-agent-execution.model.d.ts +4 -0
- package/src/ai/xpert-project.model.d.ts +21 -0
- package/src/ai/xpert-template.model.d.ts +23 -5
- package/src/ai/xpert-tool-mcp.model.d.ts +6 -0
- package/src/ai/xpert.model.d.ts +7 -2
- package/src/api-key.model.d.ts +37 -2
- package/src/default-agent-plugins.d.ts +19 -0
- package/src/i18n.model.d.ts +1 -0
- package/src/index.d.ts +5 -0
- package/src/plugin-application.d.ts +256 -0
- package/src/plugin-management.d.ts +112 -0
- package/src/plugin.d.ts +3 -319
- package/src/runtime-control.d.ts +13 -0
- package/src/secret-token.model.d.ts +8 -1
- package/src/setup-plugins.d.ts +75 -0
- package/src/types.d.ts +4 -0
- package/src/view-extension/model.d.ts +22 -1
- package/src/view-extension/workbench.d.ts +6 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
/**
|
|
3
|
+
* Running means accepted; actual work start requires an observation.
|
|
4
|
+
* Only succeeded, failed and cancelled are terminal. Unknown must be reconciled without replay.
|
|
5
|
+
*/
|
|
6
|
+
export declare const agentInvocationStatusSchema: z.ZodEnum<["queued", "running", "waiting", "cancelling", "succeeded", "failed", "cancelled", "unknown"]>;
|
|
7
|
+
export type AgentInvocationStatus = z.output<typeof agentInvocationStatusSchema>;
|
|
8
|
+
export declare const agentInvocationTerminalStatusSchema: z.ZodEnum<["succeeded", "failed", "cancelled"]>;
|
|
9
|
+
/** Activity and reported progress are separate from business acceptance. No invented percentage. */
|
|
10
|
+
export declare const agentRuntimeProgressSchema: z.ZodObject<{
|
|
11
|
+
source: z.ZodEnum<["executor", "host"]>;
|
|
12
|
+
observedAt: z.ZodString;
|
|
13
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
14
|
+
phase: z.ZodOptional<z.ZodString>;
|
|
15
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
16
|
+
steps: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
17
|
+
completed: z.ZodNumber;
|
|
18
|
+
total: z.ZodNumber;
|
|
19
|
+
}, "strict", z.ZodTypeAny, {
|
|
20
|
+
total?: number;
|
|
21
|
+
completed?: number;
|
|
22
|
+
}, {
|
|
23
|
+
total?: number;
|
|
24
|
+
completed?: number;
|
|
25
|
+
}>, {
|
|
26
|
+
total?: number;
|
|
27
|
+
completed?: number;
|
|
28
|
+
}, {
|
|
29
|
+
total?: number;
|
|
30
|
+
completed?: number;
|
|
31
|
+
}>>;
|
|
32
|
+
}, "strict", z.ZodTypeAny, {
|
|
33
|
+
source?: "executor" | "host";
|
|
34
|
+
startedAt?: string;
|
|
35
|
+
summary?: string;
|
|
36
|
+
steps?: {
|
|
37
|
+
total?: number;
|
|
38
|
+
completed?: number;
|
|
39
|
+
};
|
|
40
|
+
observedAt?: string;
|
|
41
|
+
phase?: string;
|
|
42
|
+
}, {
|
|
43
|
+
source?: "executor" | "host";
|
|
44
|
+
startedAt?: string;
|
|
45
|
+
summary?: string;
|
|
46
|
+
steps?: {
|
|
47
|
+
total?: number;
|
|
48
|
+
completed?: number;
|
|
49
|
+
};
|
|
50
|
+
observedAt?: string;
|
|
51
|
+
phase?: string;
|
|
52
|
+
}>;
|
|
53
|
+
export type AgentRuntimeProgress = z.output<typeof agentRuntimeProgressSchema>;
|
|
@@ -72,6 +72,9 @@ export interface ProviderHelpInfo {
|
|
|
72
72
|
url: I18nObject;
|
|
73
73
|
}
|
|
74
74
|
export interface ProviderModel {
|
|
75
|
+
realtime?: import('./realtime-voice.model').RealtimeModelMetadata;
|
|
76
|
+
/** Explicit provider-native protocols; absence never implies protocol compatibility. */
|
|
77
|
+
native_protocols?: Array<'openai_responses' | 'anthropic_messages'>;
|
|
75
78
|
model: string;
|
|
76
79
|
label: I18nObject;
|
|
77
80
|
model_type: AiModelTypeEnum;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
2
|
import { IUser } from '../user.model';
|
|
3
|
+
import type { BosiOnboardingPreferences } from './bosi.model';
|
|
3
4
|
export declare enum AssistantCode {
|
|
4
5
|
CHAT_COMMON = "chat_common",
|
|
5
6
|
XPERT_SHARED = "xpert_shared",
|
|
@@ -62,6 +63,8 @@ export declare function updateAssistantBindingToolPreferences(preferences: IAssi
|
|
|
62
63
|
export declare function updateAssistantBindingSkillPreferences(preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string | null | undefined, skillId: string, enabled: boolean): IAssistantBindingToolPreferences | null;
|
|
63
64
|
export declare function ensureAssistantBindingSkillWorkspacePreference(preferences: IAssistantBindingToolPreferences | null | undefined, workspaceId: string): IAssistantBindingToolPreferences;
|
|
64
65
|
export interface IAssistantBinding extends IBasePerTenantAndOrganizationEntityModel {
|
|
66
|
+
/** Defaults for the binding owner's private workspace, not organization-wide installation or access grants. */
|
|
67
|
+
desktopOnboarding?: BosiOnboardingPreferences | null;
|
|
65
68
|
code: AssistantCode;
|
|
66
69
|
scope: AssistantBindingScope;
|
|
67
70
|
assistantId?: string | null;
|
|
@@ -24,9 +24,14 @@ export interface AssistantCapabilityState {
|
|
|
24
24
|
before?: TXpertFeatures['sandbox'];
|
|
25
25
|
after?: TXpertFeatures['sandbox'];
|
|
26
26
|
};
|
|
27
|
+
realtimeVoice?: {
|
|
28
|
+
before?: TXpertFeatures['realtimeVoice'];
|
|
29
|
+
after?: TXpertFeatures['realtimeVoice'];
|
|
30
|
+
};
|
|
27
31
|
instructions: string;
|
|
28
32
|
}
|
|
29
33
|
export interface AssistantConfiguration {
|
|
34
|
+
realtimeVoice?: import('./realtime-voice.model').RealtimeVoiceSelection;
|
|
30
35
|
revision: string;
|
|
31
36
|
workspace: {
|
|
32
37
|
id: string;
|
|
@@ -38,8 +43,34 @@ export interface AssistantConfiguration {
|
|
|
38
43
|
setup: XpertTemplateSetup;
|
|
39
44
|
}
|
|
40
45
|
export interface AssistantConfigurationInput {
|
|
46
|
+
realtimeVoice?: import('./realtime-voice.model').RealtimeVoiceSelection;
|
|
41
47
|
revision: string;
|
|
42
48
|
prompt: string;
|
|
43
49
|
modelId: string;
|
|
44
50
|
capabilities: string[];
|
|
45
51
|
}
|
|
52
|
+
/** Capability authoring in an existing Assistant draft; publication remains an explicit action. */
|
|
53
|
+
export interface AssistantCapabilityConfiguration {
|
|
54
|
+
realtimeVoice?: import('./realtime-voice.model').RealtimeVoiceSelection;
|
|
55
|
+
revision: string;
|
|
56
|
+
selected: string[];
|
|
57
|
+
options: {
|
|
58
|
+
key: string;
|
|
59
|
+
label: string;
|
|
60
|
+
description: string;
|
|
61
|
+
required: boolean;
|
|
62
|
+
available: boolean;
|
|
63
|
+
reason?: string;
|
|
64
|
+
}[];
|
|
65
|
+
setup: XpertTemplateSetup;
|
|
66
|
+
modelId: string;
|
|
67
|
+
/** Null when runtime checks prevent model validation. */
|
|
68
|
+
modelAvailable: boolean | null;
|
|
69
|
+
}
|
|
70
|
+
export interface AssistantCapabilityDraftInput {
|
|
71
|
+
realtimeVoice?: import('./realtime-voice.model').RealtimeVoiceSelection;
|
|
72
|
+
revision: string;
|
|
73
|
+
capabilities: string[];
|
|
74
|
+
/** Applied after removing managed contributions; empty selects the platform default. */
|
|
75
|
+
sandboxProvider?: string;
|
|
76
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { XpertTemplateSetup } from './xpert-template.model';
|
|
2
|
+
import type { RuntimeResourceReference } from '../agent-plugin';
|
|
3
|
+
import type { IconDefinition } from '../types';
|
|
4
|
+
/** Persisted choices for one tenant/organization/user binding; runtime access is checked independently. */
|
|
5
|
+
export type BosiOnboardingPreferences = {
|
|
6
|
+
version: 1;
|
|
7
|
+
/** Choice revision for optimistic concurrency, not the plugin catalog or package version. */
|
|
8
|
+
revision: number;
|
|
9
|
+
/** The binding owner's private workspace in the current organization. */
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
/** Pin the selected runtime binding/version; do not silently adopt later plugin upgrades. */
|
|
12
|
+
packages: Array<{
|
|
13
|
+
packageId: string;
|
|
14
|
+
resource: RuntimeResourceReference;
|
|
15
|
+
}>;
|
|
16
|
+
/** Connector binding IDs in this workspace, not provider IDs used by the selection UI. */
|
|
17
|
+
connectorIds: string[];
|
|
18
|
+
};
|
|
19
|
+
/** Display and action availability for onboarding; the server rechecks authorization on each action. */
|
|
20
|
+
export type BosiOnboardingItem = {
|
|
21
|
+
/** Plugin package ID for `plugin`, connector provider ID for `connector`. */
|
|
22
|
+
id: string;
|
|
23
|
+
kind: 'plugin' | 'connector';
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
icon?: IconDefinition;
|
|
27
|
+
status: 'available' | 'ready' | 'requires_auth' | 'expired' | 'configuration_required' | 'unavailable';
|
|
28
|
+
selected: boolean;
|
|
29
|
+
canSelect: boolean;
|
|
30
|
+
canConnect: boolean;
|
|
31
|
+
reason?: string;
|
|
32
|
+
};
|
|
33
|
+
export type BosiOnboardingCatalog = {
|
|
34
|
+
workspace: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
};
|
|
38
|
+
/** Echo in a choice request; an outdated revision requires refreshing the catalog. */
|
|
39
|
+
revision: number;
|
|
40
|
+
items: BosiOnboardingItem[];
|
|
41
|
+
};
|
|
42
|
+
export type BosiOnboardingChoice = {
|
|
43
|
+
revision: number;
|
|
44
|
+
kind: BosiOnboardingItem['kind'];
|
|
45
|
+
/** The catalog item ID, whose meaning is determined by `kind`. */
|
|
46
|
+
id: string;
|
|
47
|
+
selected: boolean;
|
|
48
|
+
};
|
|
49
|
+
/** Optional bootstrap capabilities; these keys match the existing template capability registry. */
|
|
50
|
+
export type BosiCapability = 'cloud-computer' | 'desktop-shell';
|
|
51
|
+
/** Authorized setup snapshot; access/query errors must not be represented as an empty binding. */
|
|
52
|
+
export type BosiSetup = {
|
|
53
|
+
assistantId: string | null;
|
|
54
|
+
/** Null also occurs for an existing legacy Assistant; it does not mean onboarding is required. */
|
|
55
|
+
progress: {
|
|
56
|
+
/** `ready` requires a successful welcome execution; publication alone is `welcome_pending`. */
|
|
57
|
+
phase: 'installing' | 'welcome_pending' | 'welcome_running' | 'ready' | 'welcome_failed';
|
|
58
|
+
/** Choices are fixed once installation starts and reused on recovery. */
|
|
59
|
+
capabilities: BosiCapability[];
|
|
60
|
+
/** Opaque ID from XpertTemplateSetup.models, not a provider model name. */
|
|
61
|
+
modelId: string;
|
|
62
|
+
/** Preallocated first-conversation ID; the thread may not exist until welcome starts. */
|
|
63
|
+
threadId: string;
|
|
64
|
+
} | null;
|
|
65
|
+
/** Installation choices are returned while the binding has no published Assistant. */
|
|
66
|
+
setup?: XpertTemplateSetup;
|
|
67
|
+
/** Server availability only; Desktop must additionally check its local Shell support. */
|
|
68
|
+
capabilities?: {
|
|
69
|
+
key: BosiCapability;
|
|
70
|
+
available: boolean;
|
|
71
|
+
reason?: string;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
|
+
import type { ChatGroupDeliveryStatus, ChatGroupInteraction, ChatGroupParticipant } from './chat-group.model';
|
|
3
|
+
/**
|
|
4
|
+
* Persistence contracts for group collaboration. These contain internal state and must not be
|
|
5
|
+
* returned as public DTOs; use the explicit projections in chat-group.model.ts for group APIs.
|
|
6
|
+
* All records belong to a tenant and organization. groupId references ChatConversation(purpose='group').
|
|
7
|
+
*/
|
|
8
|
+
/** Membership identity, Assistant runtime binding and per-member reading/context positions. */
|
|
9
|
+
export interface IGroupParticipant extends IBasePerTenantAndOrganizationEntityModel {
|
|
10
|
+
groupId: string;
|
|
11
|
+
kind: ChatGroupParticipant['kind'];
|
|
12
|
+
/** User Account ID for a human; Xpert ID for an Assistant. */
|
|
13
|
+
subjectId: string;
|
|
14
|
+
/** Display label; never use this as an identity or authorization key. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Management role; the primary Assistant is identified by the group's xpertId instead. */
|
|
17
|
+
role: ChatGroupParticipant['role'];
|
|
18
|
+
/** Removed members retain their record for message attribution. */
|
|
19
|
+
active: boolean;
|
|
20
|
+
/** Assistant-only execution conversation, with purpose='group_assistant_runtime'. */
|
|
21
|
+
runtimeConversationId?: string;
|
|
22
|
+
/** Assistant-only execution thread, separate from the public group thread. */
|
|
23
|
+
runtimeThreadId?: string;
|
|
24
|
+
/** Assistant's technical principal; execution creators must still use the real human initiator. */
|
|
25
|
+
principalUserId?: string;
|
|
26
|
+
/** Highest public message sequence incorporated into this Assistant's completed context. */
|
|
27
|
+
contextSequence: number;
|
|
28
|
+
/** Human member's last read public message sequence. */
|
|
29
|
+
readSequence: number;
|
|
30
|
+
/** Per-member list preferences, not group-wide settings. */
|
|
31
|
+
pinned: boolean;
|
|
32
|
+
archived: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Delivery/consumption receipt for one public message and recipient; not a second execution queue. */
|
|
35
|
+
export interface IGroupMessageRecipient extends IBasePerTenantAndOrganizationEntityModel {
|
|
36
|
+
groupId: string;
|
|
37
|
+
/** Public group ChatMessage ID. */
|
|
38
|
+
messageId: string;
|
|
39
|
+
/** Recipient membership ID, not its User/Xpert subject ID. */
|
|
40
|
+
participantId: string;
|
|
41
|
+
status: ChatGroupDeliveryStatus;
|
|
42
|
+
/** Whether this delivery should invoke the recipient Assistant via the existing message queue. */
|
|
43
|
+
wake: boolean;
|
|
44
|
+
/** Public group reply that fulfills this request. */
|
|
45
|
+
replyMessageId?: string | null;
|
|
46
|
+
/** Recorded Assistant execution and its runtime input message. */
|
|
47
|
+
executionId?: string | null;
|
|
48
|
+
inputMessageId?: string | null;
|
|
49
|
+
/** Internal admission/recovery checkpoint; separate from the public delivery status. */
|
|
50
|
+
phase?: 'reserved' | 'started' | 'finalized' | null;
|
|
51
|
+
/** Internal failure reason; not public error copy. */
|
|
52
|
+
error?: string | null;
|
|
53
|
+
/** Dispatch attempts tracked by the receipt retry policy. */
|
|
54
|
+
attempts: number;
|
|
55
|
+
/** Public context sequence included in this delivery, used to advance the member's context position. */
|
|
56
|
+
contextSequence: number;
|
|
57
|
+
nextAttemptAt: Date;
|
|
58
|
+
/** Persisted run admission time, used for recovery and attribution. */
|
|
59
|
+
startedAt?: Date | null;
|
|
60
|
+
/** Dispatch lease prevents workers from claiming the same receipt concurrently. */
|
|
61
|
+
leaseToken?: string | null;
|
|
62
|
+
leaseUntil?: Date | null;
|
|
63
|
+
/** Server-authorized continuation command retained while a paused run is resumed. */
|
|
64
|
+
control?: {
|
|
65
|
+
/** Real User Account ID authorizing the control operation. */
|
|
66
|
+
actorId: string;
|
|
67
|
+
pauseId?: string;
|
|
68
|
+
decision: {
|
|
69
|
+
type: 'confirm' | 'reject';
|
|
70
|
+
payload?: unknown;
|
|
71
|
+
};
|
|
72
|
+
} | null;
|
|
73
|
+
}
|
|
74
|
+
/** Persisted human interaction and claim state for an Assistant runtime interruption. */
|
|
75
|
+
export interface IGroupInteraction extends IBasePerTenantAndOrganizationEntityModel {
|
|
76
|
+
groupId: string;
|
|
77
|
+
/** Server-generated deduplication key; distinct from this entity's primary ID. */
|
|
78
|
+
interactionId: string;
|
|
79
|
+
/** Assistant membership owning the interrupted runtime. */
|
|
80
|
+
participantId: string;
|
|
81
|
+
/** Real User Account designated to handle the interaction. */
|
|
82
|
+
assignedUserId: string;
|
|
83
|
+
/** User Account that successfully claimed the interaction. */
|
|
84
|
+
claimedBy?: string | null;
|
|
85
|
+
status: ChatGroupInteraction['status'];
|
|
86
|
+
/** Delivery receipt that triggered the interrupted execution. */
|
|
87
|
+
recipientId: string;
|
|
88
|
+
runId: string;
|
|
89
|
+
/** Client claim UUID; binds a response/retry to the successful claim. */
|
|
90
|
+
claimId?: string | null;
|
|
91
|
+
/** Stored tool/approval requests; validate with the interaction protocol before consuming. */
|
|
92
|
+
payload: unknown;
|
|
93
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import type { RuntimeCapabilitiesSelection } from '@xpert-ai/chatkit-types';
|
|
2
|
+
import type { RuntimeResourcesSelection } from '../agent-plugin';
|
|
3
|
+
import type { TAvatar } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Public group protocol for ChatConversation(purpose='group'). Each Assistant has a separate runtime.
|
|
6
|
+
* Participant IDs identify membership within this group; subject IDs identify User or Xpert records.
|
|
7
|
+
* These DTOs do not grant access: validate inputs and resolve identity/permissions on the server.
|
|
8
|
+
* Extend machine-readable discriminants and their validators/consumers together; never infer kind from names.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Server-resolved communication intent, independent of whether the sender is human or an Assistant.
|
|
12
|
+
* `request` addresses members and may wake an Assistant; `reply` answers an existing request and
|
|
13
|
+
* routes back to its sender; `message` publishes information without waking addressed Assistants.
|
|
14
|
+
*/
|
|
15
|
+
export type ChatGroupIntent = 'request' | 'reply' | 'message';
|
|
16
|
+
/** Per-recipient delivery progress, not a read receipt or the overall Assistant run status. */
|
|
17
|
+
export type ChatGroupDeliveryStatus =
|
|
18
|
+
/** Accepted for delivery; dispatch may still be pending. */
|
|
19
|
+
'pending'
|
|
20
|
+
/** Starting an Assistant run for this message. */
|
|
21
|
+
| 'starting'
|
|
22
|
+
/** Submitted to an active run through the existing steer/follow-up mechanism. */
|
|
23
|
+
| 'steering'
|
|
24
|
+
/** Consumed by the runtime; does not by itself mean a reply has been published. */
|
|
25
|
+
| 'consumed'
|
|
26
|
+
/** Delivery cannot proceed under the current authorization or runtime state. */
|
|
27
|
+
| 'blocked'
|
|
28
|
+
/** Delivery was canceled. */
|
|
29
|
+
| 'canceled'
|
|
30
|
+
/** Dispatch failed after its retry policy was exhausted. */
|
|
31
|
+
| 'failed';
|
|
32
|
+
/** Public member profile; runtime conversation IDs and private account data are excluded. */
|
|
33
|
+
export interface ChatGroupParticipant {
|
|
34
|
+
/** GroupParticipant ID used by mentions, senders, recipients and runtime projections. */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Selects the entity namespace of subjectId; also drives member-specific UI and routing. */
|
|
37
|
+
kind: 'user' | 'assistant';
|
|
38
|
+
/** User Account ID for `user`, Xpert ID for `assistant`; not a membership ID. */
|
|
39
|
+
subjectId: string;
|
|
40
|
+
/** Display label only; use IDs for identity and authorization. */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Public User/Xpert avatar; absence permits a display fallback. */
|
|
43
|
+
avatar?: TAvatar | null;
|
|
44
|
+
/** Group management role; `owner` does not identify the primary Assistant. */
|
|
45
|
+
role: 'owner' | 'member';
|
|
46
|
+
/** Inactive members may remain in snapshots to identify historical message authors. */
|
|
47
|
+
active: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Invite candidate before membership exists; submit kind + subjectId to add the member. */
|
|
50
|
+
export type ChatGroupCandidate = Pick<ChatGroupParticipant, 'kind' | 'subjectId' | 'name' | 'avatar'>;
|
|
51
|
+
/**
|
|
52
|
+
* Per-message selections from the shared Composer, scoped to one addressed Assistant.
|
|
53
|
+
* This does not choose the recipient: the server requires a single matching Assistant recipient
|
|
54
|
+
* and validates project/file/capability access within that scope.
|
|
55
|
+
*/
|
|
56
|
+
export interface ChatGroupComposerInput {
|
|
57
|
+
/** Membership ID of the Assistant whose Composer resources were selected. */
|
|
58
|
+
participantId: string;
|
|
59
|
+
/** Optional project context for this Assistant, subject to server-side access checks. */
|
|
60
|
+
projectId?: string;
|
|
61
|
+
/** Workspace file references, not file contents or arbitrary download URLs. */
|
|
62
|
+
files?: {
|
|
63
|
+
/** Workspace-relative path; currently must match workspacePath. */
|
|
64
|
+
filePath: string;
|
|
65
|
+
/** Authorized path in the target workspace; absolute paths and traversal are rejected. */
|
|
66
|
+
workspacePath: string;
|
|
67
|
+
originalName?: string;
|
|
68
|
+
mimeType?: string;
|
|
69
|
+
/** File size in bytes, when available. */
|
|
70
|
+
size?: number;
|
|
71
|
+
purpose: 'workspace';
|
|
72
|
+
}[];
|
|
73
|
+
/** Shared runtime-resource selection contract, including its own catalog revision. */
|
|
74
|
+
runtimeResources?: RuntimeResourcesSelection;
|
|
75
|
+
/** Shared capability selection contract; selection does not confer permission to use a capability. */
|
|
76
|
+
runtimeCapabilities?: RuntimeCapabilitiesSelection;
|
|
77
|
+
}
|
|
78
|
+
/** Server-authored routing and causality metadata; public senders cannot supply or override identity. */
|
|
79
|
+
export interface ChatGroupCommunication {
|
|
80
|
+
/** Validated Composer selections for this message, when supplied by a human sender. */
|
|
81
|
+
composer?: ChatGroupComposerInput;
|
|
82
|
+
intent: ChatGroupIntent;
|
|
83
|
+
/** Authenticated human or verified runtime author's membership ID. */
|
|
84
|
+
senderId: string;
|
|
85
|
+
/** Resolved membership IDs, including the original sender when intent is `reply`. */
|
|
86
|
+
recipientIds: string[];
|
|
87
|
+
/** Public group request being answered; a protocol relationship, not a required UI quote. */
|
|
88
|
+
replyToMessageId?: string;
|
|
89
|
+
/** Public group message that caused this runtime output; independent of explicit reply intent. */
|
|
90
|
+
causedByMessageId?: string;
|
|
91
|
+
/** First public message ID in the causal chain, inherited across Assistant handoffs/replies. */
|
|
92
|
+
rootMessageId: string;
|
|
93
|
+
/** Real initiating User Account ID, inherited for execution attribution; never an Assistant principal. */
|
|
94
|
+
rootUserId: string;
|
|
95
|
+
/** Causal depth: roots start at zero; inherited messages increment it for server loop limits. */
|
|
96
|
+
hop: number;
|
|
97
|
+
}
|
|
98
|
+
/** Public message in the shared group transcript, separate from private runtime ChatMessages. */
|
|
99
|
+
export interface ChatGroupMessage {
|
|
100
|
+
/** Persisted ChatMessage ID in the group conversation. */
|
|
101
|
+
id: string;
|
|
102
|
+
/** Correlation/idempotency key of the original submission; not the persisted message ID. */
|
|
103
|
+
clientMessageId: string;
|
|
104
|
+
/** Server-assigned order within this conversation; unchanged when this message is updated. */
|
|
105
|
+
sequence: number;
|
|
106
|
+
text: string;
|
|
107
|
+
/** ISO 8601 creation timestamp; sequence, not this timestamp, defines transcript order. */
|
|
108
|
+
createdAt: string;
|
|
109
|
+
communication: ChatGroupCommunication;
|
|
110
|
+
/** Members with linked execution records; opening one still requires separate runtime-view authorization. */
|
|
111
|
+
runtimeParticipantIds?: string[];
|
|
112
|
+
/** Delivery state per addressed member; an empty list does not imply unread or failed delivery. */
|
|
113
|
+
deliveries: {
|
|
114
|
+
participantId: string;
|
|
115
|
+
status: ChatGroupDeliveryStatus;
|
|
116
|
+
}[];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Binds a member to an exact `@name` span in the submitted text. Offsets use JavaScript UTF-16
|
|
120
|
+
* string indices: [start, end). Spans must not overlap; membership and displayed name are validated.
|
|
121
|
+
*/
|
|
122
|
+
export interface ChatGroupMention {
|
|
123
|
+
/** Membership ID, not the User/Xpert subject ID. */
|
|
124
|
+
participantId: string;
|
|
125
|
+
/** Inclusive offset of `@`. */
|
|
126
|
+
start: number;
|
|
127
|
+
/** Exclusive offset after the member name. */
|
|
128
|
+
end: number;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Public human-message input. The server derives author, intent and recipients from trusted context
|
|
132
|
+
* and validated mentions. No mentions routes to the primary Assistant (conversation.xpertId);
|
|
133
|
+
* explicit mentions route only to those members. Busy Assistants receive input through steer.
|
|
134
|
+
*/
|
|
135
|
+
export type ChatGroupSendInput = {
|
|
136
|
+
composer?: ChatGroupComposerInput;
|
|
137
|
+
/** Client-generated UUID; reuse for retries of the same submission, scoped to group and sender. */
|
|
138
|
+
clientMessageId: string;
|
|
139
|
+
/** Message text against which mention offsets are validated. */
|
|
140
|
+
text: string;
|
|
141
|
+
mentions?: ChatGroupMention[];
|
|
142
|
+
/** Reply candidate; it does not override @ routing or the primary-Assistant fallback. */
|
|
143
|
+
replyToMessageId?: string;
|
|
144
|
+
};
|
|
145
|
+
/** Identity to invite; the server resolves display data, access and the new membership ID. */
|
|
146
|
+
export type ChatGroupMemberInput = {
|
|
147
|
+
kind: 'user' | 'assistant';
|
|
148
|
+
subjectId: string;
|
|
149
|
+
};
|
|
150
|
+
/** Creates the shared conversation with the authenticated human as owner. */
|
|
151
|
+
export interface ChatGroupCreateInput {
|
|
152
|
+
title: string;
|
|
153
|
+
/** Xpert ID stored as conversation.xpertId and enrolled as the primary Assistant. */
|
|
154
|
+
assistantId: string;
|
|
155
|
+
}
|
|
156
|
+
/** Lightweight list entry; use a snapshot for full membership and message history. */
|
|
157
|
+
export interface ChatGroupSummary {
|
|
158
|
+
/** Stable discriminator for the shared Assistant/conversation list. */
|
|
159
|
+
purpose: 'group';
|
|
160
|
+
/** Shared ChatConversation ID, also used as groupId by APIs. */
|
|
161
|
+
id: string;
|
|
162
|
+
/** Shared conversation thread ID, not an individual Assistant runtime thread. */
|
|
163
|
+
threadId: string;
|
|
164
|
+
title: string;
|
|
165
|
+
/** ISO 8601 list activity time, using the latest message time when available. */
|
|
166
|
+
updatedAt: string;
|
|
167
|
+
/** Truncated preview only; never use it as the full message or for routing. */
|
|
168
|
+
lastMessage: string;
|
|
169
|
+
/** Total active members; may exceed the avatar preview count in members. */
|
|
170
|
+
memberCount: number;
|
|
171
|
+
/** Bounded active-member preview for composite avatars, not the complete roster. */
|
|
172
|
+
members: Pick<ChatGroupParticipant, 'id' | 'kind' | 'name' | 'avatar'>[];
|
|
173
|
+
/** Current viewer's unread state, based on their read sequence. */
|
|
174
|
+
unread: boolean;
|
|
175
|
+
/** Current viewer's list preference, not a group-wide setting. */
|
|
176
|
+
pinned: boolean;
|
|
177
|
+
/** Current viewer's list preference; does not archive the group for other members. */
|
|
178
|
+
archived: boolean;
|
|
179
|
+
}
|
|
180
|
+
/** Authorized public state plus one page of persisted messages; excludes private runtime configuration. */
|
|
181
|
+
export interface ChatGroupSnapshot {
|
|
182
|
+
/** Shared ChatConversation ID, also used as groupId by APIs. */
|
|
183
|
+
id: string;
|
|
184
|
+
/** Shared conversation thread ID; Assistant execution threads are separate. */
|
|
185
|
+
threadId: string;
|
|
186
|
+
title: string;
|
|
187
|
+
/** Current viewer's membership ID; compare with communication.senderId for own-message presentation. */
|
|
188
|
+
viewerParticipantId: string;
|
|
189
|
+
/** Primary Assistant's Xpert ID; match an assistant member's subjectId, not its id or role. */
|
|
190
|
+
xpertId: string;
|
|
191
|
+
/** Includes inactive members so older messages can retain their authors' identities. */
|
|
192
|
+
members: ChatGroupParticipant[];
|
|
193
|
+
/** One history page in ascending sequence order, not necessarily the full transcript. */
|
|
194
|
+
messages: ChatGroupMessage[];
|
|
195
|
+
/** Older messages exist before this page; paginate using its earliest message sequence. */
|
|
196
|
+
hasMore: boolean;
|
|
197
|
+
/** Server state version covering message, membership and delivery changes; not a message count or SSE cursor. */
|
|
198
|
+
revision: number;
|
|
199
|
+
/** Public runtime state for member threads with a recorded run, including completed/idle runs. */
|
|
200
|
+
runs: ChatGroupRun[];
|
|
201
|
+
/** Pending/claimed human interactions; full request payloads are returned only to an authorized claimant. */
|
|
202
|
+
interactions?: ChatGroupInteraction[];
|
|
203
|
+
}
|
|
204
|
+
/** Public summary of a runtime pause requiring a designated human's approval or client tool execution. */
|
|
205
|
+
export interface ChatGroupInteraction {
|
|
206
|
+
id: string;
|
|
207
|
+
/** Run that produced this interaction. */
|
|
208
|
+
runId: string;
|
|
209
|
+
/** Assistant membership ID owning the run. */
|
|
210
|
+
participantId: string;
|
|
211
|
+
/** User Account ID allowed to claim/respond; not a group membership ID. */
|
|
212
|
+
assignedUserId: string;
|
|
213
|
+
/** Claim/response lifecycle; claiming does not itself complete or resume the interaction. */
|
|
214
|
+
status: 'pending' | 'claimed' | 'completed' | 'canceled';
|
|
215
|
+
}
|
|
216
|
+
/** Returned after the assigned human claims an interaction; observing the group stream does not claim it. */
|
|
217
|
+
export interface ChatGroupInteractionClaim {
|
|
218
|
+
/** Interaction ID, matching ChatGroupInteraction.id. */
|
|
219
|
+
id: string;
|
|
220
|
+
/** Client claim identifier bound by the server; reuse it when responding or retrying the same claim. */
|
|
221
|
+
claimId: string;
|
|
222
|
+
/** Discriminate by kind, then validate request with the existing client-tool or approval protocol. */
|
|
223
|
+
requests: ({
|
|
224
|
+
kind: 'client_tool';
|
|
225
|
+
request: unknown;
|
|
226
|
+
} | {
|
|
227
|
+
kind: 'approval';
|
|
228
|
+
request: unknown;
|
|
229
|
+
})[];
|
|
230
|
+
}
|
|
231
|
+
/** Public projection of one Assistant runtime's current thread/run control state. */
|
|
232
|
+
export interface ChatGroupRun {
|
|
233
|
+
/** Assistant membership ID. */
|
|
234
|
+
participantId: string;
|
|
235
|
+
/** Execution/run identifier; not the shared group thread ID. */
|
|
236
|
+
runId: string;
|
|
237
|
+
/** Thread state, distinct from individual message delivery statuses. */
|
|
238
|
+
status: 'busy' | 'pausing' | 'paused' | 'interrupted' | 'idle' | 'error';
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Public group SSE payload. Transport event IDs are opaque replay cursors, separate from revision/sequence.
|
|
242
|
+
* Extend this union together with stream validation and reducers; private runtime events do not belong here.
|
|
243
|
+
*/
|
|
244
|
+
export type ChatGroupEvent =
|
|
245
|
+
/** Refresh public state and reconcile its history page by message ID. */
|
|
246
|
+
{
|
|
247
|
+
type: 'snapshot';
|
|
248
|
+
snapshot: ChatGroupSnapshot;
|
|
249
|
+
}
|
|
250
|
+
/** Append a text delta to a runtime output; messageId is the runtime output ID, not yet the group message ID. */
|
|
251
|
+
| {
|
|
252
|
+
type: 'text';
|
|
253
|
+
participantId: string;
|
|
254
|
+
runId: string;
|
|
255
|
+
messageId: string;
|
|
256
|
+
text: string;
|
|
257
|
+
}
|
|
258
|
+
/** Replay continuity was lost; recover from a fresh snapshot rather than trusting accumulated deltas. */
|
|
259
|
+
| {
|
|
260
|
+
type: 'resync';
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Workspace-authorized view of the execution linked to a public group message.
|
|
264
|
+
* Opens in the existing external-Assistant Workbench view; group membership alone grants no runtime access.
|
|
265
|
+
* Contains selected display messages, never checkpoints or runtime configuration.
|
|
266
|
+
*/
|
|
267
|
+
export interface ChatGroupRuntimeView {
|
|
268
|
+
/** Assistant's ChatConversation(purpose='group_assistant_runtime'), not the shared group conversation. */
|
|
269
|
+
conversationId: string;
|
|
270
|
+
/** Assistant runtime thread ID. */
|
|
271
|
+
threadId: string;
|
|
272
|
+
/** Xpert ID owning the execution. */
|
|
273
|
+
xpertId: string;
|
|
274
|
+
/** Corresponding Assistant membership ID in the shared group. */
|
|
275
|
+
participantId: string;
|
|
276
|
+
title: string;
|
|
277
|
+
avatar?: TAvatar | null;
|
|
278
|
+
/** Recorded execution selected by the public group message and participant. */
|
|
279
|
+
executionId: string;
|
|
280
|
+
/** Optional runtime input/output message to focus when opening the view. */
|
|
281
|
+
messageId?: string;
|
|
282
|
+
/** Execution status, distinct from the group's delivery and thread statuses. */
|
|
283
|
+
status: string;
|
|
284
|
+
/** Display projection for this execution; human runtime context is replaced with the public question. */
|
|
285
|
+
messages: {
|
|
286
|
+
/** Runtime ChatMessage ID, not the public group message ID. */
|
|
287
|
+
id: string;
|
|
288
|
+
role: string;
|
|
289
|
+
/** Existing message-content payload; narrow with its renderer/protocol before use. */
|
|
290
|
+
content: unknown;
|
|
291
|
+
/** Optional reasoning payload; likewise requires the existing message protocol's narrowing. */
|
|
292
|
+
reasoning?: unknown;
|
|
293
|
+
status?: string;
|
|
294
|
+
executionId?: string;
|
|
295
|
+
/** ISO 8601 timestamp. */
|
|
296
|
+
createdAt: string;
|
|
297
|
+
}[];
|
|
298
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Provenance is descriptive, never an execution principal or an authorization grant. */
|
|
2
|
+
export type TChatMessageSource = {
|
|
3
|
+
type: 'user';
|
|
4
|
+
userId: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'voice';
|
|
7
|
+
sessionId: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'assistant';
|
|
10
|
+
xpertId: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'agent';
|
|
13
|
+
xpertId: string;
|
|
14
|
+
agentKey: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'runtime';
|
|
17
|
+
provider: string;
|
|
18
|
+
bindingId: string;
|
|
19
|
+
invocationId: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'automation';
|
|
22
|
+
taskId: string;
|
|
23
|
+
};
|
|
24
|
+
/** Presentation does not change model roles or remove input from execution/retry history. */
|
|
25
|
+
export type TChatMessagePresentation = 'message' | 'event' | 'runtime';
|
|
26
|
+
/** Host-created provenance, persisted in ChatMessage.messageEnvelope. */
|
|
27
|
+
export interface TChatMessageEnvelope {
|
|
28
|
+
version: 1;
|
|
29
|
+
source: TChatMessageSource;
|
|
30
|
+
presentation: TChatMessagePresentation;
|
|
31
|
+
/** Audited destination, not routing instructions. The authorized request owns routing. */
|
|
32
|
+
target?: {
|
|
33
|
+
xpertId: string;
|
|
34
|
+
agentKey?: string;
|
|
35
|
+
conversationId?: string;
|
|
36
|
+
threadId?: string;
|
|
37
|
+
};
|
|
38
|
+
correlation?: {
|
|
39
|
+
messageId?: string;
|
|
40
|
+
replyToMessageId?: string;
|
|
41
|
+
executionId?: string;
|
|
42
|
+
invocationId?: string;
|
|
43
|
+
/** Existing platform task identity; never substitute a Project Task ID. */
|
|
44
|
+
taskId?: string;
|
|
45
|
+
projectTaskId?: string;
|
|
46
|
+
taskExecutionId?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Persistence boundary: unknown versions stay hidden until this host understands their policy. */
|
|
50
|
+
export declare function chatMessagePresentation(message: {
|
|
51
|
+
messageEnvelope?: unknown;
|
|
52
|
+
}): TChatMessagePresentation;
|
|
53
|
+
export declare function isRuntimeChatMessage(message: {
|
|
54
|
+
messageEnvelope?: unknown;
|
|
55
|
+
}): boolean;
|