Skip to content

Commit ac38cf8

Browse files
committed
feat(TaskProcessing): Introduce internal task types
which are not shown in the assistant UI Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 678a8a7 commit ac38cf8

7 files changed

Lines changed: 32 additions & 10 deletions

File tree

lib/private/TaskProcessing/Manager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
use OCP\TaskProcessing\Exception\ProcessingException;
5252
use OCP\TaskProcessing\Exception\UnauthorizedException;
5353
use OCP\TaskProcessing\Exception\ValidationException;
54+
use OCP\TaskProcessing\IInternalTaskType;
5455
use OCP\TaskProcessing\IManager;
5556
use OCP\TaskProcessing\IProvider;
5657
use OCP\TaskProcessing\ISynchronousProvider;
@@ -88,7 +89,7 @@ class Manager implements IManager {
8889
private ?array $providers = null;
8990

9091
/**
91-
* @var array<array-key,array{name: string, description: string, inputShape: ShapeDescriptor[], inputShapeEnumValues: ShapeEnumValue[][], inputShapeDefaults: array<array-key, numeric|string>, optionalInputShape: ShapeDescriptor[], optionalInputShapeEnumValues: ShapeEnumValue[][], optionalInputShapeDefaults: array<array-key, numeric|string>, outputShape: ShapeDescriptor[], outputShapeEnumValues: ShapeEnumValue[][], optionalOutputShape: ShapeDescriptor[], optionalOutputShapeEnumValues: ShapeEnumValue[][]}>
92+
* @var array<array-key,array{name: string, description: string, inputShape: ShapeDescriptor[], inputShapeEnumValues: ShapeEnumValue[][], inputShapeDefaults: array<array-key, numeric|string>, isInternal: bool, optionalInputShape: ShapeDescriptor[], optionalInputShapeEnumValues: ShapeEnumValue[][], optionalInputShapeDefaults: array<array-key, numeric|string>, outputShape: ShapeDescriptor[], outputShapeEnumValues: ShapeEnumValue[][], optionalOutputShape: ShapeDescriptor[], optionalOutputShapeEnumValues: ShapeEnumValue[][]}>
9293
*/
9394
private ?array $availableTaskTypes = null;
9495

@@ -878,6 +879,7 @@ public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userI
878879
'outputShapeEnumValues' => $provider->getOutputShapeEnumValues(),
879880
'optionalOutputShape' => $provider->getOptionalOutputShape(),
880881
'optionalOutputShapeEnumValues' => $provider->getOptionalOutputShapeEnumValues(),
882+
'isInternal' => $taskType instanceof IInternalTaskType,
881883
];
882884
} catch (\Throwable $e) {
883885
$this->logger->error('Failed to set up TaskProcessing provider ' . $provider::class, ['exception' => $e]);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCP\TaskProcessing;
11+
12+
/**
13+
* This is a task type interface that is implemented by task processing
14+
* task types that should not show up in the assistant UI
15+
* @since 33.0.0
16+
*/
17+
interface IInternalTaskType extends ITaskType {
18+
19+
}

lib/public/TaskProcessing/IManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ public function getPreferredProvider(string $taskTypeId);
4949
/**
5050
* @param bool $showDisabled if false, disabled task types will be filtered out
5151
* @param ?string $userId to check if the user is a guest. Will be obtained from session if left to default
52-
* @return array<string, array{name: string, description: string, inputShape: ShapeDescriptor[], inputShapeEnumValues: ShapeEnumValue[][], inputShapeDefaults: array<array-key, numeric|string>, optionalInputShape: ShapeDescriptor[], optionalInputShapeEnumValues: ShapeEnumValue[][], optionalInputShapeDefaults: array<array-key, numeric|string>, outputShape: ShapeDescriptor[], outputShapeEnumValues: ShapeEnumValue[][], optionalOutputShape: ShapeDescriptor[], optionalOutputShapeEnumValues: ShapeEnumValue[][]}>
52+
* @return array<string, array{name: string, description: string, inputShape: ShapeDescriptor[], inputShapeEnumValues: ShapeEnumValue[][], inputShapeDefaults: array<array-key, numeric|string>, isInternal: bool, optionalInputShape: ShapeDescriptor[], optionalInputShapeEnumValues: ShapeEnumValue[][], optionalInputShapeDefaults: array<array-key, numeric|string>, outputShape: ShapeDescriptor[], outputShapeEnumValues: ShapeEnumValue[][], optionalOutputShape: ShapeDescriptor[], optionalOutputShapeEnumValues: ShapeEnumValue[][]}>
5353
* @since 30.0.0
5454
* @since 31.0.0 Added the `showDisabled` argument.
5555
* @since 31.0.7 Added the `userId` argument
56+
* @since 33.0.0 Added `isInternal` to return value
5657
*/
5758
public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userId = null): array;
5859

lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
use OCP\IL10N;
1313
use OCP\L10N\IFactory;
1414
use OCP\TaskProcessing\EShapeType;
15-
use OCP\TaskProcessing\ITaskType;
15+
use OCP\TaskProcessing\IInternalTaskType;
1616
use OCP\TaskProcessing\ShapeDescriptor;
1717

1818
/**
1919
* This is the task processing task type for audio chat
2020
* @since 32.0.0
2121
*/
22-
class AudioToAudioChat implements ITaskType {
22+
class AudioToAudioChat implements IInternalTaskType {
2323
/**
2424
* @since 32.0.0
2525
*/

lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
use OCP\IL10N;
1313
use OCP\L10N\IFactory;
1414
use OCP\TaskProcessing\EShapeType;
15-
use OCP\TaskProcessing\ITaskType;
15+
use OCP\TaskProcessing\IInternalTaskType;
1616
use OCP\TaskProcessing\ShapeDescriptor;
1717

1818
/**
1919
* This is the task processing task type for Context Agent interaction
2020
* @since 32.0.0
2121
*/
22-
class ContextAgentAudioInteraction implements ITaskType {
22+
class ContextAgentAudioInteraction implements IInternalTaskType {
2323
public const ID = 'core:contextagent:audio-interaction';
2424

2525
private IL10N $l;

lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
use OCP\IL10N;
1313
use OCP\L10N\IFactory;
1414
use OCP\TaskProcessing\EShapeType;
15-
use OCP\TaskProcessing\ITaskType;
15+
use OCP\TaskProcessing\IInternalTaskType;
1616
use OCP\TaskProcessing\ShapeDescriptor;
1717

1818
/**
1919
* This is the task processing task type for Context Agent interaction
2020
* @since 31.0.0
2121
*/
22-
class ContextAgentInteraction implements ITaskType {
22+
class ContextAgentInteraction implements IInternalTaskType {
2323
public const ID = 'core:contextagent:interaction';
2424

2525
private IL10N $l;

lib/public/TaskProcessing/TaskTypes/TextToTextChatWithTools.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
use OCP\IL10N;
1313
use OCP\L10N\IFactory;
1414
use OCP\TaskProcessing\EShapeType;
15-
use OCP\TaskProcessing\ITaskType;
15+
use OCP\TaskProcessing\IInternalTaskType;
1616
use OCP\TaskProcessing\ShapeDescriptor;
1717

1818
/**
1919
* This is the task processing task type for invoking Chat-enabled LLMs with tool call support
2020
* @since 31.0.0
2121
*/
22-
class TextToTextChatWithTools implements ITaskType {
22+
class TextToTextChatWithTools implements IInternalTaskType {
2323
public const ID = 'core:text2text:chatwithtools';
2424

2525
private IL10N $l;

0 commit comments

Comments
 (0)