@toolproof-core/lib 1.0.34 → 1.0.37
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/integrations/firebase/firebaseAdminHelpers.d.ts +3 -10
- package/dist/integrations/firebase/firebaseAdminHelpers.js +43 -148
- package/dist/integrations/firebase/firebaseAdminInit.d.ts +0 -1
- package/dist/integrations/firebase/firebaseAdminInit.js +0 -1
- package/dist/lookups/lookups.d.ts +214 -0
- package/dist/lookups/lookups.js +33 -0
- package/dist/types/types.d.ts +15 -15
- package/dist/types/types.js +2 -3
- package/dist/utils/cosmosDataExtraction.d.ts +5 -0
- package/dist/utils/cosmosDataExtraction.js +15 -0
- package/dist/utils/identifierGeneration.d.ts +2 -0
- package/dist/utils/identifierGeneration.js +5 -0
- package/dist/utils/mutableStrategyOverlay.d.ts +55 -0
- package/dist/utils/mutableStrategyOverlay.js +115 -0
- package/dist/utils/resourceCreation.d.ts +11 -0
- package/dist/utils/resourceCreation.js +32 -0
- package/dist/utils/stepCreation.d.ts +9 -0
- package/dist/utils/stepCreation.js +79 -0
- package/dist/utils/stepParallelization.d.ts +2 -0
- package/dist/utils/{parallelizeSteps.js → stepParallelization.js} +40 -55
- package/dist/utils/strategyAssembly.d.ts +3 -0
- package/dist/utils/strategyAssembly.js +6 -0
- package/dist/utils/strategyCanonicalization.d.ts +4 -0
- package/dist/utils/strategyCanonicalization.js +215 -0
- package/dist/utils/strategyExtraction.d.ts +17 -0
- package/dist/utils/strategyExtraction.js +88 -0
- package/dist/utils/strategyStateResolution.d.ts +17 -0
- package/dist/utils/strategyStateResolution.js +27 -0
- package/dist/utils/strategyThreading.d.ts +2 -0
- package/dist/utils/strategyThreading.js +10 -0
- package/dist/utils/toolStepPaths.d.ts +2 -0
- package/dist/utils/toolStepPaths.js +21 -0
- package/package.json +43 -23
- package/src/integrations/firebase/firebaseAdminHelpers.ts +57 -180
- package/src/lookups/lookups.ts +35 -0
- package/src/types/types.ts +16 -13
- package/src/utils/cosmosDataExtraction.ts +25 -0
- package/src/utils/identifierGeneration.ts +12 -0
- package/src/utils/mutableStrategyOverlay.ts +286 -0
- package/src/utils/resourceCreation.ts +87 -0
- package/src/utils/stepCreation.ts +114 -0
- package/src/utils/stepParallelization.ts +181 -0
- package/src/utils/strategyAssembly.ts +14 -0
- package/src/utils/strategyCanonicalization.ts +294 -0
- package/src/utils/strategyExtraction.ts +150 -0
- package/src/utils/strategyStateResolution.ts +57 -0
- package/src/utils/strategyThreading.ts +27 -0
- package/src/utils/toolStepPaths.ts +34 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/artifacts/artifacts.d.ts +0 -175
- package/dist/artifacts/artifacts.d.ts.map +0 -1
- package/dist/artifacts/artifacts.js +0 -48
- package/dist/artifacts/artifacts.js.map +0 -1
- package/dist/integrations/firebase/createStep.d.ts +0 -11
- package/dist/integrations/firebase/createStep.d.ts.map +0 -1
- package/dist/integrations/firebase/createStep.js +0 -43
- package/dist/integrations/firebase/createStep.js.map +0 -1
- package/dist/integrations/firebase/createThreadedStrategy.d.ts +0 -3
- package/dist/integrations/firebase/createThreadedStrategy.d.ts.map +0 -1
- package/dist/integrations/firebase/createThreadedStrategy.js +0 -9
- package/dist/integrations/firebase/createThreadedStrategy.js.map +0 -1
- package/dist/integrations/firebase/firebaseAdminHelpers.d.ts.map +0 -1
- package/dist/integrations/firebase/firebaseAdminHelpers.js.map +0 -1
- package/dist/integrations/firebase/firebaseAdminInit.d.ts.map +0 -1
- package/dist/integrations/firebase/firebaseAdminInit.js.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js.map +0 -1
- package/dist/utils/bindInputRoleToResource.d.ts +0 -6
- package/dist/utils/bindInputRoleToResource.d.ts.map +0 -1
- package/dist/utils/bindInputRoleToResource.js +0 -25
- package/dist/utils/bindInputRoleToResource.js.map +0 -1
- package/dist/utils/creation/resourceCreation.d.ts +0 -21
- package/dist/utils/creation/resourceCreation.d.ts.map +0 -1
- package/dist/utils/creation/resourceCreation.js +0 -66
- package/dist/utils/creation/resourceCreation.js.map +0 -1
- package/dist/utils/creation/stepCreation.d.ts +0 -51
- package/dist/utils/creation/stepCreation.d.ts.map +0 -1
- package/dist/utils/creation/stepCreation.js +0 -90
- package/dist/utils/creation/stepCreation.js.map +0 -1
- package/dist/utils/creation/threadedStrategyCreation.d.ts +0 -19
- package/dist/utils/creation/threadedStrategyCreation.d.ts.map +0 -1
- package/dist/utils/creation/threadedStrategyCreation.js +0 -17
- package/dist/utils/creation/threadedStrategyCreation.js.map +0 -1
- package/dist/utils/extractData.d.ts +0 -13
- package/dist/utils/extractData.d.ts.map +0 -1
- package/dist/utils/extractData.js +0 -74
- package/dist/utils/extractData.js.map +0 -1
- package/dist/utils/parallelizeSteps.d.ts +0 -4
- package/dist/utils/parallelizeSteps.d.ts.map +0 -1
- package/dist/utils/parallelizeSteps.js.map +0 -1
- package/dist/utils/resolveResourceChain.d.ts +0 -19
- package/dist/utils/resolveResourceChain.d.ts.map +0 -1
- package/dist/utils/resolveResourceChain.js +0 -31
- package/dist/utils/resolveResourceChain.js.map +0 -1
- package/dist/utils/roleSpec.d.ts +0 -17
- package/dist/utils/roleSpec.d.ts.map +0 -1
- package/dist/utils/roleSpec.js +0 -58
- package/dist/utils/roleSpec.js.map +0 -1
- package/dist/utils/strategyState.d.ts +0 -8
- package/dist/utils/strategyState.d.ts.map +0 -1
- package/dist/utils/strategyState.js +0 -29
- package/dist/utils/strategyState.js.map +0 -1
- package/src/artifacts/artifacts.ts +0 -49
- package/src/integrations/firebase/createStep.ts +0 -71
- package/src/integrations/firebase/createThreadedStrategy.ts +0 -19
- package/src/utils/bindInputRoleToResource.ts +0 -54
- package/src/utils/creation/resourceCreation.ts +0 -121
- package/src/utils/creation/stepCreation.ts +0 -165
- package/src/utils/creation/threadedStrategyCreation.ts +0 -42
- package/src/utils/extractData.ts +0 -129
- package/src/utils/parallelizeSteps.ts +0 -187
- package/src/utils/resolveResourceChain.ts +0 -52
- package/src/utils/roleSpec.ts +0 -84
- package/src/utils/strategyState.ts +0 -57
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { extractResourceTypeHandleFromRoleValue } from './strategyExtraction.js';
|
|
2
|
+
export function getAuthoringSteps(strategy) {
|
|
3
|
+
return strategy.stepsByThreadIndex[0] ?? [];
|
|
4
|
+
}
|
|
5
|
+
export function setAuthoringSteps(strategy, steps) {
|
|
6
|
+
const nextStepsByThreadIndex = [...strategy.stepsByThreadIndex];
|
|
7
|
+
nextStepsByThreadIndex[0] = steps;
|
|
8
|
+
return {
|
|
9
|
+
...strategy,
|
|
10
|
+
stepsByThreadIndex: nextStepsByThreadIndex,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function getStrategyStateInputEntryByRoleName(strategyState, toolStepKey) {
|
|
14
|
+
return strategyState[toolStepKey];
|
|
15
|
+
}
|
|
16
|
+
export function getStrategyStateInputEntry(strategyState, toolStepRoleAddress) {
|
|
17
|
+
const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
|
|
18
|
+
return inputEntryByRoleName?.[toolStepRoleAddress.roleName];
|
|
19
|
+
}
|
|
20
|
+
export function setStrategyStateInputEntry(strategyState, toolStepRoleAddress, entry) {
|
|
21
|
+
const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey) ?? {};
|
|
22
|
+
return {
|
|
23
|
+
...strategyState,
|
|
24
|
+
[toolStepRoleAddress.toolStepKey]: {
|
|
25
|
+
...inputEntryByRoleName,
|
|
26
|
+
[toolStepRoleAddress.roleName]: entry,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function clearInputBinding(strategyState, toolStepRoleAddress) {
|
|
31
|
+
const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
|
|
32
|
+
if (!inputEntryByRoleName || !(toolStepRoleAddress.roleName in inputEntryByRoleName)) {
|
|
33
|
+
return strategyState;
|
|
34
|
+
}
|
|
35
|
+
const nextInputEntryByRoleName = { ...inputEntryByRoleName };
|
|
36
|
+
delete nextInputEntryByRoleName[toolStepRoleAddress.roleName];
|
|
37
|
+
if (Object.keys(nextInputEntryByRoleName).length === 0) {
|
|
38
|
+
const nextStrategyState = { ...strategyState };
|
|
39
|
+
delete nextStrategyState[toolStepRoleAddress.toolStepKey];
|
|
40
|
+
return nextStrategyState;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
...strategyState,
|
|
44
|
+
[toolStepRoleAddress.toolStepKey]: nextInputEntryByRoleName,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function bindInputResource(strategyState, target, resource) {
|
|
48
|
+
const mutableInputResource = {
|
|
49
|
+
...resource,
|
|
50
|
+
strategyStateInputKind: 'inputResource',
|
|
51
|
+
};
|
|
52
|
+
return setStrategyStateInputEntry(strategyState, target, mutableInputResource);
|
|
53
|
+
}
|
|
54
|
+
function getInputRoleValue(tool, roleName) {
|
|
55
|
+
return tool.roleSpec.inputRoleValueByName[roleName];
|
|
56
|
+
}
|
|
57
|
+
function getOutputRoleValue(tool, roleName) {
|
|
58
|
+
return tool.roleSpec.outputRoleValueByName[roleName];
|
|
59
|
+
}
|
|
60
|
+
export function bindInternalInputPotential(strategyState, targetAddress, sourceAddress, context) {
|
|
61
|
+
const sourceToolStep = context.toolStepByKey.get(sourceAddress.toolStepKey) ?? null;
|
|
62
|
+
if (!sourceToolStep) {
|
|
63
|
+
throw new Error(`Source tool step not found for '${sourceAddress.toolStepKey}'.`);
|
|
64
|
+
}
|
|
65
|
+
const targetToolStep = context.toolStepByKey.get(targetAddress.toolStepKey) ?? null;
|
|
66
|
+
if (!targetToolStep) {
|
|
67
|
+
throw new Error(`Target tool step not found for '${targetAddress.toolStepKey}'.`);
|
|
68
|
+
}
|
|
69
|
+
const sourceTool = context.toolMap.get(sourceToolStep.toolHandle) ?? null;
|
|
70
|
+
if (!sourceTool) {
|
|
71
|
+
throw new Error(`Source tool not found for '${sourceToolStep.toolHandle}'.`);
|
|
72
|
+
}
|
|
73
|
+
const targetTool = context.toolMap.get(targetToolStep.toolHandle) ?? null;
|
|
74
|
+
if (!targetTool) {
|
|
75
|
+
throw new Error(`Target tool not found for '${targetToolStep.toolHandle}'.`);
|
|
76
|
+
}
|
|
77
|
+
const targetInputRole = getInputRoleValue(targetTool, targetAddress.roleName);
|
|
78
|
+
if (!targetInputRole) {
|
|
79
|
+
throw new Error(`Target input role not found for (${targetAddress.toolStepKey}, ${targetAddress.roleName}).`);
|
|
80
|
+
}
|
|
81
|
+
const sourceOutputRole = getOutputRoleValue(sourceTool, sourceAddress.roleName);
|
|
82
|
+
const sourceInputRole = getInputRoleValue(sourceTool, sourceAddress.roleName);
|
|
83
|
+
const sourceInputEntryByRoleName = strategyState[sourceAddress.toolStepKey];
|
|
84
|
+
const sourceInputEntry = sourceInputEntryByRoleName?.[sourceAddress.roleName];
|
|
85
|
+
const sourceRoleType = sourceOutputRole
|
|
86
|
+
? extractResourceTypeHandleFromRoleValue(sourceOutputRole)
|
|
87
|
+
: sourceInputRole
|
|
88
|
+
? extractResourceTypeHandleFromRoleValue(sourceInputRole)
|
|
89
|
+
: null;
|
|
90
|
+
const targetRoleType = extractResourceTypeHandleFromRoleValue(targetInputRole);
|
|
91
|
+
if (!sourceOutputRole && sourceInputRole) {
|
|
92
|
+
if (!sourceInputEntry) {
|
|
93
|
+
throw new Error(`Source input role is not bound for (${sourceAddress.toolStepKey}, ${sourceAddress.roleName}).`); // ATTENTION: not an ontological invariant, but it might help catch some mistakes early on.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!sourceOutputRole && !sourceInputRole) {
|
|
97
|
+
throw new Error(`Source role not found for (${sourceAddress.toolStepKey}, ${sourceAddress.roleName}).`);
|
|
98
|
+
}
|
|
99
|
+
if (!sourceRoleType || !targetRoleType || sourceRoleType !== targetRoleType) {
|
|
100
|
+
throw new Error(`Reference type mismatch between source (${sourceAddress.toolStepKey}, ${sourceAddress.roleName}) and target (${targetAddress.toolStepKey}, ${targetAddress.roleName}).`);
|
|
101
|
+
}
|
|
102
|
+
return setStrategyStateInputEntry(strategyState, targetAddress, {
|
|
103
|
+
strategyStateInputKind: 'internalInputPotential',
|
|
104
|
+
toolStepRoleAddress: {
|
|
105
|
+
toolStepKey: sourceAddress.toolStepKey,
|
|
106
|
+
roleName: sourceAddress.roleName,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export function bindExternalInputPotential(strategyState, target) {
|
|
111
|
+
const mutableExternalInputPotential = {
|
|
112
|
+
strategyStateInputKind: 'externalInputPotential',
|
|
113
|
+
};
|
|
114
|
+
return setStrategyStateInputEntry(strategyState, target, mutableExternalInputPotential);
|
|
115
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToolStepRoleAddress, ResourceId, Resource, ResourceTypeHandle, StrategyTraceHandle } from '@toolproof-core/genesis';
|
|
2
|
+
export type ResourceCreationDescriptor = {
|
|
3
|
+
id: ResourceId;
|
|
4
|
+
resourceTypeHandle: ResourceTypeHandle;
|
|
5
|
+
} | {
|
|
6
|
+
id: ResourceId;
|
|
7
|
+
resourceTypeHandle: ResourceTypeHandle;
|
|
8
|
+
toolStepRoleAddress: ToolStepRoleAddress;
|
|
9
|
+
strategyTraceHandle: StrategyTraceHandle;
|
|
10
|
+
};
|
|
11
|
+
export declare function createResourceFromDescriptor(descriptor: ResourceCreationDescriptor, projection: unknown): Resource;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CONSTANTS } from '../lookups/lookups.js';
|
|
2
|
+
function createStrategyProvenance(strategyTraceHandle, toolStepRoleAddress) {
|
|
3
|
+
return {
|
|
4
|
+
provenanceKind: CONSTANTS.Enums.ProvenanceKind.strategy,
|
|
5
|
+
strategyTraceHandle,
|
|
6
|
+
toolStepRoleAddress,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function createRuntimeProvenance() {
|
|
10
|
+
return {
|
|
11
|
+
provenanceKind: CONSTANTS.Enums.ProvenanceKind.runtime,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function createResourcePointer(id, resourceTypeHandle, provenance) {
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
resourceTypeHandle,
|
|
18
|
+
provenance,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function createResource(resourcePointer, projection) {
|
|
22
|
+
return {
|
|
23
|
+
...resourcePointer,
|
|
24
|
+
projection,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function createResourceFromDescriptor(descriptor, projection) {
|
|
28
|
+
const provenance = 'toolStepRoleAddress' in descriptor
|
|
29
|
+
? createStrategyProvenance(descriptor.strategyTraceHandle, descriptor.toolStepRoleAddress)
|
|
30
|
+
: createRuntimeProvenance();
|
|
31
|
+
return createResource(createResourcePointer(descriptor.id, descriptor.resourceTypeHandle, provenance), projection);
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Tool } from '@toolproof-core/genesis';
|
|
2
|
+
import type { MutableToolStep, MutableCase, MutableWhileStep, MutableForStep, MutableBranchStep } from './mutableStrategyOverlay.js';
|
|
3
|
+
import { CONSTANTS } from '../lookups/lookups.js';
|
|
4
|
+
export declare function createToolStepFromTool(tool: Tool): MutableToolStep;
|
|
5
|
+
export declare function createCaseFromToolStepPair(what: MutableToolStep, when: MutableToolStep): MutableCase;
|
|
6
|
+
export declare function createLoopStepFromCase(stepCase: MutableCase, stepKind: typeof CONSTANTS.Enums.StepKind.for | typeof CONSTANTS.Enums.StepKind.while): MutableForStep | MutableWhileStep;
|
|
7
|
+
export declare function createBranchStepFromCases(cases: MutableCase[]): MutableBranchStep;
|
|
8
|
+
export declare function cloneForStep(forStep: MutableForStep): MutableForStep;
|
|
9
|
+
export declare function cloneWhileStep(whileStep: MutableWhileStep): MutableWhileStep;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CONSTANTS } from '../lookups/lookups.js';
|
|
2
|
+
import { getInputRoleNamesFromTool, getOutputRoleNamesFromTool } from './strategyExtraction.js';
|
|
3
|
+
import { generateIdentifier } from './identifierGeneration.js';
|
|
4
|
+
function assertNonEmpty(arr, msg) {
|
|
5
|
+
if (arr.length === 0) {
|
|
6
|
+
throw new Error(msg);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function getRoleBindingSpec(tool) {
|
|
10
|
+
return {
|
|
11
|
+
inputBindings: getInputRoleNamesFromTool(tool),
|
|
12
|
+
outputBindings: getOutputRoleNamesFromTool(tool),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function createToolStepFromTool(tool) {
|
|
16
|
+
return {
|
|
17
|
+
toolStepKey: generateIdentifier('ToolStepKey'),
|
|
18
|
+
stepKind: CONSTANTS.Enums.StepKind.tool,
|
|
19
|
+
toolHandle: tool.handle,
|
|
20
|
+
roleBindingSpec: getRoleBindingSpec(tool),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function createCaseFromToolStepPair(what, when) {
|
|
24
|
+
return { what, when };
|
|
25
|
+
}
|
|
26
|
+
export function createLoopStepFromCase(stepCase, stepKind) {
|
|
27
|
+
if (stepKind === CONSTANTS.Enums.StepKind.for) {
|
|
28
|
+
return {
|
|
29
|
+
macroStepKey: generateIdentifier('ForStepKey'),
|
|
30
|
+
stepKind: CONSTANTS.Enums.StepKind.for,
|
|
31
|
+
case: stepCase,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
macroStepKey: generateIdentifier('WhileStepKey'),
|
|
36
|
+
stepKind: CONSTANTS.Enums.StepKind.while,
|
|
37
|
+
case: stepCase,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function createBranchStepFromCases(cases) {
|
|
41
|
+
assertNonEmpty(cases, 'createBranchStepFromCases requires at least one case');
|
|
42
|
+
return {
|
|
43
|
+
macroStepKey: generateIdentifier('BranchStepKey'),
|
|
44
|
+
stepKind: CONSTANTS.Enums.StepKind.branch,
|
|
45
|
+
cases,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function cloneForStep(forStep) {
|
|
49
|
+
return {
|
|
50
|
+
macroStepKey: generateIdentifier('ForStepKey'),
|
|
51
|
+
stepKind: CONSTANTS.Enums.StepKind.for,
|
|
52
|
+
case: {
|
|
53
|
+
what: {
|
|
54
|
+
...forStep.case.what,
|
|
55
|
+
toolStepKey: generateIdentifier('ToolStepKey'),
|
|
56
|
+
},
|
|
57
|
+
when: {
|
|
58
|
+
...forStep.case.when,
|
|
59
|
+
toolStepKey: generateIdentifier('ToolStepKey'),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function cloneWhileStep(whileStep) {
|
|
65
|
+
return {
|
|
66
|
+
macroStepKey: generateIdentifier('WhileStepKey'),
|
|
67
|
+
stepKind: CONSTANTS.Enums.StepKind.while,
|
|
68
|
+
case: {
|
|
69
|
+
what: {
|
|
70
|
+
...whileStep.case.what,
|
|
71
|
+
toolStepKey: generateIdentifier('ToolStepKey'),
|
|
72
|
+
},
|
|
73
|
+
when: {
|
|
74
|
+
...whileStep.case.when,
|
|
75
|
+
toolStepKey: generateIdentifier('ToolStepKey'),
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { MutableStep, MutableStrategyState, MutableToolStepKey } from './mutableStrategyOverlay.js';
|
|
2
|
+
export declare function getIndependentThreads<TKey extends string = MutableToolStepKey, TStep extends MutableStep<TKey> = MutableStep<TKey>>(steps: TStep[], strategyState: MutableStrategyState<TKey>): TStep[][];
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
import { CONSTANTS } from '../
|
|
2
|
-
function getToolStepId(toolStep) {
|
|
3
|
-
const maybeId = toolStep?.id;
|
|
4
|
-
return typeof maybeId === 'string' ? maybeId : undefined;
|
|
5
|
-
}
|
|
1
|
+
import { CONSTANTS } from '../lookups/lookups.js';
|
|
6
2
|
export function getIndependentThreads(steps, strategyState) {
|
|
7
3
|
const getOwnerLabel = (ownerIndex) => {
|
|
8
4
|
const step = steps[ownerIndex];
|
|
9
5
|
return `steps[${ownerIndex}] stepKind=${step?.stepKind ?? 'unknown'}`;
|
|
10
6
|
};
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const ownerToToolStepIds = new Map();
|
|
14
|
-
const toolStepById = new Map();
|
|
7
|
+
const toolStepKeyToOwner = new Map();
|
|
8
|
+
const toolStepByKey = new Map();
|
|
15
9
|
const addToolStep = (toolStep, ownerIndex) => {
|
|
16
|
-
|
|
17
|
-
if (!toolStepId || !toolStep)
|
|
10
|
+
if (!toolStep)
|
|
18
11
|
return;
|
|
19
|
-
const existingOwner =
|
|
12
|
+
const existingOwner = toolStepKeyToOwner.get(toolStep.toolStepKey);
|
|
20
13
|
if (existingOwner !== undefined) {
|
|
21
|
-
throw new Error(`Duplicate
|
|
14
|
+
throw new Error(`Duplicate toolStepKey '${toolStep.toolStepKey}' found in ${getOwnerLabel(ownerIndex)} and ${getOwnerLabel(existingOwner)}`);
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const bucket = ownerToToolStepIds.get(ownerIndex) ?? [];
|
|
26
|
-
bucket.push(toolStepId);
|
|
27
|
-
ownerToToolStepIds.set(ownerIndex, bucket);
|
|
16
|
+
toolStepKeyToOwner.set(toolStep.toolStepKey, ownerIndex);
|
|
17
|
+
toolStepByKey.set(toolStep.toolStepKey, toolStep);
|
|
28
18
|
};
|
|
29
19
|
steps.forEach((step, ownerIndex) => {
|
|
30
20
|
if (step.stepKind === CONSTANTS.Enums.StepKind.tool) {
|
|
@@ -45,16 +35,13 @@ export function getIndependentThreads(steps, strategyState) {
|
|
|
45
35
|
}
|
|
46
36
|
if (step.stepKind === CONSTANTS.Enums.StepKind.branch) {
|
|
47
37
|
const branch = step;
|
|
48
|
-
for (const
|
|
49
|
-
addToolStep(
|
|
50
|
-
addToolStep(
|
|
38
|
+
for (const stepCase of branch.cases) {
|
|
39
|
+
addToolStep(stepCase?.what, ownerIndex);
|
|
40
|
+
addToolStep(stepCase?.when, ownerIndex);
|
|
51
41
|
}
|
|
52
|
-
return;
|
|
53
42
|
}
|
|
54
43
|
});
|
|
55
|
-
// Undirected adjacency used for connected components (thread groups).
|
|
56
44
|
const ownerAdj = new Map();
|
|
57
|
-
// Directed dependencies used for strict ordering validation: owner -> producers it depends on.
|
|
58
45
|
const ownerDeps = new Map();
|
|
59
46
|
const ensureOwner = (ownerIndex) => {
|
|
60
47
|
if (!ownerAdj.has(ownerIndex))
|
|
@@ -62,36 +49,32 @@ export function getIndependentThreads(steps, strategyState) {
|
|
|
62
49
|
if (!ownerDeps.has(ownerIndex))
|
|
63
50
|
ownerDeps.set(ownerIndex, new Set());
|
|
64
51
|
};
|
|
65
|
-
for (let
|
|
66
|
-
ensureOwner(
|
|
52
|
+
for (let index = 0; index < steps.length; index++) {
|
|
53
|
+
ensureOwner(index);
|
|
67
54
|
}
|
|
68
|
-
|
|
69
|
-
for (const [toolStepId, ownerIndex] of toolStepIdToOwner) {
|
|
55
|
+
for (const [toolStepKey, ownerIndex] of toolStepKeyToOwner) {
|
|
70
56
|
ensureOwner(ownerIndex);
|
|
71
|
-
const toolStep =
|
|
57
|
+
const toolStep = toolStepByKey.get(toolStepKey);
|
|
72
58
|
const inputBindings = toolStep?.roleBindingSpec?.inputBindings ?? [];
|
|
73
|
-
const bucket = strategyState
|
|
59
|
+
const bucket = strategyState[toolStepKey];
|
|
74
60
|
for (const inputRoleId of inputBindings) {
|
|
75
61
|
const entry = bucket?.[inputRoleId];
|
|
76
|
-
if (!entry || entry.strategyStateInputKind !== '
|
|
62
|
+
if (!entry || entry.strategyStateInputKind !== 'internalInputPotential')
|
|
77
63
|
continue;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
:
|
|
81
|
-
if (!creatorToolStepId) {
|
|
82
|
-
throw new Error(`Unresolvable referenceInput in toolStep '${toolStepId}' (${getOwnerLabel(ownerIndex)}): missing toolStepPath for role '${inputRoleId}'`);
|
|
64
|
+
const producerToolStepKey = entry.toolStepRoleAddress?.toolStepKey;
|
|
65
|
+
if (typeof producerToolStepKey !== 'string') {
|
|
66
|
+
throw new Error(`Unresolvable internalInputPotential in toolStep '${toolStepKey}' (${getOwnerLabel(ownerIndex)}): missing toolStepRoleAddress.toolStepKey for role '${inputRoleId}'`);
|
|
83
67
|
}
|
|
84
|
-
const producerOwner =
|
|
68
|
+
const producerOwner = toolStepKeyToOwner.get(producerToolStepKey);
|
|
85
69
|
if (producerOwner === undefined) {
|
|
86
|
-
throw new Error(`Unresolvable
|
|
70
|
+
throw new Error(`Unresolvable internalInputPotential in toolStep '${toolStepKey}' (${getOwnerLabel(ownerIndex)}): source toolStepKey '${producerToolStepKey}' not found in strategy steps`);
|
|
87
71
|
}
|
|
88
72
|
ensureOwner(producerOwner);
|
|
89
|
-
ownerAdj.get(ownerIndex)
|
|
90
|
-
ownerAdj.get(producerOwner)
|
|
91
|
-
ownerDeps.get(ownerIndex)
|
|
73
|
+
ownerAdj.get(ownerIndex)?.add(producerOwner);
|
|
74
|
+
ownerAdj.get(producerOwner)?.add(ownerIndex);
|
|
75
|
+
ownerDeps.get(ownerIndex)?.add(producerOwner);
|
|
92
76
|
}
|
|
93
77
|
}
|
|
94
|
-
// Connected components over owners.
|
|
95
78
|
const visited = new Set();
|
|
96
79
|
const components = [];
|
|
97
80
|
for (let ownerIndex = 0; ownerIndex < steps.length; ownerIndex++) {
|
|
@@ -102,27 +85,30 @@ export function getIndependentThreads(steps, strategyState) {
|
|
|
102
85
|
visited.add(ownerIndex);
|
|
103
86
|
while (queue.length > 0) {
|
|
104
87
|
const node = queue.shift();
|
|
88
|
+
if (node === undefined)
|
|
89
|
+
break;
|
|
105
90
|
component.push(node);
|
|
106
91
|
for (const neighbor of ownerAdj.get(node) ?? []) {
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
if (visited.has(neighbor))
|
|
93
|
+
continue;
|
|
94
|
+
visited.add(neighbor);
|
|
95
|
+
queue.push(neighbor);
|
|
111
96
|
}
|
|
112
97
|
}
|
|
113
98
|
components.push(component);
|
|
114
99
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const ownersInOrder = steps.map((_, i) => i).filter((i) => compSet.has(i));
|
|
100
|
+
for (const component of components) {
|
|
101
|
+
const componentOwners = new Set(component);
|
|
102
|
+
const ownersInOrder = steps.map((_, index) => index).filter((index) => componentOwners.has(index));
|
|
119
103
|
const position = new Map();
|
|
120
|
-
ownersInOrder.forEach((owner,
|
|
104
|
+
ownersInOrder.forEach((owner, index) => position.set(owner, index));
|
|
121
105
|
for (const consumerOwner of ownersInOrder) {
|
|
122
106
|
const deps = ownerDeps.get(consumerOwner);
|
|
123
107
|
if (!deps || deps.size === 0)
|
|
124
108
|
continue;
|
|
125
109
|
const consumerPos = position.get(consumerOwner);
|
|
110
|
+
if (consumerPos === undefined)
|
|
111
|
+
continue;
|
|
126
112
|
for (const producerOwner of deps) {
|
|
127
113
|
const producerPos = position.get(producerOwner);
|
|
128
114
|
if (producerPos === undefined) {
|
|
@@ -135,10 +121,9 @@ export function getIndependentThreads(steps, strategyState) {
|
|
|
135
121
|
}
|
|
136
122
|
}
|
|
137
123
|
return components
|
|
138
|
-
.map((
|
|
139
|
-
const ownerSet = new Set(
|
|
140
|
-
return steps.filter((
|
|
124
|
+
.map((component) => {
|
|
125
|
+
const ownerSet = new Set(component);
|
|
126
|
+
return steps.filter((_step, index) => ownerSet.has(index));
|
|
141
127
|
})
|
|
142
128
|
.filter((group) => group.length > 0);
|
|
143
129
|
}
|
|
144
|
-
//# sourceMappingURL=parallelizeSteps.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { toExecutionMutableStrategy } from './strategyThreading.js';
|
|
2
|
+
import { mutableStrategyToStrategy } from './strategyCanonicalization.js';
|
|
3
|
+
export function composeStrategyForExecution(mutableStrategy) {
|
|
4
|
+
const executionStrategy = toExecutionMutableStrategy(mutableStrategy);
|
|
5
|
+
return mutableStrategyToStrategy(executionStrategy);
|
|
6
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Strategy } from '@toolproof-core/genesis';
|
|
2
|
+
import type { MutableStrategy } from './mutableStrategyOverlay.js';
|
|
3
|
+
export declare function strategyToMutableStrategy(strategy: Strategy): MutableStrategy;
|
|
4
|
+
export declare function mutableStrategyToStrategy(mutableStrategy: MutableStrategy): Strategy;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { CONSTANTS } from '../lookups/lookups.js';
|
|
2
|
+
import { generateIdentifier } from './identifierGeneration.js';
|
|
3
|
+
function stripMutableCase(stepCase) {
|
|
4
|
+
const { when, what, ...rest } = stepCase;
|
|
5
|
+
const { toolStepKey: _whenToolStepKey, ...canonicalWhen } = when;
|
|
6
|
+
const { toolStepKey: _whatToolStepKey, ...canonicalWhat } = what;
|
|
7
|
+
return {
|
|
8
|
+
...rest,
|
|
9
|
+
when: canonicalWhen,
|
|
10
|
+
what: canonicalWhat,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function buildExecutionPathMap(strategy) {
|
|
14
|
+
const executionPathByKey = new Map();
|
|
15
|
+
const registerStep = (step, pathPrefix) => {
|
|
16
|
+
switch (step.stepKind) {
|
|
17
|
+
case CONSTANTS.Enums.StepKind.tool:
|
|
18
|
+
executionPathByKey.set(step.toolStepKey, `${pathPrefix}/self`);
|
|
19
|
+
return;
|
|
20
|
+
case CONSTANTS.Enums.StepKind.branch:
|
|
21
|
+
step.cases.forEach((stepCase, caseIndex) => {
|
|
22
|
+
executionPathByKey.set(stepCase.when.toolStepKey, `${pathPrefix}/cases/${caseIndex}/when`);
|
|
23
|
+
executionPathByKey.set(stepCase.what.toolStepKey, `${pathPrefix}/cases/${caseIndex}/what`);
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
case CONSTANTS.Enums.StepKind.while:
|
|
27
|
+
case CONSTANTS.Enums.StepKind.for:
|
|
28
|
+
executionPathByKey.set(step.case.when.toolStepKey, `${pathPrefix}/case/when`);
|
|
29
|
+
executionPathByKey.set(step.case.what.toolStepKey, `${pathPrefix}/case/what`);
|
|
30
|
+
return;
|
|
31
|
+
default:
|
|
32
|
+
throw new Error('Unsupported step kind while projecting strategy.');
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
strategy.stepsByThreadIndex.forEach((steps, threadIndex) => {
|
|
36
|
+
steps.forEach((step, stepIndex) => {
|
|
37
|
+
registerStep(step, `/threads/${threadIndex}/steps/${stepIndex}`);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return executionPathByKey;
|
|
41
|
+
}
|
|
42
|
+
function toCanonicalStrategyStateEntry(entry, executionPathByKey) {
|
|
43
|
+
if (entry.strategyStateInputKind !== 'internalInputPotential') {
|
|
44
|
+
return entry;
|
|
45
|
+
}
|
|
46
|
+
const sourceToolStepPath = executionPathByKey.get(entry.toolStepRoleAddress.toolStepKey);
|
|
47
|
+
if (!sourceToolStepPath) {
|
|
48
|
+
throw new Error(`Cannot project strategy state: no execution path found for toolStepKey '${entry.toolStepRoleAddress.toolStepKey}'.`);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
strategyStateInputKind: 'internalInputPotential',
|
|
52
|
+
toolStepRoleAddress: {
|
|
53
|
+
toolStepPath: sourceToolStepPath,
|
|
54
|
+
roleName: entry.toolStepRoleAddress.roleName,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function toCanonicalStep(step) {
|
|
59
|
+
switch (step.stepKind) {
|
|
60
|
+
case CONSTANTS.Enums.StepKind.tool: {
|
|
61
|
+
const { toolStepKey: _toolStepKey, ...canonicalToolStep } = step;
|
|
62
|
+
return canonicalToolStep;
|
|
63
|
+
}
|
|
64
|
+
case CONSTANTS.Enums.StepKind.branch: {
|
|
65
|
+
const { macroStepKey: _macroStepKey, cases, ...rest } = step;
|
|
66
|
+
return {
|
|
67
|
+
...rest,
|
|
68
|
+
cases: cases.map(stripMutableCase),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
case CONSTANTS.Enums.StepKind.while:
|
|
72
|
+
case CONSTANTS.Enums.StepKind.for: {
|
|
73
|
+
const { macroStepKey: _macroStepKey, case: stepCase, ...rest } = step;
|
|
74
|
+
return {
|
|
75
|
+
...rest,
|
|
76
|
+
case: stripMutableCase(stepCase),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
default:
|
|
80
|
+
throw new Error('Unsupported step kind while projecting steps.');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function toMutableStrategyStateEntry(entry, executionKeyByPath) {
|
|
84
|
+
if (entry.strategyStateInputKind !== 'internalInputPotential') {
|
|
85
|
+
return entry;
|
|
86
|
+
}
|
|
87
|
+
const sourceToolStepKey = executionKeyByPath.get(entry.toolStepRoleAddress.toolStepPath);
|
|
88
|
+
if (!sourceToolStepKey) {
|
|
89
|
+
throw new Error(`Cannot deproject strategy state: no mutable key found for toolStepPath '${entry.toolStepRoleAddress.toolStepPath}'.`);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
strategyStateInputKind: 'internalInputPotential',
|
|
93
|
+
toolStepRoleAddress: {
|
|
94
|
+
toolStepKey: sourceToolStepKey,
|
|
95
|
+
roleName: entry.toolStepRoleAddress.roleName,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function toMutableToolStep(step) {
|
|
100
|
+
return {
|
|
101
|
+
...step,
|
|
102
|
+
toolStepKey: generateIdentifier('ToolStepKey'),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function toMutableCase(stepCase) {
|
|
106
|
+
const { when, what, ...rest } = stepCase;
|
|
107
|
+
return {
|
|
108
|
+
...rest,
|
|
109
|
+
when: toMutableToolStep(when),
|
|
110
|
+
what: toMutableToolStep(what),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function toMutableBranchStep(step) {
|
|
114
|
+
const { cases, ...rest } = step;
|
|
115
|
+
return {
|
|
116
|
+
...rest,
|
|
117
|
+
macroStepKey: generateIdentifier('BranchStepKey'),
|
|
118
|
+
cases: cases.map(toMutableCase),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function toMutableWhileStep(step) {
|
|
122
|
+
const { case: stepCase, ...rest } = step;
|
|
123
|
+
return {
|
|
124
|
+
...rest,
|
|
125
|
+
macroStepKey: generateIdentifier('WhileStepKey'),
|
|
126
|
+
case: toMutableCase(stepCase),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function toMutableForStep(step) {
|
|
130
|
+
const { case: stepCase, ...rest } = step;
|
|
131
|
+
return {
|
|
132
|
+
...rest,
|
|
133
|
+
macroStepKey: generateIdentifier('ForStepKey'),
|
|
134
|
+
case: toMutableCase(stepCase),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function toMutableStep(step) {
|
|
138
|
+
switch (step.stepKind) {
|
|
139
|
+
case CONSTANTS.Enums.StepKind.tool:
|
|
140
|
+
return toMutableToolStep(step);
|
|
141
|
+
case CONSTANTS.Enums.StepKind.branch:
|
|
142
|
+
return toMutableBranchStep(step);
|
|
143
|
+
case CONSTANTS.Enums.StepKind.while:
|
|
144
|
+
return toMutableWhileStep(step);
|
|
145
|
+
case CONSTANTS.Enums.StepKind.for:
|
|
146
|
+
return toMutableForStep(step);
|
|
147
|
+
default:
|
|
148
|
+
throw new Error('Unsupported step kind while deprojecting steps.');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function buildExecutionKeyMap(strategy) {
|
|
152
|
+
const executionPathByKey = buildExecutionPathMap(strategy);
|
|
153
|
+
const executionKeyByPath = new Map();
|
|
154
|
+
for (const [toolStepKey, toolStepPath] of executionPathByKey.entries()) {
|
|
155
|
+
executionKeyByPath.set(toolStepPath, toolStepKey);
|
|
156
|
+
}
|
|
157
|
+
return executionKeyByPath;
|
|
158
|
+
}
|
|
159
|
+
export function strategyToMutableStrategy(strategy) {
|
|
160
|
+
const stepsByThreadIndex = strategy.stepsByThreadIndex.map((steps) => steps.map(toMutableStep));
|
|
161
|
+
const seededMutableStrategy = {
|
|
162
|
+
...strategy,
|
|
163
|
+
stepsByThreadIndex,
|
|
164
|
+
strategyState: {},
|
|
165
|
+
};
|
|
166
|
+
const executionKeyByPath = buildExecutionKeyMap(seededMutableStrategy);
|
|
167
|
+
const strategyState = {};
|
|
168
|
+
for (const [toolStepPath, inputEntryByRoleName] of Object.entries(strategy.strategyState)) {
|
|
169
|
+
const toolStepKey = executionKeyByPath.get(toolStepPath);
|
|
170
|
+
if (!toolStepKey) {
|
|
171
|
+
throw new Error(`Cannot deproject strategy state: no mutable key found for toolStepPath '${toolStepPath}'.`);
|
|
172
|
+
}
|
|
173
|
+
strategyState[toolStepKey] = Object.fromEntries(Object.entries(inputEntryByRoleName).map(([roleName, entry]) => {
|
|
174
|
+
if (entry === undefined) {
|
|
175
|
+
throw new Error(`Cannot deproject strategy state: role '${roleName}' on toolStepPath '${toolStepPath}' is explicitly undefined.`);
|
|
176
|
+
}
|
|
177
|
+
return [
|
|
178
|
+
roleName,
|
|
179
|
+
toMutableStrategyStateEntry(entry, executionKeyByPath),
|
|
180
|
+
];
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
...strategy,
|
|
185
|
+
stepsByThreadIndex,
|
|
186
|
+
strategyState,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export function mutableStrategyToStrategy(mutableStrategy) {
|
|
190
|
+
const executionPathByKey = buildExecutionPathMap(mutableStrategy);
|
|
191
|
+
const strategyState = {};
|
|
192
|
+
for (const [toolStepKey, inputEntryByRoleName] of Object.entries(mutableStrategy.strategyState)) {
|
|
193
|
+
if (!inputEntryByRoleName) {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const toolStepPath = executionPathByKey.get(toolStepKey);
|
|
197
|
+
if (!toolStepPath) {
|
|
198
|
+
throw new Error(`Cannot project strategy state: no execution path found for toolStepKey '${toolStepKey}'.`);
|
|
199
|
+
}
|
|
200
|
+
strategyState[toolStepPath] = Object.fromEntries(Object.entries(inputEntryByRoleName).map(([roleName, entry]) => {
|
|
201
|
+
if (entry === undefined) {
|
|
202
|
+
throw new Error(`Cannot project strategy state: role '${roleName}' on toolStepKey '${toolStepKey}' is explicitly undefined.`);
|
|
203
|
+
}
|
|
204
|
+
return [
|
|
205
|
+
roleName,
|
|
206
|
+
toCanonicalStrategyStateEntry(entry, executionPathByKey),
|
|
207
|
+
];
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
...mutableStrategy,
|
|
212
|
+
stepsByThreadIndex: mutableStrategy.stepsByThreadIndex.map((steps) => steps.map(toCanonicalStep)),
|
|
213
|
+
strategyState,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RoleName, RoleSpec, ToolHandle, Tool, ResourceTypeHandle, RoleValue } from '@toolproof-core/genesis';
|
|
2
|
+
import type { MutableStrategy, MutableToolStep } from './mutableStrategyOverlay.js';
|
|
3
|
+
export type RoleSpecEntry = [RoleName, RoleValue];
|
|
4
|
+
type RoleSpecDirectionKeys = keyof Pick<RoleSpec, 'inputRoleValueByName' | 'outputRoleValueByName'>;
|
|
5
|
+
export type RoleSpecByDirection = {
|
|
6
|
+
[K in RoleSpecDirectionKeys]: Map<RoleName, RoleValue>;
|
|
7
|
+
};
|
|
8
|
+
export declare function getInputRoleSpecEntriesFromTool(tool: Tool): RoleSpecEntry[];
|
|
9
|
+
export declare function getOutputRoleSpecEntriesFromTool(tool: Tool): RoleSpecEntry[];
|
|
10
|
+
export declare function getInputRoleNamesFromTool(tool: Tool): RoleName[];
|
|
11
|
+
export declare function getOutputRoleNamesFromTool(tool: Tool): RoleName[];
|
|
12
|
+
export declare function extractResourceTypeHandleFromRoleValue(roleValue: RoleValue): ResourceTypeHandle | null;
|
|
13
|
+
export declare function extractToolStepsFromStrategy(strategy: MutableStrategy): MutableToolStep[];
|
|
14
|
+
export declare function extractToolsFromStrategy(strategy: MutableStrategy, toolMap: Map<ToolHandle, Tool>): Tool[];
|
|
15
|
+
export declare function extractRoleSpecByDirectionByToolHandleFromStrategy(strategy: MutableStrategy, toolMap: Map<ToolHandle, Tool>): Map<ToolHandle, RoleSpecByDirection>;
|
|
16
|
+
export declare function extractSingleBranchableOutputResourceTypeHandle(tool: Tool): ResourceTypeHandle | null;
|
|
17
|
+
export {};
|