plugin-agent-orchestrator 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/plugin.js +9 -0
- package/package.json +1 -1
- package/src/server/plugin.ts +15 -0
- package/dist/client/AIEmployeeSelect.d.ts +0 -11
- package/dist/client/AIEmployeesContext.d.ts +0 -30
- package/dist/client/AgentRunsTab.d.ts +0 -2
- package/dist/client/HarnessProfilesTab.d.ts +0 -2
- package/dist/client/OrchestratorSettings.d.ts +0 -3
- package/dist/client/RulesTab.d.ts +0 -2
- package/dist/client/TracingTab.d.ts +0 -2
- package/dist/client/hooks/useRunEventStream.d.ts +0 -22
- package/dist/client/index.d.ts +0 -2
- package/dist/client/plugin.d.ts +0 -6
- package/dist/client/skill-hub/components/ExecutionHistory.d.ts +0 -2
- package/dist/client/skill-hub/components/ExecutionProgress.d.ts +0 -20
- package/dist/client/skill-hub/components/GitSkillImport.d.ts +0 -7
- package/dist/client/skill-hub/components/LoopSettings.d.ts +0 -2
- package/dist/client/skill-hub/components/SkillEditor.d.ts +0 -7
- package/dist/client/skill-hub/components/SkillManager.d.ts +0 -2
- package/dist/client/skill-hub/components/SkillMetrics.d.ts +0 -2
- package/dist/client/skill-hub/components/SkillTestPanel.d.ts +0 -7
- package/dist/client/skill-hub/index.d.ts +0 -11
- package/dist/client/skill-hub/locale.d.ts +0 -3
- package/dist/client/skill-hub/tools/InteractionSchemasProvider.d.ts +0 -6
- package/dist/client/skill-hub/tools/SkillHubCard.d.ts +0 -3
- package/dist/client/skill-hub/tools/loopTemplates.d.ts +0 -22
- package/dist/client/skill-hub/tools/registerSkillLoopCards.d.ts +0 -1
- package/dist/client/skill-hub/utils/jsonFields.d.ts +0 -3
- package/dist/client/tools/PlanApprovalCard.d.ts +0 -3
- package/dist/client/tools/registerOrchestratorCards.d.ts +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/server/collections/agent-execution-spans.d.ts +0 -9
- package/dist/server/collections/agent-harness-profiles.d.ts +0 -2
- package/dist/server/collections/agent-loop-events.d.ts +0 -2
- package/dist/server/collections/agent-loop-runs.d.ts +0 -2
- package/dist/server/collections/agent-loop-steps.d.ts +0 -2
- package/dist/server/collections/orchestrator-config.d.ts +0 -2
- package/dist/server/collections/orchestrator-logs.d.ts +0 -8
- package/dist/server/collections/skill-definitions.d.ts +0 -3
- package/dist/server/collections/skill-executions.d.ts +0 -3
- package/dist/server/collections/skill-loop-configs.d.ts +0 -3
- package/dist/server/collections/skill-worker-configs.d.ts +0 -3
- package/dist/server/index.d.ts +0 -1
- package/dist/server/migrations/20260423000000-add-progress-fields.d.ts +0 -4
- package/dist/server/migrations/20260425000000-add-interaction-schema.d.ts +0 -4
- package/dist/server/migrations/20260427000000-add-tracing-detail-fields.d.ts +0 -7
- package/dist/server/migrations/20260427000000-change-packages-to-text.d.ts +0 -4
- package/dist/server/migrations/20260427000001-change-other-json-to-text.d.ts +0 -4
- package/dist/server/migrations/20260429000000-add-llm-fields.d.ts +0 -7
- package/dist/server/migrations/20260429000000-fix-inputargs-json-to-text.d.ts +0 -16
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.d.ts +0 -7
- package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.d.ts +0 -7
- package/dist/server/migrations/20260524001000-add-plan-approval-and-harness-profiles.d.ts +0 -12
- package/dist/server/migrations/20260601000000-add-token-fields.d.ts +0 -7
- package/dist/server/plugin.d.ts +0 -16
- package/dist/server/resources/agent-loop.d.ts +0 -3
- package/dist/server/resources/tracing.d.ts +0 -7
- package/dist/server/services/AgentHarness.d.ts +0 -44
- package/dist/server/services/AgentLoopController.d.ts +0 -218
- package/dist/server/services/AgentLoopRepository.d.ts +0 -20
- package/dist/server/services/AgentLoopService.d.ts +0 -159
- package/dist/server/services/AgentPlanValidator.d.ts +0 -4
- package/dist/server/services/AgentPlannerService.d.ts +0 -8
- package/dist/server/services/AgentRegistryService.d.ts +0 -21
- package/dist/server/services/CircuitBreaker.d.ts +0 -40
- package/dist/server/services/CodeValidator.d.ts +0 -32
- package/dist/server/services/ContextAggregator.d.ts +0 -45
- package/dist/server/services/ExecutionSpanService.d.ts +0 -46
- package/dist/server/services/FileManager.d.ts +0 -28
- package/dist/server/services/RunEventBus.d.ts +0 -9
- package/dist/server/services/SandboxRunner.d.ts +0 -41
- package/dist/server/services/SkillManager.d.ts +0 -6
- package/dist/server/services/SkillRepositoryService.d.ts +0 -22
- package/dist/server/services/TokenTracker.d.ts +0 -62
- package/dist/server/services/WorkerEnvManager.d.ts +0 -26
- package/dist/server/skill-hub/actions/git-import.d.ts +0 -21
- package/dist/server/skill-hub/mcp/McpController.d.ts +0 -15
- package/dist/server/skill-hub/plugin.d.ts +0 -61
- package/dist/server/skill-hub/tasks/SkillExecutionTask.d.ts +0 -16
- package/dist/server/skill-hub/utils/json-fields.d.ts +0 -7
- package/dist/server/tools/agent-loop.d.ts +0 -235
- package/dist/server/tools/delegate-task.d.ts +0 -19
- package/dist/server/tools/external-rag-search.d.ts +0 -42
- package/dist/server/tools/orchestrator-plan.d.ts +0 -205
- package/dist/server/tools/skill-execute.d.ts +0 -36
- package/dist/server/types.d.ts +0 -47
- package/dist/server/utils/ctx-utils.d.ts +0 -30
- package/dist/server/utils/logging.d.ts +0 -6
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface SkillPackageMetadata {
|
|
2
|
-
path: string;
|
|
3
|
-
metadata: Record<string, any>;
|
|
4
|
-
instructions: string;
|
|
5
|
-
code: string | null;
|
|
6
|
-
}
|
|
7
|
-
export declare class SkillRepositoryService {
|
|
8
|
-
private baseDir;
|
|
9
|
-
constructor(storagePath: string);
|
|
10
|
-
/**
|
|
11
|
-
* Extract a zip file to the repository.
|
|
12
|
-
* Returns parsed metadata from SKILL.md / skill.yaml
|
|
13
|
-
*/
|
|
14
|
-
extractSkillPackage(skillName: string, zipFilePath: string): Promise<SkillPackageMetadata>;
|
|
15
|
-
getSkillPath(skillName: string): string;
|
|
16
|
-
getSkillCode(skillName: string): string | null;
|
|
17
|
-
copySkillPackageTo(skillName: string, destDir: string): void;
|
|
18
|
-
readSkillPackage(packageDir: string): SkillPackageMetadata;
|
|
19
|
-
copyDirectoryTo(srcDir: string, destDir: string): void;
|
|
20
|
-
private getSkillCodeFromDir;
|
|
21
|
-
private aggregateOtherMarkdownFiles;
|
|
22
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export interface TokenUsage {
|
|
2
|
-
inputTokens: number;
|
|
3
|
-
outputTokens: number;
|
|
4
|
-
totalTokens: number;
|
|
5
|
-
cost: number;
|
|
6
|
-
}
|
|
7
|
-
export interface BudgetConfig {
|
|
8
|
-
budgetMaxTokens?: number;
|
|
9
|
-
budgetMaxCost?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface BudgetCheckResult {
|
|
12
|
-
allowed: boolean;
|
|
13
|
-
reason?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Extract usage_metadata from the final state returned by createReactAgent.invoke().
|
|
17
|
-
*
|
|
18
|
-
* LangChain's createReactAgent returns a final state object with a `messages` array.
|
|
19
|
-
* The last AIMessage in that array carries `usage_metadata` populated by the
|
|
20
|
-
* LLM provider after the final generation step. This is the standard LangChain
|
|
21
|
-
* approach — no private API access needed.
|
|
22
|
-
*
|
|
23
|
-
* Expected shape (from @langchain/core/messages/ai):
|
|
24
|
-
* AIMessage.usage_metadata = {
|
|
25
|
-
* input_tokens: number,
|
|
26
|
-
* output_tokens: number,
|
|
27
|
-
* total_tokens: number,
|
|
28
|
-
* }
|
|
29
|
-
*/
|
|
30
|
-
export declare function extractTokenUsage(finalState: any): TokenUsage | null;
|
|
31
|
-
/**
|
|
32
|
-
* Service for tracking token consumption across agent runs and spans.
|
|
33
|
-
*
|
|
34
|
-
* Responsibilities:
|
|
35
|
-
* 1. Parse token usage from LangGraph execution results
|
|
36
|
-
* 2. Persist token counts to agentExecutionSpans
|
|
37
|
-
* 3. Accumulate totals at the agentLoopRuns level
|
|
38
|
-
* 4. Enforce budget limits (max tokens / max cost per run)
|
|
39
|
-
*/
|
|
40
|
-
export declare class TokenTracker {
|
|
41
|
-
private readonly plugin;
|
|
42
|
-
constructor(plugin: any);
|
|
43
|
-
get db(): any;
|
|
44
|
-
get app(): any;
|
|
45
|
-
/**
|
|
46
|
-
* Track token usage for a single execution span.
|
|
47
|
-
* Updates the span record and accumulates into the parent run.
|
|
48
|
-
*
|
|
49
|
-
* @param spanId - The agentExecutionSpans.id to update
|
|
50
|
-
* @param usage - Parsed token usage from extractTokenUsage()
|
|
51
|
-
* @param runId - Optional agentLoopRuns.id to accumulate totals
|
|
52
|
-
*/
|
|
53
|
-
trackSpan(spanId: string | number | undefined, usage: TokenUsage, runId?: string | number): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Recalculate total token/cost for a run by summing all its spans.
|
|
56
|
-
*/
|
|
57
|
-
accumulateToRun(runId: string | number): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Check if a run has exceeded its budget limits.
|
|
60
|
-
*/
|
|
61
|
-
checkBudget(runId: string | number): Promise<BudgetCheckResult>;
|
|
62
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Application from '@nocobase/server';
|
|
2
|
-
import { Database } from '@nocobase/database';
|
|
3
|
-
type WorkerEnvConfig = {
|
|
4
|
-
npmRegistryUrl?: string;
|
|
5
|
-
npmAuthToken?: string;
|
|
6
|
-
pypiIndexUrl?: string;
|
|
7
|
-
pypiTrustedHost?: string;
|
|
8
|
-
aptMirrorUrl?: string;
|
|
9
|
-
aptGpgKeyUrl?: string;
|
|
10
|
-
customPackages?: {
|
|
11
|
-
python?: string[];
|
|
12
|
-
node?: string[];
|
|
13
|
-
apt?: string[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare class WorkerEnvManager {
|
|
17
|
-
private readonly app;
|
|
18
|
-
private readonly db;
|
|
19
|
-
private readonly storagePath;
|
|
20
|
-
constructor(app: Application, db: Database, storagePath: string);
|
|
21
|
-
getOrCreateConfig(): Promise<any>;
|
|
22
|
-
initEnvironment(config: WorkerEnvConfig): Promise<string>;
|
|
23
|
-
executeInit(payload: WorkerEnvConfig): Promise<void>;
|
|
24
|
-
parsePackageWhitelist(config: any): Record<"node" | "python" | "apt", string[]>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
/**
|
|
3
|
-
* Git integration actions for skill-hub.
|
|
4
|
-
*
|
|
5
|
-
* Supported manifest shape:
|
|
6
|
-
* {
|
|
7
|
-
* "skills": [
|
|
8
|
-
* { "folder": "my-skill", "name": "my-skill", "language": "python" },
|
|
9
|
-
* { "name": "pptx-advanced-export", "storageType": "plugin", "pluginSource": "pptx-advanced-export" }
|
|
10
|
-
* ]
|
|
11
|
-
* }
|
|
12
|
-
*/
|
|
13
|
-
export declare function gitListSkills(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Sync selected skills from git into skillDefinitions.
|
|
16
|
-
*
|
|
17
|
-
* Code is optional. Regular git skills may provide code via codeTemplate,
|
|
18
|
-
* codeFile, or conventional files under skills/<folder>. Plugin skills only
|
|
19
|
-
* need storageType=plugin and pluginSource.
|
|
20
|
-
*/
|
|
21
|
-
export declare function gitSyncSkills(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type PluginSkillHubServer from '../plugin';
|
|
2
|
-
export declare class McpController {
|
|
3
|
-
private plugin;
|
|
4
|
-
constructor(plugin: PluginSkillHubServer);
|
|
5
|
-
/**
|
|
6
|
-
* List all enabled skills in standard MCP format.
|
|
7
|
-
* Route: GET /api/skillHub:mcpListTools
|
|
8
|
-
*/
|
|
9
|
-
listTools(ctx: any, next: any): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Execute a skill in standard MCP format.
|
|
12
|
-
* Route: POST /api/skillHub:mcpCallTool
|
|
13
|
-
*/
|
|
14
|
-
callTool(ctx: any, next: any): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { SandboxRunner } from '../services/SandboxRunner';
|
|
2
|
-
import { FileManager } from '../services/FileManager';
|
|
3
|
-
import { SkillManager } from '../services/SkillManager';
|
|
4
|
-
import { WorkerEnvManager } from '../services/WorkerEnvManager';
|
|
5
|
-
export declare class SkillHubSubFeature {
|
|
6
|
-
private plugin;
|
|
7
|
-
sandboxRunner: SandboxRunner;
|
|
8
|
-
fileManager: FileManager;
|
|
9
|
-
skillManager: SkillManager;
|
|
10
|
-
workerEnvManager: WorkerEnvManager;
|
|
11
|
-
private cleanupInterval;
|
|
12
|
-
private initEnvDoneCallback;
|
|
13
|
-
private initEnvProgressCallback;
|
|
14
|
-
private mcpController;
|
|
15
|
-
private skillRepoService;
|
|
16
|
-
private rateLimiter;
|
|
17
|
-
private skillTemplates;
|
|
18
|
-
constructor(plugin: any);
|
|
19
|
-
get app(): any;
|
|
20
|
-
get db(): any;
|
|
21
|
-
get name(): any;
|
|
22
|
-
load(): Promise<void>;
|
|
23
|
-
private onQueueTask;
|
|
24
|
-
/**
|
|
25
|
-
* Execute skill — called by both AI tool and REST test endpoint.
|
|
26
|
-
* Dispatches to worker via EventQueue, waits for result via PubSub.
|
|
27
|
-
* Pushes progress to SSE via runtime.writer (if within AI tool context).
|
|
28
|
-
* Includes rate limiting and graceful abort propagation.
|
|
29
|
-
*/
|
|
30
|
-
executeSkill(skill: any, inputArgs: Record<string, any>, ctx?: any): Promise<any>;
|
|
31
|
-
private handleDownload;
|
|
32
|
-
private handleTest;
|
|
33
|
-
/**
|
|
34
|
-
* Handle Init Environment request from admin UI.
|
|
35
|
-
* Dispatches init task to all workers via EventQueue.
|
|
36
|
-
*/
|
|
37
|
-
private handleInitEnv;
|
|
38
|
-
/**
|
|
39
|
-
* Subscribe to init-env done AND progress PubSub channels.
|
|
40
|
-
* When a worker finishes init, auto-update the DB with status.
|
|
41
|
-
*/
|
|
42
|
-
private subscribeInitEnvDone;
|
|
43
|
-
private getSkillRecordId;
|
|
44
|
-
private resolveLoopInteractionSchema;
|
|
45
|
-
private getLoopConfigsBySkillId;
|
|
46
|
-
private registerAITools;
|
|
47
|
-
private startCleanupInterval;
|
|
48
|
-
beforeStop(): Promise<void>;
|
|
49
|
-
private handleClearStorage;
|
|
50
|
-
private handleListTemplates;
|
|
51
|
-
/**
|
|
52
|
-
* Register a skill template into memory for UI importing.
|
|
53
|
-
*/
|
|
54
|
-
registerSkillTemplate(pluginName: string, skillDef: any): void;
|
|
55
|
-
resolveSkillTemplate(templateName: string): any;
|
|
56
|
-
getSkillDescriptionForAI(skill: any): Promise<string>;
|
|
57
|
-
getSkillInstructions(skill: any): Promise<any>;
|
|
58
|
-
private hydrateSkillTemplate;
|
|
59
|
-
install(): Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
export default SkillHubSubFeature;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Application from '@nocobase/server';
|
|
2
|
-
import { SandboxRunner } from '../../services/SandboxRunner';
|
|
3
|
-
import { FileManager } from '../../services/FileManager';
|
|
4
|
-
import { SkillRepositoryService } from '../../services/SkillRepositoryService';
|
|
5
|
-
export declare class SkillExecutionTask {
|
|
6
|
-
private execution;
|
|
7
|
-
private sandboxRunner;
|
|
8
|
-
private fileManager;
|
|
9
|
-
private skillRepoService;
|
|
10
|
-
private app;
|
|
11
|
-
constructor(execution: any, sandboxRunner: SandboxRunner, fileManager: FileManager, skillRepoService: SkillRepositoryService, app: Application);
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
private renderTemplate;
|
|
14
|
-
private installGeneratedSkillIfRequested;
|
|
15
|
-
private validateGeneratedSkillPackages;
|
|
16
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function parseJsonText<T = any>(value: any, fallback: T): T;
|
|
2
|
-
export declare function stringifyJsonText(value: any, fallback?: any): string;
|
|
3
|
-
export declare function parseJsonLike(value: any, fallback: any): any;
|
|
4
|
-
export declare function parseSkillMarkdown(markdown: string): {
|
|
5
|
-
metadata: Record<string, any>;
|
|
6
|
-
body: string;
|
|
7
|
-
};
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { AgentLoopService } from '../services/AgentLoopService';
|
|
3
|
-
export declare function createAgentLoopTools(plugin: any, service: AgentLoopService): ({
|
|
4
|
-
scope: "CUSTOM";
|
|
5
|
-
execution: "backend";
|
|
6
|
-
defaultPermission: "ALLOW";
|
|
7
|
-
introduction: {
|
|
8
|
-
title: string;
|
|
9
|
-
about: string;
|
|
10
|
-
};
|
|
11
|
-
definition: {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
schema: z.ZodObject<{
|
|
15
|
-
goal: z.ZodString;
|
|
16
|
-
leaderUsername: z.ZodOptional<z.ZodString>;
|
|
17
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
18
|
-
messageId: z.ZodOptional<z.ZodString>;
|
|
19
|
-
policy: z.ZodOptional<z.ZodObject<{
|
|
20
|
-
maxIterations: z.ZodOptional<z.ZodNumber>;
|
|
21
|
-
maxStepAttempts: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
allowReplan: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
-
requireVerification: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
stopOnApprovalRequired: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
maxIterations?: number;
|
|
27
|
-
maxStepAttempts?: number;
|
|
28
|
-
allowReplan?: boolean;
|
|
29
|
-
requireVerification?: boolean;
|
|
30
|
-
stopOnApprovalRequired?: boolean;
|
|
31
|
-
}, {
|
|
32
|
-
maxIterations?: number;
|
|
33
|
-
maxStepAttempts?: number;
|
|
34
|
-
allowReplan?: boolean;
|
|
35
|
-
requireVerification?: boolean;
|
|
36
|
-
stopOnApprovalRequired?: boolean;
|
|
37
|
-
}>>;
|
|
38
|
-
metadata: z.ZodOptional<z.ZodAny>;
|
|
39
|
-
plan: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
-
id: z.ZodOptional<z.ZodString>;
|
|
41
|
-
key: z.ZodOptional<z.ZodString>;
|
|
42
|
-
planKey: z.ZodOptional<z.ZodString>;
|
|
43
|
-
parentStepId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
44
|
-
title: z.ZodOptional<z.ZodString>;
|
|
45
|
-
description: z.ZodOptional<z.ZodString>;
|
|
46
|
-
type: z.ZodOptional<z.ZodEnum<["reasoning", "skill", "tool", "sub_agent", "verification"]>>;
|
|
47
|
-
target: z.ZodOptional<z.ZodString>;
|
|
48
|
-
input: z.ZodOptional<z.ZodAny>;
|
|
49
|
-
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
50
|
-
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
51
|
-
metadata: z.ZodOptional<z.ZodAny>;
|
|
52
|
-
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
|
|
54
|
-
key?: string;
|
|
55
|
-
title?: string;
|
|
56
|
-
description?: string;
|
|
57
|
-
metadata?: any;
|
|
58
|
-
input?: any;
|
|
59
|
-
id?: string;
|
|
60
|
-
planKey?: string;
|
|
61
|
-
target?: string;
|
|
62
|
-
dependsOn?: string[];
|
|
63
|
-
parentStepId?: string | number;
|
|
64
|
-
maxAttempts?: number;
|
|
65
|
-
}, {
|
|
66
|
-
type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
|
|
67
|
-
key?: string;
|
|
68
|
-
title?: string;
|
|
69
|
-
description?: string;
|
|
70
|
-
metadata?: any;
|
|
71
|
-
input?: any;
|
|
72
|
-
id?: string;
|
|
73
|
-
planKey?: string;
|
|
74
|
-
target?: string;
|
|
75
|
-
dependsOn?: string[];
|
|
76
|
-
parentStepId?: string | number;
|
|
77
|
-
maxAttempts?: number;
|
|
78
|
-
}>, "many">>;
|
|
79
|
-
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
leaderUsername?: string;
|
|
81
|
-
metadata?: any;
|
|
82
|
-
sessionId?: string;
|
|
83
|
-
goal?: string;
|
|
84
|
-
messageId?: string;
|
|
85
|
-
policy?: {
|
|
86
|
-
maxIterations?: number;
|
|
87
|
-
maxStepAttempts?: number;
|
|
88
|
-
allowReplan?: boolean;
|
|
89
|
-
requireVerification?: boolean;
|
|
90
|
-
stopOnApprovalRequired?: boolean;
|
|
91
|
-
};
|
|
92
|
-
plan?: {
|
|
93
|
-
type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
|
|
94
|
-
key?: string;
|
|
95
|
-
title?: string;
|
|
96
|
-
description?: string;
|
|
97
|
-
metadata?: any;
|
|
98
|
-
input?: any;
|
|
99
|
-
id?: string;
|
|
100
|
-
planKey?: string;
|
|
101
|
-
target?: string;
|
|
102
|
-
dependsOn?: string[];
|
|
103
|
-
parentStepId?: string | number;
|
|
104
|
-
maxAttempts?: number;
|
|
105
|
-
}[];
|
|
106
|
-
}, {
|
|
107
|
-
leaderUsername?: string;
|
|
108
|
-
metadata?: any;
|
|
109
|
-
sessionId?: string;
|
|
110
|
-
goal?: string;
|
|
111
|
-
messageId?: string;
|
|
112
|
-
policy?: {
|
|
113
|
-
maxIterations?: number;
|
|
114
|
-
maxStepAttempts?: number;
|
|
115
|
-
allowReplan?: boolean;
|
|
116
|
-
requireVerification?: boolean;
|
|
117
|
-
stopOnApprovalRequired?: boolean;
|
|
118
|
-
};
|
|
119
|
-
plan?: {
|
|
120
|
-
type?: "reasoning" | "skill" | "tool" | "sub_agent" | "verification";
|
|
121
|
-
key?: string;
|
|
122
|
-
title?: string;
|
|
123
|
-
description?: string;
|
|
124
|
-
metadata?: any;
|
|
125
|
-
input?: any;
|
|
126
|
-
id?: string;
|
|
127
|
-
planKey?: string;
|
|
128
|
-
target?: string;
|
|
129
|
-
dependsOn?: string[];
|
|
130
|
-
parentStepId?: string | number;
|
|
131
|
-
maxAttempts?: number;
|
|
132
|
-
}[];
|
|
133
|
-
}>;
|
|
134
|
-
};
|
|
135
|
-
invoke: (ctx: any, args: any) => Promise<{
|
|
136
|
-
status: "success" | "error";
|
|
137
|
-
content: string;
|
|
138
|
-
}>;
|
|
139
|
-
} | {
|
|
140
|
-
scope: "CUSTOM";
|
|
141
|
-
execution: "backend";
|
|
142
|
-
defaultPermission: "ALLOW";
|
|
143
|
-
introduction: {
|
|
144
|
-
title: string;
|
|
145
|
-
about: string;
|
|
146
|
-
};
|
|
147
|
-
definition: {
|
|
148
|
-
name: string;
|
|
149
|
-
description: string;
|
|
150
|
-
schema: z.ZodObject<{
|
|
151
|
-
runId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
152
|
-
}, "strip", z.ZodTypeAny, {
|
|
153
|
-
runId?: string | number;
|
|
154
|
-
}, {
|
|
155
|
-
runId?: string | number;
|
|
156
|
-
}>;
|
|
157
|
-
};
|
|
158
|
-
invoke: (ctx: any, args: any) => Promise<{
|
|
159
|
-
status: "success" | "error";
|
|
160
|
-
content: string;
|
|
161
|
-
}>;
|
|
162
|
-
} | {
|
|
163
|
-
scope: "CUSTOM";
|
|
164
|
-
execution: "backend";
|
|
165
|
-
defaultPermission: "ALLOW";
|
|
166
|
-
introduction: {
|
|
167
|
-
title: string;
|
|
168
|
-
about: string;
|
|
169
|
-
};
|
|
170
|
-
definition: {
|
|
171
|
-
name: string;
|
|
172
|
-
description: string;
|
|
173
|
-
schema: z.ZodObject<{
|
|
174
|
-
stepId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
175
|
-
status: z.ZodEnum<["running", "succeeded", "failed", "skipped"]>;
|
|
176
|
-
output: z.ZodOptional<z.ZodAny>;
|
|
177
|
-
error: z.ZodOptional<z.ZodString>;
|
|
178
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
179
|
-
skillExecutionId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
180
|
-
agentExecutionSpanId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
181
|
-
metadata: z.ZodOptional<z.ZodAny>;
|
|
182
|
-
}, "strip", z.ZodTypeAny, {
|
|
183
|
-
error?: string;
|
|
184
|
-
status?: "succeeded" | "failed" | "running" | "skipped";
|
|
185
|
-
reason?: string;
|
|
186
|
-
metadata?: any;
|
|
187
|
-
output?: any;
|
|
188
|
-
skillExecutionId?: string | number;
|
|
189
|
-
stepId?: string | number;
|
|
190
|
-
agentExecutionSpanId?: string | number;
|
|
191
|
-
}, {
|
|
192
|
-
error?: string;
|
|
193
|
-
status?: "succeeded" | "failed" | "running" | "skipped";
|
|
194
|
-
reason?: string;
|
|
195
|
-
metadata?: any;
|
|
196
|
-
output?: any;
|
|
197
|
-
skillExecutionId?: string | number;
|
|
198
|
-
stepId?: string | number;
|
|
199
|
-
agentExecutionSpanId?: string | number;
|
|
200
|
-
}>;
|
|
201
|
-
};
|
|
202
|
-
invoke: (ctx: any, args: any) => Promise<{
|
|
203
|
-
status: "success" | "error";
|
|
204
|
-
content: string;
|
|
205
|
-
}>;
|
|
206
|
-
} | {
|
|
207
|
-
scope: "CUSTOM";
|
|
208
|
-
execution: "backend";
|
|
209
|
-
defaultPermission: "ALLOW";
|
|
210
|
-
introduction: {
|
|
211
|
-
title: string;
|
|
212
|
-
about: string;
|
|
213
|
-
};
|
|
214
|
-
definition: {
|
|
215
|
-
name: string;
|
|
216
|
-
description: string;
|
|
217
|
-
schema: z.ZodObject<{
|
|
218
|
-
stepId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
219
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
220
|
-
approval: z.ZodOptional<z.ZodAny>;
|
|
221
|
-
}, "strip", z.ZodTypeAny, {
|
|
222
|
-
reason?: string;
|
|
223
|
-
stepId?: string | number;
|
|
224
|
-
approval?: any;
|
|
225
|
-
}, {
|
|
226
|
-
reason?: string;
|
|
227
|
-
stepId?: string | number;
|
|
228
|
-
approval?: any;
|
|
229
|
-
}>;
|
|
230
|
-
};
|
|
231
|
-
invoke: (ctx: any, args: any) => Promise<{
|
|
232
|
-
status: "success" | "error";
|
|
233
|
-
content: string;
|
|
234
|
-
}>;
|
|
235
|
-
})[];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates one dynamic tool per configured sub-agent for a given leader.
|
|
3
|
-
* Uses Strategy B (Per-SubAgent Tool): each sub-agent becomes a separate tool
|
|
4
|
-
* with its own name and description, making LLM tool selection natural.
|
|
5
|
-
*
|
|
6
|
-
* Architecture:
|
|
7
|
-
* - Uses createReactAgent (public LangGraph API) for agent execution
|
|
8
|
-
* - Uses plugin-ai's getLLMService() for LLM model resolution
|
|
9
|
-
* - Uses core app.aiManager.toolsManager.listTools() for tool resolution
|
|
10
|
-
* (same manager that AIEmployee uses — see ai-employee.ts:1286)
|
|
11
|
-
* - Depth enforcement via ctx metadata tracking
|
|
12
|
-
* - Per-leader scoping via invoke-time check (core ToolsOptions has no
|
|
13
|
-
* leaderUsername field, so scoping is enforced in the invoke callback)
|
|
14
|
-
*/
|
|
15
|
-
export declare function createDelegateToolsProvider(plugin: any): (register: any) => Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
* Test/internal helper to drop the in-memory tool cache (e.g., from a CLI op).
|
|
18
|
-
*/
|
|
19
|
-
export declare function invalidateDelegateToolsCache(): void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare function createExternalRagSearchTool(plugin: any): {
|
|
3
|
-
scope: "CUSTOM";
|
|
4
|
-
execution: "backend";
|
|
5
|
-
defaultPermission: "ALLOW";
|
|
6
|
-
introduction: {
|
|
7
|
-
title: string;
|
|
8
|
-
about: string;
|
|
9
|
-
};
|
|
10
|
-
definition: {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
schema: z.ZodObject<{
|
|
14
|
-
query: z.ZodString;
|
|
15
|
-
knowledgeBaseIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
-
topK: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
scoreThreshold: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
query?: string;
|
|
20
|
-
knowledgeBaseIds?: string[];
|
|
21
|
-
topK?: number;
|
|
22
|
-
scoreThreshold?: number;
|
|
23
|
-
}, {
|
|
24
|
-
query?: string;
|
|
25
|
-
knowledgeBaseIds?: string[];
|
|
26
|
-
topK?: number;
|
|
27
|
-
scoreThreshold?: number;
|
|
28
|
-
}>;
|
|
29
|
-
};
|
|
30
|
-
invoke: (ctx: any, args: {
|
|
31
|
-
query?: string;
|
|
32
|
-
knowledgeBaseIds?: string[];
|
|
33
|
-
topK?: number;
|
|
34
|
-
scoreThreshold?: number;
|
|
35
|
-
}) => Promise<{
|
|
36
|
-
status: "error";
|
|
37
|
-
content: string;
|
|
38
|
-
} | {
|
|
39
|
-
status: "success";
|
|
40
|
-
content: string;
|
|
41
|
-
}>;
|
|
42
|
-
};
|