@toolproof-core/lib 1.0.36 → 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 +1 -2
- package/dist/integrations/firebase/firebaseAdminHelpers.js +5 -14
- package/dist/lookups/lookups.d.ts +17 -24
- package/dist/lookups/lookups.js +10 -0
- package/dist/types/types.d.ts +10 -6
- 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/stepParallelization.js +129 -0
- 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/{resolveStrategyStateChain.js → strategyStateResolution.js} +5 -4
- 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 +41 -21
- package/src/integrations/firebase/firebaseAdminHelpers.ts +5 -17
- package/src/lookups/lookups.ts +16 -6
- package/src/types/types.ts +10 -4
- 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/integrations/firebase/createStep.d.ts +0 -10
- package/dist/integrations/firebase/createStep.js +0 -17
- package/dist/integrations/firebase/createThreadedStrategy.d.ts +0 -2
- package/dist/integrations/firebase/createThreadedStrategy.js +0 -8
- package/dist/utils/creation/resourceCreation.d.ts +0 -21
- package/dist/utils/creation/resourceCreation.js +0 -67
- package/dist/utils/creation/stepCreation.d.ts +0 -10
- package/dist/utils/creation/stepCreation.js +0 -64
- package/dist/utils/creation/threadedStrategyCreation.d.ts +0 -18
- package/dist/utils/creation/threadedStrategyCreation.js +0 -16
- package/dist/utils/extractData.d.ts +0 -12
- package/dist/utils/extractData.js +0 -78
- package/dist/utils/parallelizeSteps.d.ts +0 -3
- package/dist/utils/parallelizeSteps.js +0 -159
- package/dist/utils/resolveStrategyStateChain.d.ts +0 -20
- package/dist/utils/roleSpec.d.ts +0 -16
- package/dist/utils/roleSpec.js +0 -57
- package/dist/utils/strategyState.d.ts +0 -12
- package/dist/utils/strategyState.js +0 -58
- package/dist/utils_2/threadedStrategyCreation.d.ts +0 -5
- package/dist/utils_2/threadedStrategyCreation.js +0 -12
- package/src/integrations/firebase/createStep.ts +0 -41
- package/src/integrations/firebase/createThreadedStrategy.ts +0 -19
- package/src/utils/creation/resourceCreation.ts +0 -140
- package/src/utils/creation/stepCreation.ts +0 -95
- package/src/utils/creation/threadedStrategyCreation.ts +0 -42
- package/src/utils/extractData.ts +0 -137
- package/src/utils/parallelizeSteps.ts +0 -239
- package/src/utils/resolveStrategyStateChain.ts +0 -58
- package/src/utils/roleSpec.ts +0 -84
- package/src/utils/strategyState.ts +0 -128
- package/src/utils_2/threadedStrategyCreation.ts +0 -19
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getIndependentThreads } from './stepParallelization.js';
|
|
2
|
+
import type {
|
|
3
|
+
MutableStrategy,
|
|
4
|
+
MutableStep,
|
|
5
|
+
MutableStrategyState,
|
|
6
|
+
MutableToolStepKey,
|
|
7
|
+
} from './mutableStrategyOverlay.js';
|
|
8
|
+
import { getAuthoringSteps as getAuthoringThreadSteps } from './mutableStrategyOverlay.js';
|
|
9
|
+
|
|
10
|
+
export function toExecutionMutableStrategy<
|
|
11
|
+
TKey extends string = MutableToolStepKey,
|
|
12
|
+
TStep extends MutableStep<TKey> = MutableStep<TKey>,
|
|
13
|
+
TState extends MutableStrategyState<TKey> = MutableStrategyState<TKey>,
|
|
14
|
+
>(
|
|
15
|
+
mutableStrategy: MutableStrategy<TKey, TStep, TState>,
|
|
16
|
+
): MutableStrategy<TKey, TStep, TState> {
|
|
17
|
+
const authoringSteps = getAuthoringThreadSteps(mutableStrategy);
|
|
18
|
+
const stepsByThreadIndex = getIndependentThreads(
|
|
19
|
+
authoringSteps,
|
|
20
|
+
mutableStrategy.strategyState,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...mutableStrategy,
|
|
25
|
+
stepsByThreadIndex: stepsByThreadIndex,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ToolStepPath,
|
|
3
|
+
ToolStepPathSpec,
|
|
4
|
+
} from '@toolproof-core/genesis';
|
|
5
|
+
|
|
6
|
+
function getToolStepPathSuffix(spec: Pick<ToolStepPathSpec, 'toolStepPathSlot' | 'caseIndex'>): string {
|
|
7
|
+
if (spec.toolStepPathSlot === 'self') {
|
|
8
|
+
return '/self';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (spec.toolStepPathSlot === 'cases/when' || spec.toolStepPathSlot === 'cases/what') {
|
|
12
|
+
if (typeof spec.caseIndex !== 'number') {
|
|
13
|
+
throw new Error('Expected caseIndex for branch tool-step path construction');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return `/cases/${spec.caseIndex}/${spec.toolStepPathSlot === 'cases/when' ? 'when' : 'what'}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (spec.toolStepPathSlot === 'case/when') {
|
|
20
|
+
return '/case/when';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (spec.toolStepPathSlot === 'case/what') {
|
|
24
|
+
return '/case/what';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Unsupported tool-step path slot '${String(spec.toolStepPathSlot)}'`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function toToolStepPath(spec: ToolStepPathSpec): ToolStepPath {
|
|
33
|
+
return `/threads/${spec.threadIndex}/steps/${spec.stepIndex}${getToolStepPathSuffix(spec)}` as ToolStepPath;
|
|
34
|
+
}
|