@xpert-ai/plugin-sdk 3.27.0 → 3.28.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 (36) hide show
  1. package/collaboration-client.cjs.js +31 -5
  2. package/collaboration-client.esm.js +31 -5
  3. package/index.cjs.js +310 -45
  4. package/index.esm.js +303 -47
  5. package/model-provider.cjs.js +2 -1
  6. package/model-provider.esm.js +2 -1
  7. package/package.json +2 -2
  8. package/src/index.d.ts +1 -0
  9. package/src/lib/agent/handoff/types.d.ts +5 -0
  10. package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +6 -1
  11. package/src/lib/agent/runtime/capability.d.ts +4 -0
  12. package/src/lib/agent/runtime/cli-model-profile.d.ts +1 -1
  13. package/src/lib/agent/runtime/execution-runner.d.ts +11 -0
  14. package/src/lib/agent/runtime/index.d.ts +2 -0
  15. package/src/lib/agent/runtime/managed.d.ts +94 -0
  16. package/src/lib/agent/runtime/process-supervisor.d.ts +1 -0
  17. package/src/lib/agent/runtime/strategy.d.ts +14 -0
  18. package/src/lib/agent/runtime/types.d.ts +30 -1
  19. package/src/lib/ai-model/native-model.d.ts +5 -1
  20. package/src/lib/assistant-capability/index.d.ts +1 -0
  21. package/src/lib/assistant-capability/middleware.d.ts +10 -0
  22. package/src/lib/collaboration/types.d.ts +5 -0
  23. package/src/lib/content-resource/catalog.d.ts +88 -0
  24. package/src/lib/content-resource/editor-compatibility.d.ts +3 -0
  25. package/src/lib/content-resource/editor.d.ts +35 -3
  26. package/src/lib/content-resource/index.d.ts +3 -0
  27. package/src/lib/execution-control/context.d.ts +7 -0
  28. package/src/lib/execution-control/index.d.ts +2 -0
  29. package/src/lib/managed-queue/index.d.ts +12 -0
  30. package/src/lib/runtime/capabilities/artifact-drafts.d.ts +10 -1
  31. package/src/lib/runtime/capabilities/mcp-client-runtime.d.ts +2 -0
  32. package/src/lib/runtime/capabilities/sandbox-jobs.d.ts +12 -3
  33. package/src/lib/sandbox/file-edit-command.d.ts +2 -0
  34. package/src/lib/sandbox/file-edit-diff.d.ts +1 -0
  35. package/src/lib/sandbox/protocol.d.ts +13 -1
  36. package/src/lib/sandbox/runtime-provider.d.ts +12 -0
package/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { Module, applyDecorators, SetMetadata, HttpException, HttpStatus, BadReq
2
2
  import { MODULE_METADATA } from '@nestjs/common/constants.js';
3
3
  import { pick } from 'lodash-es';
4
4
  import { dispatchCustomEvent } from '@langchain/core/callbacks/dispatch';
5
- import { ChatMessageEventTypeEnum, createResourceCardContent, LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelPropertyKey, readModelConfiguration, ModelFeature, isDiscoverableModelType, configurationFromModel, projectTaskExecutionContextSchema, projectTaskExecutionReferenceSchema, agentRuntimeProgressSchema, agentInvocationTerminalStatusSchema, projectPipelineWorkContextSchema, MCP_REQUIRED_CONTEXTS, MCP_CAPABILITY_APPROVAL_MODES, MCP_TOOL_RISKS, MCP_TOOL_SIDE_EFFECTS, MCP_TOOL_IDEMPOTENCY, MCP_CAPABILITY_VISIBILITIES, PLUGIN_COMPONENT_TYPE, projectPipelineContributionSchema, projectPipelineRefSchema } from '@xpert-ai/contracts';
5
+ import { ChatMessageEventTypeEnum, createResourceCardContent, LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelPropertyKey, readModelConfiguration, ModelFeature, isDiscoverableModelType, configurationFromModel, projectTaskExecutionContextSchema, projectTaskExecutionReferenceSchema, agentRuntimeProgressSchema, agentInvocationTerminalStatusSchema, projectPipelineWorkContextSchema, WorkflowNodeTypeEnum, MCP_REQUIRED_CONTEXTS, MCP_CAPABILITY_APPROVAL_MODES, MCP_TOOL_RISKS, MCP_TOOL_SIDE_EFFECTS, MCP_TOOL_IDEMPOTENCY, MCP_CAPABILITY_VISIBILITIES, PLUGIN_COMPONENT_TYPE, projectPipelineContributionSchema, projectPipelineRefSchema } from '@xpert-ai/contracts';
6
6
  export { ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, ASSISTANT_CONTEXT_SET_COMMAND, agentOutputDeliverySchema, agentResultPathSchema, configurationFromModel, createResourceCardContent, parseResourceCard, projectPipelineContributionSchema, resourceCardId } from '@xpert-ai/contracts';
7
7
  import { DiscoveryService, Reflector } from '@nestjs/core';
8
8
  import { Subject, filter } from 'rxjs';
@@ -43,8 +43,8 @@ import { z as z$1 } from 'zod';
43
43
  export { A as AGENT_TASK_RESULTS_FEATURE, a as agentResultItemSchema, b as agentTaskResultSchema } from './results.esm.js';
44
44
  import { assertConnectorDefinition } from './connector.esm.js';
45
45
  export { CONNECTOR_AUTHORIZATION_MODES, CONNECTOR_SCOPE_TYPES, getConnectorAuthMethods, getConnectorAuthorizationModes } from './connector.esm.js';
46
- export { base64ToBytes, bytesToBase64, createCollaborationClient, createCollaborationPresenceStore, createSocketIoTransportAdapter, createYjsDocumentAdapter } from './collaboration-client.esm.js';
47
46
  import { _ as _object_without_properties_loose$2 } from './_object_without_properties_loose.esm.js';
47
+ export { base64ToBytes, bytesToBase64, createCollaborationClient, createCollaborationPresenceStore, createSocketIoTransportAdapter, createYjsDocumentAdapter } from './collaboration-client.esm.js';
48
48
  import { tool } from '@langchain/core/tools';
49
49
 
50
50
  /**
@@ -4556,6 +4556,107 @@ function taskWaitReason(states, mode) {
4556
4556
  const AgentExecutionRunnerCapability = createRuntimeCapability('platform.agent_execution.runner');
4557
4557
  const AgentExecutionRunnerFactoryCapability = createRuntimeCapability('platform.agent_execution.runner.factory');
4558
4558
 
4559
+ // Invariants: this payload has no runtime imports; protocol streams are not exit evidence.
4560
+ // The device supervisor regression test enforces identical process supervision semantics.
4561
+ const AGENT_PROCESS_SUPERVISOR = String.raw`
4562
+ import ctypes, errno, json, os, signal, subprocess, sys, time
4563
+ owner = int(sys.argv[1])
4564
+ stopping = False
4565
+ strong = False
4566
+ if sys.platform.startswith('linux'):
4567
+ strong = ctypes.CDLL(None, use_errno=True).prctl(36, 1, 0, 0, 0) == 0
4568
+ def stop(*args):
4569
+ global stopping
4570
+ stopping = True
4571
+ signal.signal(signal.SIGTERM, stop)
4572
+ signal.signal(signal.SIGINT, stop)
4573
+ # The supervisor is the process-group leader. Its live PID reserves the group identity.
4574
+ os.write(3, b'{"ready":true}\n')
4575
+ try:
4576
+ if os.getppid() != owner: raise OSError('Original host exited before admission')
4577
+ child = subprocess.Popen(sys.argv[2:], close_fds=True)
4578
+ except OSError:
4579
+ os.write(3, json.dumps({'version': 1, 'state': 'not_started', 'coverage': 'descendants', 'exitCode': 127}).encode())
4580
+ sys.exit(0)
4581
+ # Only the protocol child owns stdin, so a closed transport still produces EPIPE.
4582
+ os.close(0)
4583
+ code = None
4584
+ deadline = None
4585
+ while True:
4586
+ if os.getppid() != owner: stopping = True
4587
+ if code is None:
4588
+ value = child.poll()
4589
+ if value is not None: code = value; stopping = True
4590
+ if stopping and deadline is None:
4591
+ deadline = time.monotonic() + 2
4592
+ os.killpg(os.getpgrp(), signal.SIGTERM)
4593
+ if deadline is not None and time.monotonic() >= deadline:
4594
+ if not strong:
4595
+ # No subreaper means escaped descendants cannot be certified. No receipt is emitted.
4596
+ os.killpg(os.getpgrp(), signal.SIGKILL)
4597
+ # Kill only still-waitable direct children. Orphans are adopted by this subreaper;
4598
+ # holding them until waitpid prevents PID reuse between selection and signalling.
4599
+ try:
4600
+ ids = open('/proc/self/task/' + str(os.getpid()) + '/children').read().split()
4601
+ for value in ids:
4602
+ try: os.kill(int(value), signal.SIGKILL)
4603
+ except ProcessLookupError: pass
4604
+ except OSError:
4605
+ os.killpg(os.getpgrp(), signal.SIGKILL)
4606
+ if stopping and strong:
4607
+ empty = False
4608
+ while True:
4609
+ try:
4610
+ pid, status = os.waitpid(-1, os.WNOHANG)
4611
+ if pid == 0: break
4612
+ if pid == child.pid and code is None: code = os.waitstatus_to_exitcode(status)
4613
+ except ChildProcessError:
4614
+ empty = True
4615
+ break
4616
+ if empty:
4617
+ os.write(3, json.dumps({'version': 1, 'state': 'exited', 'coverage': 'descendants', 'exitCode': code}).encode())
4618
+ sys.exit(0)
4619
+ time.sleep(.02)
4620
+ `;
4621
+
4622
+ /** Persisted host ownership marker. Only built-in presets are supported. */ const managedAgentRuntimeSchema = z.object({
4623
+ type: z.literal('builtin'),
4624
+ version: z.string().min(1)
4625
+ }).strict();
4626
+ /** Launch settings supplied by the installed strategy, never by tool input or host provider lists. */ const agentRuntimeDeploymentSpecSchema = z.discriminatedUnion('type', [
4627
+ z.object({
4628
+ type: z.literal('process'),
4629
+ command: z.string().min(1).refine((value)=>!value.includes('\0')),
4630
+ args: z.array(z.string().refine((value)=>!value.includes('\0'))),
4631
+ environment: z.record(z.string(), z.string()),
4632
+ model: z.string().min(1).optional(),
4633
+ timeoutMs: z.number().int().min(1000).max(3600000)
4634
+ }).strict(),
4635
+ z.object({
4636
+ type: z.literal('sdk'),
4637
+ environment: z.record(z.string(), z.string()),
4638
+ model: z.string().min(1).optional(),
4639
+ timeoutMs: z.number().int().min(1000).max(3600000)
4640
+ }).strict(),
4641
+ z.object({
4642
+ type: z.literal('service'),
4643
+ serverUrl: z.string().url().refine((value)=>{
4644
+ try {
4645
+ const url = new URL(value);
4646
+ return [
4647
+ 'http:',
4648
+ 'https:'
4649
+ ].includes(url.protocol) && !url.username && !url.password && !url.search && !url.hash;
4650
+ } catch (e) {
4651
+ return false;
4652
+ }
4653
+ }),
4654
+ authorization: z.string().optional(),
4655
+ timeoutMs: z.number().int().min(1000).max(3600000)
4656
+ }).strict()
4657
+ ]);
4658
+ /** Used by SDK/process/service adapters. The host pins the target and rechecks access; no caller-selected scope. */ const AgentRuntimeDeploymentCapability = createRuntimeCapability('platform.agent_runtime.deployment');
4659
+
4559
4660
  /** Host-only provenance. This describes a saved operation; it never grants access by itself. */ const projectPipelineInvocationScopeSchema = z.object({
4560
4661
  tenantId: z.string().uuid(),
4561
4662
  organizationId: z.string().uuid(),
@@ -4575,6 +4676,69 @@ const AgentExecutionRunnerFactoryCapability = createRuntimeCapability('platform.
4575
4676
 
4576
4677
  /** Older runtime plugins can still send this event; new emissions use ON_CHAT_EVENT. */ const RESOURCE_CARD_EVENT = 'xpert.resource_card';
4577
4678
 
4679
+ function middleware(node) {
4680
+ return node.type === 'workflow' && node.entity.type === WorkflowNodeTypeEnum.MIDDLEWARE;
4681
+ }
4682
+ function hasAssistantMiddleware(draft, provider) {
4683
+ return draft.nodes.some((node)=>middleware(node) && node.entity.provider === provider && draft.connections.some((edge)=>{
4684
+ var _draft_team_agent;
4685
+ return edge.type === 'workflow' && edge.from === ((_draft_team_agent = draft.team.agent) == null ? void 0 : _draft_team_agent.key) && edge.to.split('/')[0] === node.key;
4686
+ }));
4687
+ }
4688
+ /** Compose only the draft graph. The platform records the contribution for safe removal.
4689
+ * No Project, permission, external resource or implicit replacement is created here. */ function applyAssistantMiddleware(draft, input) {
4690
+ var _agent_entity_prompt;
4691
+ const agent = draft.nodes.find((node)=>{
4692
+ var _draft_team_agent;
4693
+ return node.type === 'agent' && node.key === ((_draft_team_agent = draft.team.agent) == null ? void 0 : _draft_team_agent.key);
4694
+ });
4695
+ if ((agent == null ? void 0 : agent.type) !== 'agent') throw new BadRequestException('assistant.invalid_draft');
4696
+ if (!hasAssistantMiddleware(draft, input.provider)) {
4697
+ var _agent_entity_options, _agent_entity_options_middlewares, _agent_entity_options1;
4698
+ let key = input.key;
4699
+ for(let suffix = 2; draft.nodes.some((node)=>node.key === key) || draft.connections.some((edge)=>edge.key === `${agent.key}/${key}`); suffix++)key = `${input.key}_${suffix}`;
4700
+ const entity = {
4701
+ id: key,
4702
+ key,
4703
+ type: WorkflowNodeTypeEnum.MIDDLEWARE,
4704
+ title: input.title,
4705
+ provider: input.provider,
4706
+ required: true,
4707
+ options: {}
4708
+ };
4709
+ draft.nodes.push({
4710
+ type: 'workflow',
4711
+ key,
4712
+ position: {
4713
+ x: 620,
4714
+ y: 160 * (draft.nodes.length - 1)
4715
+ },
4716
+ entity
4717
+ });
4718
+ draft.connections.push({
4719
+ key: `${agent.key}/${key}`,
4720
+ type: 'workflow',
4721
+ from: agent.key,
4722
+ to: key,
4723
+ required: true
4724
+ });
4725
+ var _agent_entity_options_middlewares_order;
4726
+ agent.entity.options = _extends({}, agent.entity.options, {
4727
+ parallelToolCalls: false,
4728
+ middlewares: _extends({}, (_agent_entity_options = agent.entity.options) == null ? void 0 : _agent_entity_options.middlewares, {
4729
+ order: [
4730
+ ...(_agent_entity_options_middlewares_order = (_agent_entity_options1 = agent.entity.options) == null ? void 0 : (_agent_entity_options_middlewares = _agent_entity_options1.middlewares) == null ? void 0 : _agent_entity_options_middlewares.order) != null ? _agent_entity_options_middlewares_order : [],
4731
+ key
4732
+ ]
4733
+ })
4734
+ });
4735
+ }
4736
+ if (!((_agent_entity_prompt = agent.entity.prompt) == null ? void 0 : _agent_entity_prompt.includes(input.instructions))) agent.entity.prompt = [
4737
+ agent.entity.prompt,
4738
+ input.instructions
4739
+ ].filter(Boolean).join('\n\n');
4740
+ }
4741
+
4578
4742
  const ASSISTANT_CAPABILITY_PROVIDER = 'ASSISTANT_CAPABILITY_PROVIDER';
4579
4743
  const AssistantCapabilityProvider = (key)=>applyDecorators(SetMetadata(ASSISTANT_CAPABILITY_PROVIDER, key), SetMetadata(STRATEGY_META_KEY, ASSISTANT_CAPABILITY_PROVIDER));
4580
4744
  let AssistantCapabilityProviderRegistry = class AssistantCapabilityProviderRegistry extends BaseStrategyRegistry {
@@ -4941,26 +5105,59 @@ function resolveSandboxBackend(sandbox) {
4941
5105
  return isSandboxBackend(candidate) ? candidate : null;
4942
5106
  }
4943
5107
 
5108
+ const editMetricsSchema = z.object({
5109
+ occurrences: z.number().int().nonnegative(),
5110
+ oldLines: z.number().int().nonnegative(),
5111
+ newLines: z.number().int().nonnegative(),
5112
+ changed: z.boolean(),
5113
+ diff: z.object({
5114
+ removed: z.number().int().nonnegative(),
5115
+ added: z.number().int().nonnegative()
5116
+ }).optional(),
5117
+ diffUnavailable: z.enum([
5118
+ 'comparison_budget_exceeded',
5119
+ 'diff_unavailable'
5120
+ ]).optional()
5121
+ });
5122
+ function editMetrics(output) {
5123
+ try {
5124
+ const result = editMetricsSchema.safeParse(JSON.parse(output));
5125
+ if (!result.success) return undefined;
5126
+ const _result_data = result.data, { diff } = _result_data, metrics = _object_without_properties_loose$2(_result_data, [
5127
+ "diff"
5128
+ ]);
5129
+ return _extends({}, metrics, diff ? {
5130
+ diff: {
5131
+ removed: diff.removed,
5132
+ added: diff.added
5133
+ }
5134
+ } : {});
5135
+ } catch (e) {
5136
+ return undefined;
5137
+ }
5138
+ }
4944
5139
  function editCommandResult(filePath, result) {
5140
+ const metrics = editMetrics(result.output);
4945
5141
  switch(result.exitCode){
4946
5142
  case 0:
4947
- return {
5143
+ return _extends({
4948
5144
  path: filePath,
4949
- filesUpdate: null,
5145
+ filesUpdate: null
5146
+ }, metrics != null ? metrics : {
4950
5147
  occurrences: parseInt(result.output.trim(), 10) || 1
4951
- };
5148
+ });
4952
5149
  case 1:
4953
- return {
5150
+ return _extends({}, metrics, {
4954
5151
  error: `String not found in file '${filePath}'`
4955
- };
5152
+ });
4956
5153
  case 2:
4957
- return {
5154
+ return _extends({}, metrics, {
4958
5155
  error: `Multiple occurrences found in '${filePath}'. Use replaceAll=true to replace all.`
4959
- };
5156
+ });
4960
5157
  case 3:
4961
- return {
5158
+ return _extends({}, metrics, {
4962
5159
  error: `Error: File '${filePath}' not found`
4963
- };
5160
+ });
4964
5161
  default:
4965
5162
  return {
4966
5163
  error: `Unknown error editing file '${filePath}'`
@@ -5002,6 +5199,88 @@ function editCommandResult(filePath, result) {
5002
5199
  };
5003
5200
  }
5004
5201
 
5202
+ // Embedded in the existing sandbox Node process; no Git, subprocess, or temporary files.
5203
+ const FILE_EDIT_DIFF_SCRIPT = String.raw`
5204
+ function inspectLineDiff(before, after) {
5205
+ if (before === after) return { diff: { removed: 0, added: 0 } };
5206
+ // Include line terminators so a missing final newline is an actual line change.
5207
+ const oldLines = before.match(/[^\n]*\n|[^\n]+$/g) || [];
5208
+ const newLines = after.match(/[^\n]*\n|[^\n]+$/g) || [];
5209
+ let start = 0, oldEnd = oldLines.length, newEnd = newLines.length;
5210
+ while (start < oldEnd && start < newEnd && oldLines[start] === newLines[start]) start++;
5211
+ while (oldEnd > start && newEnd > start && oldLines[oldEnd - 1] === newLines[newEnd - 1]) {
5212
+ oldEnd--;
5213
+ newEnd--;
5214
+ }
5215
+ const removed = oldEnd - start, added = newEnd - start;
5216
+ if (!removed || !added) return { diff: { removed, added } };
5217
+
5218
+ // Myers shortest edit distance needs only a frontier when reporting counts, not a patch.
5219
+ // Bound the optional quadratic search on broad rewrites; never limit the edit itself.
5220
+ const maxDistance = Math.min(removed + added, 2000);
5221
+ const offset = maxDistance + 1;
5222
+ const frontier = new Int32Array(2 * maxDistance + 3);
5223
+ let work = 0;
5224
+ for (let distance = 0; distance <= maxDistance; distance++) {
5225
+ for (let diagonal = -distance; diagonal <= distance; diagonal += 2) {
5226
+ if (++work > 1000000) return { diffUnavailable: 'comparison_budget_exceeded' };
5227
+ const index = offset + diagonal;
5228
+ let x = diagonal === -distance || (diagonal !== distance && frontier[index - 1] < frontier[index + 1])
5229
+ ? frontier[index + 1]
5230
+ : frontier[index - 1] + 1;
5231
+ let y = x - diagonal;
5232
+ while (x < removed && y < added && oldLines[start + x] === newLines[start + y]) {
5233
+ if (++work > 1000000) return { diffUnavailable: 'comparison_budget_exceeded' };
5234
+ x++;
5235
+ y++;
5236
+ }
5237
+ if (x >= removed && y >= added) {
5238
+ return { diff: { removed: (distance + removed - added) / 2, added: (distance + added - removed) / 2 } };
5239
+ }
5240
+ frontier[index] = x;
5241
+ }
5242
+ }
5243
+ return { diffUnavailable: 'comparison_budget_exceeded' };
5244
+ }
5245
+ `;
5246
+
5247
+ /** Compare actual file contents inside the sandbox; reporting must never prevent an edit. */ function buildEditCommand(filePath, oldString, newString, replaceAll) {
5248
+ const encoded = Buffer.from(JSON.stringify({
5249
+ filePath,
5250
+ oldString,
5251
+ newString,
5252
+ replaceAll
5253
+ })).toString('base64');
5254
+ const script = `
5255
+ const fs = require('node:fs');
5256
+ const input = JSON.parse(Buffer.from('${encoded}', 'base64').toString('utf8'));
5257
+ const lines = text => text.length ? text.split('\\n').length - Number(text.endsWith('\\n')) : 0;
5258
+ const metrics = { oldLines: lines(input.oldString), newLines: lines(input.newString) };
5259
+
5260
+ ${FILE_EDIT_DIFF_SCRIPT}
5261
+
5262
+ function unchanged(exitCode) {
5263
+ console.log(JSON.stringify({ ...metrics, occurrences: 0, changed: false, diff: { removed: 0, added: 0 } }));
5264
+ process.exit(exitCode);
5265
+ }
5266
+ let before;
5267
+ try { before = fs.readFileSync(input.filePath, 'utf8'); } catch { unchanged(3); }
5268
+ const occurrences = before.split(input.oldString).length - 1;
5269
+ if (occurrences === 0) unchanged(1);
5270
+ if (occurrences > 1 && !input.replaceAll) unchanged(2);
5271
+ const after = before.split(input.oldString).join(input.newString);
5272
+ const changed = before !== after;
5273
+ if (changed) fs.writeFileSync(input.filePath, after, 'utf8');
5274
+ try {
5275
+ Object.assign(metrics, inspectLineDiff(before, after));
5276
+ } catch {
5277
+ metrics.diffUnavailable = 'diff_unavailable';
5278
+ }
5279
+ console.log(JSON.stringify({ ...metrics, occurrences, changed }));
5280
+ `;
5281
+ return `node -e '${script.replace(/'/g, "'\\''")}'`;
5282
+ }
5283
+
5005
5284
  const MAX_LINE_LENGTH = 500;
5006
5285
  const MAX_GREP_LINE_LENGTH = 2000;
5007
5286
  const GREP_RESULT_LIMIT = 100;
@@ -5501,41 +5780,6 @@ fs.appendFileSync(filePath, content, 'utf-8');
5501
5780
  console.log('OK');
5502
5781
  "`;
5503
5782
  }
5504
- /**
5505
- * Node.js command template for editing files.
5506
- */ function buildEditCommand(filePath, oldStr, newStr, replaceAll) {
5507
- const pathB64 = utf8ToBase64(filePath);
5508
- const oldB64 = utf8ToBase64(oldStr);
5509
- const newB64 = utf8ToBase64(newStr);
5510
- return `node -e "
5511
- const fs = require('fs');
5512
-
5513
- const filePath = Buffer.from('${pathB64}', 'base64').toString('utf-8');
5514
- const oldStr = Buffer.from('${oldB64}', 'base64').toString('utf-8');
5515
- const newStr = Buffer.from('${newB64}', 'base64').toString('utf-8');
5516
- const replaceAll = ${Boolean(replaceAll)};
5517
-
5518
- let text;
5519
- try {
5520
- text = fs.readFileSync(filePath, 'utf-8');
5521
- } catch (e) {
5522
- process.exit(3);
5523
- }
5524
-
5525
- const count = text.split(oldStr).length - 1;
5526
-
5527
- if (count === 0) {
5528
- process.exit(1);
5529
- }
5530
- if (count > 1 && !replaceAll) {
5531
- process.exit(2);
5532
- }
5533
-
5534
- const result = text.split(oldStr).join(newStr);
5535
- fs.writeFileSync(filePath, result, 'utf-8');
5536
- console.log(count);
5537
- "`;
5538
- }
5539
5783
  /**
5540
5784
  * Node.js command template for grep operations.
5541
5785
  */ function buildGrepCommand(pattern, searchPath, globPattern) {
@@ -5995,6 +6239,8 @@ function normalizePluginJobProcessorMetadata(options) {
5995
6239
  pluginName,
5996
6240
  queueName,
5997
6241
  jobName
6242
+ }, options.controlContract === undefined ? {} : {
6243
+ controlContract: requireManagedQueueDecoratorValue(options.controlContract, 'controlContract')
5998
6244
  }, concurrency === undefined ? {} : {
5999
6245
  concurrency: Math.trunc(concurrency)
6000
6246
  });
@@ -6567,9 +6813,19 @@ const ContentReferencesRuntimeCapability = createRuntimeCapability('platform.con
6567
6813
  description: 'Authorized durable document references; plugins provide source-specific listing and files.'
6568
6814
  });
6569
6815
 
6816
+ /** Matching semantic type alone never grants a writer access to an incompatible native model. */ function supportsContentModel(editor, model, access) {
6817
+ return editor.supports.some((item)=>item.typeId === model.typeId && item.modelId === model.modelId && item.schemaVersion === model.schemaVersion && item.editProtocol.id === model.editProtocol.id && item.editProtocol.version === model.editProtocol.version && item.access.includes(access));
6818
+ }
6819
+
6570
6820
  function isTextContentEditor(provider) {
6571
6821
  return provider.descriptor.kind === 'text-document';
6572
6822
  }
6823
+ function isFileContentEditor(provider) {
6824
+ return provider.descriptor.kind === 'file';
6825
+ }
6826
+ function isResourceContentEditor(provider) {
6827
+ return provider.descriptor.kind === 'resource';
6828
+ }
6573
6829
  const EDITOR_PROVIDER = 'XPERT_CONTENT_EDITOR_PROVIDER';
6574
6830
  const ContentEditorProvider = (key)=>applyDecorators(SetMetadata(EDITOR_PROVIDER, key), SetMetadata(STRATEGY_META_KEY, EDITOR_PROVIDER));
6575
6831
  let ContentEditorRegistry = class ContentEditorRegistry extends BaseStrategyRegistry {
@@ -10828,4 +11084,4 @@ Reflect.defineMetadata('__command__', {
10828
11084
  id: ImportDefaultAgentPluginsCommand.type
10829
11085
  }, ImportDefaultAgentPluginsCommand);
10830
11086
 
10831
- export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PROVIDER, ARTIFACT_PRESENTATION_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AnalyticsDefinitionAuthoringCapability, AnalyticsProvider, AnalyticsProviderRegistry, AnalyticsRuntimeCapability, ArtifactPresentationProvider, ArtifactPresentationRegistry, AssistantCapabilityProvider, AssistantCapabilityProviderRegistry, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CLI_MODEL_TOKEN_REFERENCE, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CONTENT_RESOURCE_PROVIDER, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorDocumentsRuntimeCapability, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, ContentDocumentsRuntimeCapability, ContentEditorProvider, ContentEditorRegistry, ContentEditorsRuntimeCapability, ContentReferencesRuntimeCapability, ContentResourceProvider, ContentResourceProviderRegistry, ContentResourcesRuntimeCapability, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionBaselineRuntimeCapability, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, ImportDefaultAgentPluginsCommand, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeDocumentVisualAssetsRuntimeCapability, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, KnowledgeGraphRuntimeCapability, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseProvisioningRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, ListAnalyticsSourcesCommand, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_PIPELINE_CONTRIBUTION, PROJECT_PIPELINE_PROJECTION_PROVIDER, PROJECT_PIPELINE_RUNTIME_ADAPTER, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectPipelineAnalyticsRuntimeCapability, ProjectPipelineCatalogRuntimeCapability, ProjectPipelineCommandsRuntimeCapability, ProjectPipelineConfigurationRuntimeCapability, ProjectPipelineContributionRegistry, ProjectPipelineContributor, ProjectPipelineEvidenceRuntimeCapability, ProjectPipelinePortfolioRuntimeCapability, ProjectPipelineProjectionProvider, ProjectPipelineProjectionProviderRegistry, ProjectPipelineProviderActionsRuntimeCapability, ProjectPipelineRuntimeAdapterProvider, ProjectPipelineRuntimeAdapterRegistry, ProjectPipelinesRuntimeCapability, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResolveAnalyticsSourceCommand, ResolveConnectorIntegrationQuery, ResourceCardProvider, ResourceCardProviderRegistry, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, ShellModelExecutionSourceCapability, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, ViewMiddlewareRuntimeCapability, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, applyModelConfiguration, applyModelContextSize, artifactPresentationKey, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createMutationEvidence, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, discoverOpenAIModels, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, isTextContentEditor, jsonEncodedSchema, knowledgebaseActions, loadYamlFile, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, projectPipelineInvocationScopeSchema, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, taskWaitReason, textTokenBoundaries, validateAnalyticsPayload };
11087
+ export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AGENT_PROCESS_SUPERVISOR, AGENT_RUNTIME_EVENT_MESSAGE_TYPE, AGENT_RUNTIME_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ANALYTICS_PROVIDER, ARTIFACT_PRESENTATION_PROVIDER, ASSISTANT_CAPABILITY_PROVIDER, AdapterDataSourceStrategy, AgentExecutionRunnerCapability, AgentExecutionRunnerFactoryCapability, AgentInvocationRuntimeCapability, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AgentRuntimeDeploymentCapability, AgentRuntimeFactoryCapability, AgentRuntimeRegistry, AgentRuntimeStrategy, AiModelNotFoundException, AnalyticsDefinitionAuthoringCapability, AnalyticsProvider, AnalyticsProviderRegistry, AnalyticsRuntimeCapability, ArtifactPresentationProvider, ArtifactPresentationRegistry, AssistantCapabilityProvider, AssistantCapabilityProviderRegistry, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, CLI_MODEL_TOKEN_REFERENCE, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CONTENT_RESOURCE_PROVIDER, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CliModelProfilesCapability, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorDocumentsRuntimeCapability, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, ContentDocumentsRuntimeCapability, ContentEditorProvider, ContentEditorRegistry, ContentEditorsRuntimeCapability, ContentReferencesRuntimeCapability, ContentResourceProvider, ContentResourceProviderRegistry, ContentResourcesRuntimeCapability, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionBaselineRuntimeCapability, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, ImportDefaultAgentPluginsCommand, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KEYWORD_ANALYZER_STRATEGY, KNOWLEDGE_STRATEGY, KeywordAnalyzerRegistry, KeywordAnalyzerStrategy, KnowledgeDocumentVisualAssetsRuntimeCapability, KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, KnowledgeGraphRuntimeCapability, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseProvisioningRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, ListAnalyticsSourcesCommand, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelExecutionEnvironmentCapability, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROJECT_PIPELINE_CONTRIBUTION, PROJECT_PIPELINE_PROJECTION_PROVIDER, PROJECT_PIPELINE_RUNTIME_ADAPTER, PROJECT_TASK_PROVIDER, PROJECT_TYPE_PROVIDER, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, ProjectPipelineAnalyticsRuntimeCapability, ProjectPipelineCatalogRuntimeCapability, ProjectPipelineCommandsRuntimeCapability, ProjectPipelineConfigurationRuntimeCapability, ProjectPipelineContributionRegistry, ProjectPipelineContributor, ProjectPipelineEvidenceRuntimeCapability, ProjectPipelinePortfolioRuntimeCapability, ProjectPipelineProjectionProvider, ProjectPipelineProjectionProviderRegistry, ProjectPipelineProviderActionsRuntimeCapability, ProjectPipelineRuntimeAdapterProvider, ProjectPipelineRuntimeAdapterRegistry, ProjectPipelinesRuntimeCapability, ProjectTaskProvider, ProjectTaskProviderRegistry, ProjectTasksRuntimeCapability, ProjectTypeProvider, ProjectTypeProviderRegistry, RESOURCE_CARD_EVENT, RESOURCE_CARD_PROVIDER, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, ResolveAnalyticsSourceCommand, ResolveConnectorIntegrationQuery, ResourceCardProvider, ResourceCardProviderRegistry, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, ShellModelExecutionSourceCapability, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, ViewMiddlewareRuntimeCapability, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, agentInvocationDispatchContextSchema, agentRuntimeConsumptionStateSchema, agentRuntimeDeliveryStateSchema, agentRuntimeDeploymentSpecSchema, agentRuntimeEventMessageId, agentRuntimeEventSchema, agentRuntimeReplyTargetSchema, agentRuntimeResultClaimSchema, agentRuntimeResultConsumptionKey, als, appendSandboxMessage, applyAssistantMiddleware, applyModelConfiguration, applyModelContextSize, artifactPresentationKey, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createMutationEvidence, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, discoverOpenAIModels, downloadRemoteFile, emitResourceCard, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, hasAssistantMiddleware, isAgentInvocationTerminal, isDevelopmentSandboxRuntimeEnvironment, isFileContentEditor, isModelOutputValidationError, isModelUsagePricingConfig, isPluginArtifactNamespace, isRemoteFile, isResourceContentEditor, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, isTextContentEditor, jsonEncodedSchema, knowledgebaseActions, loadYamlFile, managedAgentRuntimeSchema, mergeCredentials, mergeModelRequirements, mergeParentChildChunks, nativeModelTransport, normalizeContextSize, normalizeTokenUsage, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, projectPipelineInvocationScopeSchema, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveTokenUsageCandidates, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, supportsContentModel, taskWaitReason, textTokenBoundaries, validateAnalyticsPayload };
@@ -225,7 +225,8 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
225
225
  'EXPORT_MEDIA_FAILED',
226
226
  'EXPORT_INPUT_INVALID',
227
227
  'EXPORT_OUTPUT_INVALID',
228
- 'SANDBOX_CANCELLED'
228
+ 'SANDBOX_CANCELLED',
229
+ 'SANDBOX_CONTROL_UNCONFIRMED'
229
230
  ];
230
231
  /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
231
232
  /**
@@ -223,7 +223,8 @@ const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.worksp
223
223
  'EXPORT_MEDIA_FAILED',
224
224
  'EXPORT_INPUT_INVALID',
225
225
  'EXPORT_OUTPUT_INVALID',
226
- 'SANDBOX_CANCELLED'
226
+ 'SANDBOX_CANCELLED',
227
+ 'SANDBOX_CONTROL_UNCONFIRMED'
227
228
  ];
228
229
  /** Line prefix used by trusted Actions to report structured, provider-neutral progress. */ const SANDBOX_JOB_PROGRESS_PREFIX = 'XPERT_SANDBOX_PROGRESS ';
229
230
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.27.0",
3
+ "version": "3.28.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@langchain/openai": "0.6.9",
77
- "@xpert-ai/contracts": "3.27.0",
77
+ "@xpert-ai/contracts": "3.28.0",
78
78
  "express": "^4.22.1",
79
79
  "js-tiktoken": "^1.0.21"
80
80
  },
package/src/index.d.ts CHANGED
@@ -36,3 +36,4 @@ export * from './lib/project-type/index';
36
36
  export * from './lib/project-task/index';
37
37
  export * from './lib/project-pipeline';
38
38
  export * from './lib/agent-plugin/import-default-agent-plugins.command';
39
+ export * from './lib/execution-control';
@@ -5,6 +5,7 @@
5
5
  * - Two-gate lane/session permit logic has been removed.
6
6
  * - Lane is now an execution tag for observability and soft policy only.
7
7
  */
8
+ import type { TaskControlRef, TaskControlContext, TaskControlPolicy } from '../../execution-control';
8
9
  export type LaneName = 'main' | 'subagent' | 'cron' | 'nested';
9
10
  export type RunSource = 'chat' | 'xpert' | 'lark' | 'analytics' | 'api';
10
11
  export interface RunMetadata {
@@ -51,6 +52,9 @@ export declare const DEFAULT_EXECUTION_CONFIG: ExecutionConfig;
51
52
  * Using `type` with a string allows plugins to dynamically expand at runtime without needing to modify the core type definition.
52
53
  */
53
54
  export interface HandoffMessage<TPayload extends Record<string, unknown> = Record<string, unknown>> {
55
+ /** Host-issued control identity; serialized separately from business payload. */
56
+ control?: TaskControlRef;
57
+ controlPolicy?: TaskControlPolicy;
54
58
  id: string;
55
59
  /**
56
60
  * Message type, used for processor resolution.
@@ -91,6 +95,7 @@ export interface ProcessorPolicy {
91
95
  idleTimeoutMs?: number;
92
96
  }
93
97
  export interface ProcessContext {
98
+ control?: TaskControlContext;
94
99
  runId: string;
95
100
  traceId: string;
96
101
  abortSignal: AbortSignal;
@@ -1,4 +1,5 @@
1
- import type { JSONValue, TAvatar, ProjectPipelineNativeSource } from '@xpert-ai/contracts';
1
+ import type { TaskControlPolicy } from '../../../execution-control';
2
+ import type { JSONValue, TAvatar, ProjectPipelineNativeSource, ExecutionControlEvidence } from '@xpert-ai/contracts';
2
3
  /** Task lifecycle snapshot. interrupted means paused; unknown does not confirm failure. */
3
4
  export type AgentMiddlewareAssistantTaskStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'interrupted' | 'unknown';
4
5
  /** Existing platform file reference; access remains subject to host authorization. */
@@ -115,6 +116,8 @@ export type AgentMiddlewareCorrelatedExecution = {
115
116
  };
116
117
  /** Start an asynchronous task on the current Assistant or a resolved external Assistant. */
117
118
  export type AgentMiddlewareAssistantTaskInput = {
119
+ /** Trusted host lifecycle selection; background mode alone never selects independence. */
120
+ controlPolicy?: TaskControlPolicy;
118
121
  /** Current/requesting Assistant ID; must match target.requesterXpertId when target is supplied. */
119
122
  xpertId: string;
120
123
  /** Fail before dispatch if the accessible published executor changed after the caller prepared its intent. */
@@ -145,6 +148,8 @@ export type AgentMiddlewareAssistantTaskInput = {
145
148
  /** Task receipt, not necessarily a completed result. Use status and execution identifiers to follow progress. */
146
149
  export type AgentMiddlewareAssistantTaskResult = {
147
150
  status: AgentMiddlewareAssistantTaskStatus;
151
+ /** Actual execution evidence, independent of legacy business status and cancellation acknowledgements. */
152
+ control?: ExecutionControlEvidence;
148
153
  taskId?: string;
149
154
  executionId?: string;
150
155
  conversationId?: string;
@@ -4,6 +4,10 @@ import type { TaskWaitRequest, TaskWaitResult } from './task-wait';
4
4
  import type { ConversationResourceCard } from '@xpert-ai/contracts';
5
5
  /** Invocation API bound to one authorized caller/execution. Each operation revalidates access. */
6
6
  export interface AgentInvocationApi {
7
+ /** Discover inherited runtime presets without creating bindings or starting processes. */
8
+ listManaged?(): Promise<import('./managed').ManagedAgentRuntimeOption[]>;
9
+ /** Resolve an installed preset using the captured caller's current permissions. */
10
+ resolveManaged?(selection: import('./managed').ManagedAgentRuntimeSelection): Promise<AgentTarget>;
7
11
  /** Create a host-owned presentation receipt after a successful dispatch, without inspecting the runtime. */
8
12
  getResourceCard?(invocationId: string): Promise<ConversationResourceCard | null>;
9
13
  /** Resolve a binding to a pinned target. Optional on hosts with pre-resolved native targets. */
@@ -13,7 +13,7 @@ export interface CliModelConfigurationInput {
13
13
  directory: string;
14
14
  gatewayBaseUrl: string;
15
15
  defaultModelId?: string;
16
- models: Array<Pick<ModelExecutionModel, 'id' | 'protocols' | 'contextWindow' | 'outputTokenLimit'>>;
16
+ models: Array<Pick<ModelExecutionModel, 'id' | 'protocols' | 'contextWindow' | 'outputTokenLimit' | 'parameters'>>;
17
17
  /** @deprecated Legacy input only. Use the selected model's catalog metadata. */
18
18
  limits?: Partial<ModelExecutionLimits> & {
19
19
  maxOutputTokens?: number;
@@ -9,6 +9,8 @@ export type AgentRunnerEnvironment = Extract<ModelExecutionEnvironment, {
9
9
  interface AgentRunnerReceiptBase {
10
10
  /** Owning platform invocation; never a caller-selected process launch key. */
11
11
  invocationId: string;
12
+ /** Set only by hosts using the owned-descendant supervisor. Historical receipts remain unconfirmed. */
13
+ supervision?: 1;
12
14
  /** Bound environment instance; replacing the instance invalidates this receipt. */
13
15
  environment: AgentRunnerEnvironment;
14
16
  /** Opaque host process reference, not necessarily an operating-system PID. */
@@ -32,6 +34,13 @@ export type AgentRunnerReceipt = AgentRunnerReceiptBase & ({
32
34
  version: 2;
33
35
  executionDirectory: string;
34
36
  });
37
+ export interface AgentRunnerExitEvidence {
38
+ version: 1;
39
+ coverage: 'descendants';
40
+ invocationId: string;
41
+ environment: AgentRunnerEnvironment;
42
+ processId: string;
43
+ }
35
44
  /** Per-scope host capability. Methods recheck the persisted invocation and receipt before side effects. */
36
45
  export interface AgentExecutionRunner {
37
46
  /** Resolve the already persisted Invocation/Binding. Checkpoint before sending launch input. */
@@ -40,6 +49,7 @@ export interface AgentExecutionRunner {
40
49
  inspect(receipt: AgentRunnerReceipt): Promise<{
41
50
  state: 'running' | 'exited' | 'unknown';
42
51
  exitCode?: number;
52
+ completion?: AgentRunnerExitEvidence;
43
53
  }>;
44
54
  /** Relative HTTP request over the approved local service transport; no caller-supplied URL or headers. */
45
55
  request(receipt: AgentRunnerReceipt, request: {
@@ -55,6 +65,7 @@ export interface AgentExecutionRunner {
55
65
  /** Revoke model access and request process termination. Only exited confirms termination. */
56
66
  stop(receipt: AgentRunnerReceipt): Promise<{
57
67
  state: 'exited' | 'stopping' | 'unknown';
68
+ completion?: AgentRunnerExitEvidence;
58
69
  }>;
59
70
  }
60
71
  export declare const AgentExecutionRunnerCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AgentExecutionRunner>;
@@ -6,6 +6,8 @@ export * from './cli-model-profile';
6
6
  export * from './task-wait';
7
7
  export * from './results';
8
8
  export * from './execution-runner';
9
+ export * from './process-supervisor';
9
10
  export * from './dispatch';
10
11
  export * from './activity';
12
+ export * from './managed';
11
13
  export * from './pipeline-scope';