agent-ide 0.8.0 → 0.8.2
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/application/index.d.ts +1 -12
- package/dist/application/index.d.ts.map +1 -1
- package/dist/application/index.js +0 -16
- package/dist/application/index.js.map +1 -1
- package/dist/application/services/cache-coordinator.service.d.ts.map +1 -1
- package/dist/application/services/cache-coordinator.service.js.map +1 -1
- package/dist/application/services/module-coordinator.service.d.ts +3 -8
- package/dist/application/services/module-coordinator.service.d.ts.map +1 -1
- package/dist/application/services/module-coordinator.service.js +5 -139
- package/dist/application/services/module-coordinator.service.js.map +1 -1
- package/dist/application/types.d.ts +0 -63
- package/dist/application/types.d.ts.map +1 -1
- package/dist/application/types.js +1 -9
- package/dist/application/types.js.map +1 -1
- package/dist/core/call-hierarchy/call-hierarchy-analyzer.d.ts.map +1 -1
- package/dist/core/call-hierarchy/call-hierarchy-analyzer.js +3 -5
- package/dist/core/call-hierarchy/call-hierarchy-analyzer.js.map +1 -1
- package/dist/core/change-signature/change-signature-service.d.ts +9 -0
- package/dist/core/change-signature/change-signature-service.d.ts.map +1 -1
- package/dist/core/change-signature/change-signature-service.js +86 -4
- package/dist/core/change-signature/change-signature-service.js.map +1 -1
- package/dist/core/change-signature/signature-parser.d.ts +46 -4
- package/dist/core/change-signature/signature-parser.d.ts.map +1 -1
- package/dist/core/change-signature/signature-parser.js +180 -9
- package/dist/core/change-signature/signature-parser.js.map +1 -1
- package/dist/core/deadcode/dead-code-detector.d.ts +22 -1
- package/dist/core/deadcode/dead-code-detector.d.ts.map +1 -1
- package/dist/core/deadcode/dead-code-detector.js +134 -61
- package/dist/core/deadcode/dead-code-detector.js.map +1 -1
- package/dist/core/deadcode/dead-code-remover.d.ts +11 -93
- package/dist/core/deadcode/dead-code-remover.d.ts.map +1 -1
- package/dist/core/deadcode/dead-code-remover.js +71 -690
- package/dist/core/deadcode/dead-code-remover.js.map +1 -1
- package/dist/core/deadcode/file-operations.d.ts +85 -0
- package/dist/core/deadcode/file-operations.d.ts.map +1 -0
- package/dist/core/deadcode/file-operations.js +263 -0
- package/dist/core/deadcode/file-operations.js.map +1 -0
- package/dist/core/deadcode/import-cleaner.d.ts +63 -0
- package/dist/core/deadcode/import-cleaner.d.ts.map +1 -0
- package/dist/core/deadcode/import-cleaner.js +229 -0
- package/dist/core/deadcode/import-cleaner.js.map +1 -0
- package/dist/core/deadcode/import-parser.d.ts +79 -0
- package/dist/core/deadcode/import-parser.d.ts.map +1 -0
- package/dist/core/deadcode/import-parser.js +229 -0
- package/dist/core/deadcode/import-parser.js.map +1 -0
- package/dist/core/deadcode/range-expander.d.ts +38 -0
- package/dist/core/deadcode/range-expander.d.ts.map +1 -0
- package/dist/core/deadcode/range-expander.js +175 -0
- package/dist/core/deadcode/range-expander.js.map +1 -0
- package/dist/core/deadcode/types.d.ts +2 -0
- package/dist/core/deadcode/types.d.ts.map +1 -1
- package/dist/core/deadcode/types.js.map +1 -1
- package/dist/core/find-references/index.d.ts +2 -2
- package/dist/core/find-references/index.d.ts.map +1 -1
- package/dist/core/find-references/index.js +1 -1
- package/dist/core/find-references/index.js.map +1 -1
- package/dist/core/move/import-resolver.d.ts +5 -0
- package/dist/core/move/import-resolver.d.ts.map +1 -1
- package/dist/core/move/import-resolver.js +7 -0
- package/dist/core/move/import-resolver.js.map +1 -1
- package/dist/core/move/move-service.d.ts +39 -1
- package/dist/core/move/move-service.d.ts.map +1 -1
- package/dist/core/move/move-service.js +230 -63
- package/dist/core/move/move-service.js.map +1 -1
- package/dist/core/move/types.d.ts.map +1 -1
- package/dist/core/move-member/member-extractor.d.ts.map +1 -1
- package/dist/core/move-member/member-extractor.js +2 -2
- package/dist/core/move-member/member-extractor.js.map +1 -1
- package/dist/core/move-member/move-member-service.d.ts +6 -0
- package/dist/core/move-member/move-member-service.d.ts.map +1 -1
- package/dist/core/move-member/move-member-service.js +60 -3
- package/dist/core/move-member/move-member-service.js.map +1 -1
- package/dist/core/move-member/types.d.ts.map +1 -1
- package/dist/core/rename/reference-updater.d.ts +1 -35
- package/dist/core/rename/reference-updater.d.ts.map +1 -1
- package/dist/core/rename/reference-updater.js +4 -250
- package/dist/core/rename/reference-updater.js.map +1 -1
- package/dist/core/rename/rename-engine.d.ts +14 -22
- package/dist/core/rename/rename-engine.d.ts.map +1 -1
- package/dist/core/rename/rename-engine.js +37 -207
- package/dist/core/rename/rename-engine.js.map +1 -1
- package/dist/core/rename/scope-analyzer.d.ts.map +1 -1
- package/dist/core/shared/index.d.ts +1 -1
- package/dist/core/shared/index.d.ts.map +1 -1
- package/dist/core/shared/index.js +1 -1
- package/dist/core/shared/index.js.map +1 -1
- package/dist/core/shared/indexing/index-engine.d.ts +1 -1
- package/dist/core/shared/indexing/index-engine.d.ts.map +1 -1
- package/dist/core/shared/indexing/index-engine.js +1 -1
- package/dist/core/shared/indexing/index-engine.js.map +1 -1
- package/dist/core/shared/symbol-finder/call-site-parser.d.ts +71 -0
- package/dist/core/shared/symbol-finder/call-site-parser.d.ts.map +1 -0
- package/dist/core/shared/symbol-finder/call-site-parser.js +369 -0
- package/dist/core/shared/symbol-finder/call-site-parser.js.map +1 -0
- package/dist/core/shared/symbol-finder/index.d.ts +9 -0
- package/dist/core/shared/symbol-finder/index.d.ts.map +1 -0
- package/dist/core/shared/symbol-finder/index.js +12 -0
- package/dist/core/shared/symbol-finder/index.js.map +1 -0
- package/dist/core/shared/{symbol-finder.d.ts → symbol-finder/symbol-finder.d.ts} +27 -133
- package/dist/core/shared/symbol-finder/symbol-finder.d.ts.map +1 -0
- package/dist/core/shared/symbol-finder/symbol-finder.js +544 -0
- package/dist/core/shared/symbol-finder/symbol-finder.js.map +1 -0
- package/dist/core/shared/symbol-finder/text-matcher.d.ts +45 -0
- package/dist/core/shared/symbol-finder/text-matcher.d.ts.map +1 -0
- package/dist/core/shared/symbol-finder/text-matcher.js +195 -0
- package/dist/core/shared/symbol-finder/text-matcher.js.map +1 -0
- package/dist/core/shared/symbol-finder/types.d.ts +108 -0
- package/dist/core/shared/symbol-finder/types.d.ts.map +1 -0
- package/dist/core/shared/symbol-finder/types.js +71 -0
- package/dist/core/shared/symbol-finder/types.js.map +1 -0
- package/dist/core/snapshot/snapshot-generator.d.ts +16 -4
- package/dist/core/snapshot/snapshot-generator.d.ts.map +1 -1
- package/dist/core/snapshot/snapshot-generator.js +91 -18
- package/dist/core/snapshot/snapshot-generator.js.map +1 -1
- package/dist/infrastructure/cache/cache-manager.d.ts.map +1 -1
- package/dist/infrastructure/cache/cache-manager.js +4 -0
- package/dist/infrastructure/cache/cache-manager.js.map +1 -1
- package/dist/infrastructure/cache/index.d.ts +15 -9
- package/dist/infrastructure/cache/index.d.ts.map +1 -1
- package/dist/infrastructure/cache/index.js +5 -5
- package/dist/infrastructure/cache/index.js.map +1 -1
- package/dist/infrastructure/cache/memory-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/memory-cache.js.map +1 -1
- package/dist/infrastructure/cache/strategies.d.ts.map +1 -1
- package/dist/infrastructure/cache/strategies.js +2 -1
- package/dist/infrastructure/cache/strategies.js.map +1 -1
- package/dist/infrastructure/cache/types.d.ts +4 -4
- package/dist/infrastructure/cache/types.d.ts.map +1 -1
- package/dist/infrastructure/changeset/change-applicator.d.ts +95 -0
- package/dist/infrastructure/changeset/change-applicator.d.ts.map +1 -0
- package/dist/infrastructure/changeset/change-applicator.js +466 -0
- package/dist/infrastructure/changeset/change-applicator.js.map +1 -0
- package/dist/infrastructure/changeset/changeset-builder.d.ts +107 -0
- package/dist/infrastructure/changeset/changeset-builder.d.ts.map +1 -0
- package/dist/infrastructure/changeset/changeset-builder.js +183 -0
- package/dist/infrastructure/changeset/changeset-builder.js.map +1 -0
- package/dist/infrastructure/changeset/changeset-converter.d.ts +15 -0
- package/dist/infrastructure/changeset/changeset-converter.d.ts.map +1 -0
- package/dist/infrastructure/changeset/changeset-converter.js +369 -0
- package/dist/infrastructure/changeset/changeset-converter.js.map +1 -0
- package/dist/infrastructure/changeset/index.d.ts +9 -0
- package/dist/infrastructure/changeset/index.d.ts.map +1 -0
- package/dist/infrastructure/changeset/index.js +11 -0
- package/dist/infrastructure/changeset/index.js.map +1 -0
- package/dist/infrastructure/changeset/types.d.ts +110 -0
- package/dist/infrastructure/changeset/types.d.ts.map +1 -0
- package/dist/infrastructure/changeset/types.js +6 -0
- package/dist/infrastructure/changeset/types.js.map +1 -0
- package/dist/infrastructure/parser/base.d.ts.map +1 -1
- package/dist/infrastructure/parser/base.js +4 -3
- package/dist/infrastructure/parser/base.js.map +1 -1
- package/dist/infrastructure/parser/interface.d.ts +4 -2
- package/dist/infrastructure/parser/interface.d.ts.map +1 -1
- package/dist/infrastructure/parser/interface.js.map +1 -1
- package/dist/infrastructure/storage/file-system.d.ts.map +1 -1
- package/dist/infrastructure/storage/file-system.js +61 -54
- package/dist/infrastructure/storage/file-system.js.map +1 -1
- package/dist/interfaces/cli/commands/change-signature.command.d.ts.map +1 -1
- package/dist/interfaces/cli/commands/change-signature.command.js +31 -107
- package/dist/interfaces/cli/commands/change-signature.command.js.map +1 -1
- package/dist/interfaces/cli/commands/deadcode.command.js +51 -46
- package/dist/interfaces/cli/commands/deadcode.command.js.map +1 -1
- package/dist/interfaces/cli/commands/find-references.command.d.ts.map +1 -1
- package/dist/interfaces/cli/commands/find-references.command.js +18 -3
- package/dist/interfaces/cli/commands/find-references.command.js.map +1 -1
- package/dist/interfaces/cli/commands/move-member.command.d.ts.map +1 -1
- package/dist/interfaces/cli/commands/move-member.command.js +32 -103
- package/dist/interfaces/cli/commands/move-member.command.js.map +1 -1
- package/dist/interfaces/cli/commands/move.command.js +43 -54
- package/dist/interfaces/cli/commands/move.command.js.map +1 -1
- package/dist/interfaces/cli/commands/rename.command.js +27 -61
- package/dist/interfaces/cli/commands/rename.command.js.map +1 -1
- package/dist/interfaces/cli/output-formatter.d.ts +2 -2
- package/dist/interfaces/cli/output-formatter.d.ts.map +1 -1
- package/dist/interfaces/cli/output-formatter.js.map +1 -1
- package/dist/plugins/javascript/declaration-analyzer.d.ts.map +1 -1
- package/dist/plugins/javascript/declaration-analyzer.js +7 -0
- package/dist/plugins/javascript/declaration-analyzer.js.map +1 -1
- package/dist/plugins/javascript/parser.d.ts +11 -10
- package/dist/plugins/javascript/parser.d.ts.map +1 -1
- package/dist/plugins/javascript/parser.js +57 -53
- package/dist/plugins/javascript/parser.js.map +1 -1
- package/dist/plugins/javascript/pattern-analyzer.d.ts.map +1 -1
- package/dist/plugins/javascript/pattern-analyzer.js +4 -3
- package/dist/plugins/javascript/pattern-analyzer.js.map +1 -1
- package/dist/plugins/javascript/reference-finder.d.ts +21 -0
- package/dist/plugins/javascript/reference-finder.d.ts.map +1 -1
- package/dist/plugins/javascript/reference-finder.js +119 -76
- package/dist/plugins/javascript/reference-finder.js.map +1 -1
- package/dist/plugins/javascript/types.d.ts +4 -7
- package/dist/plugins/javascript/types.d.ts.map +1 -1
- package/dist/plugins/javascript/types.js +9 -9
- package/dist/plugins/javascript/types.js.map +1 -1
- package/dist/plugins/shared/parser-helpers.js.map +1 -1
- package/dist/{shared → plugins/shared}/utils/array.d.ts +6 -1
- package/dist/plugins/shared/utils/array.d.ts.map +1 -0
- package/dist/plugins/shared/utils/array.js.map +1 -0
- package/dist/{shared → plugins/shared}/utils/async.d.ts +1 -1
- package/dist/plugins/shared/utils/async.d.ts.map +1 -0
- package/dist/{shared → plugins/shared}/utils/async.js +2 -0
- package/dist/plugins/shared/utils/async.js.map +1 -0
- package/dist/{shared → plugins/shared}/utils/index.d.ts +0 -20
- package/dist/plugins/shared/utils/index.d.ts.map +1 -0
- package/dist/{shared → plugins/shared}/utils/index.js +0 -20
- package/dist/plugins/shared/utils/index.js.map +1 -0
- package/dist/plugins/shared/utils/memory-monitor.d.ts.map +1 -0
- package/dist/plugins/shared/utils/memory-monitor.js.map +1 -0
- package/dist/{shared → plugins/shared}/utils/object.d.ts +6 -6
- package/dist/plugins/shared/utils/object.d.ts.map +1 -0
- package/dist/{shared → plugins/shared}/utils/object.js +21 -3
- package/dist/plugins/shared/utils/object.js.map +1 -0
- package/dist/plugins/shared/utils/path.d.ts.map +1 -0
- package/dist/plugins/shared/utils/path.js.map +1 -0
- package/dist/{shared → plugins/shared}/utils/string.d.ts +1 -1
- package/dist/plugins/shared/utils/string.d.ts.map +1 -0
- package/dist/{shared → plugins/shared}/utils/string.js +7 -4
- package/dist/plugins/shared/utils/string.js.map +1 -0
- package/dist/plugins/typescript/declaration-analyzer.d.ts +4 -4
- package/dist/plugins/typescript/declaration-analyzer.d.ts.map +1 -1
- package/dist/plugins/typescript/declaration-analyzer.js +21 -8
- package/dist/plugins/typescript/declaration-analyzer.js.map +1 -1
- package/dist/plugins/typescript/language-service.d.ts +1 -1
- package/dist/plugins/typescript/language-service.d.ts.map +1 -1
- package/dist/plugins/typescript/parser.d.ts +3 -2
- package/dist/plugins/typescript/parser.d.ts.map +1 -1
- package/dist/plugins/typescript/parser.js +18 -13
- package/dist/plugins/typescript/parser.js.map +1 -1
- package/dist/plugins/typescript/reference-finder.d.ts +3 -0
- package/dist/plugins/typescript/reference-finder.d.ts.map +1 -1
- package/dist/plugins/typescript/reference-finder.js +5 -2
- package/dist/plugins/typescript/reference-finder.js.map +1 -1
- package/dist/plugins/typescript/symbol-extractor.d.ts +4 -0
- package/dist/plugins/typescript/symbol-extractor.d.ts.map +1 -1
- package/dist/plugins/typescript/symbol-extractor.js +18 -4
- package/dist/plugins/typescript/symbol-extractor.js.map +1 -1
- package/dist/plugins/typescript/types.d.ts +0 -3
- package/dist/plugins/typescript/types.d.ts.map +1 -1
- package/dist/plugins/typescript/types.js +6 -9
- package/dist/plugins/typescript/types.js.map +1 -1
- package/dist/shared/errors/index.d.ts +1 -1
- package/dist/shared/errors/index.d.ts.map +1 -1
- package/dist/shared/errors/parser-error.js +5 -5
- package/dist/shared/errors/parser-error.js.map +1 -1
- package/dist/shared/errors/validation-error.d.ts +2 -2
- package/dist/shared/errors/validation-error.d.ts.map +1 -1
- package/dist/shared/errors/validation-error.js.map +1 -1
- package/dist/shared/types/ast.d.ts +4 -4
- package/dist/shared/types/ast.d.ts.map +1 -1
- package/dist/shared/types/ast.js.map +1 -1
- package/dist/shared/types/core.d.ts +1 -1
- package/dist/shared/types/core.d.ts.map +1 -1
- package/dist/shared/types/index.d.ts +1 -0
- package/dist/shared/types/index.d.ts.map +1 -1
- package/dist/shared/types/index.js +2 -0
- package/dist/shared/types/index.js.map +1 -1
- package/dist/shared/types/line-number.d.ts +22 -0
- package/dist/shared/types/line-number.d.ts.map +1 -0
- package/dist/shared/types/line-number.js +28 -0
- package/dist/shared/types/line-number.js.map +1 -0
- package/package.json +2 -2
- package/dist/application/services/workflow-engine.service.d.ts +0 -76
- package/dist/application/services/workflow-engine.service.d.ts.map +0 -1
- package/dist/application/services/workflow-engine.service.js +0 -405
- package/dist/application/services/workflow-engine.service.js.map +0 -1
- package/dist/application/workflows/analysis-workflow.d.ts +0 -239
- package/dist/application/workflows/analysis-workflow.d.ts.map +0 -1
- package/dist/application/workflows/analysis-workflow.js +0 -395
- package/dist/application/workflows/analysis-workflow.js.map +0 -1
- package/dist/application/workflows/base-workflow.d.ts +0 -108
- package/dist/application/workflows/base-workflow.d.ts.map +0 -1
- package/dist/application/workflows/base-workflow.js +0 -236
- package/dist/application/workflows/base-workflow.js.map +0 -1
- package/dist/application/workflows/index.d.ts +0 -115
- package/dist/application/workflows/index.d.ts.map +0 -1
- package/dist/application/workflows/index.js +0 -218
- package/dist/application/workflows/index.js.map +0 -1
- package/dist/application/workflows/refactor-workflow.d.ts +0 -107
- package/dist/application/workflows/refactor-workflow.d.ts.map +0 -1
- package/dist/application/workflows/refactor-workflow.js +0 -310
- package/dist/application/workflows/refactor-workflow.js.map +0 -1
- package/dist/core/shared/symbol-finder.d.ts.map +0 -1
- package/dist/core/shared/symbol-finder.js +0 -882
- package/dist/core/shared/symbol-finder.js.map +0 -1
- package/dist/plugins/javascript/code-analyzer.d.ts +0 -68
- package/dist/plugins/javascript/code-analyzer.d.ts.map +0 -1
- package/dist/plugins/javascript/code-analyzer.js +0 -302
- package/dist/plugins/javascript/code-analyzer.js.map +0 -1
- package/dist/plugins/javascript/index.d.ts +0 -12
- package/dist/plugins/javascript/index.d.ts.map +0 -1
- package/dist/plugins/javascript/index.js +0 -16
- package/dist/plugins/javascript/index.js.map +0 -1
- package/dist/plugins/typescript/index.d.ts +0 -14
- package/dist/plugins/typescript/index.d.ts.map +0 -1
- package/dist/plugins/typescript/index.js +0 -13
- package/dist/plugins/typescript/index.js.map +0 -1
- package/dist/shared/utils/array.d.ts.map +0 -1
- package/dist/shared/utils/array.js.map +0 -1
- package/dist/shared/utils/async.d.ts.map +0 -1
- package/dist/shared/utils/async.js.map +0 -1
- package/dist/shared/utils/index.d.ts.map +0 -1
- package/dist/shared/utils/index.js.map +0 -1
- package/dist/shared/utils/memory-monitor.d.ts.map +0 -1
- package/dist/shared/utils/memory-monitor.js.map +0 -1
- package/dist/shared/utils/object.d.ts.map +0 -1
- package/dist/shared/utils/object.js.map +0 -1
- package/dist/shared/utils/path.d.ts.map +0 -1
- package/dist/shared/utils/path.js.map +0 -1
- package/dist/shared/utils/string.d.ts.map +0 -1
- package/dist/shared/utils/string.js.map +0 -1
- /package/dist/{shared → plugins/shared}/utils/array.js +0 -0
- /package/dist/{shared → plugins/shared}/utils/memory-monitor.d.ts +0 -0
- /package/dist/{shared → plugins/shared}/utils/memory-monitor.js +0 -0
- /package/dist/{shared → plugins/shared}/utils/path.d.ts +0 -0
- /package/dist/{shared → plugins/shared}/utils/path.js +0 -0
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BaseWorkflow 抽象類別
|
|
3
|
-
* 提供工作流程基礎架構和共用功能
|
|
4
|
-
*/
|
|
5
|
-
import { BaseError } from '../../shared/errors/base-error.js';
|
|
6
|
-
import type { Workflow, WorkflowStep, StepResult, WorkflowResult, IModuleCoordinatorService } from '../types.js';
|
|
7
|
-
/**
|
|
8
|
-
* 工作流程基礎錯誤
|
|
9
|
-
*/
|
|
10
|
-
export declare class WorkflowError extends BaseError {
|
|
11
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 步驟執行上下文
|
|
15
|
-
*/
|
|
16
|
-
export interface StepContext {
|
|
17
|
-
workflowId: string;
|
|
18
|
-
stepId: string;
|
|
19
|
-
previousResults: Map<string, unknown>;
|
|
20
|
-
metadata: Record<string, unknown>;
|
|
21
|
-
moduleCoordinator: IModuleCoordinatorService;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 工作流程配置
|
|
25
|
-
*/
|
|
26
|
-
export interface WorkflowConfig {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
timeout?: number;
|
|
31
|
-
maxRetries?: number;
|
|
32
|
-
enableRollback?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* BaseWorkflow 抽象類別
|
|
36
|
-
*/
|
|
37
|
-
export declare abstract class BaseWorkflow<TContext = unknown, TResult = unknown> {
|
|
38
|
-
protected readonly config: WorkflowConfig;
|
|
39
|
-
protected readonly steps: Map<string, WorkflowStep>;
|
|
40
|
-
protected readonly stepOrder: string[];
|
|
41
|
-
protected readonly moduleCoordinator: IModuleCoordinatorService;
|
|
42
|
-
constructor(config: WorkflowConfig, moduleCoordinator: IModuleCoordinatorService);
|
|
43
|
-
/**
|
|
44
|
-
* 子類別必須實作的工作流程定義方法
|
|
45
|
-
*/
|
|
46
|
-
protected abstract defineSteps(): void;
|
|
47
|
-
/**
|
|
48
|
-
* 子類別必須實作的上下文初始化方法
|
|
49
|
-
*/
|
|
50
|
-
protected abstract initializeContext(input: unknown): Promise<TContext>;
|
|
51
|
-
/**
|
|
52
|
-
* 子類別必須實作的結果處理方法
|
|
53
|
-
*/
|
|
54
|
-
protected abstract processResult(context: TContext): Promise<TResult>;
|
|
55
|
-
/**
|
|
56
|
-
* 建立工作流程實例
|
|
57
|
-
*/
|
|
58
|
-
createWorkflow(context?: TContext): Workflow<TContext>;
|
|
59
|
-
/**
|
|
60
|
-
* 執行工作流程
|
|
61
|
-
*/
|
|
62
|
-
execute(input: unknown): Promise<WorkflowResult<TResult>>;
|
|
63
|
-
/**
|
|
64
|
-
* 新增步驟到工作流程
|
|
65
|
-
*/
|
|
66
|
-
protected addStep(step: WorkflowStep): void;
|
|
67
|
-
/**
|
|
68
|
-
* 建立步驟的輔助方法
|
|
69
|
-
*/
|
|
70
|
-
protected createStep(id: string, name: string, executor: (context: StepContext) => Promise<StepResult>, options?: {
|
|
71
|
-
rollback?: (context: StepContext) => Promise<void>;
|
|
72
|
-
canRetry?: boolean;
|
|
73
|
-
maxRetries?: number;
|
|
74
|
-
}): WorkflowStep;
|
|
75
|
-
/**
|
|
76
|
-
* 建立成功步驟結果的輔助方法
|
|
77
|
-
*/
|
|
78
|
-
protected createSuccessResult(data?: unknown, nextStepId?: string): StepResult;
|
|
79
|
-
/**
|
|
80
|
-
* 建立失敗步驟結果的輔助方法
|
|
81
|
-
*/
|
|
82
|
-
protected createFailureResult(error: BaseError): StepResult;
|
|
83
|
-
/**
|
|
84
|
-
* 執行單一步驟
|
|
85
|
-
*/
|
|
86
|
-
private executeStep;
|
|
87
|
-
/**
|
|
88
|
-
* 產生唯一的工作流程 ID
|
|
89
|
-
*/
|
|
90
|
-
private generateWorkflowId;
|
|
91
|
-
/**
|
|
92
|
-
* 休眠輔助方法
|
|
93
|
-
*/
|
|
94
|
-
protected sleep(ms: number): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* 取得工作流程配置
|
|
97
|
-
*/
|
|
98
|
-
getConfig(): WorkflowConfig;
|
|
99
|
-
/**
|
|
100
|
-
* 取得步驟列表
|
|
101
|
-
*/
|
|
102
|
-
getSteps(): WorkflowStep[];
|
|
103
|
-
/**
|
|
104
|
-
* 取得步驟執行順序
|
|
105
|
-
*/
|
|
106
|
-
getStepOrder(): string[];
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=base-workflow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-workflow.d.ts","sourceRoot":"","sources":["../../../src/application/workflows/base-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,cAAc,EACd,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK;CAG9E;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,iBAAiB,EAAE,yBAAyB,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,8BAAsB,YAAY,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACtE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY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mB,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU;IAO3D;;OAEG;YACW,WAAW;IAuBzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C;;OAEG;IACI,SAAS,IAAI,cAAc;IAIlC;;OAEG;IACI,QAAQ,IAAI,YAAY,EAAE;IAIjC;;OAEG;IACI,YAAY,IAAI,MAAM,EAAE;CAGhC"}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BaseWorkflow 抽象類別
|
|
3
|
-
* 提供工作流程基礎架構和共用功能
|
|
4
|
-
*/
|
|
5
|
-
import { BaseError } from '../../shared/errors/base-error.js';
|
|
6
|
-
import { WorkflowStatus } from '../types.js';
|
|
7
|
-
/**
|
|
8
|
-
* 工作流程基礎錯誤
|
|
9
|
-
*/
|
|
10
|
-
export class WorkflowError extends BaseError {
|
|
11
|
-
constructor(message, details, cause) {
|
|
12
|
-
super('WORKFLOW_ERROR', message, details, cause);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* BaseWorkflow 抽象類別
|
|
17
|
-
*/
|
|
18
|
-
export class BaseWorkflow {
|
|
19
|
-
config;
|
|
20
|
-
steps;
|
|
21
|
-
stepOrder;
|
|
22
|
-
moduleCoordinator;
|
|
23
|
-
constructor(config, moduleCoordinator) {
|
|
24
|
-
this.config = config;
|
|
25
|
-
this.moduleCoordinator = moduleCoordinator;
|
|
26
|
-
this.steps = new Map();
|
|
27
|
-
this.stepOrder = [];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 建立工作流程實例
|
|
31
|
-
*/
|
|
32
|
-
createWorkflow(context) {
|
|
33
|
-
this.defineSteps();
|
|
34
|
-
return {
|
|
35
|
-
id: this.config.id,
|
|
36
|
-
name: this.config.name,
|
|
37
|
-
steps: Array.from(this.steps.values()),
|
|
38
|
-
context,
|
|
39
|
-
metadata: {
|
|
40
|
-
description: this.config.description,
|
|
41
|
-
timeout: this.config.timeout,
|
|
42
|
-
maxRetries: this.config.maxRetries,
|
|
43
|
-
enableRollback: this.config.enableRollback,
|
|
44
|
-
createdAt: new Date().toISOString()
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 執行工作流程
|
|
50
|
-
*/
|
|
51
|
-
async execute(input) {
|
|
52
|
-
const startTime = Date.now();
|
|
53
|
-
const workflowId = this.generateWorkflowId();
|
|
54
|
-
try {
|
|
55
|
-
// 初始化上下文
|
|
56
|
-
const context = await this.initializeContext(input);
|
|
57
|
-
// 建立工作流程
|
|
58
|
-
const workflow = this.createWorkflow(context);
|
|
59
|
-
workflow.id = workflowId;
|
|
60
|
-
// 執行步驟
|
|
61
|
-
const executedSteps = [];
|
|
62
|
-
const stepResults = new Map();
|
|
63
|
-
for (const stepId of this.stepOrder) {
|
|
64
|
-
const step = this.steps.get(stepId);
|
|
65
|
-
if (!step) {
|
|
66
|
-
throw new WorkflowError(`找不到步驟: ${stepId}`, { workflowId, stepId });
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const stepContext = {
|
|
70
|
-
workflowId,
|
|
71
|
-
stepId,
|
|
72
|
-
previousResults: stepResults,
|
|
73
|
-
metadata: workflow.metadata || {},
|
|
74
|
-
moduleCoordinator: this.moduleCoordinator
|
|
75
|
-
};
|
|
76
|
-
const stepResult = await this.executeStep(step, stepContext);
|
|
77
|
-
if (!stepResult.success) {
|
|
78
|
-
return {
|
|
79
|
-
workflowId,
|
|
80
|
-
status: WorkflowStatus.Failed,
|
|
81
|
-
error: stepResult.error || new WorkflowError(`步驟 ${stepId} 執行失敗`),
|
|
82
|
-
executedSteps,
|
|
83
|
-
duration: Date.now() - startTime
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
executedSteps.push(stepId);
|
|
87
|
-
if (stepResult.data !== undefined) {
|
|
88
|
-
stepResults.set(stepId, stepResult.data);
|
|
89
|
-
}
|
|
90
|
-
// 檢查是否有指定下一步驟
|
|
91
|
-
if (stepResult.nextStepId) {
|
|
92
|
-
const nextStepIndex = this.stepOrder.indexOf(stepResult.nextStepId);
|
|
93
|
-
if (nextStepIndex !== -1 && nextStepIndex > this.stepOrder.indexOf(stepId)) {
|
|
94
|
-
// 跳到指定步驟
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
const workflowError = error instanceof WorkflowError
|
|
101
|
-
? error
|
|
102
|
-
: new WorkflowError(`步驟 ${stepId} 執行時發生錯誤: ${error.message}`, { workflowId, stepId }, error);
|
|
103
|
-
return {
|
|
104
|
-
workflowId,
|
|
105
|
-
status: WorkflowStatus.Failed,
|
|
106
|
-
error: workflowError,
|
|
107
|
-
executedSteps,
|
|
108
|
-
duration: Date.now() - startTime
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// 處理最終結果
|
|
113
|
-
const result = await this.processResult(context);
|
|
114
|
-
return {
|
|
115
|
-
workflowId,
|
|
116
|
-
status: WorkflowStatus.Completed,
|
|
117
|
-
result,
|
|
118
|
-
executedSteps,
|
|
119
|
-
duration: Date.now() - startTime
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
const workflowError = error instanceof WorkflowError
|
|
124
|
-
? error
|
|
125
|
-
: new WorkflowError(`工作流程執行失敗: ${error.message}`, { workflowId }, error);
|
|
126
|
-
return {
|
|
127
|
-
workflowId,
|
|
128
|
-
status: WorkflowStatus.Failed,
|
|
129
|
-
error: workflowError,
|
|
130
|
-
executedSteps: [],
|
|
131
|
-
duration: Date.now() - startTime
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* 新增步驟到工作流程
|
|
137
|
-
*/
|
|
138
|
-
addStep(step) {
|
|
139
|
-
if (this.steps.has(step.id)) {
|
|
140
|
-
throw new WorkflowError(`步驟 ID 重複: ${step.id}`, { stepId: step.id });
|
|
141
|
-
}
|
|
142
|
-
this.steps.set(step.id, step);
|
|
143
|
-
this.stepOrder.push(step.id);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* 建立步驟的輔助方法
|
|
147
|
-
*/
|
|
148
|
-
createStep(id, name, executor, options) {
|
|
149
|
-
return {
|
|
150
|
-
id,
|
|
151
|
-
name,
|
|
152
|
-
execute: async (context) => {
|
|
153
|
-
return executor(context);
|
|
154
|
-
},
|
|
155
|
-
rollback: options?.rollback
|
|
156
|
-
? async (context) => options.rollback(context)
|
|
157
|
-
: undefined,
|
|
158
|
-
canRetry: options?.canRetry ?? false,
|
|
159
|
-
maxRetries: options?.maxRetries ?? 0
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* 建立成功步驟結果的輔助方法
|
|
164
|
-
*/
|
|
165
|
-
createSuccessResult(data, nextStepId) {
|
|
166
|
-
return {
|
|
167
|
-
success: true,
|
|
168
|
-
data,
|
|
169
|
-
nextStepId
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* 建立失敗步驟結果的輔助方法
|
|
174
|
-
*/
|
|
175
|
-
createFailureResult(error) {
|
|
176
|
-
return {
|
|
177
|
-
success: false,
|
|
178
|
-
error
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* 執行單一步驟
|
|
183
|
-
*/
|
|
184
|
-
async executeStep(step, context) {
|
|
185
|
-
const maxRetries = step.maxRetries || this.config.maxRetries || 0;
|
|
186
|
-
let lastError;
|
|
187
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
188
|
-
try {
|
|
189
|
-
return await step.execute(context);
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
lastError = error;
|
|
193
|
-
if (attempt < maxRetries && (step.canRetry ?? false)) {
|
|
194
|
-
// 等待一段時間後重試
|
|
195
|
-
await this.sleep(Math.pow(2, attempt) * 1000);
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
throw error;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
throw lastError || new WorkflowError('步驟執行失敗');
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* 產生唯一的工作流程 ID
|
|
205
|
-
*/
|
|
206
|
-
generateWorkflowId() {
|
|
207
|
-
const timestamp = Date.now().toString(36);
|
|
208
|
-
const random = Math.random().toString(36).substr(2, 5);
|
|
209
|
-
return `${this.config.name}-${timestamp}-${random}`;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* 休眠輔助方法
|
|
213
|
-
*/
|
|
214
|
-
sleep(ms) {
|
|
215
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* 取得工作流程配置
|
|
219
|
-
*/
|
|
220
|
-
getConfig() {
|
|
221
|
-
return { ...this.config };
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* 取得步驟列表
|
|
225
|
-
*/
|
|
226
|
-
getSteps() {
|
|
227
|
-
return Array.from(this.steps.values());
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* 取得步驟執行順序
|
|
231
|
-
*/
|
|
232
|
-
getStepOrder() {
|
|
233
|
-
return [...this.stepOrder];
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
//# sourceMappingURL=base-workflow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-workflow.js","sourceRoot":"","sources":["../../../src/application/workflows/base-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAQzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;GAEG;AAC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M,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvD,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;IACtD,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,EAAU;QACxB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,SAAS;QACd,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,YAAY;QACjB,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflows 模組匯出
|
|
3
|
-
* 提供所有工作流程類別和相關型別的統一匯出
|
|
4
|
-
*/
|
|
5
|
-
export { BaseWorkflow, WorkflowError, type StepContext, type WorkflowConfig } from './base-workflow.js';
|
|
6
|
-
export { RefactorWorkflow, type RefactorWorkflowInput, type RefactorWorkflowContext, type RefactorWorkflowResult } from './refactor-workflow.js';
|
|
7
|
-
export { AnalysisWorkflow, AnalysisType, type AnalysisWorkflowInput, type AnalysisWorkflowContext, type AnalysisWorkflowResult, type AnalysisReport } from './analysis-workflow.js';
|
|
8
|
-
import type { IModuleCoordinatorService } from '../types.js';
|
|
9
|
-
import { RefactorWorkflow } from '../workflows/refactor-workflow.js';
|
|
10
|
-
import { AnalysisWorkflow } from '../workflows/analysis-workflow.js';
|
|
11
|
-
/**
|
|
12
|
-
* 工作流程類型枚舉
|
|
13
|
-
*/
|
|
14
|
-
export declare enum WorkflowType {
|
|
15
|
-
REFACTOR = "refactor",
|
|
16
|
-
ANALYSIS = "analysis"
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 工作流程工廠
|
|
20
|
-
* 提供統一的工作流程建立介面
|
|
21
|
-
*/
|
|
22
|
-
export declare class WorkflowFactory {
|
|
23
|
-
private readonly moduleCoordinator;
|
|
24
|
-
constructor(moduleCoordinator: IModuleCoordinatorService);
|
|
25
|
-
/**
|
|
26
|
-
* 建立重構工作流程
|
|
27
|
-
*/
|
|
28
|
-
createRefactorWorkflow(): RefactorWorkflow;
|
|
29
|
-
/**
|
|
30
|
-
* 建立分析工作流程
|
|
31
|
-
*/
|
|
32
|
-
createAnalysisWorkflow(): AnalysisWorkflow;
|
|
33
|
-
/**
|
|
34
|
-
* 根據類型建立工作流程
|
|
35
|
-
*/
|
|
36
|
-
createWorkflow(type: WorkflowType): RefactorWorkflow | AnalysisWorkflow;
|
|
37
|
-
/**
|
|
38
|
-
* 取得所有支援的工作流程類型
|
|
39
|
-
*/
|
|
40
|
-
getSupportedTypes(): WorkflowType[];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 工作流程註冊表
|
|
44
|
-
* 用於管理和查詢可用的工作流程
|
|
45
|
-
*/
|
|
46
|
-
export declare class WorkflowRegistry {
|
|
47
|
-
private static readonly workflows;
|
|
48
|
-
/**
|
|
49
|
-
* 註冊工作流程
|
|
50
|
-
*/
|
|
51
|
-
static register(id: string, workflow: {
|
|
52
|
-
type: WorkflowType;
|
|
53
|
-
name: string;
|
|
54
|
-
description: string;
|
|
55
|
-
inputSchema?: unknown;
|
|
56
|
-
outputSchema?: unknown;
|
|
57
|
-
}): void;
|
|
58
|
-
/**
|
|
59
|
-
* 取得工作流程資訊
|
|
60
|
-
*/
|
|
61
|
-
static get(id: string): {
|
|
62
|
-
type: WorkflowType;
|
|
63
|
-
name: string;
|
|
64
|
-
description: string;
|
|
65
|
-
inputSchema?: unknown;
|
|
66
|
-
outputSchema?: unknown;
|
|
67
|
-
} | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* 取得所有註冊的工作流程
|
|
70
|
-
*/
|
|
71
|
-
static getAll(): Array<{
|
|
72
|
-
id: string;
|
|
73
|
-
type: WorkflowType;
|
|
74
|
-
name: string;
|
|
75
|
-
description: string;
|
|
76
|
-
inputSchema?: unknown;
|
|
77
|
-
outputSchema?: unknown;
|
|
78
|
-
}>;
|
|
79
|
-
/**
|
|
80
|
-
* 根據類型取得工作流程
|
|
81
|
-
*/
|
|
82
|
-
static getByType(type: WorkflowType): Array<{
|
|
83
|
-
id: string;
|
|
84
|
-
type: WorkflowType;
|
|
85
|
-
name: string;
|
|
86
|
-
description: string;
|
|
87
|
-
inputSchema?: unknown;
|
|
88
|
-
outputSchema?: unknown;
|
|
89
|
-
}>;
|
|
90
|
-
/**
|
|
91
|
-
* 檢查工作流程是否存在
|
|
92
|
-
*/
|
|
93
|
-
static exists(id: string): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* 移除工作流程註冊
|
|
96
|
-
*/
|
|
97
|
-
static unregister(id: string): boolean;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* 工作流程輔助方法
|
|
101
|
-
*/
|
|
102
|
-
export declare class WorkflowUtils {
|
|
103
|
-
/**
|
|
104
|
-
* 驗證工作流程輸入
|
|
105
|
-
*/
|
|
106
|
-
static validateInput(type: WorkflowType, input: unknown): {
|
|
107
|
-
isValid: boolean;
|
|
108
|
-
errors: string[];
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* 格式化工作流程結果
|
|
112
|
-
*/
|
|
113
|
-
static formatResult(type: WorkflowType, result: unknown): string;
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/workflows/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,O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