@xpert-ai/contracts 3.35.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.
Files changed (105) hide show
  1. package/context-event.cjs.default.js +1 -0
  2. package/context-event.cjs.js +26 -0
  3. package/context-event.cjs.mjs +2 -0
  4. package/context-event.d.ts +1 -0
  5. package/context-event.esm.js +24 -0
  6. package/index.cjs.default.js +1 -0
  7. package/index.cjs.js +1165 -805
  8. package/index.cjs.mjs +2 -0
  9. package/index.esm.js +1140 -801
  10. package/package.json +18 -2
  11. package/src/agent-plugin.d.ts +4 -29
  12. package/src/ai/agent-output-delivery.model.d.ts +22 -1
  13. package/src/ai/agent-runtime.model.d.ts +4 -4
  14. package/src/ai/assistant-capability.model.d.ts +0 -1
  15. package/src/ai/assistant-template-manifest.model.d.ts +272 -308
  16. package/src/ai/assistant-template-overview.model.d.ts +0 -4
  17. package/src/ai/assistant-template.model.d.ts +0 -4
  18. package/src/ai/bosi.model.d.ts +1 -1
  19. package/src/ai/chat-activity.model.d.ts +13 -0
  20. package/src/ai/chat-message.model.d.ts +0 -11
  21. package/src/ai/chat.model.d.ts +3 -0
  22. package/src/ai/cli-execution.model.d.ts +88 -0
  23. package/src/ai/conversation-trail.model.d.ts +274 -274
  24. package/src/ai/copilot-store.model.d.ts +0 -13
  25. package/src/ai/evolution/entities.d.ts +164 -0
  26. package/src/ai/evolution/evaluation.d.ts +7 -0
  27. package/src/ai/evolution/execution-review.d.ts +68 -0
  28. package/src/ai/evolution/index.d.ts +2 -0
  29. package/src/ai/evolution/provider.d.ts +1 -0
  30. package/src/ai/evolution/target.d.ts +5 -0
  31. package/src/ai/execution-activity.model.d.ts +362 -362
  32. package/src/ai/execution-control-evidence.schema.d.ts +26 -26
  33. package/src/ai/execution-observability.model.d.ts +160 -160
  34. package/src/ai/execution-source.model.d.ts +45 -0
  35. package/src/ai/index.d.ts +2 -0
  36. package/src/ai/middleware.model.d.ts +1 -0
  37. package/src/ai/model-execution.model.d.ts +5 -108
  38. package/src/ai/model-replacement.model.d.ts +12 -12
  39. package/src/ai/project-configuration-view.model.d.ts +1 -0
  40. package/src/ai/project-pipeline/analytics.d.ts +288 -288
  41. package/src/ai/project-pipeline/budget.schema.d.ts +4 -4
  42. package/src/ai/project-pipeline/commands.schema.d.ts +519 -476
  43. package/src/ai/project-pipeline/configuration-declaration.schema.d.ts +3815 -0
  44. package/src/ai/project-pipeline/configuration-form.d.ts +1903 -1759
  45. package/src/ai/project-pipeline/configuration.schema.d.ts +425 -388
  46. package/src/ai/project-pipeline/contribution.schema.d.ts +764 -612
  47. package/src/ai/project-pipeline/definition.schema.d.ts +382 -338
  48. package/src/ai/project-pipeline/execution-statistics.d.ts +30 -30
  49. package/src/ai/project-pipeline/graph.model.d.ts +7 -2
  50. package/src/ai/project-pipeline/human-wait-statistics.d.ts +2 -2
  51. package/src/ai/project-pipeline/index.d.ts +1 -0
  52. package/src/ai/project-pipeline/model-usage-statistics.d.ts +6 -6
  53. package/src/ai/project-pipeline/node.schema.d.ts +57 -44
  54. package/src/ai/project-pipeline/operation.schema.d.ts +378 -378
  55. package/src/ai/project-pipeline/plugin-deployment.schema.d.ts +6 -6
  56. package/src/ai/project-pipeline/portfolio.schema.d.ts +684 -684
  57. package/src/ai/project-pipeline/primitives.schema.d.ts +4 -4
  58. package/src/ai/project-pipeline/projection.schema.d.ts +674 -637
  59. package/src/ai/project-pipeline/provider-actions.schema.d.ts +120 -120
  60. package/src/ai/project-pipeline/queue-statistics.d.ts +34 -34
  61. package/src/ai/project-pipeline/runtime.schema.d.ts +89 -89
  62. package/src/ai/project-pipeline/statistics.d.ts +142 -142
  63. package/src/ai/project-task-runtime.model.d.ts +265 -789
  64. package/src/ai/sandbox-execution-control.schema.d.ts +6 -6
  65. package/src/ai/template-installation.model.d.ts +13 -13
  66. package/src/ai/template-lifecycle.model.d.ts +4 -4
  67. package/src/ai/xpert-agent-execution.model.d.ts +33 -0
  68. package/src/ai/xpert-project.model.d.ts +2 -1
  69. package/src/ai/xpert-tool.model.d.ts +12 -0
  70. package/src/ai/xpert.model.d.ts +0 -34
  71. package/src/ai/xpert.utils.d.ts +0 -1
  72. package/src/always-on/agent-event.model.d.ts +121 -0
  73. package/src/always-on/agent-event.schema.d.ts +139 -0
  74. package/src/always-on/agent-output-reference.schema.d.ts +27 -0
  75. package/src/always-on/agent-output.model.d.ts +411 -0
  76. package/src/always-on/human-decision.model.d.ts +204 -0
  77. package/src/always-on/index.d.ts +3 -0
  78. package/src/always-on/output-workbench.schema.d.ts +154 -0
  79. package/src/analytics/analysis-evidence.model.d.ts +29 -0
  80. package/src/analytics/analytics-certification.model.d.ts +17 -0
  81. package/src/{analytics-definition.model.d.ts → analytics/analytics-definition.model.d.ts} +1 -1
  82. package/src/{analytics-diagnostic.d.ts → analytics/analytics-diagnostic.d.ts} +8 -8
  83. package/src/{analytics-query.model.d.ts → analytics/analytics-query.model.d.ts} +9 -1
  84. package/src/analytics/index.d.ts +7 -0
  85. package/src/{resource-analysis.model.d.ts → analytics/resource-analysis.model.d.ts} +6 -1
  86. package/src/app-platform.d.ts +14 -14
  87. package/src/{artifact-group-reference.model.d.ts → artifacts/artifact-group-reference.model.d.ts} +1 -1
  88. package/src/{artifact-presentation.model.d.ts → artifacts/artifact-presentation.model.d.ts} +1 -1
  89. package/src/{artifact-use-grant-command.d.ts → artifacts/artifact-use-grant-command.d.ts} +1 -1
  90. package/src/{artifact-use-grant.model.d.ts → artifacts/artifact-use-grant.model.d.ts} +2 -2
  91. package/src/{artifact.model.d.ts → artifacts/artifact.model.d.ts} +4 -2
  92. package/src/artifacts/index.d.ts +5 -0
  93. package/src/collaboration.model.d.ts +31 -11
  94. package/src/{content-document.model.d.ts → content/content-document.model.d.ts} +2 -0
  95. package/src/{content-resource.model.d.ts → content/content-resource.model.d.ts} +7 -3
  96. package/src/content/content-transfer.model.d.ts +21 -0
  97. package/src/content/index.d.ts +4 -0
  98. package/src/execution-control-admission.schema.d.ts +2 -2
  99. package/src/icon-definition.schema.d.ts +6 -10
  100. package/src/index.d.ts +5 -14
  101. package/src/secret-token.model.d.ts +4 -4
  102. package/src/user-notification.schema.d.ts +1300 -471
  103. package/src/view-extension/client-commands.d.ts +24 -0
  104. /package/src/{analytics-source.model.d.ts → analytics/analytics-source.model.d.ts} +0 -0
  105. /package/src/{content-reference.model.d.ts → content/content-reference.model.d.ts} +0 -0
@@ -10,17 +10,17 @@ export declare const sandboxRuntimeTargetSchema: z.ZodObject<{
10
10
  runtimeRef: z.ZodString;
11
11
  }, "strict", z.ZodTypeAny, {
12
12
  version?: 1;
13
- kind?: "host" | "engine";
14
13
  provider?: string;
15
14
  generation?: string;
15
+ kind?: "host" | "engine";
16
16
  environmentId?: string;
17
17
  runtimeProfile?: string;
18
18
  runtimeRef?: string;
19
19
  }, {
20
20
  version?: 1;
21
- kind?: "host" | "engine";
22
21
  provider?: string;
23
22
  generation?: string;
23
+ kind?: "host" | "engine";
24
24
  environmentId?: string;
25
25
  runtimeProfile?: string;
26
26
  runtimeRef?: string;
@@ -39,17 +39,17 @@ export declare const sandboxRuntimeEvidenceSchema: z.ZodObject<{
39
39
  runtimeRef: z.ZodString;
40
40
  }, "strict", z.ZodTypeAny, {
41
41
  version?: 1;
42
- kind?: "host" | "engine";
43
42
  provider?: string;
44
43
  generation?: string;
44
+ kind?: "host" | "engine";
45
45
  environmentId?: string;
46
46
  runtimeProfile?: string;
47
47
  runtimeRef?: string;
48
48
  }, {
49
49
  version?: 1;
50
- kind?: "host" | "engine";
51
50
  provider?: string;
52
51
  generation?: string;
52
+ kind?: "host" | "engine";
53
53
  environmentId?: string;
54
54
  runtimeProfile?: string;
55
55
  runtimeRef?: string;
@@ -60,9 +60,9 @@ export declare const sandboxRuntimeEvidenceSchema: z.ZodObject<{
60
60
  version?: 1;
61
61
  target?: {
62
62
  version?: 1;
63
- kind?: "host" | "engine";
64
63
  provider?: string;
65
64
  generation?: string;
65
+ kind?: "host" | "engine";
66
66
  environmentId?: string;
67
67
  runtimeProfile?: string;
68
68
  runtimeRef?: string;
@@ -73,9 +73,9 @@ export declare const sandboxRuntimeEvidenceSchema: z.ZodObject<{
73
73
  version?: 1;
74
74
  target?: {
75
75
  version?: 1;
76
- kind?: "host" | "engine";
77
76
  provider?: string;
78
77
  generation?: string;
78
+ kind?: "host" | "engine";
79
79
  environmentId?: string;
80
80
  runtimeProfile?: string;
81
81
  runtimeRef?: string;
@@ -84,11 +84,11 @@ export declare const templateDependencyLocksSchema: z.ZodArray<z.ZodObject<{
84
84
  kind: z.ZodEnum<["middleware", "sandbox", "toolset"]>;
85
85
  key: z.ZodString;
86
86
  }, "strict", z.ZodTypeAny, {
87
- kind?: "middleware" | "toolset" | "sandbox";
88
87
  key?: string;
89
- }, {
90
88
  kind?: "middleware" | "toolset" | "sandbox";
89
+ }, {
91
90
  key?: string;
91
+ kind?: "middleware" | "toolset" | "sandbox";
92
92
  }>, "many">>;
93
93
  components: z.ZodArray<z.ZodObject<{
94
94
  type: z.ZodEnum<["skill", "mcp_server", "toolset", "app", "hook", "asset"]>;
@@ -96,20 +96,15 @@ export declare const templateDependencyLocksSchema: z.ZodArray<z.ZodObject<{
96
96
  hash: z.ZodString;
97
97
  }, "strict", z.ZodTypeAny, {
98
98
  type?: "skill" | "toolset" | "app" | "asset" | "mcp_server" | "hook";
99
- key?: string;
100
99
  hash?: string;
100
+ key?: string;
101
101
  }, {
102
102
  type?: "skill" | "toolset" | "app" | "asset" | "mcp_server" | "hook";
103
- key?: string;
104
103
  hash?: string;
104
+ key?: string;
105
105
  }>, "many">;
106
106
  }, "strict", z.ZodTypeAny, {
107
107
  version?: string;
108
- components?: {
109
- type?: "skill" | "toolset" | "app" | "asset" | "mcp_server" | "hook";
110
- key?: string;
111
- hash?: string;
112
- }[];
113
108
  source?: {
114
109
  name?: string;
115
110
  kind?: "agent-plugin";
@@ -120,16 +115,16 @@ export declare const templateDependencyLocksSchema: z.ZodArray<z.ZodObject<{
120
115
  pluginName?: string;
121
116
  requiredVersion?: string;
122
117
  providers?: {
123
- kind?: "middleware" | "toolset" | "sandbox";
124
118
  key?: string;
119
+ kind?: "middleware" | "toolset" | "sandbox";
125
120
  }[];
126
- }, {
127
- version?: string;
128
121
  components?: {
129
122
  type?: "skill" | "toolset" | "app" | "asset" | "mcp_server" | "hook";
130
- key?: string;
131
123
  hash?: string;
124
+ key?: string;
132
125
  }[];
126
+ }, {
127
+ version?: string;
133
128
  source?: {
134
129
  name?: string;
135
130
  kind?: "agent-plugin";
@@ -140,7 +135,12 @@ export declare const templateDependencyLocksSchema: z.ZodArray<z.ZodObject<{
140
135
  pluginName?: string;
141
136
  requiredVersion?: string;
142
137
  providers?: {
138
+ key?: string;
143
139
  kind?: "middleware" | "toolset" | "sandbox";
140
+ }[];
141
+ components?: {
142
+ type?: "skill" | "toolset" | "app" | "asset" | "mcp_server" | "hook";
143
+ hash?: string;
144
144
  key?: string;
145
145
  }[];
146
146
  }>, "many">;
@@ -7,15 +7,15 @@ export declare const templatePublicationInputSchema: z.ZodObject<{
7
7
  releaseNotes: z.ZodDefault<z.ZodString>;
8
8
  }, "strict", z.ZodTypeAny, {
9
9
  version?: string;
10
- visibility?: "public" | "team";
11
10
  revision?: string;
12
11
  contentHash?: string;
12
+ visibility?: "public" | "team";
13
13
  releaseNotes?: string;
14
14
  }, {
15
15
  version?: string;
16
- visibility?: "public" | "team";
17
16
  revision?: string;
18
17
  contentHash?: string;
18
+ visibility?: "public" | "team";
19
19
  releaseNotes?: string;
20
20
  }>;
21
21
  export type TemplatePublicationInput = z.output<typeof templatePublicationInputSchema>;
@@ -43,12 +43,12 @@ export declare const templateUpgradeInputSchema: z.ZodObject<{
43
43
  revision?: string;
44
44
  sourceHash?: string;
45
45
  targetTemplateId?: string;
46
- choices?: Partial<Record<"definition" | "runtime" | "instructions" | "presentation", "replace" | "keep">>;
46
+ choices?: Partial<Record<"runtime" | "instructions" | "presentation" | "definition", "replace" | "keep">>;
47
47
  }, {
48
48
  revision?: string;
49
49
  sourceHash?: string;
50
50
  targetTemplateId?: string;
51
- choices?: Partial<Record<"definition" | "runtime" | "instructions" | "presentation", "replace" | "keep">>;
51
+ choices?: Partial<Record<"runtime" | "instructions" | "presentation" | "definition", "replace" | "keep">>;
52
52
  }>;
53
53
  export type TemplateUpgradeInput = z.output<typeof templateUpgradeInputSchema>;
54
54
  export interface TemplateUpgradeSource {
@@ -113,15 +113,24 @@ export declare enum XpertAgentExecutionStatusEnum {
113
113
  INTERRUPTED = "interrupted"
114
114
  }
115
115
  export type TAgentExecutionMetadata = {
116
+ /** Host-created result continuation; its inbox claim proves the originating execution. */
117
+ runtimeContinuation?: {
118
+ /** Durable runtime inbox entry whose claim identifies this continuation and its source invocation. */
119
+ inboxId: string;
120
+ };
116
121
  /** Written atomically with root checkpoints, not by message/execution finalizers. */
117
122
  recovery?: import('./chat-recovery.model').TChatExecutionRecovery;
123
+ /** Agent-plugin template provenance retained for the Assistant used by this execution. */
118
124
  templateSource?: import('../agent-plugin').TemplateAgentSource;
125
+ /** Reported business outcome, separate from process completion and the execution status. */
119
126
  businessOutcome?: import('@xpert-ai/chatkit-types').TAgentExecutionOutcome;
120
127
  /** Recorded by the invocation boundary; never inferred from agent names. */
121
128
  invocationKind?: 'external_assistant' | 'sub_agent';
122
129
  /** Tool call in the parent execution that started this run. Omit for workflow-driven runs. */
123
130
  sourceToolCallId?: string;
131
+ /** Assistant display name captured for execution history and live presentation. */
124
132
  assistantName?: string;
133
+ /** Assistant avatar captured with the display name; not an identity or authorization source. */
125
134
  assistantAvatar?: TAvatar;
126
135
  /**
127
136
  * AI model provider
@@ -133,31 +142,55 @@ export type TAgentExecutionMetadata = {
133
142
  model?: string;
134
143
  /** Opaque Assistant model option used by the base and Primary models. */
135
144
  primaryModelId?: string;
145
+ /** Whether model selection came from an explicit choice, preference, default, retry or fallback. */
136
146
  primaryModelSource?: import('./assistant-model.model').TAssistantPrimaryModelSelectionSource;
137
147
  /** Sanitized model snapshot used to keep resume and retry deterministic. */
138
148
  primaryModelSnapshot?: Pick<import('./copilot-model.model').TCopilotModel, 'copilotId' | 'modelType' | 'model' | 'options'>;
149
+ /** Audited entry-point category, with adapter-specific values retained for compatibility. */
139
150
  triggerSource?: 'integration' | 'channel' | 'api' | 'job' | 'trigger' | string;
151
+ /** Originating integration resolved from the source audit or trusted runtime principal. */
140
152
  sourceIntegrationId?: string;
153
+ /** Integration supplied by the caller; defaults to sourceIntegrationId when absent. */
141
154
  integrationId?: string;
155
+ /** Source channel type recorded by the channel adapter. */
142
156
  channelType?: string;
157
+ /** Adapter-specific channel ingress label, normalized from channelSource or channel_source. */
143
158
  channelSource?: string;
159
+ /** Original caller-supplied entry-point label, retained alongside normalized triggerSource. */
144
160
  from?: string;
161
+ /** End-user identifier in the originating client or channel, not a platform user grant. */
145
162
  fromEndUserId?: string;
163
+ /** User identifier supplied by the channel adapter. */
146
164
  channelUserId?: string;
165
+ /** Opaque UUID forwarded by a source adapter; not the platform execution ID. */
147
166
  uuid?: string;
167
+ /** WeChat account owner identifier forwarded by a compatible channel adapter. */
148
168
  ownerWxid?: string;
169
+ /** Source-channel contact identifier, normalized from contactId or contact_id. */
149
170
  contactId?: string;
171
+ /** Source-channel conversation identifier, normalized from chatId or chat_id. */
150
172
  chatId?: string;
173
+ /** Source-channel conversation type, normalized from chatType or chat_type. */
151
174
  chatType?: string;
175
+ /** Source-channel message sender identifier, normalized from senderId or sender_id. */
152
176
  senderId?: string;
177
+ /** Deduplicated inbound message-log identifiers used to trace this execution's source. */
153
178
  sourceMessageLogIds?: string[];
179
+ /** Handoff message that dispatched this execution. */
154
180
  handoffMessageId?: string;
181
+ /** Trace identifier correlating related handoff messages and executions. */
155
182
  handoffTraceId?: string;
183
+ /** Parent handoff message identifier for the dispatch chain. */
156
184
  handoffParentMessageId?: string;
185
+ /** Runtime principal type captured for audit; does not itself grant permission. */
157
186
  runtimePrincipalType?: string;
187
+ /** Assistant identity from the trusted runtime principal, retained for source auditing. */
158
188
  runtimePrincipalXpertId?: string;
159
189
  /** Root execution this run continued after a durable thread pause. */
160
190
  resumedFromExecutionId?: string;
191
+ /** Host-validated root execution whose original input was retried in this new run. */
192
+ retriedFromExecutionId?: string;
193
+ /** Extension metadata; consumers must validate unknown values before using them. */
161
194
  [key: string]: unknown;
162
195
  };
163
196
  /** Public execution summary shared by live events and conversation history. */
@@ -63,6 +63,7 @@ export type TXpertProjectSkillSummary = {
63
63
  path: string;
64
64
  enabled: boolean;
65
65
  source: TXpertProjectSkillSource;
66
+ skillIndexId?: string;
66
67
  description?: string;
67
68
  version?: string;
68
69
  };
@@ -273,7 +274,7 @@ export interface IXpertProjectTaskConversation extends IBasePerXpertProjectEntit
273
274
  sourceExecutionId?: string;
274
275
  }
275
276
  export interface IXpertProjectTaskExecution extends IBasePerXpertProjectEntityModel {
276
- reviewVerdict?: 'pass' | 'changes_required' | 'indeterminate' | null;
277
+ reviewReportAvailable?: boolean;
277
278
  /** Runtime-owned attempt. Distinct from a native Agent execution ID. */
278
279
  invocationId?: string | null;
279
280
  invocationStatus?: AgentInvocationStatus | null;
@@ -1,9 +1,21 @@
1
+ import type { JSONValue } from '../core.model';
1
2
  import type { JSONSchema4 } from 'json-schema';
2
3
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
4
  import { I18nObject } from '../types';
4
5
  import { DefaultModelRole, LegacyProviderRole } from './default-model-role';
5
6
  import { TAvatar } from '../types';
6
7
  import { IXpertToolset } from './xpert-toolset.model';
8
+ /**
9
+ * Set metadata.publicToolPresentation on the registered server-side tool.
10
+ * Callbacks return only JSON safe for conversation participants. An omitted
11
+ * phase or undefined return publishes no details. No callback is serialized.
12
+ */
13
+ export interface PublicToolPresentation {
14
+ tool: string;
15
+ input?: (args: unknown) => JSONValue | undefined;
16
+ output?: (content: unknown) => JSONValue | undefined;
17
+ error?: (error: unknown) => string | undefined;
18
+ }
7
19
  /**
8
20
  * Tools for Xpert
9
21
  */
@@ -77,13 +77,6 @@ export type TXpertFeatures = {
77
77
  * File upload feature
78
78
  */
79
79
  attachment?: TXpertAttachment;
80
- /**
81
- * Reply with memory(Q&A)
82
- */
83
- memoryReply?: {
84
- enabled: boolean;
85
- scoreThreshold?: number;
86
- };
87
80
  /**
88
81
  * Sandbox feature
89
82
  */
@@ -99,7 +92,6 @@ export type TXpertExportedTemplate = {
99
92
  filePath: string;
100
93
  exportedAt: string;
101
94
  isDraft: boolean;
102
- includeMemory: boolean;
103
95
  };
104
96
  export type XpertFrequentQuestionsRequest = {
105
97
  locale?: string | null;
@@ -178,10 +170,6 @@ export type TXpert = {
178
170
  * Config of summarize past conversations
179
171
  */
180
172
  summarize?: TSummarize;
181
- /**
182
- * @deprecated use memory middlewares
183
- */
184
- memory?: TLongTermMemory;
185
173
  features?: TXpertFeatures;
186
174
  commandProfile?: TXpertCommandProfile;
187
175
  marketplace?: TXpertMarketplaceProfile;
@@ -490,28 +478,6 @@ export type TSummarize = {
490
478
  */
491
479
  retainMessages?: number;
492
480
  };
493
- export declare enum LongTermMemoryTypeEnum {
494
- PROFILE = "profile",
495
- QA = "qa"
496
- }
497
- export type TLongTermMemoryConfig = {
498
- enabled?: boolean;
499
- /**
500
- * System prompt guide how to remember the key points of the conversation
501
- */
502
- prompt?: string;
503
- };
504
- /**
505
- * Config of long-term memory
506
- */
507
- export type TLongTermMemory = {
508
- enabled?: boolean;
509
- copilotModel?: TCopilotModel;
510
- profile?: TLongTermMemoryConfig & {
511
- afterSeconds?: number;
512
- };
513
- qa?: TLongTermMemoryConfig;
514
- };
515
481
  export type TXpertAttachmentType = 'document' | 'image' | 'audio' | 'video' | 'others';
516
482
  export type TXpertAttachment = {
517
483
  enabled?: boolean;
@@ -31,7 +31,6 @@ export declare function omitXpertRelations(xpert: Partial<IXpert>): {
31
31
  options?: import("./xpert.model").TXpertOptions;
32
32
  agentConfig?: import("./xpert.model").TXpertAgentConfig;
33
33
  summarize?: import("./xpert.model").TSummarize;
34
- memory?: import("./xpert.model").TLongTermMemory;
35
34
  features?: import("./xpert.model").TXpertFeatures;
36
35
  commandProfile?: import("./prompt-workflow.model").TXpertCommandProfile;
37
36
  marketplace?: import("./xpert-marketplace.model").TXpertMarketplaceProfile;
@@ -0,0 +1,121 @@
1
+ import type { EventDecision, PluginAgentEvent } from './agent-event.schema';
2
+ import type { I18nObject, IconDefinition } from '../types';
3
+ import type { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
4
+ export * from './agent-event.schema';
5
+ /**
6
+ * Connects a plugin source to a published assistant under one user's workspace and project scope.
7
+ * The host checks this binding when accepting events and again when dispatching work.
8
+ */
9
+ export interface IAgentEventBinding extends IBasePerTenantAndOrganizationEntityModel {
10
+ id: string;
11
+ tenantId: string;
12
+ organizationId: string;
13
+ workspaceId: string;
14
+ projectId: string | null;
15
+ xpertId: string;
16
+ userId: string;
17
+ plugin: string;
18
+ adapter: string;
19
+ /** Plugin-owned identifier of the configured source, such as a repository or a procurement case. */
20
+ sourceBindingRef: string;
21
+ /** Identifies the assistant publication used to configure the binding. */
22
+ publishedAt: Date;
23
+ /** Configuration generation carried by events so the host can detect a changed binding. */
24
+ revision: number;
25
+ state: 'configuring' | 'enabled' | 'paused' | 'revoked';
26
+ nextScan: Date;
27
+ capture: boolean;
28
+ lastScanAt: Date | null;
29
+ lastError: string | null;
30
+ }
31
+ /**
32
+ * The host processes receipts in sequence for each subject within a binding. Workers claim a
33
+ * lease on this partition so different subjects can progress independently across instances.
34
+ */
35
+ export interface IAgentEventPartition extends IBasePerTenantAndOrganizationEntityModel {
36
+ id: string;
37
+ tenantId: string;
38
+ organizationId: string;
39
+ binding: string;
40
+ kind: string;
41
+ subject: string;
42
+ owner: string | null;
43
+ /** Lease generation. Completion is accepted only from the owner of the current, unexpired lease. */
44
+ fence: string;
45
+ expires: Date | null;
46
+ }
47
+ /**
48
+ * The host's durable receipt for one accepted source event. Redelivery with the same envelope
49
+ * and sourceEventId in this binding returns this receipt. Processing attempts share its id.
50
+ */
51
+ export interface IAgentEventInbox extends IBasePerTenantAndOrganizationEntityModel {
52
+ id: string;
53
+ tenantId: string;
54
+ organizationId: string;
55
+ binding: string;
56
+ partition: string;
57
+ sourceEventId: string;
58
+ event: PluginAgentEvent;
59
+ /** Digest of the accepted envelope used to detect conflicting reuse of a sourceEventId. */
60
+ fingerprint: string;
61
+ /** Host-assigned sequence that orders receipts for dispatch within a partition. */
62
+ seq: string;
63
+ state: 'pending' | 'processing' | 'retry_wait' | 'isolated' | EventDecision['status'];
64
+ attempt: number;
65
+ due: Date;
66
+ receivedAt: Date;
67
+ conflictCount: number;
68
+ decision: EventDecision | null;
69
+ error: string | null;
70
+ }
71
+ /**
72
+ * Localized identity of an event type in the inbox. Types that should share a navigation
73
+ * filter use the same stable category key across plugins and locales.
74
+ */
75
+ export interface AgentEventTypeDisplay {
76
+ label: I18nObject;
77
+ icon: IconDefinition;
78
+ category: {
79
+ key: string;
80
+ label: I18nObject;
81
+ icon: IconDefinition;
82
+ };
83
+ }
84
+ /**
85
+ * Declares an event a source can publish and handle. The host admits a new event only when
86
+ * its type and schemaVersion match a declaration from the bound source.
87
+ */
88
+ export interface AgentEventTypeDefinition {
89
+ type: string;
90
+ schemaVersion: number;
91
+ display?: AgentEventTypeDisplay;
92
+ }
93
+ /**
94
+ * Details a source can show the current viewer for a receipt. The source resolves its domain
95
+ * data at read time, so a change in access also changes which details the inbox can show.
96
+ */
97
+ export interface AgentEventPresentation {
98
+ /** Originating conversation and optional branch. The host checks access before offering navigation. */
99
+ conversation?: {
100
+ conversationId: string;
101
+ threadId?: string;
102
+ };
103
+ title: string;
104
+ fields?: {
105
+ label: I18nObject;
106
+ value: string;
107
+ }[];
108
+ result?: {
109
+ action: I18nObject;
110
+ fields: {
111
+ label: I18nObject;
112
+ value: string;
113
+ }[];
114
+ };
115
+ }
116
+ /** Host feature used to activate the assistant workbench inbox. */
117
+ export declare const EVENT_INBOX_FEATURE = "platform.event-inbox";
118
+ /** Personal host slot for a user's inbox across assistants. */
119
+ export declare const USER_EVENT_INBOX_SLOT = "user.event-inbox";
120
+ /** Built-in remote view shared by the assistant workbench and personal inbox entry points. */
121
+ export declare const EVENT_INBOX_VIEW_KEY = "platform.event-inbox__inbox";
@@ -0,0 +1,139 @@
1
+ import { z } from 'zod/v3';
2
+ /** Validates the source-defined object identity carried in a subject or a handling result. */
3
+ export declare const agentEventRefSchema: z.ZodObject<{
4
+ kind: z.ZodEffects<z.ZodString, string, string>;
5
+ key: z.ZodEffects<z.ZodString, string, string>;
6
+ }, "strict", z.ZodTypeAny, {
7
+ kind: string;
8
+ key: string;
9
+ }, {
10
+ kind: string;
11
+ key: string;
12
+ }>;
13
+ /** Validates the event envelope at inbox admission. The source retains the referenced business data. */
14
+ export declare const pluginAgentEventSchema: z.ZodObject<{
15
+ sourceEventId: z.ZodEffects<z.ZodString, string, string>;
16
+ bindingRevision: z.ZodNumber;
17
+ type: z.ZodEffects<z.ZodString, string, string>;
18
+ schemaVersion: z.ZodNumber;
19
+ occurredAt: z.ZodString;
20
+ subject: z.ZodObject<{
21
+ kind: z.ZodEffects<z.ZodString, string, string>;
22
+ key: z.ZodEffects<z.ZodString, string, string>;
23
+ }, "strict", z.ZodTypeAny, {
24
+ kind: string;
25
+ key: string;
26
+ }, {
27
+ kind: string;
28
+ key: string;
29
+ }>;
30
+ fact: z.ZodObject<{
31
+ key: z.ZodEffects<z.ZodString, string, string>;
32
+ revision: z.ZodEffects<z.ZodString, string, string>;
33
+ sha256: z.ZodString;
34
+ }, "strict", z.ZodTypeAny, {
35
+ key: string;
36
+ revision: string;
37
+ sha256: string;
38
+ }, {
39
+ key: string;
40
+ revision: string;
41
+ sha256: string;
42
+ }>;
43
+ }, "strict", z.ZodTypeAny, {
44
+ type: string;
45
+ sourceEventId: string;
46
+ bindingRevision: number;
47
+ schemaVersion: number;
48
+ occurredAt: string;
49
+ subject: {
50
+ kind: string;
51
+ key: string;
52
+ };
53
+ fact: {
54
+ key: string;
55
+ revision: string;
56
+ sha256: string;
57
+ };
58
+ }, {
59
+ type: string;
60
+ sourceEventId: string;
61
+ bindingRevision: number;
62
+ schemaVersion: number;
63
+ occurredAt: string;
64
+ subject: {
65
+ kind: string;
66
+ key: string;
67
+ };
68
+ fact: {
69
+ key: string;
70
+ revision: string;
71
+ sha256: string;
72
+ };
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
+ */
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
+ */
84
+ export type PluginAgentEvent = z.infer<typeof pluginAgentEventSchema>;
85
+ /** Accepts a completed source handler outcome for storage on the inbox receipt. */
86
+ export declare const agentEventDecisionSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
87
+ status: z.ZodLiteral<"handled">;
88
+ operationKey: z.ZodEffects<z.ZodString, string, string>;
89
+ resultRef: z.ZodObject<{
90
+ kind: z.ZodEffects<z.ZodString, string, string>;
91
+ key: z.ZodEffects<z.ZodString, string, string>;
92
+ }, "strict", z.ZodTypeAny, {
93
+ kind: string;
94
+ key: string;
95
+ }, {
96
+ kind: string;
97
+ key: string;
98
+ }>;
99
+ }, "strict", z.ZodTypeAny, {
100
+ status: "handled";
101
+ operationKey: string;
102
+ resultRef: {
103
+ kind: string;
104
+ key: string;
105
+ };
106
+ }, {
107
+ status: "handled";
108
+ operationKey: string;
109
+ resultRef: {
110
+ kind: string;
111
+ key: string;
112
+ };
113
+ }>, z.ZodObject<{
114
+ status: z.ZodLiteral<"ignored">;
115
+ reasonCode: z.ZodString;
116
+ }, "strict", z.ZodTypeAny, {
117
+ status: "ignored";
118
+ reasonCode: string;
119
+ }, {
120
+ status: "ignored";
121
+ reasonCode: string;
122
+ }>, z.ZodObject<{
123
+ status: z.ZodLiteral<"blocked">;
124
+ reasonCode: z.ZodString;
125
+ }, "strict", z.ZodTypeAny, {
126
+ status: "blocked";
127
+ reasonCode: string;
128
+ }, {
129
+ status: "blocked";
130
+ reasonCode: string;
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
+ */
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
+ }>;